From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyG28-0007Vi-KI for qemu-devel@nongnu.org; Tue, 20 Mar 2018 08:06:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyG23-0005D7-KQ for qemu-devel@nongnu.org; Tue, 20 Mar 2018 08:06:28 -0400 Date: Tue, 20 Mar 2018 14:05:56 +0200 From: "Michael S. Tsirkin" Message-ID: <20180320135548-mutt-send-email-mst@kernel.org> References: <1521510562-529051-1-git-send-email-mst@redhat.com> <8f06e1e3-4823-d8e8-43bd-c092c523849e@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <8f06e1e3-4823-d8e8-43bd-c092c523849e@vivier.eu> Content-Transfer-Encoding: quoted-printable 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: Laurent Vivier Cc: qemu-devel@nongnu.org, 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 , Zhang Chen , Li Zhijian , Wen Congyang , Xie Changlong , Marcelo Tosatti , Aurelien Jarno , kvm@vger.kernel.org, qemu-block@nongnu.org, sheepdog@lists.wpkg.org, qemu-arm@nongnu.org, xen-devel@lists.xenproject.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Thomas Huth On Tue, Mar 20, 2018 at 09:58:23AM +0100, Laurent Vivier wrote: > Le 20/03/2018 =E0 02:54, Michael S. Tsirkin a =E9crit=A0: > > 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. >=20 > If you change that, we can have issue when a system include has the sam= e > name as our local include. With "", system header are taken first= . Are you sure? I just tested and that is not the case with either gcc or clang. > > 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. >=20 > Not exactly, there is the notion of "system header" too. >=20 > https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html >=20 > #include > This variant is used for system header files. It searches for a file > named file in a standard list of system directories. You can prepend > directories to this list with the -I option (see Invocation). This is exactly what we do. > #include "file" > This variant is used for header files of your own program. It searches > for a file named file first in the directory containing the current > file, then in the quote directories and then the same directories used > for . You can prepend directories to the list of quote directorie= s > with the -iquote option. Since we do not use -iquote, "" just adds the current directory. > > As generated files are not in the search directory (unless the build > > directory happens to match the source directory), it does not make se= nse > > to include them with "" - doing so is merely more work for preprocess= or > > and a source or errors if a stale file happens to exist in the source > > directory. >=20 > I agree there is a problem with stale files. But linux, for instance, > asks for a "make mrproper" to avoid this. Using <> we avoid the problem completely and create slightly less work for the preprocessor. > > 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. > >=20 > > Note that should some generated files be missed by this tree-wide > > refactoring, it isn't a big deal - this merely maintains the status q= uo, > > and this can be addressed by a separate patch on top. > >=20 > > Signed-off-by: Michael S. Tsirkin >=20 > I think your idea conflicts with what Markus has started to do: >=20 > commit d8e39b70625d4ba1e998439d1a077b4b978930e7 > Author: Markus Armbruster > Date: Thu Feb 1 12:18:28 2018 +0100 >=20 > Use #include "..." for our own headers, <...> for others >=20 > System headers should be included with <...>, our own headers with > "...". Offenders tracked down with an ugly, brittle and probably > buggy Perl script. Previous iteration was commit a9c94277f0. >=20 > Delete inclusions of "string.h" and "strings.h" instead of fixing t= hem > to and , because we always include these via > osdep.h. >=20 > Put the cleaned up system header includes first. >=20 > While there, separate #include from file comment with exactly one > blank line. >=20 > commit a9c94277f07d19d3eb14f199c3e93491aa3eae0e > Author: Markus Armbruster > Date: Wed Jun 22 19:11:19 2016 +0200 >=20 > Use #include "..." for our own headers, <...> for others >=20 > Tracked down with an ugly, brittle and probably buggy Perl script. >=20 > Also move includes converted to <...> up so they get included befor= e > ours where that's obviously okay. >=20 > Thanks, > Laurent I suspect we previously actually did have headers in the same directory as source so it was somewhat helpful. They all have been moved out to include now. --=20 MST