[PATCH 11/39] target/ppc: replace assert(0) with g_assert_not_reached()

Pierrick Bouvier posted 39 patches 2 months, 2 weeks ago
There is a newer version of this series
[PATCH 11/39] target/ppc: replace assert(0) with g_assert_not_reached()
Posted by Pierrick Bouvier 2 months, 2 weeks ago
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 target/ppc/dfp_helper.c | 8 ++++----
 target/ppc/mmu_helper.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/ppc/dfp_helper.c b/target/ppc/dfp_helper.c
index 5967ea07a92..6ef31a480b7 100644
--- a/target/ppc/dfp_helper.c
+++ b/target/ppc/dfp_helper.c
@@ -249,7 +249,7 @@ static void dfp_set_FPRF_from_FRT_with_context(struct PPC_DFP *dfp,
         fprf = 0x05;
         break;
     default:
-        assert(0); /* should never get here */
+        g_assert_not_reached(); /* should never get here */
     }
     dfp->env->fpscr &= ~FP_FPRF;
     dfp->env->fpscr |= (fprf << FPSCR_FPRF);
@@ -1243,7 +1243,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b) \
         } else if (decNumberIsQNaN(&dfp.b)) {                  \
             vt.VsrD(1) = -2;                                   \
         } else {                                               \
-            assert(0);                                         \
+            g_assert_not_reached();                                         \
         }                                                      \
         set_dfp64(t, &vt);                                     \
     } else {                                                   \
@@ -1252,7 +1252,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b) \
         } else if ((size) == 128) {                            \
             vt.VsrD(1) = dfp.b.exponent + 6176;                \
         } else {                                               \
-            assert(0);                                         \
+            g_assert_not_reached();                                         \
         }                                                      \
         set_dfp64(t, &vt);                                     \
     }                                                          \
@@ -1300,7 +1300,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *a,          \
         raw_inf = 0x1e000;                                                \
         bias = 6176;                                                      \
     } else {                                                              \
-        assert(0);                                                        \
+        g_assert_not_reached();                                                        \
     }                                                                     \
                                                                           \
     if (unlikely((exp < 0) || (exp > max_exp))) {                         \
diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index b0a0676beba..b167b37e0ab 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -316,7 +316,7 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
         break;
     default:
         /* Should never reach here with other MMU models */
-        assert(0);
+        g_assert_not_reached();
     }
 #else
     ppc_tlb_invalidate_all(env);
-- 
2.39.2
Re: [PATCH 11/39] target/ppc: replace assert(0) with g_assert_not_reached()
Posted by Daniel Henrique Barboza 2 months, 1 week ago

