Patchwork poison TARGET_<ARCH> for compile once.

login
register
mail settings
Submitter Isaku Yamahata
Date June 24, 2010, 6:52 a.m.
Message ID <20100624065253.GA4498@valinux.co.jp>
Download mbox | patch
Permalink /patch/56760/
State New
Headers show

Comments

Isaku Yamahata - June 24, 2010, 6:52 a.m.
poison TARGET_<ARCH> for compile once object
to prevent those ifdef from creeping in again.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 Makefile.objs |    9 +++++++++
 poison-arch.h |   25 +++++++++++++++++++++++++
 poison.h      |   16 +---------------
 3 files changed, 35 insertions(+), 15 deletions(-)
 create mode 100644 poison-arch.h

Patch

diff --git a/Makefile.objs b/Makefile.objs
index 53fb68e..3438195 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -265,3 +265,12 @@  os-win32.o: qemu-options.def
 qemu-options.def: $(SRC_PATH)/qemu-options.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
+
+######################################################################
+# poison TARGET_arch to prevent from creeping those defines again.
+
+POISON_CFLAGS = -include poison-arch.h
+$(qobject-obj-y) $(block-obj-y) $(block-nested-y) $(block-obj-y) \
+$(net-obj-y) $(net-nested-y) $(fsdev-nested-y) $(fsdev-obj-y) \
+$(common-obj-y) $(audio-obj-y) $(slirp-obj-y) $(user-obj-y) \
+$(hw-obj-y) $(sound-obj-y) $(libdis-y) vl.o: QEMU_CFLAGS += $(POISON_CFLAGS)
diff --git a/poison-arch.h b/poison-arch.h
new file mode 100644
index 0000000..8143c41
--- /dev/null
+++ b/poison-arch.h
@@ -0,0 +1,25 @@ 
+/* Poison identifiers that should not be used when building
+   target independent device code.  */
+
+#ifndef HW_POISON_ARCH_H
+#define HW_POISON_ARCH_H
+#ifdef __GNUC__
+
+#pragma GCC poison TARGET_I386
+#pragma GCC poison TARGET_X86_64
+#pragma GCC poison TARGET_ALPHA
+#pragma GCC poison TARGET_ARM
+#pragma GCC poison TARGET_CRIS
+#pragma GCC poison TARGET_M68K
+#pragma GCC poison TARGET_MIPS
+#pragma GCC poison TARGET_MIPS64
+#pragma GCC poison TARGET_PPC
+#pragma GCC poison TARGET_PPCEMB
+#pragma GCC poison TARGET_PPC64
+#pragma GCC poison TARGET_ABI32
+#pragma GCC poison TARGET_SH4
+#pragma GCC poison TARGET_SPARC
+#pragma GCC poison TARGET_SPARC64
+
+#endif
+#endif
diff --git a/poison.h b/poison.h
index d7db7f4..f9efae9 100644
--- a/poison.h
+++ b/poison.h
@@ -5,21 +5,7 @@ 
 #define HW_POISON_H
 #ifdef __GNUC__
 
-#pragma GCC poison TARGET_I386
-#pragma GCC poison TARGET_X86_64
-#pragma GCC poison TARGET_ALPHA
-#pragma GCC poison TARGET_ARM
-#pragma GCC poison TARGET_CRIS
-#pragma GCC poison TARGET_M68K
-#pragma GCC poison TARGET_MIPS
-#pragma GCC poison TARGET_MIPS64
-#pragma GCC poison TARGET_PPC
-#pragma GCC poison TARGET_PPCEMB
-#pragma GCC poison TARGET_PPC64
-#pragma GCC poison TARGET_ABI32
-#pragma GCC poison TARGET_SH4
-#pragma GCC poison TARGET_SPARC
-#pragma GCC poison TARGET_SPARC64
+#include "poison-arch.h"
 
 #pragma GCC poison TARGET_WORDS_BIGENDIAN
 #pragma GCC poison BSWAP_NEEDED