From: Laszlo Ersek <lersek@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Chris Wulff" <crwulff@gmail.com>,
"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
"David Hildenbrand" <david@redhat.com>,
"James Hogan" <jhogan@kernel.org>,
"Anthony Green" <green@moxielogic.com>,
"Palmer Dabbelt" <palmer@sifive.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, "Max Filippov" <jcmvbkbc@gmail.com>,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
"Alistair Francis" <Alistair.Francis@wdc.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Guan Xuetao" <gxt@mprc.pku.edu.cn>,
"Marek Vasut" <marex@denx.de>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Aleksandar Rikalo" <arikalo@wavecomp.com>,
"Helge Deller" <deller@gmx.de>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Anthony Perard" <anthony.perard@citrix.com>,
"Richard Henderson" <rth@twiddle.net>,
"Jason Wang" <jasowang@redhat.com>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Riku Voipio" <riku.voipio@iki.fi>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Greg Kurz" <groug@kaod.org>,
"Marcelo Tosatti" <mtosatti@redhat.com>,
"Beniamino Galvani" <b.galvani@gmail.com>,
"Eric Auger" <eric.auger@redhat.com>,
"Paul Durrant" <paul.durrant@citrix.com>,
"Stafford Horne" <shorne@gmail.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Claudio Fontana" <claudio.fontana@gmail.com>,
"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
"Cornelia Huck" <cohuck@redhat.com>,
"Claudio Fontana" <claudio.fontana@huawei.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Michael Walle" <michael@walle.cc>,
"Aleksandar Markovic" <amarkovic@wavecomp.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [Qemu-devel] Headers without multiple inclusion guards
Date: Wed, 5 Jun 2019 19:03:31 +0200 [thread overview]
Message-ID: <d4ca9944-e69e-3114-a924-4a416a0ea6e4@redhat.com> (raw)
In-Reply-To: <20190605162348.GN8956@redhat.com>
On 06/05/19 18:23, Daniel P. Berrangé wrote:
> On Wed, Jun 05, 2019 at 06:18:38PM +0200, Laszlo Ersek wrote:
>> On 06/05/19 16:23, Daniel P. Berrangé wrote:
>>> On Tue, May 28, 2019 at 08:12:24PM +0200, Markus Armbruster wrote:
>>>> We have a bunch of headers without multiple inclusion guards. Some are
>>>> clearly intentional, some look accidental. Too many for me to find out
>>>> by examining each of them, so I'm asking their maintainers.
>>>>
>>>> Why do I ask? I'd like to mark the intentional ones and fix the
>>>> accidental ones, so they don't flunk "make check-headers" from "[RFC v4
>>>> 0/7] Baby steps towards saner headers" just because they lack multiple
>>>> inclusion guards.
>>>>
>>>> Just in case: what's a multiple inclusion guard? It's
>>>>
>>>> #ifndef UNIQUE_GUARD_SYMBOL_H
>>>> #define UNIQUE_GUARD_SYMBOL_H
>>>> ...
>>>> #endif
>>>>
>>>> with nothing but comments outside the conditional, so that the header
>>>> can safely be included more than once.
>>>
>>> Any opinions on using the less verbose syntax instead:
>>>
>>> #pragma once
>>>
>>> It is not portable C, but we explicitly only care about GCC or CLang,
>>> so portability isn't an issue for us.
>>
>> I don't feel strongly about this particular question, so if folks prefer
>> "#pragma once", I won't complain. I'd just like to report that section 6
>> of "HACKING" appears the opposite of "we explicitly only care about GCC
>> or CLang".
>
> Heh, yeah that doc does require some updating, as we certainly don't
> require conformance to the vanilla C standard any more. We now explicitly
> request "-std=gnu99" as the conformance level which allows many GNU
> extensions to the standard.
>
> commit 7be41675f7cb16be7c8d2554add7a63fa43781a8
> Author: Thomas Huth <thuth@redhat.com>
> Date: Mon Jan 7 11:25:22 2019 +0100
>
> configure: Force the C standard to gnu99
>
> Different versions of GCC and Clang use different versions of the C standard.
> This repeatedly caused problems already, e.g. with duplicated typedefs:
>
> https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg05829.html
>
> or with for-loop variable initializers:
>
> https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg00237.html
>
> To avoid these problems, we should enforce the C language version to the
> same level for all compilers. Since our minimum compiler versions is
> GCC v4.8, our best option is "gnu99" for C code right now ("gnu17" is not
> available there yet, and "gnu11" is marked as "experimental"), and "gnu++98"
> for the few C++ code that we have in the repository.
TIL :)
Thanks!
Laszlo
> The HACKING docs predate this commit, and when reviewing, we failed to
> notice we needed to update HACKING to match our new policy.
>
> Regards,
> Daniel
>
next prev parent reply other threads:[~2019-06-05 17:05 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 18:12 [Qemu-devel] Headers without multiple inclusion guards Markus Armbruster
2019-05-28 18:32 ` Peter Maydell
2019-05-29 12:47 ` Markus Armbruster
2019-05-30 10:14 ` Peter Maydell
2019-05-28 19:23 ` Eduardo Habkost
2019-05-29 8:21 ` Paul Durrant
2019-05-29 12:49 ` Markus Armbruster
2019-05-28 19:55 ` Max Filippov
2019-05-29 12:51 ` Markus Armbruster
2019-05-29 13:20 ` Philippe Mathieu-Daudé
2019-05-28 20:08 ` Richard Henderson
2019-05-28 22:14 ` BALATON Zoltan
2019-05-29 1:47 ` David Gibson
2019-05-29 6:30 ` Laurent Vivier
2019-05-29 8:25 ` Bastian Koppelmann
2019-05-29 9:01 ` Cornelia Huck
2019-05-29 9:19 ` Greg Kurz
2019-05-29 9:38 ` Alex Bennée
2019-05-29 9:58 ` Anthony PERARD
2019-05-29 12:55 ` Markus Armbruster
2019-05-29 10:05 ` David Hildenbrand
2019-05-29 13:22 ` Philippe Mathieu-Daudé
2019-05-29 14:10 ` Markus Armbruster
2019-06-03 10:57 ` Laszlo Ersek
2019-06-02 7:06 ` Dmitry Fleytman
2019-06-03 10:55 ` Laszlo Ersek
2019-06-03 12:59 ` Markus Armbruster
2019-06-03 14:24 ` Philippe Mathieu-Daudé
2019-06-03 16:23 ` Laszlo Ersek
2019-06-05 14:23 ` Daniel P. Berrangé
2019-06-05 16:18 ` Laszlo Ersek
2019-06-05 16:23 ` Daniel P. Berrangé
2019-06-05 17:03 ` Laszlo Ersek [this message]
2019-06-05 17:52 ` Markus Armbruster
2019-06-07 17:32 ` Daniel P. Berrangé
2019-06-05 20:49 ` Alistair Francis
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=d4ca9944-e69e-3114-a924-4a416a0ea6e4@redhat.com \
--to=lersek@redhat.com \
--cc=Alistair.Francis@wdc.com \
--cc=Andrew.Baumann@microsoft.com \
--cc=alex.bennee@linaro.org \
--cc=alistair@alistair23.me \
--cc=amarkovic@wavecomp.com \
--cc=anthony.perard@citrix.com \
--cc=arikalo@wavecomp.com \
--cc=armbru@redhat.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=b.galvani@gmail.com \
--cc=berrange@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=claudio.fontana@gmail.com \
--cc=claudio.fontana@huawei.com \
--cc=cohuck@redhat.com \
--cc=crwulff@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=deller@gmx.de \
--cc=dmitry.fleytman@gmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=eric.auger@redhat.com \
--cc=f4bug@amsat.org \
--cc=green@moxielogic.com \
--cc=groug@kaod.org \
--cc=gxt@mprc.pku.edu.cn \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=jhogan@kernel.org \
--cc=kbastian@mail.uni-paderborn.de \
--cc=kraxel@redhat.com \
--cc=laurent@vivier.eu \
--cc=lvivier@redhat.com \
--cc=marex@denx.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=michael@walle.cc \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=palmer@sifive.com \
--cc=pasic@linux.ibm.com \
--cc=paul.durrant@citrix.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=rth@twiddle.net \
--cc=sagark@eecs.berkeley.edu \
--cc=shorne@gmail.com \
--cc=sstabellini@kernel.org \
--cc=thuth@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).