Chris Lattner | 0a4f1b9 | 2009-04-18 01:13:56 +0000 | [diff] [blame] | 1 | /* RUN: clang-cc %s -Eonly -std=c89 -pedantic -verify |
| 2 | */ |
| 3 | /* PR3937 */ |
| 4 | #define zero() 0 |
| 5 | #define one(x) 0 |
| 6 | #define two(x, y) 0 |
| 7 | |
| 8 | zero() |
| 9 | zero(1); /* expected-error {{too many arguments provided to function-like macro invocation}} */ |
| 10 | zero(1, 2, 3); /* expected-error {{too many arguments provided to function-like macro invocation}} */ |
| 11 | |
| 12 | one() /* ok */ |
| 13 | one(a) |
| 14 | one(a,) /* expected-error {{too many arguments provided to function-like macro invocation}} */ |
| 15 | one(a, b) /* expected-error {{too many arguments provided to function-like macro invocation}} */ |
| 16 | |
| 17 | two() /* expected-error {{too few arguments provided to function-like macro invocation}} */ |
| 18 | two(a) /* expected-error {{too few arguments provided to function-like macro invocation}} */ |
| 19 | two(a,b) |
| 20 | two(a, ) /* expected-warning {{empty macro arguments were standardized in C99}} */ |
| 21 | two(a,b,c) /* expected-error {{too many arguments provided to function-like macro invocation}} */ |
| 22 | two( |
| 23 | , /* expected-warning {{empty macro arguments were standardized in C99}} */ |
| 24 | , /* expected-warning {{empty macro arguments were standardized in C99}} \ |
| 25 | expected-error {{too many arguments provided to function-like macro invocation}} */ |
| 26 | ) |
| 27 | two(,) /* expected-warning 2 {{empty macro arguments were standardized in C99}} */ |
Chris Lattner | 8fde597 | 2009-04-19 18:26:34 +0000 | [diff] [blame^] | 28 | |
| 29 | |
| 30 | |
| 31 | /* PR4006 */ |
| 32 | #define e(...) __VA_ARGS__ /* expected-warning {{variadic macros were introduced in C99}} */ |
| 33 | e(x) |