2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 %s -verify -Wall
|
2006-07-03 05:23:03 +08:00
|
|
|
|
2009-05-13 14:07:25 +08:00
|
|
|
_Pragma ("GCC system_header") // expected-warning {{system_header ignored in main file}}
|
2006-07-03 05:23:03 +08:00
|
|
|
|
2009-05-13 14:10:29 +08:00
|
|
|
// rdar://6880630
|
|
|
|
_Pragma("#define macro") // expected-warning {{unknown pragma ignored}}
|
|
|
|
|
2013-09-26 00:42:48 +08:00
|
|
|
_Pragma("") // expected-warning {{unknown pragma ignored}}
|
|
|
|
_Pragma("message(\"foo \\\\\\\\ bar\")") // expected-warning {{foo \\ bar}}
|
|
|
|
|
2009-05-13 14:10:29 +08:00
|
|
|
#ifdef macro
|
|
|
|
#error #define invalid
|
|
|
|
#endif
|
2014-08-15 03:47:06 +08:00
|
|
|
|
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
2015-07-31 05:30:00 +08:00
|
|
|
_Pragma(unroll 1 // expected-error{{_Pragma takes a parenthesized string literal}}
|
|
|
|
|
|
|
|
_Pragma(clang diagnostic push) // expected-error{{_Pragma takes a parenthesized string literal}}
|
|
|
|
|
2014-08-15 03:47:06 +08:00
|
|
|
_Pragma( // expected-error{{_Pragma takes a parenthesized string literal}}
|