diff options
| author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2019-02-26 14:16:14 -0500 |
|---|---|---|
| committer | Daniel Thompson <daniel.thompson@linaro.org> | 2019-05-02 08:38:04 -0400 |
| commit | a5d5092c9285f6c8937b56f9c6ff2b22d818fc25 (patch) | |
| tree | 0c08f716161ba2c873b147fd19ce8f89089204e5 | |
| parent | dc4060a5dc2557e6b5aa813bf5b73677299d62d2 (diff) | |
gdbstub: mark expected switch fall-throughs
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@embeddedor.com>
Acked-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
| -rw-r--r-- | kernel/debug/gdbstub.c | 5 |
1 files 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) | |||
| 1033 | return DBG_PASS_EVENT; | 1033 | return DBG_PASS_EVENT; |
| 1034 | } | 1034 | } |
| 1035 | #endif | 1035 | #endif |
| 1036 | /* Fall through */ | ||
| 1036 | case 'C': /* Exception passing */ | 1037 | case 'C': /* Exception passing */ |
| 1037 | tmp = gdb_cmd_exception_pass(ks); | 1038 | tmp = gdb_cmd_exception_pass(ks); |
| 1038 | if (tmp > 0) | 1039 | if (tmp > 0) |
| 1039 | goto default_handle; | 1040 | goto default_handle; |
| 1040 | if (tmp == 0) | 1041 | if (tmp == 0) |
| 1041 | break; | 1042 | break; |
| 1042 | /* Fall through on tmp < 0 */ | 1043 | /* Fall through - on tmp < 0 */ |
| 1043 | case 'c': /* Continue packet */ | 1044 | case 'c': /* Continue packet */ |
| 1044 | case 's': /* Single step packet */ | 1045 | case 's': /* Single step packet */ |
| 1045 | if (kgdb_contthread && kgdb_contthread != current) { | 1046 | if (kgdb_contthread && kgdb_contthread != current) { |
| @@ -1048,7 +1049,7 @@ int gdb_serial_stub(struct kgdb_state *ks) | |||
| 1048 | break; | 1049 | break; |
| 1049 | } | 1050 | } |
| 1050 | dbg_activate_sw_breakpoints(); | 1051 | dbg_activate_sw_breakpoints(); |
| 1051 | /* Fall through to default processing */ | 1052 | /* Fall through - to default processing */ |
| 1052 | default: | 1053 | default: |
| 1053 | default_handle: | 1054 | default_handle: |
| 1054 | error = kgdb_arch_handle_exception(ks->ex_vector, | 1055 | error = kgdb_arch_handle_exception(ks->ex_vector, |
