[Main]
Title=System Headers

[Top]
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 <U>system headers</U> special
treatment.  All warnings, other than those generated by <CODE>#warning</CODE>
(see <A HREF="$$LINK(SEC40)">Diagnostics</A>), 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.
<BR><BR>
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.
<BR><BR>
The <B>'-isystem'</B> command line option adds its argument to the list of
directories to search for headers, just like <B>'-I'</B>.  Any headers
found in that directory will be considered system headers.
<BR><BR>
All directories named by <B>'-isystem'</B> are searched <I>after</I> all
directories named by <B>'-I'</B>, no matter what their order was on the
command line.  If the same directory is named by both <B>'-I'</B> and
<B>'-isystem'</B>, the <B>'-I'</B> option is ignored.  GCC provides an
informative message when this occurs if <B>'-v'</B> is used.
<BR><BR>
There is also a directive, <CODE>#pragma&nbsp;GCC&nbsp;system_header</CODE>, 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
<CODE>#pragma</CODE> in the file will not be affected.  <CODE>#pragma&nbsp;GCC
system_header</CODE> has no effect in the primary source file.
<BR><BR>
On very old systems, some of the pre-defined system header directories
get even more special treatment.  GNU C++ considers code in headers
found in those directories to be surrounded by an <CODE>extern&nbsp;&quot;C&quot;</CODE>
block.  There is no way to request this behavior with a <CODE>#pragma</CODE>,
or from the command line.
