From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyGY0-0000Ek-GP for qemu-devel@nongnu.org; Tue, 20 Mar 2018 08:39:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyGXw-0004Ho-Kz for qemu-devel@nongnu.org; Tue, 20 Mar 2018 08:39:24 -0400 Date: Tue, 20 Mar 2018 12:39:00 +0000 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= Message-ID: <20180320123900.GO4530@redhat.com> Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= References: <1521510562-529051-1-git-send-email-mst@redhat.com> <8f06e1e3-4823-d8e8-43bd-c092c523849e@vivier.eu> <20180320094406.GD4530@redhat.com> <20180320141107-mutt-send-email-mst@kernel.org> <20180320121841.GN4530@redhat.com> <20180320142756-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180320142756-mutt-send-email-mst@kernel.org> 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: "Michael S. Tsirkin" Cc: Laurent Vivier , 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" , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , "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 , =?utf-8?B?SGVydsOp?= Poussineau , Peter Chubb , Subbaraya Sundeep , Dmitry Fleytman , Jason Wang , Yongbok Kim , Max Filippov , Jiri Pirko , Yuval Shaia , David Hildenbrand , Hannes Reinecke , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Andrzej Zaborowski , Artyom Tarasenko , Alistair Francis , "Edgar E. Iglesias" , Stefan Berger , Alex Williamson , zhanghailiang , Juan Quintela , Michael Roth , Andreas =?utf-8?Q?F=C3=A4rber?= , 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 02:28:42PM +0200, Michael S. Tsirkin wrote: > On Tue, Mar 20, 2018 at 12:18:41PM +0000, Daniel P. Berrang=C3=A9 wrote= : > > On Tue, Mar 20, 2018 at 02:12:24PM +0200, Michael S. Tsirkin wrote: > > > On Tue, Mar 20, 2018 at 09:44:06AM +0000, Daniel P. Berrang=C3=A9 w= rote: > > > > On Tue, Mar 20, 2018 at 09:58:23AM +0100, Laurent Vivier wrote: > > > > > Le 20/03/2018 =C3=A0 02:54, Michael S. Tsirkin a =C3=A9crit=C2=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 same > > > > > name as our local include. With "", system header are tak= en first. > > > >=20 > > > > > > 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 pat= h. > > > > >=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 pr= epend > > > > > directories to this list with the -I option (see Invocation). > > > > >=20 > > > > > #include "file" > > > > > This variant is used for header files of your own program. It s= earches > > > > > for a file named file first in the directory containing the cur= rent > > > > > file, then in the quote directories and then the same directori= es used > > > > > for . You can prepend directories to the list of quote di= rectories > > > > > with the -iquote option. > > > > >=20 > > > > > > As generated files are not in the search directory (unless th= e build > > > > > > directory happens to match the source directory), it does not= make sense > > > > > > to include them with "" - doing so is merely more work for pr= eprocessor > > > > > > and a source or errors if a stale file happens to exist in th= e source > > > > > > directory. > > > > >=20 > > > > > I agree there is a problem with stale files. But linux, for ins= tance, > > > > > asks for a "make mrproper" to avoid this. > > > >=20 > > > > We can follow what autoconf does, and add a check to configure to= see if > > > > there are generated files left in the source dir, when configurin= g with > > > > builddir !=3D srcdir, and exit with error, telling user to clean = their > > > > src dir first. > > > >=20 > > > > > > This changes include directives for all generated files, acro= ss the > > > > > > tree. The idea is to avoid sending a huge amount of email. B= ut 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 quo, > > > > > > 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 > > > > Yes, I don't think we should revert what Markus started. Both w= ays of > > > > referencing QEMU headers have downsides, but I think "..." has fe= wer > > > > downsides that "<....">. > > >=20 > > > Could you please explain what the advantage of "" is? > > > It seems to be gone since we moved headers away from > > > source. > >=20 > > We moved *some* headers into the include/ directory tree. > >=20 > > I still count 650+ headers which are alongside the .c files. >=20 > So for these, we should use "". None of these are generated files thou= gh. 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 "". Having a consistent message for developers is one of the key reasons why Markus submitted the patches to standardize on the use of "" for QEMU header files, leaving <> for system headers & external dependancies. Regards, Daniel --=20 |: https://berrange.com -o- https://www.flickr.com/photos/dberran= ge :| |: https://libvirt.org -o- https://fstop138.berrange.c= om :| |: https://entangle-photo.org -o- https://www.instagram.com/dberran= ge :|