Skip to contentSkip to conversation

qapi/opts-visitor: Added missing fallthrough annotations

PATCH In review Rohit Shinde 2 participants 6 messages Aug 18, 2020 – Aug 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 qapi/opts-visitor: Added missing fallthrough annotations

Added fallthrough comment on line 270 to prevent the compiler from throwing an error while compiling with the -Wimplicit-fallthrough flag

---
 qapi/opts-visitor.c | 1 +
 1 file changed, 1 insertion(+)
qapi/opts-visitor.c +1 -0
index 7781c23a42..3422ff265e 100644
@@ -266,6 +266,7 @@ opts_next_list(Visitor *v, GenericList *tail, size_t size)
         }
         ov->list_mode = LM_IN_PROGRESS;
         /* range has been completed, fall through in order to pop option */
+        /* fallthrough */
 
     case LM_IN_PROGRESS: {
         const QemuOpt *opt;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 2 lines · Rohit Shinde

Added fallthrough comment on line 270 to prevent the compiler from throwing an error while compiling with the -Wimplicit-fallthrough flag

None of the compilers I know warns there. Which one are you using?

Commit message style tip: use the imperative mood
https://chris.beams.io/posts/git-commit/#imperative

Quoted 17 lines
---
 qapi/opts-visitor.c | 1 +
 1 file changed, 1 insertion(+)
qapi/opts-visitor.c +1 -0
index 7781c23a42..3422ff265e 100644
@@ -266,6 +266,7 @@ opts_next_list(Visitor *v, GenericList *tail, size_t size)
         }
         ov->list_mode = LM_IN_PROGRESS;
         /* range has been completed, fall through in order to pop option */
+        /* fallthrough */
 
     case LM_IN_PROGRESS: {
         const QemuOpt *opt;
#2 lore raw

I am just compiling with cflag set to -Wimplicit-fallthrough. I am using gcc.

Quoted 31 lines · Markus Armbruster
Quoted 2 lines · Rohit Shinde

Added fallthrough comment on line 270 to prevent the compiler from throwing an error while compiling with the -Wimplicit-fallthrough flag

None of the compilers I know warns there. Which one are you using?

Commit message style tip: use the imperative mood
https://chris.beams.io/posts/git-commit/#imperative

qapi/opts-visitor.c opts_next_list(Visitor *v, GenericList *tail, size_t

Quoted 10 lines
---
 qapi/opts-visitor.c | 1 +
 1 file changed, 1 insertion(+)
qapi/opts-visitor.c +0 -0
index 7781c23a42..3422ff265e 100644
@@ -266,6 +266,7 @@ opts_next_list(Visitor *v, GenericList *tail, size_t

size)

qapi/opts-visitor.c opts_next_list(Visitor *v, GenericList *tail, size_t size)

Quoted 3 lines
qapi/opts-visitor.c +0 -0
         }
         ov->list_mode = LM_IN_PROGRESS;
         /* range has been completed, fall through in order to pop

option */

Quoted 4 lines
qapi/opts-visitor.c +1 -0
+        /* fallthrough */
 
     case LM_IN_PROGRESS: {
         const QemuOpt *opt;
#3 lore raw
Quoted 2 lines · Rohit Shinde

I am just compiling with cflag set to -Wimplicit-fallthrough. I am using gcc.

-Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3. Our -code is not prepared for that. What should work is --Wimplicit-fallthrough=2.

If you have patches to make the entire tree compile with -Wimplicit-fallthrough=3, we can talk. You'd have to test them on all supported hosts, and with a sufficient range of configurations to ensure they are not breaking builds.

#4 lore raw

Hey Markus,

Thanks for the clarification! No, I do not have patches for the same. I was browsing through the bite sized tasks page and that did not mention these details. I will keep this in mind however. For now, I will leave this task and I might return to it at a later time.

Thanks,
Rohit.

Quoted 15 lines · Markus Armbruster
Quoted 2 lines · Rohit Shinde

I am just compiling with cflag set to -Wimplicit-fallthrough. I am using gcc.

(quoted diff) +0 -3
-Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3.  Our
-code is not prepared for that.  What should work is
--Wimplicit-fallthrough=2.

If you have patches to make the entire tree compile with -Wimplicit-fallthrough=3, we can talk. You'd have to test them on all supported hosts, and with a sufficient range of configurations to ensure they are not breaking builds.

#5 lore raw
Quoted 6 lines · Rohit Shinde

Hey Markus,

Thanks for the clarification! No, I do not have patches for the same. I was browsing through the bite sized tasks page and that did not mention these details. I will keep this in mind however. For now, I will leave this task and I might return to it at a later time.

I corrected https://wiki.qemu.org/Contribute/BiteSizedTasks to ask for -Wimplicit-fallthrough=2. Thanks!