diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2018-10-22 19:16:23 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-10-23 10:12:46 +0100 |
commit | 3ebee3b191e755d3f7311a6a62eea5c9628b221b (patch) | |
tree | 2bd1549ce5e0a97ad8300b867cf786d3c1299357 /include | |
parent | 99e2487e00c4fbdd2deeeeeac88bb5d6d4e0dc1d (diff) | |
download | qemu-3ebee3b191e755d3f7311a6a62eea5c9628b221b.zip qemu-3ebee3b191e755d3f7311a6a62eea5c9628b221b.tar.gz qemu-3ebee3b191e755d3f7311a6a62eea5c9628b221b.tar.bz2 |
osdep: Work around MinGW assert
In several places we use assert(FEATURE), and assume that if FEATURE
is disabled, all following code is removed as unreachable. Which allows
us to compile-out functions that are only present with FEATURE, and
have a link-time failure if the functions remain used.
MinGW does not mark its internal function _assert() as noreturn, so the
compiler cannot see when code is unreachable, which leads to link errors
for this host that are not present elsewhere.
The current build-time failure concerns 62823083b8a2, but I remember
having seen this same error before. Fix it once and for all for MinGW.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20181022181623.8810-1-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/osdep.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 4f8559e..3bf48bc 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -123,6 +123,18 @@ extern int daemon(int, int); #include "qemu/typedefs.h" /* + * For mingw, as of v6.0.0, the function implementing the assert macro is + * not marked as noreturn, so the compiler cannot delete code following an + * assert(false) as unused. We rely on this within the code base to delete + * code that is unreachable when features are disabled. + * All supported versions of Glib's g_assert() satisfy this requirement. + */ +#ifdef __MINGW32__ +#undef assert +#define assert(x) g_assert(x) +#endif + +/* * According to waitpid man page: * WCOREDUMP * This macro is not specified in POSIX.1-2001 and is not |