]> git.proxmox.com Git - mirror_qemu.git/commitdiff
util: remove redundant include of glib.h and add osdep.h
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 6 Jun 2018 17:15:38 +0000 (18:15 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 29 Jun 2018 11:22:28 +0000 (12:22 +0100)
Code must only ever include glib.h indirectly via the glib-compat.h
header file, because we will need some macros set before glib.h is
pulled in. Adding extra includes of glib.h will (soon) cause compile
failures such as:

In file included from /home/berrange/src/virt/qemu/include/qemu/osdep.h:107,
                 from /home/berrange/src/virt/qemu/include/qemu/iova-tree.h:26,
                 from util/iova-tree.c:13:
/home/berrange/src/virt/qemu/include/glib-compat.h:22: error: "GLIB_VERSION_MIN_REQUIRED" redefined [-Werror]
 #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_40

In file included from /usr/include/glib-2.0/glib/gtypes.h:34,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from util/iova-tree.c:12:
/usr/include/glib-2.0/glib/gversionmacros.h:237: note: this is the location of the previous definition
 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE)

Furthermore, the osdep.h include should always be done directly from the
.c file rather than indirectly via any .h file.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
include/qemu/iova-tree.h
util/iova-tree.c

index b061932097ab788ad0333b82acebb4c2d9bb8536..b66cf93c4bc6deaad4527a89bace3b9f3afa295e 100644 (file)
@@ -23,7 +23,6 @@
  * for the thread safety issue.
  */
 
-#include "qemu/osdep.h"
 #include "exec/memory.h"
 #include "exec/hwaddr.h"
 
index 2d9cebfc89c0f630d648ac1c22d398927ba0a916..7990692cbd33f12ce77ad175ca05637b3196199d 100644 (file)
@@ -9,7 +9,7 @@
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  */
 
-#include <glib.h>
+#include "qemu/osdep.h"
 #include "qemu/iova-tree.h"
 
 struct IOVATree {