[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH] qemu: include generated files with <> and not ""
- To: Daniel P. Berrangé <berrange@xxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>
- From: Max Reitz <mreitz@xxxxxxxxxx>
- Date: Tue, 20 Mar 2018 14:54:37 +0100
- Cc: Peter Maydell <peter.maydell@xxxxxxxxxx>, Dmitry Fleytman <dmitry.fleytman@xxxxxxxxx>, sheepdog@xxxxxxxxxxxxxx, Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>, Li Zhijian <lizhijian@xxxxxxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Jeff Cody <jcody@xxxxxxxxxx>, Zhang Chen <zhangckid@xxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, qemu-devel@xxxxxxxxxx, "Richard W.M. Jones" <rjones@xxxxxxxxxx>, Keith Busch <keith.busch@xxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Jiri Pirko <jiri@xxxxxxxxxxx>, Eric Blake <eblake@xxxxxxxxxx>, Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, Josh Durgin <jdurgin@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Alberto Garcia <berto@xxxxxxxxxx>, zhanghailiang <zhang.zhanghailiang@xxxxxxxxxx>, Ben Warren <ben@xxxxxxxxxxxxxxxxxx>, Marcel Apfelbaum <marcel@xxxxxxxxxx>, Yongbok Kim <yongbok.kim@xxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, Hervé Poussineau <hpoussin@xxxxxxxxxxx>, Shannon Zhao <zhaoshenglong@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Liu Yuan <namei.unix@xxxxxxxxx>, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>, Andrzej Zaborowski <balrogg@xxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, Thomas Huth <thuth@xxxxxxxxxx>, Riku Voipio <riku.voipio@xxxxxx>, Fam Zheng <famz@xxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, Corey Minyard <minyard@xxxxxxx>, Amit Shah <amit@xxxxxxxxxx>, Pavel Dovgalyuk <pavel.dovgaluk@xxxxxxxxx>, Stefan Weil <sw@xxxxxxxxxxx>, Xie Changlong <xiechanglong.d@xxxxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, Peter Lieven <pl@xxxxxxx>, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, Fabien Chouteau <chouteau@xxxxxxxxxxx>, Greg Kurz <groug@xxxxxxxx>, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, qemu-arm@xxxxxxxxxx, Peter Chubb <peter.chubb@xxxxxxxxxxxx>, Yuval Shaia <yuval.shaia@xxxxxxxxxx>, Stefan Hajnoczi <stefanha@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, BALATON Zoltan <balaton@xxxxxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxx>, Kevin Wolf <kwolf@xxxxxxxxxx>, Alexander Graf <agraf@xxxxxxx>, qemu-block@xxxxxxxxxx, Peter Crosthwaite <crosthwaite.peter@xxxxxxxxx>, Hitoshi Mitake <mitake.hitoshi@xxxxxxxxxxxxx>, Wen Congyang <wencongyang2@xxxxxxxxxx>, qemu-s390x@xxxxxxxxxx, Cornelia Huck <cohuck@xxxxxxxxxx>, Laurent Vivier <laurent@xxxxxxxxx>, Juan Quintela <quintela@xxxxxxxxxx>, Subbaraya Sundeep <sundeep.lkml@xxxxxxxxx>, Michael Walle <michael@xxxxxxxx>, qemu-ppc@xxxxxxxxxx, Andreas Färber <afaerber@xxxxxxx>, Igor Mammedov <imammedo@xxxxxxxxxx>, Hannes Reinecke <hare@xxxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>, Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- Delivery-date: Tue, 20 Mar 2018 13:57:43 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2018-03-20 14:41, Daniel P. Berrangé wrote:
> On Tue, Mar 20, 2018 at 02:32:16PM +0100, Gerd Hoffmann wrote:
>> Hi,
>>
>>>> So for these, we should use "". None of these are generated files though.
>>>
>>> That leads to crazy inconsistent message for developers where 50% of QEMU
>>> header files must use <> and the other 50% of header files must use "".
>>
>> The rules are pretty simple though:
>>
>> (1) Headers which are generated use <>.
>> (2) Headers which are in include/ use <>.
>> (3) Headers sitting in the same directory as the source files use "".
>
> We have 1200 header files in QEMU - a developer might just reasonably remember
> which header file is a QEMU header, vs which is a 3rd party system header.
> Expecting devs to remember which of those 3 buckets each QEMU header falls
> under is unreasonable IMHO.
I agree with this in principle, but I don't find it unreasonable for
someone to look up whether a header file exists in the same directory.
I find that much simpler than to look up whether it is a system header,
actually.
And I have to agree with Michael that his rule when to use "" (if the
file is in the same directory) and when to use <> (otherwise) is
actually what every C developer might do by instinct. (I guess it's
also easier to check in a script than the original guideline?)
However, I also think that if any problem arises because "" was used for
a generated file and that then uses a stale file, the bug is somewhere
else. And I think that while Michael's proposal is the more intuitive
(C) way, it is a tiny bit more complicated to explain than 'Use "" for
qemu headers, <> for everything else'.
But I guess the main advantage with using this rule I see is that it's
better for people reading the code. It's just nice to know whether a
file belongs to qemu or not by just looking at the #include statement.
(Note that this implies that it is indeed more difficult to determine
whether a header belongs to qemu than whether it sits in the same
directory as the C file, though!) So I think the old (current) rule is
better for reading code, Michael's rule would be better for writing
code. I think reading code is what should be easier.
But since that may be eaten up by build breakages due to stale files, I
don't have a strong opinion either way. I just wanted to chime in
because in my opinion 'Use "" for headers in the same directory, <> for
everything else' is by no means an unreasonably complicated rule for
people writing code.
Max
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|