Author: alp
Date: Fri Jan 24 18:32:40 2014
New Revision: 200054

URL: http://llvm.org/viewvc/llvm-project?rev=200054&view=rev
Log:
Add a proper test for -Wsystem-headers

This will be extended as we fix issues in the current implementation.

Added:
    cfe/trunk/test/Headers/warn-sysheader.cpp

Added: cfe/trunk/test/Headers/warn-sysheader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/warn-sysheader.cpp?rev=200054&view=auto
==============================================================================
--- cfe/trunk/test/Headers/warn-sysheader.cpp (added)
+++ cfe/trunk/test/Headers/warn-sysheader.cpp Fri Jan 24 18:32:40 2014
@@ -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


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to