From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTCeK-0000Bt-5R for qemu-devel@nongnu.org; Tue, 09 Feb 2016 13:04:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTCeJ-0006IV-5q for qemu-devel@nongnu.org; Tue, 09 Feb 2016 13:04:28 -0500 Received: from mail-vk0-x22d.google.com ([2607:f8b0:400c:c05::22d]:36600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTCeI-0006IM-Vb for qemu-devel@nongnu.org; Tue, 09 Feb 2016 13:04:27 -0500 Received: by mail-vk0-x22d.google.com with SMTP id c3so76067505vkb.3 for ; Tue, 09 Feb 2016 10:04:26 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <56BA1F5B.3050903@redhat.com> References: <1455031511-23684-1-git-send-email-peter.maydell@linaro.org> <56BA0F09.8060302@redhat.com> <56BA0F98.2040300@redhat.com> <56BA1D97.5040705@redhat.com> <56BA1F5B.3050903@redhat.com> From: Peter Maydell Date: Tue, 9 Feb 2016 18:04:06 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH 00/14] More #include cleanups List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Paolo Bonzini , Richard Henderson , QEMU Developers , Patch Tracking On 9 February 2016 at 17:18, Eric Blake wrote: > On 02/09/2016 10:10 AM, Eric Blake wrote: > >> but with the new header order it expands to: >> >> # 1989 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3 >> namespace std >> { >> >> # 1991 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" >> __attribute__ (( always_inline )) __inline__ >> # 1991 "/usr/include/c++/5.3.1/x86_64-redhat-linux/bits/c++config.h" 3 >> namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } >> } >> >> So _something_ in osdep.h is redefining 'inline' with disastrous effects >> to C++. > > This hack seems to fix things; but I'm not enough of a C++ expert to > know if it is the best fix. > > diff --git i/include/qemu/compiler.h w/include/qemu/compiler.h > index d22eb01..d50b806 100644 > --- i/include/qemu/compiler.h > +++ w/include/qemu/compiler.h > @@ -77,6 +77,7 @@ > #define typeof_field(type, field) typeof(((type *)0)->field) > #define type_check(t1,t2) ((t1*)0 - (t2*)0) > > +#ifndef __cplusplus > #ifndef always_inline > #if !((__GNUC__ < 3) || defined(__APPLE__)) > #ifdef __OPTIMIZE__ > @@ -88,6 +89,7 @@ > #undef inline > #define inline always_inline > #endif > +#endif Ah, well tracked down. I guess my system headers don't happen to rely on this bit of inline syntax. Next question -- do we really need to redefine "inline" to always_inline at all, in C or C++? (cc'd a few people who might have an opinion). My instinct is to say "don't do this, just trust the compiler to decide whether to bother inlining". Git blame says this was added back in commit df2542c737ea2 in 2007, with the rationale "To avoid discarded inlining bug"... thanks -- PMM