<br><br><div class="gmail_quote">On Wed, Jun 13, 2012 at 10:27 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard-llvm@metafoo.co.uk" target="_blank">richard-llvm@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: rsmith<br>
Date: Wed Jun 13 15:27:03 2012<br>
New Revision: 158418<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=158418&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=158418&view=rev</a><br>
Log:<br>
Add -isystem-prefix and -ino-system-prefix arguments, which can be used to<br>
override whether headers are system headers by checking for prefixes of the<br>
header name specified in the #include directive.<br>
<br>
This allows warnings to be disabled for third-party code which is found in<br>
specific subdirectories of include paths.<br>
<br>
Added:<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/all.h<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/warn.h<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/all.h<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/warn.h<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/all.h<br>
    cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/warn.h<br>
    cfe/trunk/test/Frontend/system-header-prefix.c<br>
Modified:<br>
    cfe/trunk/docs/UsersManual.html<br>
    cfe/trunk/include/clang/Driver/CC1Options.td<br>
    cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h<br>
    cfe/trunk/include/clang/Lex/HeaderSearch.h<br>
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
    cfe/trunk/lib/Frontend/InitHeaderSearch.cpp<br>
    cfe/trunk/lib/Lex/HeaderSearch.cpp<br>
<br>
Modified: cfe/trunk/docs/UsersManual.html<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.html?rev=158418&r1=158417&r2=158418&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.html?rev=158418&r1=158417&r2=158418&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/docs/UsersManual.html (original)<br>
+++ cfe/trunk/docs/UsersManual.html Wed Jun 13 15:27:03 2012<br>
@@ -43,6 +43,7 @@<br>
    <li><a href="#diagnostics_categories">Diagnostic Categories</a></li><br>
    <li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Line Flags</a></li><br>
    <li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></li><br>
+   <li><a href="#diagnostics_systemheader">Controlling Diagnostics in System Headers</a></li><br>
    <li><a href="#diagnostics_enable_everything">Enabling All Warnings</a></li><br>
    <li><a href="#analyzer_diagnositics">Controlling Static Analyzer Diagnostics</a></li><br>
    </ul><br>
@@ -654,6 +655,45 @@<br>
 compatible #pragmas there is no guarantee that they will have identical behaviour<br>
 on both compilers. </p><br>
<br>
+<h4 id="diagnostics_systemheader">Controlling Diagnostics in System Headers</h4><br>
+<br>
+<p>Warnings are suppressed when they occur in system headers. By default, an<br>
+included file is treated as a system header if it is found in an include path<br>
+specified by <tt>-isystem</tt>, but this can be overridden in several ways.</p><br>
+<br>
+<p>The <tt>system_header</tt> pragma can be used to mark the current file as<br>
+being a system header. No warnings will be produced from the location of the<br>
+pragma onwards within the same file.</p><br>
+<br>
+<pre><br>
+char a = 'xy'; // warning<br>
+<br>
+#pragma clang system_header<br>
+<br>
+char b = 'ab'; // no warning<br>
+</pre><br>
+<br>
+<p>The <tt>-isystem-prefix</tt> and <tt>-ino-system-prefix</tt> command-line<br>
+arguments can be used to override whether subsets of an include path are treated<br>
+as system headers. When the name in a <tt>#include</tt> directive is found<br>
+within a header search path and starts with a system prefix, the header is<br>
+treated as a system header. The last prefix on the command-line which matches<br>
+the specified header name takes precedence. For instance:</p><br>
+<br>
+<pre><br>
+clang -Ifoo -isystem bar -isystem-prefix x/ -ino-system-prefix x/y/<br>
+</pre><br>
+<br>
+<p>Here, <tt>#include "x/a.h"</tt> is treated as including a system header, even<br>
+if the header is found in <tt>foo</tt>, and <tt>#include "x/y/b.h"</tt> is<br>
+treated as not including a system header, even if the header is found in<br>
+<tt>bar</tt>.<br>
+</p><br>
+<br>
+<p>A <tt>#include</tt> directive which finds a file relative to the current<br>
+directory is treated as including a system header if the including file is<br>
+treated as a system header.</p><br>
+<br>
 <h4 id="diagnostics_enable_everything">Enabling All Warnings</h4><br>
<br>
 <p>In addition to the traditional <tt>-W</tt> flags, one can enable <b>all</b><br>
