[PULL v2 1/3] osdep: include glib-compat.h before other QEMU headers

Paolo Bonzini posted 3 patches 4 years, 10 months ago
Maintainers: Eduardo Habkost <ehabkost@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>
[PULL v2 1/3] osdep: include glib-compat.h before other QEMU headers
Posted by Paolo Bonzini 4 years, 10 months ago
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>
---
 include/qemu/osdep.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index ba15be9c56..b67b0a1e8c 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -111,6 +111,8 @@ extern int daemon(int, int);
 #define WEXITSTATUS(x) (x)
 #endif
 
+#include "glib-compat.h"
+
 #ifdef _WIN32
 #include "sysemu/os-win32.h"
 #endif
@@ -123,7 +125,6 @@ extern int daemon(int, int);
 #include <AvailabilityMacros.h>
 #endif
 
-#include "glib-compat.h"
 #include "qemu/typedefs.h"
 
 /*
-- 
2.30.1



Re: [PULL v2 1/3] osdep: include glib-compat.h before other QEMU headers
Posted by Philippe Mathieu-Daudé 4 years, 10 months ago
On 4/13/21 6:08 PM, Paolo Bonzini wrote:
> 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>
> ---
>  include/qemu/osdep.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index ba15be9c56..b67b0a1e8c 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -111,6 +111,8 @@ extern int daemon(int, int);
>  #define WEXITSTATUS(x) (x)
>  #endif
>  

Maybe worth a comment "must be after system headers and before other
QEMU headers" so we don't move it again by mistake.

> +#include "glib-compat.h"
> +
>  #ifdef _WIN32
>  #include "sysemu/os-win32.h"
>  #endif
> @@ -123,7 +125,6 @@ extern int daemon(int, int);
>  #include <AvailabilityMacros.h>
>  #endif
>  
> -#include "glib-compat.h"
>  #include "qemu/typedefs.h"
>  
>  /*
> 


Re: [PULL v2 1/3] osdep: include glib-compat.h before other QEMU headers
Posted by Daniel P. Berrangé 4 years, 10 months ago
On Tue, Apr 13, 2021 at 06:08:48PM +0200, Paolo Bonzini wrote:
> 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>
> ---
>  include/qemu/osdep.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|