diff options
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/cppmacro.c | 7 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/cpp/tr-warn2.c | 22 | 
4 files changed, 28 insertions, 10 deletions
| diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4d1dcb0625..9d5bf6c06bb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-09-20  Neil Booth  <neil@daikokuya.co.uk> + +	* cppmacro.c: Don't warn about function-like macros without +	'(' during pre-expandion. +  2002-09-20  Jim Wilson  <wilson@redhat.com>  	* config/v850/v850.c (current_function_anonymous_args): Delete. diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index ead48f6429c..961109ad100 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -1032,10 +1032,15 @@ expand_arg (pfile, arg)       macro_arg *arg;  {    unsigned int capacity; +  bool saved_warn_trad;    if (arg->count == 0)      return; +  /* Don't warn about funlike macros when pre-expanding.  */ +  saved_warn_trad = CPP_WTRADITIONAL (pfile); +  CPP_WTRADITIONAL (pfile) = 0; +    /* Loop, reading in the arguments.  */    capacity = 256;    arg->expanded = (const cpp_token **) @@ -1062,6 +1067,8 @@ expand_arg (pfile, arg)      }    _cpp_pop_context (pfile); + +  CPP_WTRADITIONAL (pfile) = saved_warn_trad;  }  /* Pop the current context off the stack, re-enabling the macro if the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b7de26b397..eccae633521 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-09-20  Neil Booth  <neil@daikokuya.co.uk> + +	* gcc.dg/cpp/tr-warn2.c: Update. +  2002-09-20  Richard Earnshaw  <rearnsha@arm.com>  	* gcc.c-torture/execute/20020720-1.x: Skip test on ARM-based systems. 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" } */ | 

