diff mbox series

[v2,3/8] accel/tcg/user-exec: silence the compiler warnings

Message ID 20201030004046.2191790-4-kuhn.chenqun@huawei.com
State Accepted
Commit f190bf05f83c378958da84fe85c4df91c3941ce8
Headers show
Series None | expand

Commit Message

Chenqun (kuhn) Oct. 30, 2020, 12:40 a.m. UTC
When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:
../accel/tcg/user-exec.c:169:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
  169 |             cpu_exit_tb_from_sighandler(cpu, old_set);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../accel/tcg/user-exec.c:172:9: note: here
  172 |         default:

Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
v1->v2: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function
to avoid the compiler warnings(Base on Thomas's and Richard's comments).

Cc: Thomas Huth <thuth@redhat.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/tcg/user-exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Richard Henderson Oct. 30, 2020, 5:50 a.m. UTC | #1
On 10/29/20 5:40 PM, Chen Qun wrote:
> When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:

> ../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:

> ../accel/tcg/user-exec.c:169:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

>   169 |             cpu_exit_tb_from_sighandler(cpu, old_set);

>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> ../accel/tcg/user-exec.c:172:9: note: here

>   172 |         default:

> 

> Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

> 

> Reported-by: Euler Robot <euler.robot@huawei.com>

> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>

> ---

> v1->v2: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function

> to avoid the compiler warnings(Base on Thomas's and Richard's comments).


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~
Philippe Mathieu-Daudé Oct. 30, 2020, 6:31 a.m. UTC | #2
On 10/30/20 1:40 AM, Chen Qun wrote:
> When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:

> ../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:

> ../accel/tcg/user-exec.c:169:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

>   169 |             cpu_exit_tb_from_sighandler(cpu, old_set);

>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> ../accel/tcg/user-exec.c:172:9: note: here

>   172 |         default:

> 

> Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

> 

> Reported-by: Euler Robot <euler.robot@huawei.com>

> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>

> ---

> v1->v2: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function

> to avoid the compiler warnings(Base on Thomas's and Richard's comments).


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Thomas Huth Oct. 30, 2020, 3:40 p.m. UTC | #3
On 30/10/2020 01.40, Chen Qun wrote:
> When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:

> ../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:

> ../accel/tcg/user-exec.c:169:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

>   169 |             cpu_exit_tb_from_sighandler(cpu, old_set);

>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> ../accel/tcg/user-exec.c:172:9: note: here

>   172 |         default:

> 

> Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

> 

> Reported-by: Euler Robot <euler.robot@huawei.com>

> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>

> ---

> v1->v2: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function

> to avoid the compiler warnings(Base on Thomas's and Richard's comments).

> 

> Cc: Thomas Huth <thuth@redhat.com>

> Cc: Riku Voipio <riku.voipio@iki.fi>

> Cc: Richard Henderson <richard.henderson@linaro.org>

> Cc: Paolo Bonzini <pbonzini@redhat.com>

> ---

>  accel/tcg/user-exec.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c

> index 4ebe25461a..293ee86ea4 100644

> --- a/accel/tcg/user-exec.c

> +++ b/accel/tcg/user-exec.c

> @@ -49,7 +49,8 @@ __thread uintptr_t helper_retaddr;

>  /* exit the current TB from a signal handler. The host registers are

>     restored in a state compatible with the CPU emulator

>   */

> -static void cpu_exit_tb_from_sighandler(CPUState *cpu, sigset_t *old_set)

> +static void QEMU_NORETURN cpu_exit_tb_from_sighandler(CPUState *cpu,

> +                                                      sigset_t *old_set)

>  {

>      /* XXX: use siglongjmp ? */

>      sigprocmask(SIG_SETMASK, old_set, NULL);

> 


Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 4ebe25461a..293ee86ea4 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -49,7 +49,8 @@  __thread uintptr_t helper_retaddr;
 /* exit the current TB from a signal handler. The host registers are
    restored in a state compatible with the CPU emulator
  */
-static void cpu_exit_tb_from_sighandler(CPUState *cpu, sigset_t *old_set)
+static void QEMU_NORETURN cpu_exit_tb_from_sighandler(CPUState *cpu,
+                                                      sigset_t *old_set)
 {
     /* XXX: use siglongjmp ? */
     sigprocmask(SIG_SETMASK, old_set, NULL);