hw/misc: remove break after g_assert_not_reached()
authorPierrick Bouvier <pierrick.bouvier@linaro.org>
Tue, 10 Sep 2024 22:15:55 +0000 (15:15 -0700)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 13 Sep 2024 18:12:16 +0000 (20:12 +0200)
Use of assert(false) can trip spurious control flow warnings from
some versions of GCC (i.e. using -fsanitize=thread with gcc-12):

  error: control reaches end of non-void function [-Werror=return-type]
        default:
            g_assert_not_reached();
            break;
          | ^^^^^

Solve that by removing the unreachable 'break' statement, unifying
the code base on g_assert_not_reached() instead.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240910221606.1817478-29-pierrick.bouvier@linaro.org>
[PMD: Add description suggested by Eric Blake]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
hw/misc/imx6_ccm.c
hw/misc/mac_via.c

index 4b23ef19cd90f8b4c24976e2bdb3aed14226864b..7d522ed7c5fa1f3a1c2740bc064a199beeb67f54 100644 (file)
@@ -301,7 +301,6 @@ static uint64_t imx6_analog_get_periph_clk(IMX6CCMState *dev)
     default:
         /* We should never get there */
         g_assert_not_reached();
-        break;
     }
 
     trace_imx6_analog_get_periph_clk(freq);
index 652395b84fce0d2c6d1252dec54acc1e8263c3f7..af2b2b1af3d00fcc5bbc864e60eab22895b64b37 100644 (file)
@@ -495,7 +495,6 @@ static void via1_rtc_update(MOS6522Q800VIA1State *v1s)
                 break;
             default:
                 g_assert_not_reached();
-                break;
             }
             return;
         }
@@ -556,7 +555,6 @@ static void via1_rtc_update(MOS6522Q800VIA1State *v1s)
             break;
         default:
             g_assert_not_reached();
-            break;
         }
         return;
     }