From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0n3g-0002Cy-0T for qemu-devel@nongnu.org; Wed, 08 Jan 2014 01:56:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0n3b-0004Z9-2z for qemu-devel@nongnu.org; Wed, 08 Jan 2014 01:56:07 -0500 Received: from [2a03:4000:1::4e2f:c7ac:d] (port=38435 helo=v220110690675601.yourvserver.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0n3a-0004Z1-S9 for qemu-devel@nongnu.org; Wed, 08 Jan 2014 01:56:03 -0500 Message-ID: <52CCF675.6090504@weilnetz.de> Date: Wed, 08 Jan 2014 07:55:49 +0100 From: Stefan Weil MIME-Version: 1.0 References: <1389113488-18005-1-git-send-email-peter.maydell@linaro.org> <52CC8006.9030305@weilnetz.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/4] disas: add libvixl to support A64 disassembly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Patch Tracking , Alexander Graf , QEMU Developers , Blue Swirl , Claudio Fontana , Aurelien Jarno , Anthony Liguori , =?UTF-8?B?QWxleCBCZW5uw6ll?= , "kvmarm@lists.cs.columbia.edu" , Christoffer Dall , Richard Henderson Am 08.01.2014 00:00, schrieb Peter Maydell: > On 7 January 2014 22:30, Stefan Weil wrote: > >> I'd prefer one file disas/aarch64.cc instead of these two files: >> >> disas/aarch64-cxx.cc | 80 >> +++++++++++++++++++++++++++++++++++++++++++ >> disas/aarch64.c | 39 +++++++++++++++++++++ >> >> This would also allow removing the extern statement in the C++ code (and >> use a local function). > See the comment in aarch64-cxx.cc -- to do that we'd need to > make sure bfd.h was valid for C++ as well as C compilation. This > came up when Andreas reviewed the RFC and that was Claudio's > explanation for the split, which is why I added the comment. > > Claudio -- do you recall what the exact issue here is? > > Specifically, I think the problem is that if we put print_insn_aarch64() > in the C++ file then we need to have its prototype in bfd.h guarded > with "extern C {}" if (and only if) we're compiling a C++ file. If > you care about restricting the C++-isms to the C++ files that's > a bit ugly. But we could do that if people prefer. > > Some experimentation suggests it would also be possible to > just do > > extern "C" { > #include "disas/bfd.h" > } > > in the C++ file. If that doesn't have any hidden gotchas I don't > know about it looks like the nicest solution. > Adding the extern "C" to include/disas/bfd.h would be even better. It might be possible to use the glib macros G_BEGIN_DECLS and G_END_DECLSor __BEGIN_DECLS and __END_DECLS from the C library for this purpose. Stefan