blob: 90dc2f06d68f7e5d72c8c7cacdf4928764c77e92 [file] [log] [blame]
Chris Lattner0a4f1b92009-04-18 01:13:56 +00001/* 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
8zero()
9zero(1); /* expected-error {{too many arguments provided to function-like macro invocation}} */
10zero(1, 2, 3); /* expected-error {{too many arguments provided to function-like macro invocation}} */
11
12one() /* ok */
13one(a)
14one(a,) /* expected-error {{too many arguments provided to function-like macro invocation}} */
15one(a, b) /* expected-error {{too many arguments provided to function-like macro invocation}} */
16
17two() /* expected-error {{too few arguments provided to function-like macro invocation}} */
18two(a) /* expected-error {{too few arguments provided to function-like macro invocation}} */
19two(a,b)
20two(a, ) /* expected-warning {{empty macro arguments were standardized in C99}} */
21two(a,b,c) /* expected-error {{too many arguments provided to function-like macro invocation}} */
22two(
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 )
27two(,) /* expected-warning 2 {{empty macro arguments were standardized in C99}} */
Chris Lattner8fde5972009-04-19 18:26:34 +000028
29
30
31/* PR4006 */
32#define e(...) __VA_ARGS__ /* expected-warning {{variadic macros were introduced in C99}} */
33e(x)