diff options
author | Alp Toker <alp@nuanti.com> | 2014-01-25 00:32:40 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-01-25 00:32:40 +0000 |
commit | 0d05ab46c656ba334bdded25ff100aa083ceee99 (patch) | |
tree | cbd43859faac2847e3975597baf874351ceb4536 /test/Headers | |
parent | 0f96528104a24f869c923267ff32b1449a0289b4 (diff) | |
download | clang-0d05ab46c656ba334bdded25ff100aa083ceee99.tar.gz |
Add a proper test for -Wsystem-headers
This will be extended as we fix issues in the current implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Headers')
-rw-r--r-- | test/Headers/warn-sysheader.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Headers/warn-sysheader.cpp b/test/Headers/warn-sysheader.cpp new file mode 100644 index 0000000000..dbc38258c4 --- /dev/null +++ b/test/Headers/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 |