diff mbox series

[v4,17/17] target/m68k: Mark helper_raise_exception as noreturn

Message ID 20220430175342.370628-18-richard.henderson@linaro.org
State Superseded
Headers show
Series target/m68k: Conditional traps + trap cleanup | expand

Commit Message

Richard Henderson April 30, 2022, 5:53 p.m. UTC
Also mark raise_exception_ra and raise_exception, lest we
generate a warning about helper_raise_exception returning.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/m68k/helper.h    | 2 +-
 target/m68k/op_helper.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé May 22, 2022, 9:48 p.m. UTC | #1
On 30/4/22 19:53, Richard Henderson wrote:
> Also mark raise_exception_ra and raise_exception, lest we
> generate a warning about helper_raise_exception returning.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/m68k/helper.h    | 2 +-
>   target/m68k/op_helper.c | 5 +++--
>   2 files changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Laurent Vivier May 25, 2022, 7:45 p.m. UTC | #2
Le 30/04/2022 à 19:53, Richard Henderson a écrit :
> Also mark raise_exception_ra and raise_exception, lest we
> generate a warning about helper_raise_exception returning.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/m68k/helper.h    | 2 +-
>   target/m68k/op_helper.c | 5 +++--
>   2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/target/m68k/helper.h b/target/m68k/helper.h
> index f016c4c1c2..c9bed2b884 100644
> --- a/target/m68k/helper.h
> +++ b/target/m68k/helper.h
> @@ -109,7 +109,7 @@ DEF_HELPER_3(set_mac_extu, void, env, i32, i32)
>   DEF_HELPER_2(flush_flags, void, env, i32)
>   DEF_HELPER_2(set_ccr, void, env, i32)
>   DEF_HELPER_FLAGS_1(get_ccr, TCG_CALL_NO_WG_SE, i32, env)
> -DEF_HELPER_2(raise_exception, void, env, i32)
> +DEF_HELPER_2(raise_exception, noreturn, env, i32)
>   
>   DEF_HELPER_FLAGS_3(bfffo_reg, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32)
>   
> diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
> index 61948d92bb..d9937ca8dc 100644
> --- a/target/m68k/op_helper.c
> +++ b/target/m68k/op_helper.c
> @@ -532,7 +532,8 @@ bool m68k_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
>   
>   #endif /* !CONFIG_USER_ONLY */
>   
> -static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
> +G_NORETURN static void
> +raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
>   {
>       CPUState *cs = env_cpu(env);
>   
> @@ -540,7 +541,7 @@ static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
>       cpu_loop_exit_restore(cs, raddr);
>   }
>   
> -static void raise_exception(CPUM68KState *env, int tt)
> +G_NORETURN static void raise_exception(CPUM68KState *env, int tt)
>   {
>       raise_exception_ra(env, tt, 0);
>   }

And why not

   G_NORETURN void HELPER(raise_exception)(CPUM68KState *env, uint32_t tt)

?

Thanks,
Laurent
Richard Henderson May 25, 2022, 8:13 p.m. UTC | #3
On 5/25/22 12:45, Laurent Vivier wrote:
>> +DEF_HELPER_2(raise_exception, noreturn, env, i32)
...
>> -static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
>> +G_NORETURN static void
>> +raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
>>   {
>>       CPUState *cs = env_cpu(env);
>> @@ -540,7 +541,7 @@ static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t 
>> raddr)
>>       cpu_loop_exit_restore(cs, raddr);
>>   }
>> -static void raise_exception(CPUM68KState *env, int tt)
>> +G_NORETURN static void raise_exception(CPUM68KState *env, int tt)
>>   {
>>       raise_exception_ra(env, tt, 0);
>>   }
> 
> And why not
> 
>    G_NORETURN void HELPER(raise_exception)(CPUM68KState *env, uint32_t tt)
> 
> ?

Because the declaration in the header file takes care of that.
No need to replicate it in the definition.


r~
Laurent Vivier May 25, 2022, 9:54 p.m. UTC | #4
Le 30/04/2022 à 19:53, Richard Henderson a écrit :
> Also mark raise_exception_ra and raise_exception, lest we
> generate a warning about helper_raise_exception returning.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/m68k/helper.h    | 2 +-
>   target/m68k/op_helper.c | 5 +++--
>   2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/target/m68k/helper.h b/target/m68k/helper.h
> index f016c4c1c2..c9bed2b884 100644
> --- a/target/m68k/helper.h
> +++ b/target/m68k/helper.h
> @@ -109,7 +109,7 @@ DEF_HELPER_3(set_mac_extu, void, env, i32, i32)
>   DEF_HELPER_2(flush_flags, void, env, i32)
>   DEF_HELPER_2(set_ccr, void, env, i32)
>   DEF_HELPER_FLAGS_1(get_ccr, TCG_CALL_NO_WG_SE, i32, env)
> -DEF_HELPER_2(raise_exception, void, env, i32)
> +DEF_HELPER_2(raise_exception, noreturn, env, i32)
>   
>   DEF_HELPER_FLAGS_3(bfffo_reg, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32)
>   
> diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
> index 61948d92bb..d9937ca8dc 100644
> --- a/target/m68k/op_helper.c
> +++ b/target/m68k/op_helper.c
> @@ -532,7 +532,8 @@ bool m68k_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
>   
>   #endif /* !CONFIG_USER_ONLY */
>   
> -static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
> +G_NORETURN static void
> +raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
>   {
>       CPUState *cs = env_cpu(env);
>   
> @@ -540,7 +541,7 @@ static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
>       cpu_loop_exit_restore(cs, raddr);
>   }
>   
> -static void raise_exception(CPUM68KState *env, int tt)
> +G_NORETURN static void raise_exception(CPUM68KState *env, int tt)
>   {
>       raise_exception_ra(env, tt, 0);
>   }

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
diff mbox series

Patch

diff --git a/target/m68k/helper.h b/target/m68k/helper.h
index f016c4c1c2..c9bed2b884 100644
--- a/target/m68k/helper.h
+++ b/target/m68k/helper.h
@@ -109,7 +109,7 @@  DEF_HELPER_3(set_mac_extu, void, env, i32, i32)
 DEF_HELPER_2(flush_flags, void, env, i32)
 DEF_HELPER_2(set_ccr, void, env, i32)
 DEF_HELPER_FLAGS_1(get_ccr, TCG_CALL_NO_WG_SE, i32, env)
-DEF_HELPER_2(raise_exception, void, env, i32)
+DEF_HELPER_2(raise_exception, noreturn, env, i32)
 
 DEF_HELPER_FLAGS_3(bfffo_reg, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32)
 
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 61948d92bb..d9937ca8dc 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -532,7 +532,8 @@  bool m68k_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
 
 #endif /* !CONFIG_USER_ONLY */
 
-static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
+G_NORETURN static void
+raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
 {
     CPUState *cs = env_cpu(env);
 
@@ -540,7 +541,7 @@  static void raise_exception_ra(CPUM68KState *env, int tt, uintptr_t raddr)
     cpu_loop_exit_restore(cs, raddr);
 }
 
-static void raise_exception(CPUM68KState *env, int tt)
+G_NORETURN static void raise_exception(CPUM68KState *env, int tt)
 {
     raise_exception_ra(env, tt, 0);
 }