diff mbox series

target/ppc/excp_helper: Add a fallthrough for fix compiler warning

Message ID 20201028055107.2170401-1-kuhn.chenqun@huawei.com (mailing list archive)
State New, archived
Headers show
Series target/ppc/excp_helper: Add a fallthrough for fix compiler warning | expand

Commit Message

Chen Qun Oct. 28, 2020, 5:51 a.m. UTC
When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../target/ppc/excp_helper.c: In function ‘powerpc_excp’:
../target/ppc/excp_helper.c:529:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
  529 |         msr |= env->error_code;
      |         ~~~~^~~~~~~~~~~~~~~~~~
../target/ppc/excp_helper.c:530:5: note: here
  530 |     case POWERPC_EXCP_HDECR:     /* Hypervisor decrementer exception         */
      |     ^~~~

Add the corresponding "fall through" comment to fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
 target/ppc/excp_helper.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Gibson Oct. 28, 2020, 5:53 a.m. UTC | #1
On Wed, Oct 28, 2020 at 01:51:07PM +0800, Chen Qun wrote:
> When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
> ../target/ppc/excp_helper.c: In function ‘powerpc_excp’:
> ../target/ppc/excp_helper.c:529:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   529 |         msr |= env->error_code;
>       |         ~~~~^~~~~~~~~~~~~~~~~~
> ../target/ppc/excp_helper.c:530:5: note: here
>   530 |     case POWERPC_EXCP_HDECR:     /* Hypervisor decrementer exception         */
>       |     ^~~~
> 
> Add the corresponding "fall through" comment to fix it.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>

Applied to ppc-for-5.2, thanks.

> ---
>  target/ppc/excp_helper.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> index a988ba15f4..c639516399 100644
> --- a/target/ppc/excp_helper.c
> +++ b/target/ppc/excp_helper.c
> @@ -527,6 +527,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
>          break;
>      case POWERPC_EXCP_HISI:      /* Hypervisor instruction storage exception */
>          msr |= env->error_code;
> +        /* fall through */
>      case POWERPC_EXCP_HDECR:     /* Hypervisor decrementer exception         */
>      case POWERPC_EXCP_HDSI:      /* Hypervisor data storage exception        */
>      case POWERPC_EXCP_HDSEG:     /* Hypervisor data segment exception        */
diff mbox series

Patch

diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index a988ba15f4..c639516399 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -527,6 +527,7 @@  static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
         break;
     case POWERPC_EXCP_HISI:      /* Hypervisor instruction storage exception */
         msr |= env->error_code;
+        /* fall through */
     case POWERPC_EXCP_HDECR:     /* Hypervisor decrementer exception         */
     case POWERPC_EXCP_HDSI:      /* Hypervisor data storage exception        */
     case POWERPC_EXCP_HDSEG:     /* Hypervisor data segment exception        */