summaryrefslogtreecommitdiffstats
path: root/test/Misc/diag-mapping.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-15 07:01:18 +0000
committerChris Lattner <sabre@nondot.org>2009-04-15 07:01:18 +0000
commit27ceb9d77d929f02a8a811d189a96885629c7c0c (patch)
tree5bdff22c0f05093e02e4aa969b6e35bfa9b60b30 /test/Misc/diag-mapping.c
parentffb4b6e299069139908540ce97be4462e16b53a4 (diff)
Rejigger how -pedantic and -pedantic-errors work and their interaction
with other diagnostic mapping. In the new scheme, -Wfoo or -Wno-foo or -Werror=foo all override the -pedantic options, and __extension__ robustly silences all extension diagnostics in their scope. An added bonus of this change is that MAP_DEFAULT goes away, meaning that per-diagnostic mapping information can now be stored in 2 bits, doubling the density of the Diagnostic::DiagMapping array. This also substantially simplifies Diagnostic::getDiagnosticLevel. OTOH, this temporarily introduces some "macro intensive" code in Diagnostic.cpp. This will be addressed in a later patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Misc/diag-mapping.c')
-rw-r--r--test/Misc/diag-mapping.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Misc/diag-mapping.c b/test/Misc/diag-mapping.c
new file mode 100644
index 0000000000..f6ace02d07
--- /dev/null
+++ b/test/Misc/diag-mapping.c
@@ -0,0 +1,27 @@
+// This should warn by default.
+// RUN: clang-cc %s 2>&1 | grep "warning:" &&
+// This should not emit anything.
+// RUN: clang-cc %s -Wno-extra-tokens 2>&1 | not grep diagnostic
+
+// -Werror can map all warnings to error.
+// RUN: clang-cc %s -Werror 2>&1 | grep "error:" &&
+
+// -Werror can map this one warning to error.
+// RUN: clang-cc %s -Werror=extra-tokens 2>&1 | grep "error:" &&
+
+// This should stay a warning with -pedantic.
+// RUN: clang-cc %s -pedantic 2>&1 | grep "warning:" &&
+
+// This should emit an error with -pedantic-errors.
+// RUN: clang-cc %s -pedantic-errors 2>&1 | grep "error:" &&
+
+// This should emit a warning, because -Wfoo overrides -pedantic*.
+// RUN: clang-cc %s -pedantic-errors -Wextra_tokens 2>&1 | grep "error:" &&
+
+// This should emit nothing, because -Wno-extra-tokens overrides -pedantic*
+// RUN: clang-cc %s -pedantic-errors -Wno-extra-tokens 2>&1 | not grep diagnostic
+
+#ifdef foo
+#endif bad // extension!
+
+int x;