diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp/tr-warn2.c')
| -rw-r--r-- | gcc/testsuite/gcc.dg/cpp/tr-warn2.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn2.c b/gcc/testsuite/gcc.dg/cpp/tr-warn2.c index 413ac5c4e22..41be76e316e 100644 --- a/gcc/testsuite/gcc.dg/cpp/tr-warn2.c +++ b/gcc/testsuite/gcc.dg/cpp/tr-warn2.c @@ -1,14 +1,16 @@ /* K+R rejects use of function-like macros in non-function context. - ANSI C explicitly permits this (the macro is not expanded). */ + ANSI C explicitly permits this (the macro is not expanded). -/* { dg-do compile } */ -/* { dg-options -Wtraditional } */ - -enum { SIGN_EXTEND = 23 }; + 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. */ -#define SIGN_EXTEND(v) (((v) < 0) ? -1 : 0) +/* { dg-do preprocess } */ +/* { dg-options -Wtraditional } */ -int fun() -{ - return SIGN_EXTEND; /* { dg-warning "must be used with arguments" } */ -} +#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" } */ |

