diff mbox series

[21/39] migration: replace assert(false) with g_assert_not_reached()

Message ID 20240910221606.1817478-22-pierrick.bouvier@linaro.org
State Superseded
Headers show
Series Use g_assert_not_reached instead of (g_)assert(0, false) | expand

Commit Message

Pierrick Bouvier Sept. 10, 2024, 10:15 p.m. UTC
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 migration/dirtyrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Fabiano Rosas Sept. 10, 2024, 10:26 p.m. UTC | #1
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:

> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>  migration/dirtyrate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
> index 1d9db812990..a28c07327e8 100644
> --- a/migration/dirtyrate.c
> +++ b/migration/dirtyrate.c
> @@ -228,7 +228,7 @@ static int time_unit_to_power(TimeUnit time_unit)
>      case TIME_UNIT_MILLISECOND:
>          return -3;
>      default:
> -        assert(false); /* unreachable */
> +        g_assert_not_reached(); /* unreachable */
>          return 0;
>      }
>  }

You could drop the comment that's now redundant.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Richard Henderson Sept. 11, 2024, 3:26 a.m. UTC | #2
On 9/10/24 15:15, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   migration/dirtyrate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
> index 1d9db812990..a28c07327e8 100644
> --- a/migration/dirtyrate.c
> +++ b/migration/dirtyrate.c
> @@ -228,7 +228,7 @@ static int time_unit_to_power(TimeUnit time_unit)
>       case TIME_UNIT_MILLISECOND:
>           return -3;
>       default:
> -        assert(false); /* unreachable */
> +        g_assert_not_reached(); /* unreachable */
>           return 0;
>       }
>   }

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

r~
Richard Henderson Sept. 11, 2024, 3:27 a.m. UTC | #3
On 9/10/24 15:15, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   migration/dirtyrate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
> index 1d9db812990..a28c07327e8 100644
> --- a/migration/dirtyrate.c
> +++ b/migration/dirtyrate.c
> @@ -228,7 +228,7 @@ static int time_unit_to_power(TimeUnit time_unit)
>       case TIME_UNIT_MILLISECOND:
>           return -3;
>       default:
> -        assert(false); /* unreachable */
> +        g_assert_not_reached(); /* unreachable */
>           return 0;
>       }
>   }

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

r~
Peter Xu Sept. 11, 2024, 1:40 p.m. UTC | #4
On Tue, Sep 10, 2024 at 03:15:48PM -0700, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>

Reviewed-by: Peter Xu <peterx@redhat.com>
diff mbox series

Patch

diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
index 1d9db812990..a28c07327e8 100644
--- a/migration/dirtyrate.c
+++ b/migration/dirtyrate.c
@@ -228,7 +228,7 @@  static int time_unit_to_power(TimeUnit time_unit)
     case TIME_UNIT_MILLISECOND:
         return -3;
     default:
-        assert(false); /* unreachable */
+        g_assert_not_reached(); /* unreachable */
         return 0;
     }
 }