diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-04-16 00:07:09 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-04-16 00:07:09 +0000 |
| commit | 4d247e7012ae6355c9b63b6a6549adadd0a16fd1 (patch) | |
| tree | 7a9023b34b23836242445e0198efc694ec78c0ce /clang/test/Preprocessor | |
| parent | 60469e2ac0248f29afb4a9247913410ecef8ddd4 (diff) | |
| download | bcm5719-llvm-4d247e7012ae6355c9b63b6a6549adadd0a16fd1.tar.gz bcm5719-llvm-4d247e7012ae6355c9b63b6a6549adadd0a16fd1.zip | |
Improve diagnostic for the case when a non-defined function-like macro is used
in a preprocessor constant expression.
llvm-svn: 266495
Diffstat (limited to 'clang/test/Preprocessor')
| -rw-r--r-- | clang/test/Preprocessor/expr_invalid_tok.c | 19 | ||||
| -rw-r--r-- | clang/test/Preprocessor/has_attribute.c | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/clang/test/Preprocessor/expr_invalid_tok.c b/clang/test/Preprocessor/expr_invalid_tok.c index 5defcc5bfbb..0b97b255f11 100644 --- a/clang/test/Preprocessor/expr_invalid_tok.c +++ b/clang/test/Preprocessor/expr_invalid_tok.c @@ -1,15 +1,28 @@ -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'invalid token at start of a preprocessor expression' -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'token is not a valid binary operator in a preprocessor subexpression' -// RUN: not %clang_cc1 -E %s 2>&1 | grep ':14: error: expected end of line in preprocessor expression' +// RUN: not %clang_cc1 -E %s 2>&1 | FileCheck %s // PR2220 +// CHECK: invalid token at start of a preprocessor expression #if 1 * * 2 #endif +// CHECK: token is not a valid binary operator in a preprocessor subexpression #if 4 [ 2 #endif // PR2284 - The constant-expr production does not including comma. +// CHECK: [[@LINE+1]]:14: error: expected end of line in preprocessor expression #if 1 ? 2 : 0, 1 #endif + +// CHECK: [[@LINE+1]]:5: error: function-like macro 'FOO' is not defined +#if FOO(1, 2, 3) +#endif + +// CHECK: [[@LINE+1]]:9: error: function-like macro 'BAR' is not defined +#if 1 + BAR(1, 2, 3) +#endif + +// CHECK: [[@LINE+1]]:10: error: token is not a valid binary operator +#if (FOO)(1, 2, 3) +#endif diff --git a/clang/test/Preprocessor/has_attribute.c b/clang/test/Preprocessor/has_attribute.c index 1a3c2a0e18c..4970dc59042 100644 --- a/clang/test/Preprocessor/has_attribute.c +++ b/clang/test/Preprocessor/has_attribute.c @@ -54,5 +54,5 @@ int has_no_volatile_attribute(); int does_not_have_uuid #endif -#if __has_cpp_attribute(selectany) // expected-error {{token is not a valid binary operator in a preprocessor subexpression}} +#if __has_cpp_attribute(selectany) // expected-error {{function-like macro '__has_cpp_attribute' is not defined}} #endif |

