| 1 |
/* Test that we correctly complain about an invalid number of macro |
| 2 |
arguments. */ |
| 3 |
|
| 4 |
/* { dg-do preprocess } */ |
| 5 |
|
| 6 |
#define f(x) x |
| 7 |
#define g(x, y) x y |
| 8 |
#define h() |
| 9 |
|
| 10 |
f(); /* { dg-bogus "-:requires 1" "no arg is 1 empty arg" } */ |
| 11 |
f( ); /* { dg-bogus "-:macro" "1 arg to 1 param macro" } */ |
| 12 |
f(1,); /* { dg-error "-:passed 2" "2 args to 1 param macro" } */ |
| 13 |
f(1,2); /* { dg-error "-:passed 2" "2 args to 1 param macro" } */ |
| 14 |
h(); /* { dg-bogus "-:macro" "no arg to 1 param macro" } */ |
| 15 |
h( ); /* { dg-error "-:passed 1" "1 arg to 0 param macro" } */ |
| 16 |
h(1,2); /* { dg-error "-:passed 2" "2 args to 0 param macro" } */ |
| 17 |
g(); /* { dg-error "-:requires 2" "0 args to 2 param macro" } */ |
| 18 |
g( ); /* { dg-error "-:requires 2" "1 args to 2 param macro" } */ |
| 19 |
g( ,2); /* { dg-bogus "-:requires 2" "2 args to 2 param macro" } */ |
| 20 |
g(,); /* { dg-bogus "-:requires 2" "2 args to 2 param macro" } */ |
| 21 |
g(1,2,3); /* { dg-error "-:passed 3" "3 args to 2 param macro" } */ |