diff options
| author | Andy Gibbs <andyg1001@hotmail.co.uk> | 2012-11-17 19:14:53 +0000 |
|---|---|---|
| committer | Andy Gibbs <andyg1001@hotmail.co.uk> | 2012-11-17 19:14:53 +0000 |
| commit | b9971bada4eeae74883b61ba96fc6d983b6b0e7f (patch) | |
| tree | c5774497417dd31e99e8ee9e57ec7dda666e13f3 /test/Preprocessor | |
| parent | 7baa711e61258a762db42e449e424bd0928318a6 (diff) | |
| download | clang-b9971bada4eeae74883b61ba96fc6d983b6b0e7f.tar.gz clang-b9971bada4eeae74883b61ba96fc6d983b6b0e7f.tar.bz2 clang-b9971bada4eeae74883b61ba96fc6d983b6b0e7f.tar.xz | |
Fix handling of invalid uses of the __has_warning builtin macro
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Preprocessor')
| -rw-r--r-- | test/Preprocessor/invalid-__has_warning1.c | 5 | ||||
| -rw-r--r-- | test/Preprocessor/invalid-__has_warning2.c | 5 | ||||
| -rw-r--r-- | test/Preprocessor/warning_tests.c | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/test/Preprocessor/invalid-__has_warning1.c b/test/Preprocessor/invalid-__has_warning1.c new file mode 100644 index 0000000000..40491d4767 --- /dev/null +++ b/test/Preprocessor/invalid-__has_warning1.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -verify %s + +// These must be the last lines in this test. +// expected-error@+1{{requires a parenthesized string}} expected-error@+1 2{{expected}} +int i = __has_warning( diff --git a/test/Preprocessor/invalid-__has_warning2.c b/test/Preprocessor/invalid-__has_warning2.c new file mode 100644 index 0000000000..7d85e5376f --- /dev/null +++ b/test/Preprocessor/invalid-__has_warning2.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -verify %s + +// These must be the last lines in this test. +// expected-error@+1{{requires a parenthesized string}} expected-error@+1{{expected}} +int i = __has_warning(); diff --git a/test/Preprocessor/warning_tests.c b/test/Preprocessor/warning_tests.c index 3f2865cdb4..ac0b37b645 100644 --- a/test/Preprocessor/warning_tests.c +++ b/test/Preprocessor/warning_tests.c @@ -11,7 +11,9 @@ #warning Should have -Wparentheses #endif -#if __has_warning(-Wfoo) // expected-error {{builtin warning check macro requires a parenthesized string}} +// expected-error@+2 {{builtin warning check macro requires a parenthesized string}} +// expected-error@+1 {{expected value in expression}} +#if __has_warning(-Wfoo) #endif // expected-warning@+3 {{Not a valid warning flag}} |
