disas: avoid including everything in headers compiled from C++
PATCH 1/1 disas: avoid including everything in headers compiled from C++
disas/arm-a64.cc is careful to include only the bare minimum that it needs---qemu/osdep.h and disas/bfd.h. Unfortunately, disas/bfd.h then includes qemu-common.h, which brings in qemu/option.h and from there we get the kitchen sink.
This causes problems because for example QEMU's atomic macros conflict with C++ atomic types. But really all that bfd.h needs is the fprintf_function typedef, so replace the inclusion of qemu-common.h with qemu/fprintf-fn.h.
--- include/disas/bfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/disas/bfd.h +1 -1
@@ -9,7 +9,7 @@#ifndef DIS_ASM_H #define DIS_ASM_H -#include "qemu-common.h" +#include "qemu/fprintf-fn.h" typedef void *PTR ;typedef uint64_t bfd_vma ;
Signature · 1 line
2.7.4
Quoted 24 lines · Paolo Bonzini
disas/arm-a64.cc is careful to include only the bare minimum that it
needs---qemu/osdep.handdisas/bfd.h. Unfortunately,disas/bfd.hthen includesqemu-common.h, which brings inqemu/option.hand from there we get the kitchen sink.This causes problems because for example QEMU's atomic macros conflict with C++ atomic types. But really all that
bfd.hneeds is thefprintf_functiontypedef, so replace the inclusion ofqemu-common.hwithqemu/fprintf-fn.h.Reported-by Sean Bruno <[email protected]>Tested-by Sean Bruno <[email protected]>Cc Peter Maydell <[email protected]>Cc Markus Armbruster <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- include/disas/bfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/disas/bfd.h +0
-0
include/disas/bfd.h line 15
Quoted 8 lines
include/disas/bfd.h +1
-1@@ -9,7 +9,7 @@#ifndef DIS_ASM_H #define DIS_ASM_H -#include "qemu-common.h" +#include "qemu/fprintf-fn.h" typedef void *PTR ;typedef uint64_t bfd_vma ;
I'm sitting on a series that purges qemu-common.h from headers. It makes the same change. I haven't posted it because I want to rebase it onto the "make check-headers" series first. Anyway,