blob: a7d4536b12214f0ced8b2f26cbb3957d0be3b80f [file] [log] [blame]
<html lang="en">
<head>
<title>System Headers - The C Preprocessor</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The C Preprocessor">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Header-Files.html#Header-Files" title="Header Files">
<link rel="prev" href="Wrapper-Headers.html#Wrapper-Headers" title="Wrapper Headers">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009, 2010
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation. A copy of
the license is included in the
section entitled ``GNU Free Documentation License''.
This manual contains no Invariant Sections. The Front-Cover Texts are
(a) (see below), and the Back-Cover Texts are (b) (see below).
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="System-Headers"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Wrapper-Headers.html#Wrapper-Headers">Wrapper Headers</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Header-Files.html#Header-Files">Header Files</a>
<hr>
</div>
<h3 class="section">2.8 System Headers</h3>
<p><a name="index-system-header-files-39"></a>
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 <dfn>system headers</dfn> special
treatment. All warnings, other than those generated by &lsquo;<samp><span class="samp">#warning</span></samp>&rsquo;
(see <a href="Diagnostics.html#Diagnostics">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.
<p>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.
<p>The <samp><span class="option">-isystem</span></samp> command line option adds its argument to the list of
directories to search for headers, just like <samp><span class="option">-I</span></samp>. Any headers
found in that directory will be considered system headers.
<p>All directories named by <samp><span class="option">-isystem</span></samp> are searched <em>after</em> all
directories named by <samp><span class="option">-I</span></samp>, no matter what their order was on the
command line. If the same directory is named by both <samp><span class="option">-I</span></samp> and
<samp><span class="option">-isystem</span></samp>, the <samp><span class="option">-I</span></samp> option is ignored. GCC provides an
informative message when this occurs if <samp><span class="option">-v</span></samp> is used.
<p><a name="index-g_t_0023pragma-GCC-system_005fheader-40"></a>There is also a directive, <code>#pragma&nbsp;GCC&nbsp;system_header<!-- /@w --></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
&lsquo;<samp><span class="samp">#pragma</span></samp>&rsquo; in the file will not be affected. <code>#pragma&nbsp;GCC&nbsp;system_header<!-- /@w --></code> has no effect in the primary source file.
<p>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;"C"<!-- /@w --></code>
block. There is no way to request this behavior with a &lsquo;<samp><span class="samp">#pragma</span></samp>&rsquo;,
or from the command line.
</body></html>