Chris Lattner | 9944f78 | 2009-12-07 01:49:36 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -E -dM %s -o - | FileCheck %s -strict-whitespace |
Chris Lattner | f73903a | 2009-02-06 06:45:26 +0000 | [diff] [blame] | 2 | |
Chris Lattner | 9944f78 | 2009-12-07 01:49:36 +0000 | [diff] [blame] | 3 | // Space at end even without expansion tokens |
| 4 | // CHECK: {{#define A[(]x[)] $}} |
Chris Lattner | f73903a | 2009-02-06 06:45:26 +0000 | [diff] [blame] | 5 | #define A(x) |
| 6 | |
| 7 | // Space before expansion list. |
Chris Lattner | 9944f78 | 2009-12-07 01:49:36 +0000 | [diff] [blame] | 8 | // CHECK: {{#define B[(]x,y[)] x y$}} |
Chris Lattner | f73903a | 2009-02-06 06:45:26 +0000 | [diff] [blame] | 9 | #define B(x,y)x y |
| 10 | |
Chris Lattner | 9944f78 | 2009-12-07 01:49:36 +0000 | [diff] [blame] | 11 | // No space in argument list. |
| 12 | // CHECK: #define C(x,y) x y |
Chris Lattner | f73903a | 2009-02-06 06:45:26 +0000 | [diff] [blame] | 13 | #define C(x, y) x y |
| 14 | |
| 15 | // No paste avoidance. |
Chris Lattner | 5146b1b | 2009-12-07 01:57:13 +0000 | [diff] [blame^] | 16 | // CHECK: #define D() .. |
| 17 | #define D() .. |
Chris Lattner | f73903a | 2009-02-06 06:45:26 +0000 | [diff] [blame] | 18 | |
| 19 | // Simple test. |
Chris Lattner | 5146b1b | 2009-12-07 01:57:13 +0000 | [diff] [blame^] | 20 | // CHECK: #define E . |
| 21 | // CHECK: #define F X()Y |
| 22 | #define E . |
| 23 | #define F X()Y |
Chris Lattner | f73903a | 2009-02-06 06:45:26 +0000 | [diff] [blame] | 24 | |
| 25 | // gcc prints macros at end of translation unit, so last one wins. |
Chris Lattner | 5146b1b | 2009-12-07 01:57:13 +0000 | [diff] [blame^] | 26 | // CHECK: #define G 2 |
| 27 | #define G 1 |
| 28 | #undef G |
| 29 | #define G 2 |