From: Eric Blake <eblake@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
QEMU Developers <qemu-devel@nongnu.org>,
Patch Tracking <patches@linaro.org>
Subject: Re: [Qemu-devel] [PATCH 00/14] More #include cleanups
Date: Tue, 9 Feb 2016 11:29:31 -0700 [thread overview]
Message-ID: <56BA300B.3060504@redhat.com> (raw)
In-Reply-To: <CAFEAcA_QaToz0COae9PhjnYz+GeUsx93MO4fhCYDHY1EjAazeQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1833 bytes --]
On 02/09/2016 11:04 AM, Peter Maydell wrote:
>>> 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".
If ripping that chunk out doesn't hurt anything, I'm all in favor of it.
Redefining 'inline' tends to hurt more than it prevents (and while there
IS the case of C89 vs. C99 vs. GNU having different semantics for
'static inline', those are best worked around by writing and
consistently using wrapper macros such as 'STATIC_INLINE', not
redefining 'inline' itself).
>
> Git blame says this was added back in commit df2542c737ea2 in
> 2007, with the rationale "To avoid discarded inlining bug"...
The date alone says it may be time to quit doing it :)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-02-09 18:29 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 15:24 [Qemu-devel] [PATCH 00/14] More #include cleanups Peter Maydell
2016-02-09 15:24 ` [Qemu-devel] [PATCH 01/14] cpu: Clean up includes Peter Maydell
2016-02-12 14:49 ` Andreas Färber
2016-02-09 15:24 ` [Qemu-devel] [PATCH 02/14] ui/cocoa.m: Include qemu/osdep.h Peter Maydell
2016-02-09 16:07 ` Eric Blake
2016-02-09 16:08 ` Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 03/14] disas/arm-a64.cc: Include osdep.h first Peter Maydell
2016-02-18 15:49 ` Peter Maydell
2016-02-18 16:41 ` Markus Armbruster
2016-02-18 16:42 ` Peter Maydell
2016-02-18 17:15 ` Eric Blake
2016-02-09 15:25 ` [Qemu-devel] [PATCH 04/14] hw/block/nand.c: " Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 05/14] target-cris: Remove unnecessary ifdef from mmu.c Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 06/14] cris: Clean up includes Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 07/14] libdecnumber: " Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 08/14] tests/i440fx-test: Don't define ARRAY_SIZE locally Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 09/14] tests: Clean up includes Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 10/14] qapi: Clean up includes in generated files Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 11/14] scripts/feature_to_c.sh: Include qemu/osdep.h rather than config.h Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 12/14] scripts/tracetool: Include qemu/osdep.h in generated .c files Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 13/14] all: Clean up includes Peter Maydell
2016-02-09 15:25 ` [Qemu-devel] [PATCH 14/14] oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h Peter Maydell
2016-02-09 16:08 ` [Qemu-devel] [PATCH 00/14] More #include cleanups Eric Blake
2016-02-09 16:11 ` Eric Blake
2016-02-09 16:21 ` Peter Maydell
2016-02-09 17:01 ` Peter Maydell
2016-02-09 17:10 ` Eric Blake
2016-02-09 17:18 ` Eric Blake
2016-02-09 18:04 ` Peter Maydell
2016-02-09 18:17 ` Paolo Bonzini
2016-02-09 18:29 ` Eric Blake [this message]
2016-02-16 13:49 ` Peter Maydell
2016-02-16 15:47 ` 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=56BA300B.3060504@redhat.com \
--to=eblake@redhat.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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.