diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-06-13 20:27:03 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-06-13 20:27:03 +0000 |
commit | 8acadcb84bcb70e1eea08cf261a2f4f5973578c3 (patch) | |
tree | 84f91fcb648badaf8014efa8581c738d40368d06 /clang/docs/UsersManual.html | |
parent | dc3559106b15c8b44355560ec5203f0a1b441d69 (diff) | |
download | bcm5719-llvm-8acadcb84bcb70e1eea08cf261a2f4f5973578c3.tar.gz bcm5719-llvm-8acadcb84bcb70e1eea08cf261a2f4f5973578c3.zip |
Add -isystem-prefix and -ino-system-prefix arguments, which can be used to
override whether headers are system headers by checking for prefixes of the
header name specified in the #include directive.
This allows warnings to be disabled for third-party code which is found in
specific subdirectories of include paths.
llvm-svn: 158418
Diffstat (limited to 'clang/docs/UsersManual.html')
-rw-r--r-- | clang/docs/UsersManual.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/clang/docs/UsersManual.html b/clang/docs/UsersManual.html index 2356b031467..a0e5ed8e8c6 100644 --- a/clang/docs/UsersManual.html +++ b/clang/docs/UsersManual.html @@ -43,6 +43,7 @@ td { <li><a href="#diagnostics_categories">Diagnostic Categories</a></li> <li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Line Flags</a></li> <li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></li> + <li><a href="#diagnostics_systemheader">Controlling Diagnostics in System Headers</a></li> <li><a href="#diagnostics_enable_everything">Enabling All Warnings</a></li> <li><a href="#analyzer_diagnositics">Controlling Static Analyzer Diagnostics</a></li> </ul> @@ -654,6 +655,45 @@ GCC do not support the exact same set of warnings, so even when using GCC compatible #pragmas there is no guarantee that they will have identical behaviour on both compilers. </p> +<h4 id="diagnostics_systemheader">Controlling Diagnostics in System Headers</h4> + +<p>Warnings are suppressed when they occur in system headers. By default, an +included file is treated as a system header if it is found in an include path +specified by <tt>-isystem</tt>, but this can be overridden in several ways.</p> + +<p>The <tt>system_header</tt> pragma can be used to mark the current file as +being a system header. No warnings will be produced from the location of the +pragma onwards within the same file.</p> + +<pre> +char a = 'xy'; // warning + +#pragma clang system_header + +char b = 'ab'; // no warning +</pre> + +<p>The <tt>-isystem-prefix</tt> and <tt>-ino-system-prefix</tt> command-line +arguments can be used to override whether subsets of an include path are treated +as system headers. When the name in a <tt>#include</tt> directive is found +within a header search path and starts with a system prefix, the header is +treated as a system header. The last prefix on the command-line which matches +the specified header name takes precedence. For instance:</p> + +<pre> +clang -Ifoo -isystem bar -isystem-prefix x/ -ino-system-prefix x/y/ +</pre> + +<p>Here, <tt>#include "x/a.h"</tt> is treated as including a system header, even +if the header is found in <tt>foo</tt>, and <tt>#include "x/y/b.h"</tt> is +treated as not including a system header, even if the header is found in +<tt>bar</tt>. +</p> + +<p>A <tt>#include</tt> directive which finds a file relative to the current +directory is treated as including a system header if the including file is +treated as a system header.</p> + <h4 id="diagnostics_enable_everything">Enabling All Warnings</h4> <p>In addition to the traditional <tt>-W</tt> flags, one can enable <b>all</b> |