summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg/cpp/tr-warn2.c
blob: 41be76e316e72064ebdaeca6db464f706adac22a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* K+R rejects use of function-like macros in non-function context.
   ANSI C explicitly permits this (the macro is not expanded).

   We should not warn about this during pre-expansion of arguments,
   since traditional preprocessors don't do pre-expansion, and we get
   the warning anyway during the re-scan pass if and only if it is
   appropriate.  */

/* { dg-do preprocess } */
/* { dg-options -Wtraditional } */

#define f(x) x
#define g(x) x / 2
f(g) (3)	    /* { dg-bogus "must be used with arguments" } */
f 2		    /* { dg-warning "must be used with arguments" } */
f(g) 3		    /* { dg-warning "must be used with arguments" } */
OpenPOWER on IntegriCloud