Skip to contentSkip to conversation

gdbstub: mark expected switch fall-throughs

PATCH Superseded Gustavo A. R. Silva 3 participants 6 messages Feb 26, 2019 – Apr 4, 2019 KGDB / KDB /debug_core

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 kernel/debug/gdbstub.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/debug/gdbstub.c +3 -2
index 7510dc687c0d..9f267b8905b4 100644
@@ -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,
Signature · 1 line
2.21.0
maintainer Acked-by on v1 1/1
#1 lore raw

We'll have to fix them at some point.

Cheers,
Jason.

Quoted 68 lines · Gustavo A. R. Silva

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.

---
  kernel/debug/gdbstub.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
kernel/debug/gdbstub.c +3 -2
index 7510dc687c0d..9f267b8905b4 100644
@@ -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,
#2 lore raw
Quoted 2 lines · Jason Wessel

We'll have to fix them at some point.

Yep. And we're about to fix them all.

Quoted 2 lines

Thanks, Jason.

--
Gustavo

Quoted 74 lines

Cheers,
Jason.

Quoted 68 lines · Gustavo A. R. Silva

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.

---
  kernel/debug/gdbstub.c | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
kernel/debug/gdbstub.c +1 -0
index 7510dc687c0d..9f267b8905b4 100644
@@ -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) {

kernel/debug/gdbstub.c +1 -1
@@ -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,

#3 lore raw
In reply to Jason Wessel
Quoted 4 lines · Jason Wessel

We'll have to fix them at some point.

Thank you, Jason.

Friendly ping:

Who can take this?

Thanks
--
Gustavo

Quoted 74 lines

Cheers,
Jason.

Quoted 68 lines · Gustavo A. R. Silva

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.

---
  kernel/debug/gdbstub.c | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
kernel/debug/gdbstub.c +1 -0
index 7510dc687c0d..9f267b8905b4 100644
@@ -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) {

kernel/debug/gdbstub.c +1 -1
@@ -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,

#4 lore raw
Quoted 5 lines · Gustavo A. R. Silva
Quoted 2 lines · Jason Wessel

We'll have to fix them at some point.

Quoted 8 lines
Quoted 2 lines

Thank you, Jason.

Friendly ping:

Who can take this?

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

Daniel.

Quoted 79 lines

Thanks
--
Gustavo

Quoted 74 lines

Cheers,
Jason.

Quoted 68 lines · Gustavo A. R. Silva

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.

---
  kernel/debug/gdbstub.c | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
kernel/debug/gdbstub.c +1 -0
index 7510dc687c0d..9f267b8905b4 100644
@@ -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) {

kernel/debug/gdbstub.c +1 -1
@@ -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,

#5 lore raw
Quoted 9 lines · Daniel Thompson
Quoted 8 lines · Gustavo A. R. Silva
Quoted 4 lines · Jason Wessel

We'll have to fix them at some point.

Quoted 8 lines
Quoted 5 lines

Thank you, Jason.

Friendly ping:

Who can take this?

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

Awesome. :)

Thanks, Daniel.
--
Gustavo