diff mbox series

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

Message ID 20190719131425.10835-6-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series Trivial switch 'fall through' comment fixes for GCC9 | expand

Commit Message

Philippe Mathieu-Daudé July 19, 2019, 1:14 p.m. UTC
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.

Reported-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 target/ppc/mmu_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

David Gibson July 19, 2019, 2:20 p.m. UTC | #1
On Fri, Jul 19, 2019 at 03:14:23PM +0200, Philippe Mathieu-Daudé wrote:
> 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.
> 
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  target/ppc/mmu_helper.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index 261a8fe707..862824b073 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -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 */
Laurent Vivier Aug. 21, 2019, 8:57 a.m. UTC | #2
Le 19/07/2019 à 15:14, Philippe Mathieu-Daudé a écrit :
> 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.
> 
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  target/ppc/mmu_helper.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index 261a8fe707..862824b073 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -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 */
> 

Applied to my trivial-patches branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index 261a8fe707..862824b073 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -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 */