1 // RUN: not %clang -fsyntax-only -fmacro-backtrace-limit=0 %s 2>&1 | FileCheck %s
2 
3 #define FOO 1+"hi"
4 #define BAR FOO
5 #define BAZ BAR
6 #define QUZ BAZ
7 #define TAZ QUZ
8 #define ABA TAZ
9 #define BAB ABA
10 #define ZAZ BAB
11 #define WAZ ZAZ
12 #define DROOL WAZ
13 #define FOOL DROOL
14 
15 FOOL;
16 
17 // CHECK: :15:1: error: expected identifier or '('
18 // CHECK: FOOL
19 // CHECK: ^
20 // CHECK: :13:14: note: expanded from macro 'FOOL'
21 // CHECK: #define FOOL DROOL
22 // CHECK:              ^
23 // CHECK: :12:15: note: expanded from macro 'DROOL'
24 // CHECK: #define DROOL WAZ
25 // CHECK:               ^
26 // CHECK: :11:13: note: expanded from macro 'WAZ'
27 // CHECK: #define WAZ ZAZ
28 // CHECK:             ^
29 // CHECK: :10:13: note: expanded from macro 'ZAZ'
30 // CHECK: #define ZAZ BAB
31 // CHECK:             ^
32 // CHECK: :9:13: note: expanded from macro 'BAB'
33 // CHECK: #define BAB ABA
34 // CHECK:             ^
35 // CHECK: :8:13: note: expanded from macro 'ABA'
36 // CHECK: #define ABA TAZ
37 // CHECK:             ^
38 // CHECK: :7:13: note: expanded from macro 'TAZ'
39 // CHECK: #define TAZ QUZ
40 // CHECK:             ^
41 // CHECK: :6:13: note: expanded from macro 'QUZ'
42 // CHECK: #define QUZ BAZ
43 // CHECK:             ^
44 // CHECK: :5:13: note: expanded from macro 'BAZ'
45 // CHECK: #define BAZ BAR
46 // CHECK:             ^
47 // CHECK: :4:13: note: expanded from macro 'BAR'
48 // CHECK: #define BAR FOO
49 // CHECK:             ^
50 // CHECK: :3:13: note: expanded from macro 'FOO'
51 // CHECK: #define FOO 1+"hi"
52 // CHECK:             ^
53 
54 #define ADD(a, b) a ## #b
55 ADD(L, foo)
56 // CHECK:    error: expected identifier or '('
57 // CHECK:    ADD(L, foo)
58 // CHECK: {{^\^}}
59 // CHECK:    note: expanded from macro 'ADD'
60 // CHECK:    #define ADD(a, b) a ## #b
61 // CHECK: {{^                  \^}}
62 // CHECK:    note: expanded from here
63 // CHECK:    L"foo"
64 // CHECK: {{^\^}}
65 
66 // CHECK: 2 errors generated.
67