From: Thomas Huth Subject: Re: [Qemu-ppc] [PATCH] qemu: include generated files with <> and not "" Date: Wed, 21 Mar 2018 08:16:00 +0100 Message-ID: <459fa95d-8f0a-22fa-80fb-4af22ccf49b3@redhat.com> References: <1521510562-529051-1-git-send-email-mst@redhat.com> <8f06e1e3-4823-d8e8-43bd-c092c523849e@vivier.eu> <20180320135548-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Peter Maydell , Dmitry Fleytman , sheepdog@lists.wpkg.org, Pavel Dovgalyuk , Li Zhijian , David Hildenbrand , Stefan Hajnoczi , qemu-devel@nongnu.org, BALATON Zoltan , Keith Busch , Max Filippov , Hannes Reinecke , Gerd Hoffmann , Fam Zheng , Max Reitz , Stefano Stabellini , zhanghailiang , Ben Warren , Stefan Berger , Yongbok Kim , Michael Roth , "Richard W.M. Jones" , Christian Borntraeger , =?UTF To: "Michael S. Tsirkin" , Laurent Vivier Return-path: In-Reply-To: <20180320135548-mutt-send-email-mst@kernel.org> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-block-bounces+gceqb-qemu-block=m.gmane.org@nongnu.org Sender: "Qemu-block" List-Id: kvm.vger.kernel.org On 20.03.2018 13:05, Michael S. Tsirkin wrote: > 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. >> >> If you change that, we can have issue when a system include has the sa= me >> name as our local include. With "", system header are taken firs= t. >=20 > Are you sure? I just tested and that is not the case with > either gcc or clang. >=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 path. >> >> Not exactly, there is the notion of "system header" too. >> >> https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html >> >> #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). >=20 > This is exactly what we do. >=20 >> #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 directori= es >> with the -iquote option. >=20 > Since we do not use -iquote, "" just adds the current directory. So why don't we simply switch to use -iquote instead of -I for adding search paths for our own headers? We then would get a clean separation of QEMU headers from system headers. Thomas