1 /* { dg-options "-traditional-cpp" } */
2
3 #define MACRO_1(X,Y) /* { dg-line "def_of_MACRO_1" } */
test_1()4 void test_1 ()
5 {
6 MACRO_1(42); /* { dg-line "use_of_MACRO_1" } */
7 /* { dg-error "-:macro \"MACRO_1\" requires 2 arguments, but only 1 given" "" { target c } use_of_MACRO_1 } */
8 /* { dg-error "macro \"MACRO_1\" requires 2 arguments, but only 1 given" "" { target c++ } use_of_MACRO_1 } */
9 /* { dg-message "-: macro .MACRO_1. defined here" "" { target *-*-* } def_of_MACRO_1 } */
10 /* { dg-error "'MACRO_1' was not declared in this scope" "" { target c++ } use_of_MACRO_1 } */
11 /* { dg-bogus "had not yet been defined" "" { target *-*-* } use_of_MACRO_1 } */
12 }
13
14 #define MACRO_2(X,Y) /* { dg-line "def_of_MACRO_2" } */
test_2()15 void test_2 ()
16 {
17 MACRO_2(1, 2, 3); /* { dg-line "use_of_MACRO_2" } */
18 /* { dg-error "-:macro \"MACRO_2\" passed 3 arguments, but takes just 2" "" { target c } use_of_MACRO_2 } */
19 /* { dg-error "macro \"MACRO_2\" passed 3 arguments, but takes just 2" "" { target c++ } use_of_MACRO_2 } */
20 /* { dg-message "-: macro .MACRO_2. defined here" "" { target *-*-* } def_of_MACRO_2 } */
21 /* { dg-error "'MACRO_2' was not declared in this scope" "" { target c++ } use_of_MACRO_2 } */
22 /* { dg-bogus "had not yet been defined" "" { target *-*-* } use_of_MACRO_2 } */
23 }
24
25 #define MACRO_3
test_3()26 void test_3 ()
27 {
28 MACRO_3 (42);
29 }
30
31 #define MACRO_4(X,Y)
test_4()32 void test_4 ()
33 {
34 MACRO_4; /* { dg-line "use_of_MACRO_4" } */
35 /* { dg-error "'MACRO_4' was not declared in this scope" "" { target c++ } use_of_MACRO_4 } */
36 }
37