<br>
Modified: cfe/trunk/include/clang/Driver/CC1Options.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=158418&r1=158417&r2=158418&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=158418&r1=158417&r2=158418&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)<br>
+++ cfe/trunk/include/clang/Driver/CC1Options.td Wed Jun 13 15:27:03 2012<br>
@@ -471,6 +471,14 @@<br>
            "implicit extern \"C\" semantics; these are assumed to not be "<br>
            "user-provided and are used to model system and standard headers' "<br>
            "paths.">;<br>
+def isystem_prefix : JoinedOrSeparate<"-isystem-prefix">,<br>
+  MetaVarName<"<prefix>">,<br>
+  HelpText<"Treat all #include paths starting with <prefix> as including a "<br>
+           "system header.">;<br>
+def ino_system_prefix : JoinedOrSeparate<"-ino-system-prefix">,<br>
+  MetaVarName<"<prefix>">,<br>
+  HelpText<"Treat all #include paths starting with <prefix> as not including a "<br>
+           "system header.">;<br>
<br>
 //===----------------------------------------------------------------------===//<br>
 // Preprocessor Options<br>
<br>
Modified: cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h?rev=158418&r1=158417&r2=158418&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h?rev=158418&r1=158417&r2=158418&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h (original)<br>
+++ cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h Wed Jun 13 15:27:03 2012<br>
@@ -69,6 +69,18 @@<br>
         IsInternal(isInternal), ImplicitExternC(implicitExternC) {}<br>
   };<br>
<br>
+  struct SystemHeaderPrefix {<br>
+    /// A prefix to be matched against paths in #include directives.<br>
+    std::string Prefix;<br>
+<br>
+    /// True if paths beginning with this prefix should be treated as system<br>
+    /// headers.<br>
+    bool IsSystemHeader;<br>
+<br>
+    SystemHeaderPrefix(StringRef Prefix, bool IsSystemHeader)<br>
+      : Prefix(Prefix), IsSystemHeader(IsSystemHeader) {}<br>
+  };<br>
+<br>
   /// If non-empty, the directory to use as a "virtual system root" for include<br>
   /// paths.<br>
   std::string Sysroot;<br>
@@ -76,6 +88,9 @@<br>
   /// User specified include entries.<br>
   std::vector<Entry> UserEntries;<br>
<br>
+  /// User-specified system header prefixes.<br>
+  std::vector<SystemHeaderPrefix> SystemHeaderPrefixes;<br>
+<br>
   /// The directory which holds the compiler resource files (builtin includes,<br>
   /// etc.).<br>
   std::string ResourceDir;<br>
@@ -117,6 +132,13 @@<br>
     UserEntries.push_back(Entry(Path, Group, IsUserSupplied, IsFramework,<br>
                                 IgnoreSysRoot, IsInternal, ImplicitExternC));<br>
   }<br>
+<br>
+  /// AddSystemHeaderPrefix - Override whether #include directives naming a<br>
+  /// path starting with \arg Prefix should be considered as naming a system<br>
+  /// header.<br>
+  void AddSystemHeaderPrefix(StringRef Prefix, bool IsSystemHeader) {<br>
+    SystemHeaderPrefixes.push_back(SystemHeaderPrefix(Prefix, IsSystemHeader));<br>
+  }<br>
 };<br>
<br>
 } // end namespace clang<br>
<br>
Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=158418&r1=158417&r2=158418&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=158418&r1=158417&r2=158418&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)<br>
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Wed Jun 13 15:27:03 2012<br>
@@ -16,6 +16,7 @@<br>
<br>
 #include "clang/Lex/DirectoryLookup.h"<br>
 #include "clang/Lex/ModuleMap.h"<br>
+#include "llvm/ADT/ArrayRef.h"<br>
 #include "llvm/ADT/StringMap.h"<br>
 #include "llvm/ADT/StringSet.h"<br>
 #include "llvm/Support/Allocator.h"<br>
@@ -144,6 +145,12 @@<br>
   unsigned SystemDirIdx;<br>
   bool NoCurDirSearch;<br>
<br>
+  /// #include prefixes for which the 'system header' property is overridden.<br>
+  /// For a #include "x" or #include <x> directive, the last string in this<br>
+  /// list which is a prefix of 'x' determines whether the file is treated as<br>
+  /// a system header.<br>
+  std::vector<std::pair<std::string, bool> > SystemHeaderPrefixes;<br>
+<br>
   /// \brief The path to the module cache.<br>
   std::string ModuleCachePath;<br>
<br>
@@ -235,6 +242,11 @@<br>
     SystemDirIdx++;<br>
   }<br>
