This patch will make the include stack from "instantiated from" notes fall
under the control of f/fno-diagnostics-show-note-include-stack flags.  This
should help with reducing diagnostic spew from macros instantiations.

The patch is attached, and is also available through Code Review:
http://codereview.appspot.com/4463041/
Index: test/Misc/Inputs/include.h
===================================================================
--- test/Misc/Inputs/include.h	(revision 130810)
+++ test/Misc/Inputs/include.h	(working copy)
@@ -1 +1,3 @@
+#define EQUALS(a,b) a == b
+
 int foo(int x) { return x; }
Index: test/Misc/include-stack-for-note-flag.cpp
===================================================================
--- test/Misc/include-stack-for-note-flag.cpp	(revision 130810)
+++ test/Misc/include-stack-for-note-flag.cpp	(working copy)
@@ -9,10 +9,20 @@
   return foo(1, 1);
 }
 
+bool macro(int x, int y) {
+  return EQUALS(&x, y);
+}
+
 // STACK: error: no matching function for call to 'foo'
 // STACK:  In file included from
 // STACK: note: candidate function not viable
+// STACK: error: comparison between pointer and integer
+// STACK:  In file included from
+// STACK: note: instantiated from:
 
 // STACKLESS: error: no matching function for call to 'foo'
 // STACKLESS-NOT:  In file included from
 // STACKLESS: note: candidate function not viable
+// STACKLESS: error: comparison between pointer and integer
+// STACKLESS-NOT:  In file included from
+// STACKLESS: note: instantiated from:
Index: lib/Frontend/TextDiagnosticPrinter.cpp
===================================================================
--- lib/Frontend/TextDiagnosticPrinter.cpp	(revision 130810)
+++ lib/Frontend/TextDiagnosticPrinter.cpp	(working copy)
@@ -343,7 +343,7 @@
       // "included from" lines.
       if (LastWarningLoc != PLoc.getIncludeLoc()) {
         LastWarningLoc = PLoc.getIncludeLoc();
-        PrintIncludeStack(Level, LastWarningLoc, SM);
+        PrintIncludeStack(Diagnostic::Note, LastWarningLoc, SM);
       }
 
       if (DiagOpts->ShowLocation) {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to