Re: [PATCH] gdbstub: mark expected switch fall-throughs

From: Daniel Thompson
Date: Thu Apr 04 2019 - 06:12:45 EST


On Mon, Apr 01, 2019 at 02:57:36PM -0500, Gustavo A. R. Silva wrote:
>
>
> On 2/26/19 2:47 PM, Jason Wessel wrote:
> > We'll have to fix them at some point.
> >
> > Acked-by: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>
> >
>
> Thank you, Jason.
>
> Friendly ping:
>
> Who can take this?

I happy to put it in my tree (probably next week).


Daniel.

>
> Thanks
> --
> Gustavo
>
> >
> > Cheers,
> > Jason.
> >
> > On 2/26/19 1:16 PM, Gustavo A. R. Silva wrote:
> >> In preparation to enabling -Wimplicit-fallthrough, mark switch
> >> cases where we are expecting to fall through.
> >>
> >> This patch fixes the following warnings:
> >>
> >> kernel/debug/gdbstub.c: In function âgdb_serial_stubâ:
> >> kernel/debug/gdbstub.c:1031:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >> ÂÂÂÂ if (remcom_in_buffer[1] == '\0') {
> >> ÂÂÂÂÂÂÂ ^
> >> kernel/debug/gdbstub.c:1036:3: note: here
> >> ÂÂÂ case 'C': /* Exception passing */
> >> ÂÂÂ ^~~~
> >> kernel/debug/gdbstub.c:1040:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >> ÂÂÂÂ if (tmp == 0)
> >> ÂÂÂÂÂÂÂ ^
> >> kernel/debug/gdbstub.c:1043:3: note: here
> >> ÂÂÂ case 'c': /* Continue packet */
> >> ÂÂÂ ^~~~
> >> kernel/debug/gdbstub.c:1050:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >> ÂÂÂÂ dbg_activate_sw_breakpoints();
> >> ÂÂÂÂ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> kernel/debug/gdbstub.c:1052:3: note: here
> >> ÂÂÂ default:
> >> ÂÂÂ ^~~~~~~
> >>
> >> Warning level 3 was used: -Wimplicit-fallthrough=3
> >>
> >> Notice that, in this particular case, the code comment is modified
> >> in accordance with what GCC is expecting to find.
> >>
> >> This patch is part of the ongoing efforts to enable
> >> -Wimplicit-fallthrough.
> >>
> >> Signed-off-by: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>
> >> ---
> >> Â kernel/debug/gdbstub.c | 5 +++--
> >> Â 1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
> >> index 7510dc687c0d..9f267b8905b4 100644
> >> --- a/kernel/debug/gdbstub.c
> >> +++ b/kernel/debug/gdbstub.c
> >> @@ -1033,13 +1033,14 @@ int gdb_serial_stub(struct kgdb_state *ks)
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ return DBG_PASS_EVENT;
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂ }
> >> Â #endif
> >> +ÂÂÂÂÂÂÂÂÂÂÂ /* Fall through */
> >> ÂÂÂÂÂÂÂÂÂ case 'C': /* Exception passing */
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂ tmp = gdb_cmd_exception_pass(ks);
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂ if (tmp > 0)
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ goto default_handle;
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂ if (tmp == 0)
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ break;
> >> -ÂÂÂÂÂÂÂÂÂÂÂ /* Fall through on tmp < 0 */
> >> +ÂÂÂÂÂÂÂÂÂÂÂ /* Fall through - on tmp < 0 */
> >> ÂÂÂÂÂÂÂÂÂ case 'c': /* Continue packet */
> >> ÂÂÂÂÂÂÂÂÂ case 's': /* Single step packet */
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂ if (kgdb_contthread && kgdb_contthread != current) {
> >> @@ -1048,7 +1049,7 @@ int gdb_serial_stub(struct kgdb_state *ks)
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ break;
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂ }
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂ dbg_activate_sw_breakpoints();
> >> -ÂÂÂÂÂÂÂÂÂÂÂ /* Fall through to default processing */
> >> +ÂÂÂÂÂÂÂÂÂÂÂ /* Fall through - to default processing */
> >> ÂÂÂÂÂÂÂÂÂ default:
> >> Â default_handle:
> >> ÂÂÂÂÂÂÂÂÂÂÂÂÂ error = kgdb_arch_handle_exception(ks->ex_vector,
> >>
> >