Skip to contentSkip to conversation

tests/test-char: Use a proper fallthrough comment

PATCH Applied Thomas Huth 4 participants 4 messages Oct 2, 2020 – Oct 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/test-char: Use a proper fallthrough comment

For being able to compile with -Werror=implicit-fallthrough we need to use comments that the compiler recognizes. Use "fallthrough" instead of "no break" here.

---
 tests/test-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/test-char.c +1 -1
index d35cc839bc..9196e566e9 100644
@@ -70,7 +70,7 @@ static void fe_event(void *opaque, QEMUChrEvent event)
             h->openclose_mismatch = true;
         }
         h->is_open = new_open_state;
-        /* no break */
+        /* fallthrough */
     default:
         quit = true;
         break;
Signature · 1 line
2.18.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Thomas Huth

For being able to compile with -Werror=implicit-fallthrough we need to use comments that the compiler recognizes. Use "fallthrough" instead of "no break" here.

---

Quoted 21 lines
 tests/test-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/test-char.c +1 -2
index d35cc839bc..9196e566e9 100644
@@ -70,7 +70,7 @@ static void fe_event(void *opaque, QEMUChrEvent event)
             h->openclose_mismatch = true;
         }
         h->is_open = new_open_state;
-        /* no break */
+        /* fallthrough */
     default:
         quit = true;
         break;
--

2.18.2

Signature · 1 line
Marc-André Lureau
Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 15 lines · Thomas Huth

For being able to compile with -Werror=implicit-fallthrough we need to use comments that the compiler recognizes. Use "fallthrough" instead of "no break" here.

---
 tests/test-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/test-char.c +0 -0
index d35cc839bc..9196e566e9 100644

tests/test-char.c static void fe_event(void *opaque, QEMUChrEvent event) · line 76

Quoted 8 lines
tests/test-char.c +1 -1
@@ -70,7 +70,7 @@ static void fe_event(void *opaque, QEMUChrEvent event)
             h->openclose_mismatch = true;
         }
         h->is_open = new_open_state;
-        /* no break */
+        /* fallthrough */
     default:
         quit = true;
         break;
#3 lore raw
In reply to Thomas Huth

Le 02/10/2020 à 19:13, Thomas Huth a écrit :

Quoted 15 lines

For being able to compile with -Werror=implicit-fallthrough we need to use comments that the compiler recognizes. Use "fallthrough" instead of "no break" here.

---
 tests/test-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/test-char.c +0 -0
index d35cc839bc..9196e566e9 100644

tests/test-char.c static void fe_event(void *opaque, QEMUChrEvent event) · line 76

Quoted 8 lines
tests/test-char.c +1 -1
@@ -70,7 +70,7 @@ static void fe_event(void *opaque, QEMUChrEvent event)
             h->openclose_mismatch = true;
         }
         h->is_open = new_open_state;
-        /* no break */
+        /* fallthrough */
     default:
         quit = true;
         break;

Applied to my trivial-patches branch.

Thanks,
Laurent