Skip to contentSkip to conversation

qapi/opts-visitor: Fixed fallthrough compiler warning

PATCH In review Rohit Shinde 2 participants 7 messages Aug 16, 2020 – Aug 17, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 qapi/opts-visitor: Fixed fallthrough compiler warning

Added fallthrough comment on line 270 to fix compiler warning

---
 qapi/opts-visitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/opts-visitor.c +1 -1
index 43cf60d3a0..3422ff265e 100644
@@ -266,7 +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 */
-        __attribute__((fallthrough));
+        /* fallthrough */
 
     case LM_IN_PROGRESS: {
         const QemuOpt *opt;
Signature · 1 line
2.25.1
#1 lore raw

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

Quoted 3 lines · Rohit Shinde
         /* range has been completed, fall through in order to pop option */
qapi/opts-visitor.c +1 -1
-        __attribute__((fallthrough));
+        /* fallthrough */

(1) Any patch should not be relative to your own v3.
(2) The previous line already contains the words "fall through", so what is it that you are trying to fix?

r~

#2 lore raw

Hey Richard,

1. So I should fork off the master again? I am a bit unclear on the workflow, since this is my first doing patches via format-patch and send-email so I am making mistakes.
2. I just checked and my version of the code doesn't contain that line, so I am unsure on how that line got there. I was trying to fix the compiler warnings. Could you please guide me on how I create the next version of a patch?

Thanks,
Rohit.

Quoted 13 lines · Richard Henderson
Quoted 1 line · Rohit Shinde
         /* range has been completed, fall through in order to pop

option */

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

Quoted 2 lines
qapi/opts-visitor.c +1 -1
-        __attribute__((fallthrough));
+        /* fallthrough */

(1) Any patch should not be relative to your own v3.
(2) The previous line already contains the words "fall through", so what is it that you are trying to fix?

r~

#3 lore raw
Quoted 3 lines · Rohit Shinde

Hey Richard,

1. So I should fork off the master again?

Yes.

There need to be special circumstances for not posting a patch set relative to master, and even then your cover letter would need to detail against what base the patch set applies.

Quoted 4 lines

2. I just checked and my version of the code doesn't contain that line, so I am unsure on how that line got there. I was trying to fix the compiler warnings. Could you please guide me on how I create the next version of a patch?

That makes no sense at all. The line was added at the same time as the code above it, in d8754f40acb.

There should be nothing to fix.

r~

#4 lore raw
Quoted 16 lines · Richard Henderson
Quoted 3 lines · Rohit Shinde

Hey Richard,

1. So I should fork off the master again?

Yes.

There need to be special circumstances for not posting a patch set relative to
master, and even then your cover letter would need to detail against what base
the patch set applies.

Quoted 1 line

2. I just checked and my version of the code doesn't contain that line,

so I

Quoted 1 line

am unsure on how that line got there. I was trying to fix the

Quoted 9 lines

compiler

Quoted 1 line

warnings. Could you please guide me on how I create the next version

of a

Quoted 1 line

patch?

That makes no sense at all. The line was added at the same time as the code
above it, in d8754f40acb.

I misread the comment. The comment /* fallthrough */ was meant to stop the compiler warning from occurring. I am trying to complete the bite sized task mentioned here <https://wiki.qemu.org/Contribute/BiteSizedTasks> under "Compiler driven cleanups". I wanted to take that up to get more familiar with the codebase.

Quoted 6 lines

There should be nothing to fix.

r~

#5 lore raw
Quoted 5 lines · Rohit Shinde

I misread the comment. The comment /* fallthrough */ was meant to stop the compiler warning from occurring. I am trying to complete the bite sized task mentioned here <https://wiki.qemu.org/Contribute/BiteSizedTasks> under "Compiler driven cleanups". I wanted to take that up to get more familiar with the codebase.

Fine, but the current comment matches the compiler regexp, so this instance isn't part of that cleanup.

r~

#6 lore raw
Quoted 4 lines · Richard Henderson
Quoted 1 line · Rohit Shinde

I misread the comment. The comment /* fallthrough */ was meant to stop

the

Quoted 1 line

compiler warning from occurring. I am trying to complete the bite sized

Quoted 9 lines

task

Quoted 2 lines

mentioned here <https://wiki.qemu.org/Contribute/BiteSizedTasks> under "Compiler driven cleanups". I wanted to take that up to get more

familiar with

Quoted 1 line

the codebase.

Fine, but the current comment matches the compiler regexp, so this instance isn't part of that cleanup.

But when I was compiling with the -Wimplicit-fallthrough option, the compiler gave an error at that very line. That's why I came up on that specific line in that file first.

I am pasting the error that I got below:

home/rohit/Desktop/open-source/qemu/qapi/opts-visitor.c: In function ‘opts_next_list’:
/home/rohit/Desktop/open-source/qemu/qapi/opts-visitor.c:267:23: error:
this statement may fall through [-Werror=implicit-fallthrough=]

  267 |         ov->list_mode = LM_IN_PROGRESS;
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/rohit/Desktop/open-source/qemu/qapi/opts-visitor.c:270:5: note: here
  270 |     case LM_IN_PROGRESS: {
      |     ^~~~

Sending it again, because I forgot to reply all.

Thanks,
Rohit.

Quoted 5 lines

r~