mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-03 23:41:53 -06:00
qemu/compiler.h: Add qemu_build_not_reached
Use this as a compile-time assert that a particular code path is not reachable. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
c6b716cdc0
commit
560e36d5a4
1 changed files with 15 additions and 0 deletions
|
@ -221,4 +221,19 @@
|
||||||
#define QEMU_GENERIC9(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC8(x, __VA_ARGS__))
|
#define QEMU_GENERIC9(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC8(x, __VA_ARGS__))
|
||||||
#define QEMU_GENERIC10(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC9(x, __VA_ARGS__))
|
#define QEMU_GENERIC10(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC9(x, __VA_ARGS__))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qemu_build_not_reached()
|
||||||
|
*
|
||||||
|
* The compiler, during optimization, is expected to prove that a call
|
||||||
|
* to this function cannot be reached and remove it. If the compiler
|
||||||
|
* supports QEMU_ERROR, this will be reported at compile time; otherwise
|
||||||
|
* this will be reported at link time due to the missing symbol.
|
||||||
|
*/
|
||||||
|
#ifdef __OPTIMIZE__
|
||||||
|
extern void QEMU_NORETURN QEMU_ERROR("code path is reachable")
|
||||||
|
qemu_build_not_reached(void);
|
||||||
|
#else
|
||||||
|
#define qemu_build_not_reached() g_assert_not_reached()
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* COMPILER_H */
|
#endif /* COMPILER_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue