FreeBSD/contrib/gcc/c-decl.c
/* WARNED is 1 if we have done a pedwarn, 2 if we have done a warning,
   but no pedwarn.  */
WARNED is 1 if we have done a pedwarn, 2 if we have done a warning,
but no pedwarn.
WARNED is 1 if we have done a pedwarn 2 if we have done a warning but no pedwarn .
void
shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
{
  bool found_tag = false;
  if (declspecs->type && !declspecs->default_int_p && !declspecs->typedef_p)
    {
      tree value = declspecs->type;
      enum tree_code code = TREE_CODE (value);
      if (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE)
	{
	  tree name = TYPE_NAME (value);
	  tree t;
	  found_tag = true;
	  if (name == 0)
	    {
	      if (warned != 1 && code != ENUMERAL_TYPE)
		{
		  pedwarn ("unnamed struct/union that defines no instances");
		  warned = 1;
		}
	    }
	  else if (!declspecs->tag_defined_p
		   && declspecs->storage_class != csc_none)
	    {
	      if (warned != 1)
		pedwarn ("empty declaration with storage class specifier "
			 "does not redeclare tag");
	      warned = 1;
	      pending_xref_error ();
	    }
	  else if (!declspecs->tag_defined_p
		   && (declspecs->const_p
		       || declspecs->volatile_p
		       || declspecs->restrict_p))
	    {
	      if (warned != 1)
		pedwarn ("empty declaration with type qualifier "
			 "does not redeclare tag");
	      warned = 1;
	      pending_xref_error ();
	    }
	  else
	    {
	      pending_invalid_xref = 0;
	      t = lookup_tag (code, name, 1);
	      if (t == 0)
		{
		  t = make_node (code);
		  pushtag (name, t);
		}
	    }
	}
      else
	{
	  if (warned != 1 && !in_system_header)
	    {
	      pedwarn ("useless type name in empty declaration");
	      warned = 1;
	    }
	}
    }
  else if (warned != 1 && !in_system_header && declspecs->typedef_p)
    {
      pedwarn ("useless type name in empty declaration");
      warned = 1;
    }
  pending_invalid_xref = 0;
  if (declspecs->inline_p)
    {
      error ("%<inline%> in empty declaration");
      warned = 1;
    }
  if (current_scope == file_scope && declspecs->storage_class == csc_auto)
    {
      error ("%<auto%> in file-scope empty declaration");
      warned = 1;
    }
  if (current_scope == file_scope && declspecs->storage_class == csc_register)
    {
      error ("%<register%> in file-scope empty declaration");
      warned = 1;
    }
  if (!warned && !in_system_header && declspecs->storage_class != csc_none)
    {
      warning (0, "useless storage class specifier in empty declaration");
      warned = 2;
    }
  if (!warned && !in_system_header && declspecs->thread_p)
    {
      warning (0, "useless %<__thread%> in empty declaration");
      warned = 2;
    }
  if (!warned && !in_system_header && (declspecs->const_p
				       || declspecs->volatile_p
				       || declspecs->restrict_p))
    {
      warning (0, "useless type qualifier in empty declaration");
      warned = 2;
    }
  if (warned != 1)
    {
      if (!found_tag)
	pedwarn ("empty declaration");
    }
}
void shadow_tag_warned ( const struct c_declspecs * declspecs , int warned ) { bool found_tag = false ; if ( declspecs -> type && ! declspecs -> default_int_p && ! declspecs -> typedef_p ) { tree value = declspecs -> type ; enum tree_code code = TREE_CODE ( value ) ; if ( code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE ) { tree name = TYPE_NAME ( value ) ; tree t ; found_tag = true ; if ( name == 0 ) { if ( warned != 1 && code != ENUMERAL_TYPE ) { pedwarn ( " " ) ; warned = 1 ; } } else if ( ! declspecs -> tag_defined_p && declspecs -> storage_class != csc_none ) { if ( warned != 1 ) pedwarn ( " " " " ) ; warned = 1 ; pending_xref_error ( ) ; } else if ( ! declspecs -> tag_defined_p && ( declspecs -> const_p || declspecs -> volatile_p || declspecs -> restrict_p ) ) { if ( warned != 1 ) pedwarn ( " " " " ) ; warned = 1 ; pending_xref_error ( ) ; } else { pending_invalid_xref = 0 ; t = lookup_tag ( code , name , 1 ) ; if ( t == 0 ) { t = make_node ( code ) ; pushtag ( name , t ) ; } } } else { if ( warned != 1 && ! in_system_header ) { pedwarn ( " " ) ; warned = 1 ; } } } else if ( warned != 1 && ! in_system_header && declspecs -> typedef_p ) { pedwarn ( " " ) ; warned = 1 ; } pending_invalid_xref = 0 ; if ( declspecs -> inline_p ) { error ( " " ) ; warned = 1 ; } if ( current_scope == file_scope && declspecs -> storage_class == csc_auto ) { error ( " " ) ; warned = 1 ; } if ( current_scope == file_scope && declspecs -> storage_class == csc_register ) { error ( " " ) ; warned = 1 ; } if ( ! warned && ! in_system_header && declspecs -> storage_class != csc_none ) { warning ( 0 , " " ) ; warned = 2 ; } if ( ! warned && ! in_system_header && declspecs -> thread_p ) { warning ( 0 , " " ) ; warned = 2 ; } if ( ! warned && ! in_system_header && ( declspecs -> const_p || declspecs -> volatile_p || declspecs -> restrict_p ) ) { warning ( 0 , " " ) ; warned = 2 ; } if ( warned != 1 ) { if ( ! found_tag ) pedwarn ( " " ) ; } }
WARNED is 1 if we have done a pedwarn, 2 if we have done a warning,
but no pedwarn.
WARNED is 1 if we have done a pedwarn 2 if we have done a warning but no pedwarn .
/* Used to test also that TYPE_SIZE (value) != 0.
	   That caused warning for `struct foo;' at top level in the file.  */ /* Empty unnamed enum OK */