Skip to content

Commit eac145a

Browse files
committed
[clang][Tests] Enhance diagnostic notes for function-like macros in initializer list tests
1 parent 094887d commit eac145a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

clang/test/Preprocessor/macro_with_initializer_list.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ void test_NE() {
134134
// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{110:32-110:32}:")"
135135

136136
#define INIT(var, init) Foo var = init; // expected-note 3{{macro 'INIT' defined here}}
137+
// expected-note@-1 2{{'INIT' defined here as a function-like macro}}
137138
// Can't use an initializer list as a macro argument. The commas in the list
138139
// will be interpretted as argument separaters and adding parenthesis will
139140
// make it no longer an initializer list.
@@ -159,12 +160,13 @@ void test() {
159160
// expected-note@-3 {{cannot use initializer list at the beginning of a macro argument}}
160161
}
161162

162-
// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{145:11-145:11}:"("
163-
// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{145:23-145:23}:")"
163+
// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{146:11-146:11}:"("
164+
// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{146:23-146:23}:")"
164165

165166
#define M(name,a,b,c,d,e,f,g,h,i,j,k,l) \
166167
Foo name = a + b + c + d + e + f + g + h + i + j + k + l;
167168
// expected-note@-2 2{{defined here}}
169+
// expected-note@-3 {{'M' defined here as a function-like macro}}
168170
void test2() {
169171
M(F1, Foo(), Foo(), Foo(), Foo(), Foo(), Foo(),
170172
Foo(), Foo(), Foo(), Foo(), Foo(), Foo());
@@ -179,4 +181,4 @@ void test2() {
179181
// expected-error@-2 {{too many arguments provided}}
180182
// expected-error@-3 {{use of undeclared identifier}}
181183
// expected-note@-4 {{cannot use initializer list at the beginning of a macro argument}}
182-
}
184+
}

0 commit comments

Comments
 (0)