Richard Trieu | a1d7ece | 2015-08-27 23:38:45 +0000 | [diff] [blame] | 1 | // RUN: not %clang -cc1 -fsyntax-only %s 2>&1 | FileCheck %s |
| 2 | |
| 3 | #define a b |
| 4 | #define b c |
| 5 | #define c(x) d(x) |
| 6 | #define d(x) x*1 |
| 7 | |
| 8 | #define e f |
| 9 | #define f g |
| 10 | #define g(x) h(x) |
| 11 | #define h(x) x |
| 12 | |
| 13 | void PR16799() { |
| 14 | const char str[] = "string"; |
| 15 | a(str); |
| 16 | // CHECK: :15:3: error: invalid operands to binary expression |
| 17 | // CHECK: ('const char *' and 'int') |
| 18 | // CHECK: a(str); |
Richard Trieu | c309624 | 2015-09-24 01:21:01 +0000 | [diff] [blame] | 19 | // CHECK: ^~~~~~ |
Richard Trieu | a1d7ece | 2015-08-27 23:38:45 +0000 | [diff] [blame] | 20 | // CHECK: :3:11: note: expanded from macro 'a' |
| 21 | // CHECK: #define a b |
| 22 | // CHECK: ^ |
| 23 | // CHECK: :4:11: note: expanded from macro 'b' |
| 24 | // CHECK: #define b c |
| 25 | // CHECK: ^ |
| 26 | // CHECK: :5:14: note: expanded from macro 'c' |
| 27 | // CHECK: #define c(x) d(x) |
| 28 | // CHECK: ^~~~ |
| 29 | // CHECK: :6:15: note: expanded from macro 'd' |
| 30 | // CHECK: #define d(x) x*1 |
Richard Trieu | c309624 | 2015-09-24 01:21:01 +0000 | [diff] [blame] | 31 | // CHECK: ~^~ |
Richard Trieu | a1d7ece | 2015-08-27 23:38:45 +0000 | [diff] [blame] | 32 | |
| 33 | e(str); |
| 34 | // CHECK: :33:5: warning: expression result unused |
| 35 | // CHECK: e(str); |
| 36 | // CHECK: ^~~ |
| 37 | // CHECK: :8:11: note: expanded from macro 'e' |
| 38 | // CHECK: #define e f |
| 39 | // CHECK: ^ |
| 40 | // CHECK: :9:11: note: expanded from macro 'f' |
| 41 | // CHECK: #define f g |
| 42 | // CHECK: ^ |
| 43 | // CHECK: :10:16: note: expanded from macro 'g' |
| 44 | // CHECK: #define g(x) h(x) |
| 45 | // CHECK: ^ |
| 46 | // CHECK: :11:14: note: expanded from macro 'h' |
| 47 | // CHECK: #define h(x) x |
| 48 | // CHECK: ^ |
| 49 | } |
| 50 | // CHECK: 1 warning and 1 error generated. |