qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"


From: Xuebing wang
Subject: Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
Date: Tue, 04 Mar 2014 20:02:09 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0


diff --git a/include/disas/disas.h b/include/disas/disas.h
index c13ca9a..e5cdfd7 100644
--- a/include/disas/disas.h
+++ b/include/disas/disas.h
@@ -1,9 +1,9 @@
 #ifndef _QEMU_DISAS_H
 #define _QEMU_DISAS_H

-#include "qemu-common.h"
-
 #ifdef NEED_CPU_H
+#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong,
+                    CPUArchState */
 /* Disassemble this for me please... (debugging). */
 void disas(FILE *out, void *code, unsigned long size);
 void target_disas(FILE *out, CPUArchState *env, target_ulong code,
@@ -14,7 +14,7 @@ void monitor_disas(Monitor *mon, CPUArchState *env,

 /* Look up symbol for debugging purpose.  Returns "" if unknown. */
 const char *lookup_symbol(target_ulong orig_addr);
-#endif
+#endif /* NEED_CPU_H */

Perhaps the file that includes disas/disas.h can instead include cpu.h too? Most of them already do:

$ git grep -L include.*cpu.h $(git grep -l disas/disas.h)
bsd-user/elfload.c
hw/core/loader.c
linux-user/elfload.c
vl.c

Of these, vl.c and linux-user/elfload.c should not include disas/disas.h at all, and hw/core/loader.c is !NEED_CPU_H. So there are just two files where you can add a #include "cpu.h" manually.


My idea is to keep disas/disas.h correct just by itself, regardless how it's used by *.c files.

I have almost zero knowledge about static code analyzer, I am not sure whether disas.h can pass it without
including "cpu.h"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]