include/disas/dis-asm.h: Handle being included outside 'extern "C"'
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 16 Apr 2021 13:55:43 +0000 (14:55 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 10 May 2021 16:21:54 +0000 (17:21 +0100)
Make dis-asm.h handle being included outside an 'extern "C"' block;
this allows us to remove the 'extern "C"' blocks that our two C++
files that include it are using.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
disas/arm-a64.cc
disas/nanomips.cpp
include/disas/dis-asm.h

index 27613d4b256897a488a5fe88308d586914fc0235..a1402a2e0715db94c6c2fa1bc3de59edb1af5723 100644 (file)
@@ -18,9 +18,7 @@
  */
 
 #include "qemu/osdep.h"
-extern "C" {
 #include "disas/dis-asm.h"
-}
 
 #include "vixl/a64/disasm-a64.h"
 
index 8ddef897f0dec6c0aa18e8903880f7469a802739..9be8df75dd60025ba616ef81b378a9329a75c01b 100644 (file)
@@ -28,9 +28,7 @@
  */
 
 #include "qemu/osdep.h"
-extern "C" {
 #include "disas/dis-asm.h"
-}
 
 #include <cstring>
 #include <stdexcept>
index 13fa1edd411eacfbff9caa47d88a8a12742d8a23..4701445e8069f10455f739e6697853bc8a379d52 100644 (file)
@@ -9,6 +9,12 @@
 #ifndef DISAS_DIS_ASM_H
 #define DISAS_DIS_ASM_H
 
+#include "qemu/bswap.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef void *PTR;
 typedef uint64_t bfd_vma;
 typedef int64_t bfd_signed_vma;
@@ -479,8 +485,6 @@ bool cap_disas_plugin(disassemble_info *info, uint64_t pc, size_t size);
 
 /* from libbfd */
 
-#include "qemu/bswap.h"
-
 static inline bfd_vma bfd_getl64(const bfd_byte *addr)
 {
     return ldq_le_p(addr);
@@ -508,4 +512,8 @@ static inline bfd_vma bfd_getb16(const bfd_byte *addr)
 
 typedef bool bfd_boolean;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* DISAS_DIS_ASM_H */