Skip to contentSkip to conversation

Trivial switch 'fall through' comment fixes for GCC9

PATCH Applied Philippe Mathieu-Daudé 7 participants 24 messages Jul 19, 2019 – Aug 21, 2019

lore
Share & tools
lore
#0 lore raw

cover Trivial switch 'fall through' comment fixes for GCC9

Trivial patches, simply rewrite the comment or move it around.

Reported by Stefan here:
https://lists.gnu.org/archive/html/qemu-devel/2019-07/msg01970.html

Regards,

Phil.

Philippe Mathieu-Daudé (7):
json: Move switch 'fall through' comment to correct place hw/dma/omap_dma: Move switch 'fall through' comment to correct place hw/block/pflash_cfi02: Rewrite a fall through comment hw/ipmi: Rewrite a fall through comment
target/ppc: Rewrite a fall through comment
vl: Rewrite a fall through comment
spapr_events: Rewrite a fall through comment

 hw/block/pflash_cfi02.c   | 2 +-
 hw/dma/omap_dma.c         | 2 +-
 hw/ipmi/ipmi_bmc_extern.c | 3 +--
 hw/ppc/spapr_events.c     | 2 +-
 qobject/json-parser.c     | 2 +-
 target/ppc/mmu_helper.c   | 6 +++---
 vl.c                      | 2 +-
 7 files changed, 9 insertions(+), 10 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/7 json: Move switch 'fall through' comment to correct place

Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:

qobject/json-parser.c: In function ‘parse_literal’:
qobject/json-parser.c:492:24: error: this statement may fall through [-Werror=implicit-fallthrough=]

    492 |     case JSON_INTEGER: {
        |                        ^
  qobject/json-parser.c:524:5: note: here
    524 |     case JSON_FLOAT:
        |     ^~~~

Correctly place the 'fall through' comment.

---
 qobject/json-parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qobject/json-parser.c +1 -1
index 7d23e12e33..d083810d37 100644
@@ -519,8 +519,8 @@ static QObject *parse_literal(JSONParserContext *ctxt)
             }
             assert(ret == -ERANGE);
         }
-        /* fall through to JSON_FLOAT */
     }
+    /* fall through to JSON_FLOAT */
     case JSON_FLOAT:
         /* FIXME dependent on locale; a pervasive issue in QEMU */
         /* FIXME our lexer matches RFC 8259 in forbidding Inf or NaN,
Signature · 1 line
2.20.1
Reviewed-by on v1 1/7
#2 lore raw

Re: [Qemu-devel] [PATCH-for-4.1? 1/7] json: Move switch 'fall through' comment to correct place

Quoted 10 lines · Philippe Mathieu-Daudé

Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:

qobject/json-parser.c: In function ‘parse_literal’:
qobject/json-parser.c:492:24: error: this statement may fall through [-Werror=implicit-fallthrough=]

    492 |     case JSON_INTEGER: {
        |                        ^
  qobject/json-parser.c:524:5: note: here
    524 |     case JSON_FLOAT:
        |     ^~~~
Quoted 7 lines

Correctly place the 'fall through' comment.

---
 qobject/json-parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#3 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH-for-4.1? 1/7] json: Move switch 'fall through' comment to correct place

In reply to Philippe Mathieu-Daudé

Le 19/07/2019 à 15:14, Philippe Mathieu-Daudé a écrit :

Quoted 24 lines

Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:

qobject/json-parser.c: In function ‘parse_literal’:
qobject/json-parser.c:492:24: error: this statement may fall through [-Werror=implicit-fallthrough=]

    492 |     case JSON_INTEGER: {
        |                        ^
  qobject/json-parser.c:524:5: note: here
    524 |     case JSON_FLOAT:
        |     ^~~~

Correctly place the 'fall through' comment.

---
 qobject/json-parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qobject/json-parser.c +0 -0
index 7d23e12e33..d083810d37 100644

qobject/json-parser.c static QObject *parse_literal(JSONParserContext *ctxt) · line 526

Quoted 9 lines
qobject/json-parser.c +1 -1
@@ -519,8 +519,8 @@ static QObject *parse_literal(JSONParserContext *ctxt)
             }
             assert(ret == -ERANGE);
         }
-        /* fall through to JSON_FLOAT */
     }
