diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2021-04-16 14:55:38 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-04-17 18:44:30 +0100 |
commit | af1bb59c07c889c59cc22322d6eccb678991a299 (patch) | |
tree | 7807451fd25dc52e9180381450b3aae2532d6f85 | |
parent | 8fe9f1f891eff4e37f82622b7480ee748bf4af74 (diff) | |
download | qemu-af1bb59c07c889c59cc22322d6eccb678991a299.zip qemu-af1bb59c07c889c59cc22322d6eccb678991a299.tar.gz qemu-af1bb59c07c889c59cc22322d6eccb678991a299.tar.bz2 |
osdep: include glib-compat.h before other QEMU headers
glib-compat.h is sort of like a system header, and it needs to include
system headers (glib.h) that may dislike being included under
'extern "C"'. Move it right after all system headers and before
all other QEMU headers.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210416135543.20382-2-peter.maydell@linaro.org
[PMM: Added comment about why glib-compat.h is special]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | include/qemu/osdep.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index ba15be9..ab84ecc 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -111,6 +111,13 @@ extern int daemon(int, int); #define WEXITSTATUS(x) (x) #endif +/* + * This is somewhat like a system header; it must be outside any extern "C" + * block because it includes system headers itself, including glib.h, + * which will not compile if inside an extern "C" block. + */ +#include "glib-compat.h" + #ifdef _WIN32 #include "sysemu/os-win32.h" #endif @@ -123,7 +130,6 @@ extern int daemon(int, int); #include <AvailabilityMacros.h> #endif -#include "glib-compat.h" #include "qemu/typedefs.h" /* |