From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyGxe-0007Qc-AR for qemu-devel@nongnu.org; Tue, 20 Mar 2018 09:06:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyGxY-0001Cu-Hs for qemu-devel@nongnu.org; Tue, 20 Mar 2018 09:05:54 -0400 Date: Tue, 20 Mar 2018 15:05:00 +0200 From: "Michael S. Tsirkin" Message-ID: <20180320145402-mutt-send-email-mst@kernel.org> References: <1521510562-529051-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1521510562-529051-1-git-send-email-mst@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qemu: include generated files with <> and not "" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Gerd Hoffmann , Eduardo Habkost , Igor Mammedov , Kevin Wolf , Max Reitz , Jeff Cody , Fam Zheng , John Snow , Stefan Weil , Stefan Hajnoczi , Ronnie Sahlberg , Peter Lieven , Eric Blake , Markus Armbruster , Alberto Garcia , Josh Durgin , Hitoshi Mitake , Liu Yuan , "Richard W.M. Jones" , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= , "Dr. David Alan Gilbert" , Greg Kurz , Ben Warren , Peter Maydell , Shannon Zhao , Michael Walle , Keith Busch , Stefano Stabellini , Anthony Perard , Fabien Chouteau , Amit Shah , Marcel Apfelbaum , Mark Cave-Ayland , BALATON Zoltan , Alexander Graf , Cornelia Huck , Christian Borntraeger , David Gibson , Corey Minyard , =?iso-8859-1?Q?Herv=E9?= Poussineau , Peter Chubb , Subbaraya Sundeep , Dmitry Fleytman , Jason Wang , Yongbok Kim , Max Filippov , Jiri Pirko , Yuval Shaia , David Hildenbrand , Hannes Reinecke , Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= , Andrzej Zaborowski , Artyom Tarasenko , Alistair Francis , "Edgar E. Iglesias" , Stefan Berger , Alex Williamson , zhanghailiang , Juan Quintela , Michael Roth , Andreas =?iso-8859-1?Q?F=E4rber?= , Pavel Dovgalyuk , Riku Voipio , Laurent Vivier , Zhang Chen , Li Zhijian , Wen Congyang , Xie Changlong , Marcelo Tosatti , Aurelien Jarno , kvm@vger.kernel.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, xen-devel@lists.xenproject.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org On Tue, Mar 20, 2018 at 03:54:36AM +0200, Michael S. Tsirkin wrote: > 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 means look on include search path. > > As generated files are not in the search directory (unless the build > directory happens to match the source directory), it does not make sense > to include them with "" - doing so is merely more work for preprocessor > and a source or errors if a stale file happens to exist in the source > directory. > > This changes include directives for all generated files, across the > tree. The idea is to avoid sending a huge amount of email. But when > merging, the changes will be split with one commit per file, e.g. for > ease of bisect in case of build failures, and to ease merging. > > Note that should some generated files be missed by this tree-wide > refactoring, it isn't a big deal - this merely maintains the status quo, > and this can be addressed by a separate patch on top. > > Signed-off-by: Michael S. Tsirkin For the record, the stated advantage is that one can have a header file that happens to match the system header. To put it bluntly that does not work as designed. For example, if a system header foo.h somewhere has #include then the compiler will happily pull in our own version (since that is in the -I path) and completely ignore the system one, breaking things in the process. When does it make sense to use include ""? When the header is a directory-specific one, located with the source. This approach would both be enforced by the compiler and help people know where to find the header. -- MST