<br>
+  /// SetSystemHeaderPrefixes - Set the list of system header prefixes.<br>
+  void SetSystemHeaderPrefixes(ArrayRef<std::pair<std::string, bool> > P) {<br>
+    SystemHeaderPrefixes.assign(P.begin(), P.end());<br>
+  }<br>
+<br>
   /// HasIncludeAliasMap - Checks whether the map exists or not<br>
   bool HasIncludeAliasMap() const {<br>
     return IncludeAliases;<br>
<br>
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=158418&r1=158417&r2=158418&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=158418&r1=158417&r2=158418&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)<br>
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Jun 13 15:27:03 2012<br>
@@ -624,6 +624,16 @@<br>
     Res.push_back(E.Path);<br>
   }<br>
<br>
+  /// User-specified system header prefixes.<br>
+  for (unsigned i = 0, e = Opts.SystemHeaderPrefixes.size(); i != e; ++i) {<br>
+    if (Opts.SystemHeaderPrefixes[i].IsSystemHeader)<br>
+      Res.push_back("-isystem-prefix");<br>
+    else<br>
+      Res.push_back("-ino-system-prefix");<br>
+<br>
+    Res.push_back(Opts.SystemHeaderPrefixes[i].Prefix);<br>
+  }<br>
+<br>
   if (!Opts.ResourceDir.empty())<br>
     Res.push_back("-resource-dir", Opts.ResourceDir);<br>
   if (!Opts.ModuleCachePath.empty())<br>
@@ -1688,6 +1698,14 @@<br>
     Opts.AddPath((*I)->getValue(Args), frontend::System,<br>
                  false, false, /*IgnoreSysRoot=*/true, /*IsInternal=*/true,<br>
                  (*I)->getOption().matches(OPT_internal_externc_isystem));<br>
+<br>
+  // Add the path prefixes which are implicitly treated as being system headers.<br>
+  for (arg_iterator I = Args.filtered_begin(OPT_isystem_prefix,<br>
+                                            OPT_ino_system_prefix),<br>
+                    E = Args.filtered_end();<br>
+       I != E; ++I)<br>
+    Opts.AddSystemHeaderPrefix((*I)->getValue(Args),<br>
+                               (*I)->getOption().matches(OPT_isystem_prefix));<br>
 }<br>
<br>
 void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,<br>
<br>
Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=158418&r1=158417&r2=158418&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=158418&r1=158417&r2=158418&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)<br>
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Wed Jun 13 15:27:03 2012<br>
@@ -40,6 +40,7 @@<br>
   std::vector<std::pair<IncludeDirGroup, DirectoryLookup> > IncludePath;<br>
   typedef std::vector<std::pair<IncludeDirGroup,<br>
                       DirectoryLookup> >::const_iterator path_iterator;<br>
+  std::vector<std::pair<std::string, bool> > SystemHeaderPrefixes;<br>
   HeaderSearch &Headers;<br>
   bool Verbose;<br>
   std::string IncludeSysroot;<br>
@@ -57,6 +58,12 @@<br>
                bool isCXXAware, bool isUserSupplied,<br>
                bool isFramework, bool IgnoreSysRoot = false);<br>
