[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH] qemu: include generated files with
Michael S. Tsirkin
Re: [Qemu-block] [Qemu-devel] [PATCH] qemu: include generated files with <> and not ""
Tue, 20 Mar 2018 19:49:41 +0200
On Tue, Mar 20, 2018 at 05:34:01PM +0000, Daniel P. Berrangé wrote:
> On Tue, Mar 20, 2018 at 07:10:42PM +0200, Michael S. Tsirkin wrote:
> > On Tue, Mar 20, 2018 at 05:33:42PM +0100, Stefan Weil wrote:
> > > Using <> for system include files and "" for local include files is a
> > > convention, and as far as I know most projects adhere to that
> > > convention. So does QEMU currently. Such conventions are not only
> > > important for humans, but also for tools. There are more tools than the
> > > C preprocessor which handle <> and "" differently. For example the GNU
> > > compiler uses -MD or -MMD to automatically generate dependency rules for
> > > make. While -MD generates dependencies to all include files, -MMD does
> > > so only for user include files, but not for system include files. "user"
> > > and "system" means the different forms how include statements are
> > > written. QEMU still seems to use -MMD:
> > >
> > > rules.mak:QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
> > To my knowledge, and according to my limited testing,
> > system headers in this context means
> > the default ones not supplied with -I.
> GCC's definition of system header is here:
Proves my point, does it not? You will note that it does not refer to
include <> anywhere.
2.8 System Headers
The header files declaring interfaces to the operating system and runtime
libraries often cannot be written in strictly conforming C. Therefore, GCC
gives code found in system headers special treatment. All warnings, other than
those generated by ‘#warning’ (see Diagnostics), are suppressed while GCC is
processing a system header. Macros defined in a system header are immune to a
few warnings wherever they are expanded. This immunity is granted on an ad-hoc
basis, when we find that a warning generates lots of false positives because of
code in macros defined in system headers.
Normally, only the headers found in specific directories are considered
system headers. These directories are determined when GCC is compiled. There
are, however, two ways to make normal headers into system headers:
Header files found in directories added to the search path with the
-isystem and -idirafter command-line options are treated as system headers for
the purposes of diagnostics.
There is also a directive, #pragma GCC system_header, which tells GCC to
consider the rest of the current include file a system header, no matter where
it was found. Code that comes before the ‘#pragma’ in the file is not affected.
#pragma GCC system_header has no effect in the primary source file.
Conclusion: #include <> is ignored for purposes of determining whether a header
a system one or not.
> |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org -o- https://fstop138.berrange.com :|
> |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-block] [PATCH] qemu: include generated files with <> and not "", Stefan Hajnoczi, 2018/03/20
Re: [Qemu-block] [PATCH] qemu: include generated files with <> and not "", Eric Blake, 2018/03/20
Re: [Qemu-block] [Qemu-devel] [PATCH] qemu: include generated files with <> and not "", Stefan Weil, 2018/03/20
Re: [Qemu-block] [Qemu-devel] [PATCH] qemu: include generated files with <> and not "", Daniel P . Berrangé, 2018/03/20
- Re: [Qemu-block] [Qemu-ppc] [PATCH] qemu: include generated files with <> and not "", (continued)