+    /* fall through to JSON_FLOAT */
     case JSON_FLOAT:
         /* FIXME dependent on locale; a pervasive issue in QEMU */
         /* FIXME our lexer matches RFC 8259 in forbidding Inf or NaN,

Applied to my trivial-patches branch.

Thanks,
Laurent

#4 lore raw

PATCH 2/7 hw/dma/omap_dma: Move switch 'fall through' comment to correct place

In reply to Philippe Mathieu-Daudé

Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:

CC hw/dma/omap_dma.o
hw/dma/omap_dma.c: In function ‘omap_dma_write’:
hw/dma/omap_dma.c:1532:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1532 | if (s->model <= omap_dma_3_1)
| ^
hw/dma/omap_dma.c:1534:5: note: here

   1534 |     case 0x400:
        |     ^~~~

cc1: all warnings being treated as errors

Correctly place the 'fall through' comment.

---
 hw/dma/omap_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/dma/omap_dma.c +1 -1
index eab83c5c3a..6677237d42 100644
@@ -1531,8 +1531,8 @@ static void omap_dma_write(void *opaque, hwaddr addr,
     case 0x404 ... 0x4fe:
         if (s->model <= omap_dma_3_1)
             break;
+        /* fall through */
     case 0x400:
-        /* Fall through. */
         if (omap_dma_sys_write(s, addr, value))
             break;
         return;
Signature · 1 line
2.20.1
Reviewed-by on v1 2/7
#5 lore raw

Re: [Qemu-devel] [PATCH-for-4.1? 2/7] hw/dma/omap_dma: Move switch 'fall through' comment to correct place

Quoted 26 lines · Philippe Mathieu-Daudé

Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:

CC hw/dma/omap_dma.o
hw/dma/omap_dma.c: In function ‘omap_dma_write’:
hw/dma/omap_dma.c:1532:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1532 | if (s->model <= omap_dma_3_1)
| ^
hw/dma/omap_dma.c:1534:5: note: here

   1534 |     case 0x400:
        |     ^~~~

cc1: all warnings being treated as errors

Correctly place the 'fall through' comment.

---
 hw/dma/omap_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/dma/omap_dma.c +0 -0
index eab83c5c3a..6677237d42 100644

