Skip to contentSkip to conversation

bitops: Header dependency fixes

PATCH Applied Eduardo Habkost 2 participants 7 messages Sep 26, 2014 – Oct 23, 2014

lore
Share & tools
lore
#0 lore raw

cover bitops: Header dependency fixes

This series adds a missing include, kills a circular header dependency, and avoid including qemu-common.h from a header to avoid new circular dependencies.

Eduardo Habkost (3):
tests: Add missing include to test-bitops.c
bitops.h: Don't include qemu-common.h
bitmap.h: Don't include qemu-common.h

 include/qemu/bitmap.h | 5 ++++-
 include/qemu/bitops.h | 4 +++-
 tests/test-bitops.c   | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/3 tests: Add missing include to test-bitops.c

The test code needs osdep.h for the ARRAY_SIZE macro.

---
 tests/test-bitops.c | 1 +
 1 file changed, 1 insertion(+)
tests/test-bitops.c +1 -0
index 8238eb5..47b5d3e 100644
@@ -8,6 +8,7 @@
 
 #include <glib.h>
 #include <stdint.h>
+#include "qemu/osdep.h"
 #include "qemu/bitops.h"
 
 typedef struct {
Signature · 1 line
1.9.3
#2 lore raw

PATCH 2/3 bitops.h: Don't include qemu-common.h

In reply to Eduardo Habkost

This removes the following circular dependency:

bitops.h -> qemu-common.h -> target-i386/cpu.h -> target-i386/cpu-qom.h -> qom/cpu.h -> qdev-core.h -> bitmap.h -> bitops.h.

---
 include/qemu/bitops.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/qemu/bitops.h +3 -1
index 7e2d5c9..181bd46 100644
@@ -12,7 +12,9 @@
 #ifndef BITOPS_H
 #define BITOPS_H
 
-#include "qemu-common.h"
+#include <stdint.h>
+#include <assert.h>
+
 #include "host-utils.h"
 
 #define BITS_PER_BYTE           CHAR_BIT
Signature · 1 line
1.9.3
#3 lore raw

PATCH 3/3 bitmap.h: Don't include qemu-common.h

In reply to Eduardo Habkost

This will avoid unexpected circular header dependencies in the future.

---
 include/qemu/bitmap.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/qemu/bitmap.h +4 -1
index 1babd5d..8c50d70 100644
@@ -12,7 +12,10 @@
 #ifndef BITMAP_H
 #define BITMAP_H
 
-#include "qemu-common.h"
+#include <glib.h>
+#include <string.h>
+
+#include "qemu/osdep.h"
 #include "qemu/bitops.h"
 
 /*
Signature · 1 line
1.9.3
#4 lore raw
In reply to Eduardo Habkost
Quoted 7 lines · Eduardo Habkost

This series adds a missing include, kills a circular header dependency, and avoid including qemu-common.h from a header to avoid new circular dependencies.

Eduardo Habkost (3):
tests: Add missing include to test-bitops.c
bitops.h: Don't include qemu-common.h
bitmap.h: Don't include qemu-common.h

Applied all 3 to -trivial, _finally_ :)

Thank you!

/mjt

#5 lore raw
Quoted 10 lines · Michael Tokarev
Quoted 7 lines · Eduardo Habkost

This series adds a missing include, kills a circular header dependency, and avoid including qemu-common.h from a header to avoid new circular dependencies.

Eduardo Habkost (3):
tests: Add missing include to test-bitops.c
bitops.h: Don't include qemu-common.h
bitmap.h: Don't include qemu-common.h

Applied all 3 to -trivial, _finally_ :)

Thanks!

But applying the series after commit be4d57c1ea7f17b9cadb0150b330efd9b6026972 breaks build, because now bitmap.h needs stdlib.h (for abort()). Can you squash the following into patch 3/3?

---
 include/qemu/bitmap.h | 1 +
 1 file changed, 1 insertion(+)
include/qemu/bitmap.h +1 -0
index 955627f..f0273c9 100644
@@ -14,6 +14,7 @@
 
 #include <glib.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include "qemu/osdep.h"
 #include "qemu/bitops.h"
Signature · 1 line
1.9.3
#6 lore raw
Quoted 10 lines · Eduardo Habkost
Quoted 9 lines · Michael Tokarev
Quoted 7 lines · Eduardo Habkost

This series adds a missing include, kills a circular header dependency, and avoid including qemu-common.h from a header to avoid new circular dependencies.

Eduardo Habkost (3):
tests: Add missing include to test-bitops.c
bitops.h: Don't include qemu-common.h
bitmap.h: Don't include qemu-common.h

Quoted 7 lines
Quoted 1 line

Applied all 3 to -trivial, _finally_ :)

Thanks!

But applying the series after commit be4d57c1ea7f17b9cadb0150b330efd9b6026972 breaks build, because now bitmap.h needs stdlib.h (for abort()). Can you squash the following into patch 3/3?

Heh. I already fixed it in local git, -- it become obvious right when I tried to verify the whole lot, -- I usually perform build tests after applying all patches, not after each of them (actually maybe this is not good, because this way I can't catch "intermediate" breakage which breaks git bisection).

Yes, squashed it in. Thank you!

/mjt

Quoted 17 lines
---
 include/qemu/bitmap.h | 1 +
 1 file changed, 1 insertion(+)
include/qemu/bitmap.h +1 -0
index 955627f..f0273c9 100644
@@ -14,6 +14,7 @@
 
 #include <glib.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include "qemu/osdep.h"
 #include "qemu/bitops.h"