Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -Eonly -verify |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 2 | |
| 3 | // This should not be rejected. |
| 4 | #ifdef defined |
| 5 | #endif |
| 6 | |
Chris Lattner | 688a248 | 2009-03-09 20:33:32 +0000 | [diff] [blame] | 7 | |
| 8 | |
| 9 | // PR3764 |
| 10 | |
| 11 | // This should not produce a redefinition warning. |
| 12 | #define FUNC_LIKE(a) (a) |
| 13 | #define FUNC_LIKE(a)(a) |
| 14 | |
| 15 | // This either. |
| 16 | #define FUNC_LIKE2(a)\ |
| 17 | (a) |
| 18 | #define FUNC_LIKE2(a) (a) |
| 19 | |
| 20 | // This should. |
| 21 | #define FUNC_LIKE3(a) ( a) // expected-note {{previous definition is here}} |
| 22 | #define FUNC_LIKE3(a) (a) // expected-warning {{'FUNC_LIKE3' macro redefined}} |
| 23 | |
Argyrios Kyrtzidis | bd25ff8 | 2013-04-03 17:39:30 +0000 | [diff] [blame^] | 24 | // RUN: %clang_cc1 -fms-extensions -DMS_EXT %s -Eonly -verify |
| 25 | #ifndef MS_EXT |
| 26 | // This should under C99. |
| 27 | #define FUNC_LIKE4(a,b) (a+b) // expected-note {{previous definition is here}} |
| 28 | #define FUNC_LIKE4(x,y) (x+y) // expected-warning {{'FUNC_LIKE4' macro redefined}} |
| 29 | #else |
| 30 | // This shouldn't under MS extensions. |
| 31 | #define FUNC_LIKE4(a,b) (a+b) |
| 32 | #define FUNC_LIKE4(x,y) (x+y) |
| 33 | |
| 34 | // This should. |
| 35 | #define FUNC_LIKE5(a,b) (a+b) // expected-note {{previous definition is here}} |
| 36 | #define FUNC_LIKE5(x,y) (y+x) // expected-warning {{'FUNC_LIKE5' macro redefined}} |
| 37 | #endif |