hw/dma/omap_dma.c static void omap_dma_write(void *opaque, hwaddr addr,

Quoted 10 lines
hw/dma/omap_dma.c +1 -2
@@ -1531,8 +1531,8 @@ static void omap_dma_write(void *opaque, hwaddr addr,
     case 0x404 ... 0x4fe:
         if (s->model <= omap_dma_3_1)
             break;
+        /* fall through */
     case 0x400:
-        /* Fall through. */
         if (omap_dma_sys_write(s, addr, value))
             break;
         return;
-

thanks
-- PMM

#6 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH-for-4.1? 2/7] hw/dma/omap_dma: Move switch 'fall through' comment to correct place

In reply to Philippe Mathieu-Daudé

Le 19/07/2019 à 15:14, Philippe Mathieu-Daudé a écrit :

Quoted 26 lines

Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:

CC hw/dma/omap_dma.o
hw/dma/omap_dma.c: In function ‘omap_dma_write’:
hw/dma/omap_dma.c:1532:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1532 | if (s->model <= omap_dma_3_1)
| ^
hw/dma/omap_dma.c:1534:5: note: here

   1534 |     case 0x400:
        |     ^~~~

cc1: all warnings being treated as errors

Correctly place the 'fall through' comment.

---
 hw/dma/omap_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/dma/omap_dma.c +0 -0
index eab83c5c3a..6677237d42 100644

hw/dma/omap_dma.c static void omap_dma_write(void *opaque, hwaddr addr, · line 1538

Quoted 9 lines
hw/dma/omap_dma.c +1 -1
@@ -1531,8 +1531,8 @@ static void omap_dma_write(void *opaque, hwaddr addr,
     case 0x404 ... 0x4fe:
         if (s->model <= omap_dma_3_1)
             break;
+        /* fall through */
     case 0x400:
-        /* Fall through. */
         if (omap_dma_sys_write(s, addr, value))
             break;
         return;

Applied to my trivial-patches branch.

Thanks,
Laurent

#7 lore raw

PATCH 3/7 hw/block/pflash_cfi02: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/block/pflash_cfi02.c: In function ‘pflash_write’:
hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]

    574 |             if (boff == 0x55 && cmd == 0x98) {
        |                ^
  hw/block/pflash_cfi02.c:581:9: note: here
    581 |         default:
        |         ^~~~~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/block/pflash_cfi02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/pflash_cfi02.c +1 -1
index f68837a449..42886f6af5 100644
@@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
                 pfl->cmd = 0x98;
                 return;
             }
-            /* No break here */
+            /* fall through */
         default:
             DPRINTF("%s: invalid write for command %02x\n",
                     __func__, pfl->cmd);
Signature · 1 line
2.20.1
Reviewed-by on v1 3/7
#8 lore raw

Re: [Qemu-devel] [PATCH-for-4.1 3/7] hw/block/pflash_cfi02: Rewrite a fall through comment

Quoted 27 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/block/pflash_cfi02.c: In function ‘pflash_write’:
hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]

    574 |             if (boff == 0x55 && cmd == 0x98) {
        |                ^
  hw/block/pflash_cfi02.c:581:9: note: here
    581 |         default:
        |         ^~~~~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/block/pflash_cfi02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/pflash_cfi02.c +0 -0
index f68837a449..42886f6af5 100644

hw/block/pflash_cfi02.c static void pflash_write(void *opaque, hwaddr offset, uint64_t value,

Quoted 9 lines
hw/block/pflash_cfi02.c +1 -2
@@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
                 pfl->cmd = 0x98;
                 return;
             }
-            /* No break here */
+            /* fall through */
         default:
             DPRINTF("%s: invalid write for command %02x\n",
                     __func__, pfl->cmd);
--

thanks
-- PMM

#9 lore raw

Re: [Qemu-devel] [PATCH-for-4.1 3/7] hw/block/pflash_cfi02: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé
Quoted 27 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/block/pflash_cfi02.c: In function ‘pflash_write’:
hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]

    574 |             if (boff == 0x55 && cmd == 0x98) {
        |                ^
  hw/block/pflash_cfi02.c:581:9: note: here
    581 |         default:
        |         ^~~~~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/block/pflash_cfi02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/pflash_cfi02.c +0 -0
index f68837a449..42886f6af5 100644

hw/block/pflash_cfi02.c static void pflash_write(void *opaque, hwaddr offset, uint64_t value, · line 583

Quoted 8 lines
hw/block/pflash_cfi02.c +1 -1
@@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
                 pfl->cmd = 0x98;
                 return;
             }
-            /* No break here */
+            /* fall through */
         default:
             DPRINTF("%s: invalid write for command %02x\n",
                     __func__, pfl->cmd);

Queued to pflash/next, thanks.

#10 lore raw

Re: [Qemu-devel] [Qemu-block] [PATCH-for-4.1 3/7] hw/block/pflash_cfi02: Rewrite a fall through comment

Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/block/pflash_cfi02.c: In function ‘pflash_write’:
hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]

    574 |             if (boff == 0x55 && cmd == 0x98) {
        |                ^
  hw/block/pflash_cfi02.c:581:9: note: here
    581 |         default:
        |         ^~~~~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/block/pflash_cfi02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
Quoted 6 lines
hw/block/pflash_cfi02.c +0 -0
index f68837a449..42886f6af5 100644

hw/block/pflash_cfi02.c static void pflash_write(void *opaque, hwaddr offset, uint64_t value, · line 583

Quoted 8 lines
hw/block/pflash_cfi02.c +1 -1
@@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
                 pfl->cmd = 0x98;
                 return;
             }
-            /* No break here */
+            /* fall through */
         default:
             DPRINTF("%s: invalid write for command %02x\n",
                     __func__, pfl->cmd);

Queued to pflash/next, thanks.

Are you queueing everything or just this one patch? It would be a little inconvenient to split a series up like that.

(Most other maintainers will, I believe, expect that with an "ACK" or similar that someone else will stage the series.)

--js

#11 lore raw

Re: [Qemu-devel] [Qemu-block] [PATCH-for-4.1 3/7] hw/block/pflash_cfi02: Rewrite a fall through comment

Quoted 41 lines · John Snow
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/block/pflash_cfi02.c: In function ‘pflash_write’:
hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]

    574 |             if (boff == 0x55 && cmd == 0x98) {
        |                ^
  hw/block/pflash_cfi02.c:581:9: note: here
    581 |         default:
        |         ^~~~~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/block/pflash_cfi02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
Quoted 6 lines
hw/block/pflash_cfi02.c +0 -0
index f68837a449..42886f6af5 100644

hw/block/pflash_cfi02.c static void pflash_write(void *opaque, hwaddr offset, uint64_t value, · line 583

Quoted 8 lines
hw/block/pflash_cfi02.c +1 -1
@@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
                 pfl->cmd = 0x98;
                 return;
             }
-            /* No break here */
+            /* fall through */
         default:
             DPRINTF("%s: invalid write for command %02x\n",
                     __func__, pfl->cmd);

Queued to pflash/next, thanks.

Quoted 2 lines

Are you queueing everything or just this one patch? It would be a little inconvenient to split a series up like that.

Oops I simply queued this particular one.

Quoted 2 lines

(Most other maintainers will, I believe, expect that with an "ACK" or similar that someone else will stage the series.)

I thought these are not critical bugfixes for 4.1, but since I had to do a pull request for pflash, I could include it. (I already noticed maintainers queueing particular patches from cleanup series).

Next time I'll ping/wait.

Regards,

Phil.

#12 lore raw

PATCH 4/7 hw/ipmi: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/ipmi/ipmi_bmc_extern.c: In function ‘addchar’:
hw/ipmi/ipmi_bmc_extern.c:178:12: error: this statement may fall through [-Werror=implicit-fallthrough=]

    178 |         ch |= 0x10;
        |         ~~~^~~~~~~
  hw/ipmi/ipmi_bmc_extern.c:181:5: note: here
    181 |     default:
        |     ^~~~~~~

cc1: all warnings being treated as errors
make: *** [rules.mak:69: hw/ipmi/ipmi_bmc_extern.o] Error 1

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/ipmi/ipmi_bmc_extern.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/ipmi/ipmi_bmc_extern.c +1 -2
index c0a8dac346..d4cbd210c4 100644
@@ -176,8 +176,7 @@ static void addchar(IPMIBmcExtern *ibe, unsigned char ch)
         ibe->outbuf[ibe->outlen] = VM_ESCAPE_CHAR;
         ibe->outlen++;
         ch |= 0x10;
-        /* No break */
-
+        /* fall through */
     default:
         ibe->outbuf[ibe->outlen] = ch;
         ibe->outlen++;
Signature · 1 line
2.20.1
Acked-by on v1 4/7
#13 lore raw

Re: [Qemu-devel] [PATCH-for-4.1? 4/7] hw/ipmi: Rewrite a fall through comment

Quoted 39 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/ipmi/ipmi_bmc_extern.c: In function ‘addchar’:
hw/ipmi/ipmi_bmc_extern.c:178:12: error: this statement may fall through [-Werror=implicit-fallthrough=]

    178 |         ch |= 0x10;
        |         ~~~^~~~~~~
  hw/ipmi/ipmi_bmc_extern.c:181:5: note: here
    181 |     default:
        |     ^~~~~~~

cc1: all warnings being treated as errors
make: *** [rules.mak:69: hw/ipmi/ipmi_bmc_extern.o] Error 1

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/ipmi/ipmi_bmc_extern.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/ipmi/ipmi_bmc_extern.c +1 -2
index c0a8dac346..d4cbd210c4 100644
@@ -176,8 +176,7 @@ static void addchar(IPMIBmcExtern *ibe, unsigned char ch)
         ibe->outbuf[ibe->outlen] = VM_ESCAPE_CHAR;
         ibe->outlen++;
         ch |= 0x10;
-        /* No break */
-
+        /* fall through */
     default:
         ibe->outbuf[ibe->outlen] = ch;
         ibe->outlen++;
Signature · 1 line
2.20.1

Well, whatever, this is fine.

#14 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH-for-4.1? 4/7] hw/ipmi: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

Le 19/07/2019 à 15:14, Philippe Mathieu-Daudé a écrit :

Quoted 28 lines

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/ipmi/ipmi_bmc_extern.c: In function ‘addchar’:
hw/ipmi/ipmi_bmc_extern.c:178:12: error: this statement may fall through [-Werror=implicit-fallthrough=]

    178 |         ch |= 0x10;
        |         ~~~^~~~~~~
  hw/ipmi/ipmi_bmc_extern.c:181:5: note: here
    181 |     default:
        |     ^~~~~~~

cc1: all warnings being treated as errors
make: *** [rules.mak:69: hw/ipmi/ipmi_bmc_extern.o] Error 1

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/ipmi/ipmi_bmc_extern.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/ipmi/ipmi_bmc_extern.c +0 -0
index c0a8dac346..d4cbd210c4 100644

hw/ipmi/ipmi_bmc_extern.c static void addchar(IPMIBmcExtern *ibe, unsigned char ch) · line 182

Quoted 9 lines
hw/ipmi/ipmi_bmc_extern.c +1 -2
@@ -176,8 +176,7 @@ static void addchar(IPMIBmcExtern *ibe, unsigned char ch)
         ibe->outbuf[ibe->outlen] = VM_ESCAPE_CHAR;
         ibe->outlen++;
         ch |= 0x10;
-        /* No break */
-
+        /* fall through */
     default:
         ibe->outbuf[ibe->outlen] = ch;
         ibe->outlen++;

Applied to my trivial-patches branch.

Thanks,
Laurent

#15 lore raw

PATCH 5/7 target/ppc: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

target/ppc/mmu_helper.c: In function ‘dump_mmu’:
target/ppc/mmu_helper.c:1349:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1349 | if (ppc64_v3_radix(env_archcpu(env))) {
| ^
target/ppc/mmu_helper.c:1356:5: note: here

   1356 |     default:
        |     ^~~~~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 target/ppc/mmu_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target/ppc/mmu_helper.c +3 -3
index 261a8fe707..862824b073 100644
@@ -98,7 +98,7 @@ static int pp_check(int key, int pp, int nx)
         case 0x1:
         case 0x2:
             access |= PAGE_WRITE;
-            /* No break here */
+            /* fall through */
         case 0x3:
             access |= PAGE_READ;
             break;
@@ -706,7 +706,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
             if (pr != 0) {
                 goto check_perms;
             }
-            /* No break here */
+            /* fall through */
         case 0x3:
             /* All accesses granted */
             ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
@@ -720,7 +720,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
                 ret = -2;
                 break;
             }
-            /* No break here */
+            /* fall through */
         case 0x1:
         check_perms:
             /* Check from TLB entry */
Signature · 1 line
2.20.1
Acked-by on v1 5/7
#16 lore raw

Re: [Qemu-devel] [PATCH-for-4.1? 5/7] target/ppc: Rewrite a fall through comment

Quoted 10 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

target/ppc/mmu_helper.c: In function ‘dump_mmu’:
target/ppc/mmu_helper.c:1349:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1349 | if (ppc64_v3_radix(env_archcpu(env))) {
| ^
target/ppc/mmu_helper.c:1356:5: note: here

   1356 |     default:
        |     ^~~~~~~
Quoted 7 lines

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

Quoted 35 lines
---
 target/ppc/mmu_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target/ppc/mmu_helper.c +3 -3
index 261a8fe707..862824b073 100644
@@ -98,7 +98,7 @@ static int pp_check(int key, int pp, int nx)
         case 0x1:
         case 0x2:
             access |= PAGE_WRITE;
-            /* No break here */
+            /* fall through */
         case 0x3:
             access |= PAGE_READ;
             break;
@@ -706,7 +706,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
             if (pr != 0) {
                 goto check_perms;
             }
-            /* No break here */
+            /* fall through */
         case 0x3:
             /* All accesses granted */
             ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
@@ -720,7 +720,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
                 ret = -2;
                 break;
             }
-            /* No break here */
+            /* fall through */
         case 0x1:
         check_perms:
             /* Check from TLB entry */
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#17 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH-for-4.1? 5/7] target/ppc: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

Le 19/07/2019 à 15:14, Philippe Mathieu-Daudé a écrit :

Quoted 45 lines

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

target/ppc/mmu_helper.c: In function ‘dump_mmu’:
target/ppc/mmu_helper.c:1349:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1349 | if (ppc64_v3_radix(env_archcpu(env))) {
| ^
target/ppc/mmu_helper.c:1356:5: note: here

   1356 |     default:
        |     ^~~~~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 target/ppc/mmu_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target/ppc/mmu_helper.c +2 -2
index 261a8fe707..862824b073 100644
@@ -98,7 +98,7 @@ static int pp_check(int key, int pp, int nx)
         case 0x1:
         case 0x2:
             access |= PAGE_WRITE;
-            /* No break here */
+            /* fall through */
         case 0x3:
             access |= PAGE_READ;
             break;
@@ -706,7 +706,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
             if (pr != 0) {
                 goto check_perms;
             }
-            /* No break here */
+            /* fall through */
         case 0x3:
             /* All accesses granted */
             ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;

target/ppc/mmu_helper.c static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx, · line 726

Quoted 8 lines
target/ppc/mmu_helper.c +1 -1
@@ -720,7 +720,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
                 ret = -2;
                 break;
             }
-            /* No break here */
+            /* fall through */
         case 0x1:
         check_perms:
             /* Check from TLB entry */

Applied to my trivial-patches branch.

Thanks,
Laurent

#18 lore raw

PATCH 6/7 vl: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

vl.c: In function ‘qemu_ref_timedate’:
vl.c:773:15: error: this statement may fall through [-Werror=implicit-fallthrough=]

    773 |         value -= rtc_realtime_clock_offset;
        |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  vl.c:775:5: note: here
    775 |     case QEMU_CLOCK_VIRTUAL:
        |     ^~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +1 -1
index a5808f9a02..f5cf71e3b4 100644
@@ -771,7 +771,7 @@ static time_t qemu_ref_timedate(QEMUClockType clock)
     switch (clock) {
     case QEMU_CLOCK_REALTIME:
         value -= rtc_realtime_clock_offset;
-        /* no break */
+        /* fall through */
     case QEMU_CLOCK_VIRTUAL:
         value += rtc_ref_start_datetime;
         break;
Signature · 1 line
2.20.1
Reviewed-by on v1 6/7
#19 lore raw

Re: [Qemu-devel] [Qemu-block] [PATCH-for-4.1? 6/7] vl: Rewrite a fall through comment

Quoted 27 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

vl.c: In function ‘qemu_ref_timedate’:
vl.c:773:15: error: this statement may fall through [-Werror=implicit-fallthrough=]

    773 |         value -= rtc_realtime_clock_offset;
        |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  vl.c:775:5: note: here
    775 |     case QEMU_CLOCK_VIRTUAL:
        |     ^~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +0 -0
index a5808f9a02..f5cf71e3b4 100644

vl.c static time_t qemu_ref_timedate(QEMUClockType clock) · line 777

Quoted 8 lines
vl.c +1 -1
@@ -771,7 +771,7 @@ static time_t qemu_ref_timedate(QEMUClockType clock)
     switch (clock) {
     case QEMU_CLOCK_REALTIME:
         value -= rtc_realtime_clock_offset;
-        /* no break */
+        /* fall through */
     case QEMU_CLOCK_VIRTUAL:
         value += rtc_ref_start_datetime;
         break;
#20 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH-for-4.1? 6/7] vl: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

Le 19/07/2019 à 15:14, Philippe Mathieu-Daudé a écrit :

Quoted 27 lines

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

vl.c: In function ‘qemu_ref_timedate’:
vl.c:773:15: error: this statement may fall through [-Werror=implicit-fallthrough=]

    773 |         value -= rtc_realtime_clock_offset;
        |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  vl.c:775:5: note: here
    775 |     case QEMU_CLOCK_VIRTUAL:
        |     ^~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +0 -0
index a5808f9a02..f5cf71e3b4 100644

vl.c static time_t qemu_ref_timedate(QEMUClockType clock) · line 777

Quoted 8 lines
vl.c +1 -1
@@ -771,7 +771,7 @@ static time_t qemu_ref_timedate(QEMUClockType clock)
     switch (clock) {
     case QEMU_CLOCK_REALTIME:
         value -= rtc_realtime_clock_offset;
-        /* no break */
+        /* fall through */
     case QEMU_CLOCK_VIRTUAL:
         value += rtc_ref_start_datetime;
         break;

Applied to my trivial-patches branch.

Thanks,
Laurent

#21 lore raw

PATCH 7/7 spapr_events: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

CC ppc64-softmmu/hw/ppc/spapr_rtc.o
hw/ppc/spapr_events.c: In function ‘rtas_event_log_to_source’:
hw/ppc/spapr_events.c:312:12: error: this statement may fall through [-Werror=implicit-fallthrough=]

    312 |         if (spapr_ovec_test(spapr->ov5_cas, OV5_HP_EVT)) {
        |            ^
  hw/ppc/spapr_events.c:317:5: note: here
    317 |     case RTAS_LOG_TYPE_EPOW:
        |     ^~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/ppc/spapr_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_events.c +1 -1
index ae0f093f59..0a98894ad6 100644
@@ -313,7 +313,7 @@ rtas_event_log_to_source(SpaprMachineState *spapr, int log_type)
             g_assert(source->enabled);
             break;
         }
-        /* fall back to epow for legacy hotplug interrupt source */
+        /* fall through back to epow for legacy hotplug interrupt source */
     case RTAS_LOG_TYPE_EPOW:
         source = spapr_event_sources_get_source(spapr->event_sources,
                                                 EVENT_CLASS_EPOW);
Signature · 1 line
2.20.1
Acked-by on v1 7/7
#22 lore raw

Re: [Qemu-devel] [PATCH-for-4.1? 7/7] spapr_events: Rewrite a fall through comment

Quoted 11 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

CC ppc64-softmmu/hw/ppc/spapr_rtc.o
hw/ppc/spapr_events.c: In function ‘rtas_event_log_to_source’:
hw/ppc/spapr_events.c:312:12: error: this statement may fall through [-Werror=implicit-fallthrough=]

    312 |         if (spapr_ovec_test(spapr->ov5_cas, OV5_HP_EVT)) {
        |            ^
  hw/ppc/spapr_events.c:317:5: note: here
    317 |     case RTAS_LOG_TYPE_EPOW:
        |     ^~~~
Quoted 7 lines

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

Quoted 17 lines
---
 hw/ppc/spapr_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_events.c +1 -1
index ae0f093f59..0a98894ad6 100644
@@ -313,7 +313,7 @@ rtas_event_log_to_source(SpaprMachineState *spapr, int log_type)
             g_assert(source->enabled);
             break;
         }
-        /* fall back to epow for legacy hotplug interrupt source */
+        /* fall through back to epow for legacy hotplug interrupt source */
     case RTAS_LOG_TYPE_EPOW:
         source = spapr_event_sources_get_source(spapr->event_sources,
                                                 EVENT_CLASS_EPOW);
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#23 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH-for-4.1? 7/7] spapr_events: Rewrite a fall through comment

In reply to Philippe Mathieu-Daudé

Le 19/07/2019 à 15:14, Philippe Mathieu-Daudé a écrit :

Quoted 28 lines

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

CC ppc64-softmmu/hw/ppc/spapr_rtc.o
hw/ppc/spapr_events.c: In function ‘rtas_event_log_to_source’:
hw/ppc/spapr_events.c:312:12: error: this statement may fall through [-Werror=implicit-fallthrough=]

    312 |         if (spapr_ovec_test(spapr->ov5_cas, OV5_HP_EVT)) {
        |            ^
  hw/ppc/spapr_events.c:317:5: note: here
    317 |     case RTAS_LOG_TYPE_EPOW:
        |     ^~~~

cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by GCC and static analyzers.

---
 hw/ppc/spapr_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_events.c +0 -0
index ae0f093f59..0a98894ad6 100644

hw/ppc/spapr_events.c rtas_event_log_to_source(SpaprMachineState *spapr, int log_type) · line 319

Quoted 8 lines
hw/ppc/spapr_events.c +1 -1
@@ -313,7 +313,7 @@ rtas_event_log_to_source(SpaprMachineState *spapr, int log_type)
             g_assert(source->enabled);
             break;
         }
-        /* fall back to epow for legacy hotplug interrupt source */
+        /* fall through back to epow for legacy hotplug interrupt source */
     case RTAS_LOG_TYPE_EPOW:
         source = spapr_event_sources_get_source(spapr->event_sources,
                                                 EVENT_CLASS_EPOW);

Applied to my trivial-patches branch.

Thanks,
Laurent