Skip to contentSkip to conversation

Compile fix

Qemu-devel Falk Hueffner 1 participant 1 message Jun 15, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

string concatenation within #include arguments is not legal. So something like the attached patch is needed.

Looking forward to playing with the new ARM support :)

Signature · 1 line
	Falk

Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.14

configure +2 -2
diff -u -p -r1.14 configure
@@ -268,11 +268,11 @@ fi
 
 if test "$target_cpu" = "x86" ; then
   echo "TARGET_ARCH=i386" >> config.mak
-  echo "#define TARGET_ARCH \"i386\"" >> $TMPH
+  echo "#define TARGET_ARCH i386" >> $TMPH
   echo "#define TARGET_I386 1" >> $TMPH
 elif test "$target_cpu" = "arm" ; then
   echo "TARGET_ARCH=arm" >> config.mak
-  echo "#define TARGET_ARCH \"arm\"" >> $TMPH
+  echo "#define TARGET_ARCH arm" >> $TMPH
   echo "#define TARGET_ARM 1" >> $TMPH
 else
   echo "Unsupported target CPU"

Index: main.c
===================================================================
RCS file: /cvsroot/qemu/qemu/main.c,v
retrieving revision 1.30

main.c +1 -1
diff -u -p -r1.30 main.c
@@ -308,7 +308,7 @@ void usage(void)
            "debug options:\n"
            "-d           activate log (logfile=%s)\n"
            "-p pagesize  set the host page size to 'pagesize'\n",
-           TARGET_ARCH,
+           STR(TARGET_ARCH),
            interp_prefix, 
            x86_stack_size,
            DEBUG_LOGFILE);

Index: qemu.h
===================================================================
RCS file: /cvsroot/qemu/qemu/qemu.h,v
retrieving revision 1.16

qemu.h +6 -2
diff -u -p -r1.16 qemu.h
@@ -2,12 +2,16 @@
 #define GEMU_H
 
 #include "thunk.h"
+#include "config.h"
 
 #include <signal.h>
 #include "syscall_defs.h"
 
-#include "cpu-" TARGET_ARCH ".h"
-#include "syscall-" TARGET_ARCH ".h"
+#define STR(x) #x
+#define XSTR(x) STR(x)
+
+#include XSTR(cpu-TARGET_ARCH.h)
+#include XSTR(syscall-TARGET_ARCH.h)
 
 /* This struct is used to hold certain information about the image.
  * Basically, it replicates in user space what would be certain

Index: translate.c
===================================================================
RCS file: /cvsroot/qemu/qemu/translate.c,v
retrieving revision 1.2

translate.c +9 -6
diff -u -p -r1.2 translate.c
@@ -23,21 +23,24 @@
 #include <string.h>
 #include <inttypes.h>
 
+#define STR(x) #x
+#define XSTR(x) STR(x)
+
 #include "config.h"
 #define IN_OP_I386
-#include "cpu-" TARGET_ARCH ".h"
+#include XSTR(cpu-TARGET_ARCH.h)
 #include "exec.h"
 #include "disas.h"
 
 enum {
 #define DEF(s, n, copy_size) INDEX_op_ ## s,
-#include "opc-" TARGET_ARCH ".h"
+#include XSTR(opc-TARGET_ARCH.h)
 #undef DEF
     NB_OPS,
 };
 
 #include "dyngen.h"
-#include "op-" TARGET_ARCH ".h"
+#include XSTR(op-TARGET_ARCH.h)
 
 uint16_t gen_opc_buf[OPC_BUF_SIZE];
 uint32_t gen_opparam_buf[OPPARAM_BUF_SIZE];
@@ -48,13 +51,13 @@ uint8_t gen_opc_instr_start[OPC_BUF_SIZE
 #ifdef DEBUG_DISAS
 static const char *op_str[] = {
 #define DEF(s, n, copy_size) #s,
-#include "opc-" TARGET_ARCH ".h"
+#include XSTR(opc-TARGET_ARCH.h)
 #undef DEF
 };
 
 static uint8_t op_nb_args[] = {
 #define DEF(s, n, copy_size) n,
-#include "opc-" TARGET_ARCH ".h"
+#include XSTR(opc-TARGET_ARCH.h)
 #undef DEF
 };
 
@@ -123,7 +126,7 @@ int cpu_gen_code(TranslationBlock *tb,
 
 static const unsigned short opc_copy_size[] = {
 #define DEF(s, n, copy_size) copy_size,
-#include "opc-" TARGET_ARCH ".h"
+#include XSTR(opc-TARGET_ARCH.h)
 #undef DEF
 };