FreeBSD/contrib/gcc/c-decl.c
/* Add the storage class specifier or function specifier SCSPEC to the
   declaration specifiers SPECS, returning SPECS.  */
Add the storage class specifier or function specifier SCSPEC to the
declaration specifiers SPECS, returning SPECS.
Add the storage class specifier or function specifier SCSPEC to the declaration specifiers SPECS returning SPECS .
struct c_declspecs *
declspecs_add_scspec (struct c_declspecs *specs, tree scspec)
{
  enum rid i;
  enum c_storage_class n = csc_none;
  bool dupe = false;
  specs->declspecs_seen_p = true;
  gcc_assert (TREE_CODE (scspec) == IDENTIFIER_NODE
	      && C_IS_RESERVED_WORD (scspec));
  i = C_RID_CODE (scspec);
  if (extra_warnings && specs->non_sc_seen_p)
    warning (OPT_Wextra, "%qE is not at beginning of declaration", scspec);
  switch (i)
    {
    case RID_INLINE:
      dupe = false;
      specs->inline_p = true;
      break;
    case RID_THREAD:
      dupe = specs->thread_p;
      if (specs->storage_class == csc_auto)
	error ("%<__thread%> used with %<auto%>");
      else if (specs->storage_class == csc_register)
	error ("%<__thread%> used with %<register%>");
      else if (specs->storage_class == csc_typedef)
	error ("%<__thread%> used with %<typedef%>");
      else
	specs->thread_p = true;
      break;
    case RID_AUTO:
      n = csc_auto;
      break;
    case RID_EXTERN:
      n = csc_extern;
      if (specs->thread_p)
	error ("%<__thread%> before %<extern%>");
      break;
    case RID_REGISTER:
      n = csc_register;
      break;
    case RID_STATIC:
      n = csc_static;
      if (specs->thread_p)
	error ("%<__thread%> before %<static%>");
      break;
    case RID_TYPEDEF:
      n = csc_typedef;
      break;
    default:
      gcc_unreachable ();
    }
  if (n != csc_none && n == specs->storage_class)
    dupe = true;
  if (dupe)
    error ("duplicate %qE", scspec);
  if (n != csc_none)
    {
      if (specs->storage_class != csc_none && n != specs->storage_class)
	{
	  error ("multiple storage classes in declaration specifiers");
	}
      else
	{
	  specs->storage_class = n;
	  if (n != csc_extern && n != csc_static && specs->thread_p)
	    {
	      error ("%<__thread%> used with %qE", scspec);
	      specs->thread_p = false;
	    }
	}
    }
  return specs;
}
struct c_declspecs * declspecs_add_scspec ( struct c_declspecs * specs , tree scspec ) { enum rid i ; enum c_storage_class n = csc_none ; bool dupe = false ; specs -> declspecs_seen_p = true ; gcc_assert ( TREE_CODE ( scspec ) == IDENTIFIER_NODE && C_IS_RESERVED_WORD ( scspec ) ) ; i = C_RID_CODE ( scspec ) ; if ( extra_warnings && specs -> non_sc_seen_p ) warning ( OPT_Wextra , " " , scspec ) ; switch ( i ) { case RID_INLINE : dupe = false ; specs -> inline_p = true ; break ; case RID_THREAD : dupe = specs -> thread_p ; if ( specs -> storage_class == csc_auto ) error ( " " ) ; else if ( specs -> storage_class == csc_register ) error ( " " ) ; else if ( specs -> storage_class == csc_typedef ) error ( " " ) ; else specs -> thread_p = true ; break ; case RID_AUTO : n = csc_auto ; break ; case RID_EXTERN : n = csc_extern ; if ( specs -> thread_p ) error ( " " ) ; break ; case RID_REGISTER : n = csc_register ; break ; case RID_STATIC : n = csc_static ; if ( specs -> thread_p ) error ( " " ) ; break ; case RID_TYPEDEF : n = csc_typedef ; break ; default : gcc_unreachable ( ) ; } if ( n != csc_none && n == specs -> storage_class ) dupe = true ; if ( dupe ) error ( " " , scspec ) ; if ( n != csc_none ) { if ( specs -> storage_class != csc_none && n != specs -> storage_class ) { error ( " " ) ; } else { specs -> storage_class = n ; if ( n != csc_extern && n != csc_static && specs -> thread_p ) { error ( " " , scspec ) ; specs -> thread_p = false ; } } } return specs ; }
Add the storage class specifier or function specifier SCSPEC to the
declaration specifiers SPECS, returning SPECS.
Add the storage class specifier or function specifier SCSPEC to the declaration specifiers SPECS returning SPECS .
/* C99 permits duplicate inline.  Although of doubtful utility,
	 it seems simplest to permit it in gnu89 mode as well, as
	 there is also little utility in maintaining this as a
	 difference between gnu89 and C99 inline.  */ /* Diagnose "__thread extern".  */ /* Diagnose "__thread static".  */