[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [Qemu-devel] [PATCH] qemu: include generated files with <> and not ""
- To: "Michael S. Tsirkin" <mst@xxxxxxxxxx>, qemu-devel@xxxxxxxxxx
- From: Stefan Weil <sw@xxxxxxxxxxx>
- Date: Tue, 20 Mar 2018 17:33:42 +0100
- Cc: Peter Maydell <peter.maydell@xxxxxxxxxx>, Dmitry Fleytman <dmitry.fleytman@xxxxxxxxx>, sheepdog@xxxxxxxxxxxxxx, Pavel Dovgalyuk <pavel.dovgaluk@xxxxxxxxx>, Li Zhijian <lizhijian@xxxxxxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Jeff Cody <jcody@xxxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, Alexander Graf <agraf@xxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Keith Busch <keith.busch@xxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Hannes Reinecke <hare@xxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Max Reitz <mreitz@xxxxxxxxxx>, Yongbok Kim <yongbok.kim@xxxxxxxx>, Josh Durgin <jdurgin@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Alberto Garcia <berto@xxxxxxxxxx>, zhanghailiang <zhang.zhanghailiang@xxxxxxxxxx>, Ben Warren <ben@xxxxxxxxxxxxxxxxxx>, Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>, Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>, Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>, "Richard W.M. Jones" <rjones@xxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxx>, Hervé Poussineau <hpoussin@xxxxxxxxxxx>, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>, Shannon Zhao <zhaoshenglong@xxxxxxxxxx>, Marcel Apfelbaum <marcel@xxxxxxxxxx>, Liu Yuan <namei.unix@xxxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, Jiri Pirko <jiri@xxxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, Corey Minyard <minyard@xxxxxxx>, Amit Shah <amit@xxxxxxxxxx>, Xie Changlong <xiechanglong.d@xxxxxxxxx>, Riku Voipio <riku.voipio@xxxxxx>, Peter Lieven <pl@xxxxxxx>, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, Fabien Chouteau <chouteau@xxxxxxxxxxx>, Greg Kurz <groug@xxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, qemu-arm@xxxxxxxxxx, Peter Chubb <peter.chubb@xxxxxxxxxxxx>, Yuval Shaia <yuval.shaia@xxxxxxxxxx>, Stefan Hajnoczi <stefanha@xxxxxxxxxx>, Zhang Chen <zhangckid@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, John Snow <jsnow@xxxxxxxxxx>, Fam Zheng <famz@xxxxxxxxxx>, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>, Kevin Wolf <kwolf@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, qemu-block@xxxxxxxxxx, Peter Crosthwaite <crosthwaite.peter@xxxxxxxxx>, Hitoshi Mitake <mitake.hitoshi@xxxxxxxxxxxxx>, Wen Congyang <wencongyang2@xxxxxxxxxx>, qemu-s390x@xxxxxxxxxx, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, Laurent Vivier <laurent@xxxxxxxxx>, Juan Quintela <quintela@xxxxxxxxxx>, Subbaraya Sundeep <sundeep.lkml@xxxxxxxxx>, Michael Walle <michael@xxxxxxxx>, Igor Mammedov <imammedo@xxxxxxxxxx>, qemu-ppc@xxxxxxxxxx, Cornelia Huck <cohuck@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Andreas Färber <afaerber@xxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>, Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- Delivery-date: Tue, 20 Mar 2018 16:33:57 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Am 20.03.2018 um 02:54 schrieb Michael S. Tsirkin:
> QEMU coding style at the moment asks for all non-system
> include files to be used with #include "foo.h".
> However this rule actually does not make sense and
> creates issues for when the included file is generated.
>
> In C, include "file" means look in current directory,
> then on include search path. Current directory here
> means the source file directory.
> By comparison include <file> means look on include search path.
Hello Michael,
the compiler (or to be more precise the preprocessor) works as you
describe it, so technically all include files which are only found by
searching the include paths would be found faster with <> than with "":
the unsuccessful search relative to the source file directory would be
omitted. Practically this will not save much build time because of
caching effects. So the suggested change is not required to get faster
build speed.
Using <> for system include files and "" for local include files is a
convention, and as far as I know most projects adhere to that
convention. So does QEMU currently. Such conventions are not only
important for humans, but also for tools. There are more tools than the
C preprocessor which handle <> and "" differently. For example the GNU
compiler uses -MD or -MMD to automatically generate dependency rules for
make. While -MD generates dependencies to all include files, -MMD does
so only for user include files, but not for system include files. "user"
and "system" means the different forms how include statements are
written. QEMU still seems to use -MMD:
rules.mak:QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
Other tools like static code analysers could restrict their warning and
error messages to user include files and ignore problems in system
include files.
Very large projects often split in sub projects, maybe one of them
describing the API. Then that API headers are similar to system headers
and can be included using <>, although they still belong to the same
larger project. Do we have a stable QEMU API described in a (small)
number of include files which typically do not change? If yes, then
those include files could be included using <> because we don't need
them in dependency lists or in static code analysis reports.
For all other QEMU include files, I'd stick to using "".
Regards
Stefan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|