summaryrefslogtreecommitdiffstats
path: root/clang/test/Misc/warn-sysheader.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-05-04 13:00:32 +0000
committerAlp Toker <alp@nuanti.com>2014-05-04 13:00:32 +0000
commita01285c4b3e0da22c41b4e2e2e06acb756ce5e13 (patch)
tree85204930e62ac64b4c5380108ecc0fa31d09b355 /clang/test/Misc/warn-sysheader.cpp
parent312dddfb81500e05f7d22264f95ab4162d237f82 (diff)
downloadbcm5719-llvm-a01285c4b3e0da22c41b4e2e2e06acb756ce5e13.tar.gz
bcm5719-llvm-a01285c4b3e0da22c41b4e2e2e06acb756ce5e13.zip
Split out header integration tests
These are somewhat arbitrary tests that check if "thing goes fine" when processing various platform-specific headers. Also move warn-sysheader.cpp to Misc where the other diagnostics infrastructure tests live. File moves only. llvm-svn: 207936
Diffstat (limited to 'clang/test/Misc/warn-sysheader.cpp')
-rw-r--r--clang/test/Misc/warn-sysheader.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/Misc/warn-sysheader.cpp b/clang/test/Misc/warn-sysheader.cpp
new file mode 100644
index 00000000000..dbc38258c4d
--- /dev/null
+++ b/clang/test/Misc/warn-sysheader.cpp
@@ -0,0 +1,33 @@
+// Test that -Wsystem-headers works with default and custom mappings like -Werror.
+// Keep run lines at the bottom for line number stability.
+
+#ifdef IS_SYSHEADER
+#pragma clang system_header
+
+int f() { return (int)0; } // Use the old-style-cast warning as an arbitrary "ordinary" diagnostic for the purpose of testing.
+
+#warning "custom message"
+
+#if defined(A) || defined(B)
+// expected-warning@9 {{"custom message"}}
+#elif defined(C)
+// expected-warning@7 {{use of old-style cast}}
+// expected-warning@9 {{"custom message"}}
+#elif defined(D)
+// expected-error@7 {{use of old-style cast}}
+// expected-error@9 {{"custom message"}}
+#elif defined(E)
+// expected-error@7 {{use of old-style cast}}
+// expected-warning@9 {{"custom message"}}
+#endif
+
+#else
+#define IS_SYSHEADER
+#include __FILE__
+#endif
+
+// RUN: %clang_cc1 -verify -fsyntax-only -DA %s
+// RUN: %clang_cc1 -verify -fsyntax-only -DB -Wold-style-cast %s
+// RUN: %clang_cc1 -verify -fsyntax-only -DC -Wold-style-cast -Wsystem-headers %s
+// RUN: %clang_cc1 -verify -fsyntax-only -DD -Wold-style-cast -Wsystem-headers -Werror %s
+// RUN: %clang_cc1 -verify -fsyntax-only -DE -Wold-style-cast -Wsystem-headers -Werror=old-style-cast %s
OpenPOWER on IntegriCloud