OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / tr-warn2.c
1 /* K+R rejects use of function-like macros in non-function context.
2    ANSI C explicitly permits this (the macro is not expanded).
3
4    We should not warn about this during pre-expansion of arguments,
5    since traditional preprocessors don't do pre-expansion, and we get
6    the warning anyway during the re-scan pass if and only if it is
7    appropriate.  */
8
9 /* { dg-do preprocess } */
10 /* { dg-options -Wtraditional } */
11
12 #define f(x) x
13 #define g(x) x / 2
14 #define h(a, b) a(b)
15 f(g) (3)            /* { dg-bogus "must be used with arguments" } */
16 f 2                 /* { dg-warning "must be used with arguments" } */
17 f(g) 3              /* { dg-warning "must be used with arguments" } */
18 h(f, 3)             /* { dg-bogus "must be used with arguments" } */