diff options
author | Hubert Tong <hubert.reinterpretcast@gmail.com> | 2015-07-30 21:30:00 +0000 |
---|---|---|
committer | Hubert Tong <hubert.reinterpretcast@gmail.com> | 2015-07-30 21:30:00 +0000 |
commit | 0deb694d943f914657437229f077b64aacf4fec7 (patch) | |
tree | 5f5ad326d6d61a79a6b1a9fb60215a1567283a8c /clang/test/Preprocessor/_Pragma.c | |
parent | c9dc96bfc6641e3d92560dfedb9ebac83f6b168c (diff) | |
download | bcm5719-llvm-0deb694d943f914657437229f077b64aacf4fec7.tar.gz bcm5719-llvm-0deb694d943f914657437229f077b64aacf4fec7.zip |
Improved error recovery for _Pragma
Summary:
Currently, if the argument to _Pragma is not a parenthesised string
literal, the bad token will be consumed, as well as the ')', if present.
If additional bad tokens are passed to the _Pragma, this results in
extra error messages which may distract from the true problem.
The proposed patch causes all tokens to be consumed until the closing
')' or a new line, whichever is reached first.
Reviewers: hfinkel, rsmith
Subscribers: hubert.reinterpretcast, fraggamuffin, rnk, cfe-commits
Differential Revision: http://reviews.llvm.org/D8308
Patch by Rachel Craik!
llvm-svn: 243692
Diffstat (limited to 'clang/test/Preprocessor/_Pragma.c')
-rw-r--r-- | clang/test/Preprocessor/_Pragma.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/_Pragma.c b/clang/test/Preprocessor/_Pragma.c index 120e754cb98..99231879ece 100644 --- a/clang/test/Preprocessor/_Pragma.c +++ b/clang/test/Preprocessor/_Pragma.c @@ -12,4 +12,8 @@ _Pragma("message(\"foo \\\\\\\\ bar\")") // expected-warning {{foo \\ bar}} #error #define invalid #endif +_Pragma(unroll 1 // expected-error{{_Pragma takes a parenthesized string literal}} + +_Pragma(clang diagnostic push) // expected-error{{_Pragma takes a parenthesized string literal}} + _Pragma( // expected-error{{_Pragma takes a parenthesized string literal}} |