~shimon/dismaltc

ref: 1ed81693aae22a7be0136e601ee14b226cce74d4 dismaltc/clang/test/Misc/diag-macro-backtrace.c -rw-r--r-- 1.8 KiB
1ed81693Itoh Shimon oops, re-enabled more tests. 1 year, 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// RUN: not %clang -fsyntax-only -fmacro-backtrace-limit=0 %s 2>&1 | FileCheck %s

#define FOO 1+"hi" 
#define BAR FOO
#define BAZ BAR
#define QUZ BAZ
#define TAZ QUZ
#define ABA TAZ
#define BAB ABA
#define ZAZ BAB
#define WAZ ZAZ
#define DROOL WAZ
#define FOOL DROOL

FOOL;

// CHECK: :15:1: error: expected identifier or '('
// CHECK: FOOL
// CHECK: ^
// CHECK: :13:14: note: expanded from macro 'FOOL'
// CHECK: #define FOOL DROOL
// CHECK:              ^
// CHECK: :12:15: note: expanded from macro 'DROOL'
// CHECK: #define DROOL WAZ
// CHECK:               ^
// CHECK: :11:13: note: expanded from macro 'WAZ'
// CHECK: #define WAZ ZAZ
// CHECK:             ^
// CHECK: :10:13: note: expanded from macro 'ZAZ'
// CHECK: #define ZAZ BAB
// CHECK:             ^
// CHECK: :9:13: note: expanded from macro 'BAB'
// CHECK: #define BAB ABA
// CHECK:             ^
// CHECK: :8:13: note: expanded from macro 'ABA'
// CHECK: #define ABA TAZ
// CHECK:             ^
// CHECK: :7:13: note: expanded from macro 'TAZ'
// CHECK: #define TAZ QUZ
// CHECK:             ^
// CHECK: :6:13: note: expanded from macro 'QUZ'
// CHECK: #define QUZ BAZ
// CHECK:             ^
// CHECK: :5:13: note: expanded from macro 'BAZ'
// CHECK: #define BAZ BAR
// CHECK:             ^
// CHECK: :4:13: note: expanded from macro 'BAR'
// CHECK: #define BAR FOO
// CHECK:             ^
// CHECK: :3:13: note: expanded from macro 'FOO'
// CHECK: #define FOO 1+"hi" 
// CHECK:             ^

#define ADD(a, b) a ## #b
ADD(L, foo)
// CHECK:    error: expected identifier or '('
// CHECK:    ADD(L, foo)
// CHECK: {{^\^}}
// CHECK:    note: expanded from macro 'ADD'
// CHECK:    #define ADD(a, b) a ## #b
// CHECK: {{^                  \^}}
// CHECK:    note: expanded from here
// CHECK:    L"foo"
// CHECK: {{^\^}}

// CHECK: 2 errors generated.