qemu/compiler: Split out qemu_build_not_reached_always
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 14 Jan 2021 20:04:04 +0000 (10:04 -1000)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 22 Jan 2021 22:48:01 +0000 (12:48 -1000)
Provide a symbol that can always be used to signal an error,
regardless of optimization.  Usage of this should be protected
by e.g. __builtin_constant_p, which guards for optimization.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
include/qemu/compiler.h

index d620a841e461c75afd587df33874124c340d29bb..cf28bb2bcd78df154a5b8ad198c8f4ca27bb3306 100644 (file)
  * supports QEMU_ERROR, this will be reported at compile time; otherwise
  * this will be reported at link time due to the missing symbol.
  */
-#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
 extern void QEMU_NORETURN QEMU_ERROR("code path is reachable")
-    qemu_build_not_reached(void);
+    qemu_build_not_reached_always(void);
+#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
+#define qemu_build_not_reached()  qemu_build_not_reached_always()
 #else
 #define qemu_build_not_reached()  g_assert_not_reached()
 #endif