On 9/10/24 7:15 PM, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   target/ppc/dfp_helper.c | 8 ++++----
>   target/ppc/mmu_helper.c | 2 +-
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/target/ppc/dfp_helper.c b/target/ppc/dfp_helper.c
> index 5967ea07a92..6ef31a480b7 100644
> --- a/target/ppc/dfp_helper.c
> +++ b/target/ppc/dfp_helper.c
> @@ -249,7 +249,7 @@ static void dfp_set_FPRF_from_FRT_with_context(struct PPC_DFP *dfp,
>           fprf = 0x05;
>           break;
>       default:
> -        assert(0); /* should never get here */
> +        g_assert_not_reached(); /* should never get here */
>       }
>       dfp->env->fpscr &= ~FP_FPRF;
>       dfp->env->fpscr |= (fprf << FPSCR_FPRF);
> @@ -1243,7 +1243,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b) \
>           } else if (decNumberIsQNaN(&dfp.b)) {                  \
>               vt.VsrD(1) = -2;                                   \
>           } else {                                               \
> -            assert(0);                                         \
> +            g_assert_not_reached();                                         \

Need to realign the '\'. Same thing with the other 2 instances below.

>           }                                                      \
>           set_dfp64(t, &vt);                                     \
>       } else {                                                   \
> @@ -1252,7 +1252,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b) \
>           } else if ((size) == 128) {                            \
>               vt.VsrD(1) = dfp.b.exponent + 6176;                \
>           } else {                                               \
> -            assert(0);                                         \
> +            g_assert_not_reached();                                         \
>           }                                                      \
>           set_dfp64(t, &vt);                                     \
>       }                                                          \
> @@ -1300,7 +1300,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *a,          \
>           raw_inf = 0x1e000;                                                \
>           bias = 6176;                                                      \
>       } else {                                                              \
> -        assert(0);                                                        \
> +        g_assert_not_reached();                                                        \
>       }                                                                     \
>                                                                             \
>       if (unlikely((exp < 0) || (exp > max_exp))) {                         \

Otherwise,

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index b0a0676beba..b167b37e0ab 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -316,7 +316,7 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
>           break;
>       default:
>           /* Should never reach here with other MMU models */
> -        assert(0);
> +        g_assert_not_reached();
>       }
>   #else
>       ppc_tlb_invalidate_all(env);
Re: [PATCH 11/39] target/ppc: replace assert(0) with g_assert_not_reached()
Posted by Richard Henderson 2 months, 2 weeks ago
On 9/10/24 15:15, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   target/ppc/dfp_helper.c | 8 ++++----
>   target/ppc/mmu_helper.c | 2 +-
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/target/ppc/dfp_helper.c b/target/ppc/dfp_helper.c
> index 5967ea07a92..6ef31a480b7 100644
> --- a/target/ppc/dfp_helper.c
> +++ b/target/ppc/dfp_helper.c
> @@ -249,7 +249,7 @@ static void dfp_set_FPRF_from_FRT_with_context(struct PPC_DFP *dfp,
>           fprf = 0x05;
>           break;
>       default:
> -        assert(0); /* should never get here */
> +        g_assert_not_reached(); /* should never get here */
>       }
>       dfp->env->fpscr &= ~FP_FPRF;
>       dfp->env->fpscr |= (fprf << FPSCR_FPRF);
> @@ -1243,7 +1243,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b) \
>           } else if (decNumberIsQNaN(&dfp.b)) {                  \
>               vt.VsrD(1) = -2;                                   \
>           } else {                                               \
> -            assert(0);                                         \
> +            g_assert_not_reached();                                         \
>           }                                                      \

Backslashes should ideally be kept aligned.

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


r~
Re: [PATCH 11/39] target/ppc: replace assert(0) with g_assert_not_reached()
Posted by Pierrick Bouvier 2 months, 1 week ago
On 9/10/24 20:14, Richard Henderson wrote:
> On 9/10/24 15:15, Pierrick Bouvier wrote:
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    target/ppc/dfp_helper.c | 8 ++++----
>>    target/ppc/mmu_helper.c | 2 +-
>>    2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/target/ppc/dfp_helper.c b/target/ppc/dfp_helper.c
>> index 5967ea07a92..6ef31a480b7 100644
>> --- a/target/ppc/dfp_helper.c
>> +++ b/target/ppc/dfp_helper.c
>> @@ -249,7 +249,7 @@ static void dfp_set_FPRF_from_FRT_with_context(struct PPC_DFP *dfp,
>>            fprf = 0x05;
>>            break;
>>        default:
>> -        assert(0); /* should never get here */
>> +        g_assert_not_reached(); /* should never get here */
>>        }
>>        dfp->env->fpscr &= ~FP_FPRF;
>>        dfp->env->fpscr |= (fprf << FPSCR_FPRF);
>> @@ -1243,7 +1243,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b) \
>>            } else if (decNumberIsQNaN(&dfp.b)) {                  \
>>                vt.VsrD(1) = -2;                                   \
>>            } else {                                               \
>> -            assert(0);                                         \
>> +            g_assert_not_reached();                                         \
>>            }                                                      \
> 
> Backslashes should ideally be kept aligned.
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
> 
> r~

I'll align those.
Thanks,
Pierrick