From af1bb59c07c889c59cc22322d6eccb678991a299 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 16 Apr 2021 14:55:38 +0100 Subject: [PATCH] osdep: include glib-compat.h before other QEMU headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Maydell Acked-by: Paolo Bonzini Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20210416135543.20382-2-peter.maydell@linaro.org [PMM: Added comment about why glib-compat.h is special] Signed-off-by: Peter Maydell --- include/qemu/osdep.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index ba15be9c56..ab84ecc7c1 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 #endif -#include "glib-compat.h" #include "qemu/typedefs.h" /* -- 2.30.2