Skip to contentSkip to conversation

qemu-pixman.h: Avoid mutual inclusion loop with console.h

PATCH Superseded Peter Maydell 2 participants 3 messages Jan 17, 2013 – Jan 18, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-pixman.h: Avoid mutual inclusion loop with console.h

Remove an unnecessary mutual inclusion loop between qemu-pixman.h and console.h, since the former was only including the latter for 'PixelFormat*', which can be provided by typedefs.h. This requires a minor adjustment to qemu-pixman.c, which was relying on the implicit inclusion of console.h for the actual struct PixelFormat definition, and on implicitly dragging in a header defining NULL.

---
I noticed this because I had an out of tree file which included ui/console.h before qemu-common.h and it didn't compile. But mutual include loops are a bad idea anyway IMHO.

 include/ui/qemu-pixman.h |    2 +-
 ui/qemu-pixman.c         |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
include/ui/qemu-pixman.h +1 -1
index 016fd87..b032f52 100644
@@ -15,7 +15,7 @@
 #pragma GCC diagnostic error "-Wredundant-decls"
 #endif
 
-#include "console.h"
+#include "qemu/typedefs.h"
 
 /*
  * pixman image formats are defined to be native endian,
ui/qemu-pixman.c +2 -1
index 609335a..6dcbe90 100644
@@ -3,7 +3,8 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include "ui/qemu-pixman.h"
+#include "qemu-common.h"
+#include "ui/console.h"
 
 int qemu_pixman_get_type(int rshift, int gshift, int bshift)
 {
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 8 lines · Peter Maydell

Remove an unnecessary mutual inclusion loop between qemu-pixman.h and console.h, since the former was only including the latter for 'PixelFormat*', which can be provided by typedefs.h. This requires a minor adjustment to qemu-pixman.c, which was relying on the implicit inclusion of console.h for the actual struct PixelFormat definition, and on implicitly dragging in a header defining NULL.

Quoted 8 lines

---
I noticed this because I had an out of tree file which included ui/console.h before qemu-common.h and it didn't compile. But mutual include loops are a bad idea anyway IMHO.

 include/ui/qemu-pixman.h |    2 +-
 ui/qemu-pixman.c         |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

CC ui/curses.o
In file included from ui/spice-core.c:40:0:
/home/stefanha/qemu/include/ui/spice-display.h:93:5: error: unknown type name ‘QEMUCursor’

Stefan

#2 lore raw
Quoted 11 lines · Stefan Hajnoczi
Quoted 6 lines · Peter Maydell

Remove an unnecessary mutual inclusion loop between qemu-pixman.h and console.h, since the former was only including the latter for 'PixelFormat*', which can be provided by typedefs.h. This requires a minor adjustment to qemu-pixman.c, which was relying on the implicit inclusion of console.h for the actual struct PixelFormat definition, and on implicitly dragging in a header defining NULL.

CC ui/curses.o
In file included from ui/spice-core.c:40:0:
/home/stefanha/qemu/include/ui/spice-display.h:93:5: error: unknown type name ‘QEMUCursor’

Oops. I don't have spice in my dev environment I guess. Having spice-display.h include console.h will probably fix this.

-- PMM