-traditional warning fix in pushdecl

Joern Rennecke amylaar@cygnus.co.uk
Fri May 19 16:03:00 GMT 2000


In the pushdecl -traditional code to determine if a warning for a external
declaration with a non-global type is in place, when you changed the
TYPE_PERMANENT test to use TYPE_CONTEXT instead, you forgot to inverse the
sense of the test.  This causes -traditional to warn about all kinds of
innocent declarations, including all the built-in ones.

FWIW, I've checked that the fixed TYPE_CONTEXT actually catches what it
is supposed to catch.  Most visible non-global types still have no
TYPE_CONTEXT at the time pushdecl is called, since the actual context is
only set in popdecl, just when they go out of scope.  However, struct
tags get a tentative context in pushtag.  That's good enough for our
purposes.
We've never warned about using local typedefs as such because it's the
type that they stand for that we look at, not the typedef itself.

Fri May 19 23:42:03 2000  J"orn Rennecke <amylaar@cygnus.co.uk>

	* c-decl.c (pushdecl): Remove bogus inversion in TYPE_CONTEXT test.

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-decl.c,v
retrieving revision 1.111
diff -p -r1.111 c-decl.c
*** c-decl.c	2000/05/18 17:53:04	1.111
--- c-decl.c	2000/05/19 22:42:19
*************** pushdecl (x)
*** 2202,2208 ****
  	    {
  	      if (type == error_mark_node)
  		break;
! 	      if (! TYPE_CONTEXT (type))
  		{
  		  warning_with_decl (x, "type of external `%s' is not global");
  		  /* By exiting the loop early, we leave TYPE nonzero,
--- 2202,2208 ----
  	    {
  	      if (type == error_mark_node)
  		break;
! 	      if (TYPE_CONTEXT (type))
  		{
  		  warning_with_decl (x, "type of external `%s' is not global");
  		  /* By exiting the loop early, we leave TYPE nonzero,


More information about the Gcc-patches mailing list