Skip to contentSkip to conversation

kdb: kdb_support: mark expected switch fall-throughs

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Aug 5, 2018 – Aug 15, 2018 KGDB / KDB /debug_core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kdb: kdb_support: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Notice that in this particular case, I replaced the code comments with a proper "fall through" annotation, which is what GCC is expecting to find.

---
 kernel/debug/kdb/kdb_support.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/debug/kdb/kdb_support.c +3 -3
index 990b3cc..89ac604 100644
@@ -432,7 +432,7 @@ int kdb_getphysword(unsigned long *word, unsigned long addr, size_t size)
 				*word = w8;
 			break;
 		}
-		/* drop through */
+		/* fall through */
 	default:
 		diag = KDB_BADWIDTH;
 		kdb_printf("kdb_getphysword: bad width %ld\n", (long) size);
@@ -481,7 +481,7 @@ int kdb_getword(unsigned long *word, unsigned long addr, size_t size)
 				*word = w8;
 			break;
 		}
-		/* drop through */
+		/* fall through */
 	default:
 		diag = KDB_BADWIDTH;
 		kdb_printf("kdb_getword: bad width %ld\n", (long) size);
@@ -525,7 +525,7 @@ int kdb_putword(unsigned long addr, unsigned long word, size_t size)
 			diag = kdb_putarea(addr, w8);
 			break;
 		}
-		/* drop through */
+		/* fall through */
 	default:
 		diag = KDB_BADWIDTH;
 		kdb_printf("kdb_putword: bad width %ld\n", (long) size);
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Notice that in this particular case, I replaced the code comments with a proper "fall through" annotation, which is what GCC is expecting to find.

Quoted 36 lines
---
  kernel/debug/kdb/kdb_support.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
kernel/debug/kdb/kdb_support.c +3 -3
index 990b3cc..89ac604 100644
@@ -432,7 +432,7 @@ int kdb_getphysword(unsigned long *word, unsigned long addr, size_t size)
  				*word = w8;
  			break;
  		}
-		/* drop through */
+		/* fall through */
  	default:
  		diag = KDB_BADWIDTH;
  		kdb_printf("kdb_getphysword: bad width %ld\n", (long) size);
@@ -481,7 +481,7 @@ int kdb_getword(unsigned long *word, unsigned long addr, size_t size)
  				*word = w8;
  			break;
  		}
-		/* drop through */
+		/* fall through */
  	default:
  		diag = KDB_BADWIDTH;
  		kdb_printf("kdb_getword: bad width %ld\n", (long) size);
@@ -525,7 +525,7 @@ int kdb_putword(unsigned long addr, unsigned long word, size_t size)
  			diag = kdb_putarea(addr, w8);
  			break;
  		}
-		/* drop through */
+		/* fall through */
  	default:
  		diag = KDB_BADWIDTH;
  		kdb_printf("kdb_putword: bad width %ld\n", (long) size);