comparison gcc/testsuite/gcc.dg/cpp/tr-warn2.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
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" } */