All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>
Subject: [PATCH for-6.0? 6/6] include/disas/dis-asm.h: Handle being included outside 'extern "C"'
Date: Fri, 16 Apr 2021 14:55:43 +0100	[thread overview]
Message-ID: <20210416135543.20382-7-peter.maydell@linaro.org> (raw)
In-Reply-To: <20210416135543.20382-1-peter.maydell@linaro.org>

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>
---
 include/disas/dis-asm.h | 12 ++++++++++--
 disas/arm-a64.cc        |  2 --
 disas/nanomips.cpp      |  2 --
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h
index 13fa1edd411..4701445e806 100644
--- a/include/disas/dis-asm.h
+++ b/include/disas/dis-asm.h
@@ -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 */
diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
index 27613d4b256..a1402a2e071 100644
--- a/disas/arm-a64.cc
+++ b/disas/arm-a64.cc
@@ -18,9 +18,7 @@
  */
 
 #include "qemu/osdep.h"
-extern "C" {
 #include "disas/dis-asm.h"
-}
 
 #include "vixl/a64/disasm-a64.h"
 
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 8ddef897f0d..9be8df75dd6 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -28,9 +28,7 @@
  */
 
 #include "qemu/osdep.h"
-extern "C" {
 #include "disas/dis-asm.h"
-}
 
 #include <cstring>
 #include <stdexcept>
-- 
2.20.1



  parent reply	other threads:[~2021-04-16 13:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16 13:55 [PATCH for-6.0? 0/6] extern "C" overhaul for C++ files Peter Maydell
2021-04-16 13:55 ` [PATCH for-6.0? 1/6] osdep: include glib-compat.h before other QEMU headers Peter Maydell
2021-04-16 17:16   ` Richard Henderson
2021-04-16 13:55 ` [PATCH for-6.0? 2/6] osdep: protect qemu/osdep.h with extern "C" Peter Maydell
2021-04-16 17:17   ` Richard Henderson
2021-04-16 13:55 ` [PATCH for-6.0? 3/6] include/qemu/osdep.h: Move system includes to top Peter Maydell
2021-04-16 17:17   ` Richard Henderson
2021-04-16 13:55 ` [PATCH for-6.0? 4/6] osdep: Make os-win32.h and os-posix.h handle 'extern "C"' themselves Peter Maydell
2021-04-16 16:25   ` Paolo Bonzini
2021-04-16 16:25     ` Peter Maydell
2021-04-16 17:17   ` Richard Henderson
2021-04-16 13:55 ` [PATCH for-6.0? 5/6] include/qemu/bswap.h: Handle being included outside extern "C" block Peter Maydell
2021-04-16 17:18   ` Richard Henderson
2021-04-16 13:55 ` Peter Maydell [this message]
2021-04-16 17:18   ` [PATCH for-6.0? 6/6] include/disas/dis-asm.h: Handle being included outside 'extern "C"' Richard Henderson
2021-04-16 14:03 ` [PATCH for-6.0? 0/6] extern "C" overhaul for C++ files no-reply
2021-04-16 14:56 ` Philippe Mathieu-Daudé
2021-04-16 16:28 ` Paolo Bonzini
2021-04-16 17:07   ` Peter Maydell
2021-04-16 18:31     ` Paolo Bonzini
2021-05-04 10:43 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210416135543.20382-7-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.