diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp-tradwarn2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp-tradwarn2.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp-tradwarn2.c b/gcc/testsuite/gcc.dg/cpp-tradwarn2.c new file mode 100644 index 0000000..783b7bc --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp-tradwarn2.c @@ -0,0 +1,14 @@ +/* K+R rejects use of function-like macros in non-function context. + ANSI C explicitly permits this (the macro is not expanded). */ + +/* { dg-do compile } */ +/* { dg-options -Wtraditional } */ + +enum { SIGN_EXTEND = 23 }; + +#define SIGN_EXTEND(v) (((v) < 0) ? -1 : 0) + +int fun(void) +{ + return SIGN_EXTEND; /* { dg-warning "in non-function context" } */ +} |