Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions |
Chris Lattner | 636c5ef | 2009-01-16 08:21:25 +0000 | [diff] [blame] | 2 | |
| 3 | // rdar://6495941 |
| 4 | |
| 5 | #define FOO 1 |
| 6 | #define BAR "2" |
| 7 | |
| 8 | #pragma comment(linker,"foo=" FOO) // expected-error {{pragma comment requires parenthesized identifier and optional string}} |
| 9 | #pragma comment(linker," bar=" BAR) |
| 10 | |
| 11 | #pragma comment( user, "Compiled on " __DATE__ " at " __TIME__ ) |
| 12 | |
| 13 | #pragma comment(foo) // expected-error {{unknown kind of pragma comment}} |
| 14 | #pragma comment(compiler,) // expected-error {{pragma comment requires}} |
| 15 | #define foo compiler |
Chris Lattner | c7d945d | 2009-01-16 19:25:54 +0000 | [diff] [blame] | 16 | #pragma comment(foo) // macro expand kind. |
Chris Lattner | 636c5ef | 2009-01-16 08:21:25 +0000 | [diff] [blame] | 17 | #pragma comment(foo) x // expected-error {{pragma comment requires}} |
| 18 | |
Chris Lattner | c7d945d | 2009-01-16 19:25:54 +0000 | [diff] [blame] | 19 | #pragma comment(user, "foo\abar\nbaz\tsome thing") |
| 20 | |
John McCall | 1ef8a2e | 2010-08-28 22:34:47 +0000 | [diff] [blame] | 21 | |
| 22 | // __pragma |
| 23 | |
| 24 | __pragma(comment(linker," bar=" BAR)) |
| 25 | |
| 26 | #define MACRO_WITH__PRAGMA { \ |
| 27 | __pragma(warning(push)); \ |
| 28 | __pragma(warning(disable: 10000)); \ |
| 29 | 2+2; \ |
| 30 | __pragma(warning(pop)); \ |
| 31 | } |
| 32 | |
| 33 | void f() |
| 34 | { |
| 35 | __pragma() |
| 36 | |
| 37 | // If we ever actually *support* __pragma(warning(disable: x)), |
| 38 | // this warning should go away. |
Argyrios Kyrtzidis | 1b2ad2f | 2010-09-19 23:03:35 +0000 | [diff] [blame^] | 39 | MACRO_WITH__PRAGMA // expected-warning {{expression result unused}} |
John McCall | 1ef8a2e | 2010-08-28 22:34:47 +0000 | [diff] [blame] | 40 | } |