From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyHLf-0002rq-Dc for qemu-devel@nongnu.org; Tue, 20 Mar 2018 09:30:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyHLb-0002L2-G7 for qemu-devel@nongnu.org; Tue, 20 Mar 2018 09:30:43 -0400 Date: Tue, 20 Mar 2018 15:30:15 +0200 From: "Michael S. Tsirkin" Message-ID: <20180320152446-mutt-send-email-mst@kernel.org> References: <1521510562-529051-1-git-send-email-mst@redhat.com> <20180320131041.GB24329@stefanha-x1.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180320131041.GB24329@stefanha-x1.localdomain> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] qemu: include generated files with <> and not "" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, Peter Maydell , Dmitry Fleytman , sheepdog@lists.wpkg.org, Stefan Hajnoczi , Li Zhijian , David Hildenbrand , Zhang Chen , Mark Cave-Ayland , BALATON Zoltan , Keith Busch , Max Filippov , Laurent Vivier , Gerd Hoffmann , "Edgar E. Iglesias" , Jiri Pirko , Subbaraya Sundeep , Michael Roth , Marcelo Tosatti , Stefano Stabellini , zhanghailiang , Ben Warren , Marcel Apfelbaum , Yongbok Kim , Markus Armbruster , Stefan Berger , Christian Borntraeger , kvm@vger.kernel.org, =?iso-8859-1?Q?Herv=E9?= Poussineau , Shannon Zhao , Anthony Perard , Liu Yuan , David Gibson , Andrzej Zaborowski , Jason Wang , Artyom Tarasenko , Riku Voipio , Fam Zheng , Eduardo Habkost , Corey Minyard , Amit Shah , Pavel Dovgalyuk , Stefan Weil , Xie Changlong , Alistair Francis , Peter Lieven , "Dr. David Alan Gilbert" , Fabien Chouteau , Greg Kurz , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Alex Williamson , qemu-arm@nongnu.org, Peter Chubb , Yuval Shaia , Ronnie Sahlberg , Paolo Bonzini , xen-devel@lists.xenproject.org, Richard Henderson , Kevin Wolf , Alexander Graf , Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= , qemu-block@nongnu.org, Peter Crosthwaite , Hitoshi Mitake , Wen Congyang , qemu-s390x@nongnu.org, Cornelia Huck , "Richard W.M. Jones" , Juan Quintela , Max Reitz , Michael Walle , qemu-ppc@nongnu.org, Andreas =?iso-8859-1?Q?F=E4rber?= , Igor Mammedov , Hannes Reinecke , Aurelien Jarno , Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= On Tue, Mar 20, 2018 at 01:10:41PM +0000, Stefan Hajnoczi wrote: > 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. > > Stale header files are a pain. I often do make distclean before > checking out a radically different QEMU version to avoid the problem. > > This patch trades off the stale header file issue for a new approach to > using <> vs "", which will be hard to use consistently The proposed rule is to use <> everywhere except if the file is in the source directory. It will be very easy to use consistently for the simple reason that compiler will enforce it. If you use <> for a header in the current directory build fails. So you are forced to use "". > in the future > since it is unconventional. All compilers I know without exception implement include <> meaning look in -I search path, and include "" meaning look in current directory then in -I search path. Looks conventional to me. > Is the build time improvement worth it (please post numbers)? > > Stefan Haven't tested it frankly. Will it convince anyone if it's marginally faster? -- MST