All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Eric Blake <eblake@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] QEMU_BUILD_BUG_ON: use __COUNTER__
Date: Tue, 31 Jan 2017 16:34:34 +0100	[thread overview]
Message-ID: <87wpdb4511.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA-UPQrgq8h1LbqsUWP-MKwkOBLsAk0R0u0YuSfyA=nQAg@mail.gmail.com> (Peter Maydell's message of "Tue, 31 Jan 2017 15:12:32 +0000")

Peter Maydell <peter.maydell@linaro.org> writes:

> On 31 January 2017 at 15:03, Eric Blake <eblake@redhat.com> wrote:
>> On 01/31/2017 08:43 AM, Michael S. Tsirkin wrote:
>>> Some headers use QEMU_BUILD_BUG_ON. This causes a problem
>>> if the C file including that header happens to have
>>> QEMU_BUILD_BUG_ON at the same line number.
>>>
>>> Fix using a widely available extension: __COUNTER__.
>>
>> gcc 4.3 and later; clang documents it but doesn't say when it was added.
>>
>>> If unavailable, provide a stub.
>>
>> What fails in our build farm if we don't provide the stub? Can we just
>> require that our compiler is new enough to have __COUNTER__, or will
>> that break some of our existing targets?
>
> I think the problem is not so much our build farm (which is
> I think all recent enough to postdate introduction of
> __COUNTER__) but the probability of there being users
> out there who are still using older compilers to build
> QEMU releases. We don't need to enforce compile time
> asserts on those old compilers but given that it's
> trivial to avoid actually breaking the build for them,
> why not provide the do-nothing fallback?

I don't think we actually need __COUNTER__.

If we want it, providing a fallback is nice.  However, the "expand to
nothing" fallback is syntactically unsound.  A sound fallback expands to
the exact same syntactic construct as the real thing does, in this case
a declaration.  When it doesn't, we risk parse errors.

Of course, we may decide to accept that risk.

  parent reply	other threads:[~2017-01-31 15:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31 14:43 [Qemu-devel] [PATCH] QEMU_BUILD_BUG_ON: use __COUNTER__ Michael S. Tsirkin
2017-01-31 15:02 ` Peter Maydell
2017-01-31 15:03 ` Eric Blake
2017-01-31 15:12   ` Peter Maydell
2017-01-31 15:16     ` Eric Blake
2017-01-31 15:26       ` Peter Maydell
2017-01-31 15:28         ` Paolo Bonzini
2017-01-31 16:17           ` Peter Maydell
2017-01-31 15:34     ` Markus Armbruster [this message]
2017-01-31 17:58       ` Michael S. Tsirkin
2017-01-31 15:26 ` Markus Armbruster
2017-01-31 15:29   ` Michael S. Tsirkin
2017-01-31 16:07     ` Markus Armbruster
2017-01-31 16:37       ` Eric Blake
2017-01-31 16:54         ` Peter Maydell
2017-01-31 15:47   ` Peter Maydell
2017-01-31 16:50 ` Daniel P. Berrange
2017-01-31 17:56   ` Michael S. Tsirkin
2017-01-31 18:43   ` Markus Armbruster
2017-01-31 18:58     ` Eric Blake

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=87wpdb4511.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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.