<br>
+  /// AddSystemHeaderPrefix - Add the specified prefix to the system header<br>
+  /// prefix list.<br>
+  void AddSystemHeaderPrefix(StringRef Prefix, bool IsSystemHeader) {<br>
+    SystemHeaderPrefixes.push_back(std::make_pair(Prefix, IsSystemHeader));<br>
+  }<br>
+<br>
   /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu<br>
   ///  libstdc++.<br>
   void AddGnuCPlusPlusIncludePaths(StringRef Base,<br>
@@ -623,6 +630,8 @@<br>
   bool DontSearchCurDir = false;  // TODO: set to true if -I- is set?<br>
   Headers.SetSearchPaths(SearchList, NumQuoted, NumAngled, DontSearchCurDir);<br>
<br>
+  Headers.SetSystemHeaderPrefixes(SystemHeaderPrefixes);<br>
+<br>
   // If verbose, print the list of directories that will be searched.<br>
   if (Verbose) {<br>
     llvm::errs() << "#include \"...\" search starts here:\n";<br>
@@ -660,6 +669,10 @@<br>
<br>
   Init.AddDefaultIncludePaths(Lang, Triple, HSOpts);<br>
<br>
+  for (unsigned i = 0, e = HSOpts.SystemHeaderPrefixes.size(); i != e; ++i)<br>
+    Init.AddSystemHeaderPrefix(HSOpts.SystemHeaderPrefixes[i].Prefix,<br>
+                               HSOpts.SystemHeaderPrefixes[i].IsSystemHeader);<br>
+<br>
   if (HSOpts.UseBuiltinIncludes) {<br>
     // Set up the builtin include directory in the module map.<br>
     llvm::sys::Path P(HSOpts.ResourceDir);<br>
<br>
Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=158418&r1=158417&r2=158418&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=158418&r1=158417&r2=158418&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)<br>
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Wed Jun 13 15:27:03 2012<br>
@@ -510,6 +510,16 @@<br>
     if (HFI.DirInfo == SrcMgr::C_User && InUserSpecifiedSystemFramework)<br>
       HFI.DirInfo = SrcMgr::C_System;<br>
<br>
+    // If the filename matches a known system header prefix, override<br>
+    // whether the file is a system header.<br>
+    for (unsigned i = SystemHeaderPrefixes.size(); i; --i) {<br>
+      if (Filename.startswith(SystemHeaderPrefixes[i-1].first)) {<br>
+        HFI.DirInfo = SystemHeaderPrefixes[i-1].second ? SrcMgr::C_System<br>
+                                                       : SrcMgr::C_User;<br>
+        break;<br>
+      }<br>
+    }<br>
+<br>
     // If this file is found in a header map and uses the framework style of<br>
     // includes, then this header is part of a framework we're building.<br>
     if (CurDir->isIndexHeaderMap()) {<br>
<br>
Added: cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/all.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/all.h?rev=158418&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/all.h?rev=158418&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/all.h (added)<br>
+++ cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/all.h Wed Jun 13 15:27:03 2012<br>
@@ -0,0 +1 @@<br>
+#include "warn.h"<br>
<br>
Added: cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/warn.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/warn.h?rev=158418&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/warn.h?rev=158418&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/warn.h (added)<br>
+++ cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/warn.h Wed Jun 13 15:27:03 2012<br>
@@ -0,0 +1,2 @@<br>
+#if BOOST<br>
+#endif<br>
<br>
Added: cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/all.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/all.h?rev=158418&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/all.h?rev=158418&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/all.h (added)<br>
+++ cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/all.h Wed Jun 13 15:27:03 2012<br>
@@ -0,0 +1 @@<br>
+#include "warn.h"<br>
<br>
Added: cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/warn.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/warn.h?rev=158418&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/warn.h?rev=158418&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/warn.h (added)<br>
+++ cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/warn.h Wed Jun 13 15:27:03 2012<br>
@@ -0,0 +1,2 @@<br>
+#if MYLIB<br>
+#endif<br>
<br>
Added: cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/all.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/all.h?rev=158418&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/all.h?rev=158418&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/all.h (added)<br>
+++ cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/all.h Wed Jun 13 15:27:03 2012<br>
@@ -0,0 +1,6 @@<br>
+#include "libs/boost/all.h"<br>
+#include "libs/mylib/all.h"<br>
+<br>
+#include "libs/boost/warn.h"<br>
+#include "libs/mylib/warn.h"<br>
+#include "src/warn.h"<br>
<br>
Added: cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/warn.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/warn.h?rev=158418&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/warn.h?rev=158418&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/warn.h (added)<br>
+++ cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/src/warn.h Wed Jun 13 15:27:03 2012<br>
@@ -0,0 +1,2 @@<br>
+#if SRC<br>
+#endif<br>
<br>
Added: cfe/trunk/test/Frontend/system-header-prefix.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/system-header-prefix.c?rev=158418&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/system-header-prefix.c?rev=158418&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Frontend/system-header-prefix.c (added)<br>
+++ cfe/trunk/test/Frontend/system-header-prefix.c Wed Jun 13 15:27:03 2012<br>
@@ -0,0 +1,11 @@<br>
+// RUN: %clang_cc1 -isystem-prefix libs/ -ino-system-prefix libs/mylib/ -I%S/Inputs/SystemHeaderPrefix -Wundef -E %s 2>&1 | FileCheck %s<br>
+<br>
+#include "src/all.h"<br>
+<br>
+// CHECK-NOT: BOOST<br>
+// CHECK: libs/mylib/warn.h:1:5: warning: 'MYLIB' is not defined, evaluates to 0<br>
+// CHECK-NOT: BOOST<br>
+// CHECK: libs/mylib/warn.h:1:5: warning: 'MYLIB' is not defined, evaluates to 0<br>
+// CHECK-NOT: BOOST<br>
+// CHECK: src/warn.h:1:5: warning: 'SRC' is not defined, evaluates to 0<br>
+// CHECK-NOT: BOOST<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br><br>Wow!<br><br>I have dreamed of this for quite a while given the issues of pulling in 3rd party code (filing a bug/pushing a fix does not give it to you "right" away).<br><br>That's a pretty slick feature, thanks.<br>
<br>-- Matthieu<br>