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