Skip to content

Commit

Permalink
osdep: include glib-compat.h before other QEMU headers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bonzini authored and pm215 committed Apr 17, 2021
1 parent 8fe9f1f commit af1bb59
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/qemu/osdep.h
Expand Up @@ -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
Expand All @@ -123,7 +130,6 @@ extern int daemon(int, int);
#include <AvailabilityMacros.h>
#endif

#include "glib-compat.h"
#include "qemu/typedefs.h"

/*
Expand Down

0 comments on commit af1bb59

Please sign in to comment.