FreeBSD/contrib/gcc/c-decl.c
/* Decode the parameter-list info for a function type or function definition.
   The argument is the value returned by `get_parm_info' (or made in c-parse.c
   if there is an identifier list instead of a parameter decl list).
   These two functions are separate because when a function returns
   or receives functions then each is called multiple times but the order
   of calls is different.  The last call to `grokparms' is always the one
   that contains the formal parameter names of a function definition.

   Return a list of arg types to use in the FUNCTION_TYPE for this function.

   FUNCDEF_FLAG is true for a function definition, false for
   a mere declaration.  A nonempty identifier-list gets an error message
   when FUNCDEF_FLAG is false.  */
Decode the parameter-list info for a function type or function definition.
The argument is the value returned by `get_parm_info' (or made in c-parse.c
if there is an identifier list instead of a parameter decl list).
These two functions are separate because when a function returns
or receives functions then each is called multiple times but the order
of calls is different.  The last call to `grokparms' is always the one
that contains the formal parameter names of a function definition.

Return a list of arg types to use in the FUNCTION_TYPE for this function.

FUNCDEF_FLAG is true for a function definition, false for
a mere declaration.  A nonempty identifier-list gets an error message
when FUNCDEF_FLAG is false.
Decode the parameter - list info for a function type or function definition . The argument is the value returned by ` get_parm_info ' ( or made in c - parse . c if there is an identifier list instead of a parameter decl list ) . These two functions are separate because when a function returns or receives functions then each is called multiple times but the order of calls is different . The last call to ` grokparms ' is always the one that contains the formal parameter names of a function definition . Return a list of arg types to use in the FUNCTION_TYPE for this function . FUNCDEF_FLAG is true for a function definition false for a mere declaration . A nonempty identifier - list gets an error message when FUNCDEF_FLAG is false .
static tree
grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
{
  tree arg_types = arg_info->types;
  if (funcdef_flag && arg_info->had_vla_unspec)
    {
      error ("%<[*]%> not allowed in other than function prototype scope");
    }
  if (arg_types == 0 && !funcdef_flag && !in_system_header)
    warning (OPT_Wstrict_prototypes,
	     "function declaration isn%'t a prototype");
  if (arg_types == error_mark_node)
    return 0;  
  else if (arg_types && TREE_CODE (TREE_VALUE (arg_types)) == IDENTIFIER_NODE)
    {
      if (!funcdef_flag)
	pedwarn ("parameter names (without types) in function declaration");
      arg_info->parms = arg_info->types;
      arg_info->types = 0;
      return 0;
    }
  else
    {
      tree parm, type, typelt;
      unsigned int parmno;
      for (parm = arg_info->parms, typelt = arg_types, parmno = 1;
	   parm;
	   parm = TREE_CHAIN (parm), typelt = TREE_CHAIN (typelt), parmno++)
	{
	  type = TREE_VALUE (typelt);
	  if (type == error_mark_node)
	    continue;
	  if (!COMPLETE_TYPE_P (type))
	    {
	      if (funcdef_flag)
		{
		  if (DECL_NAME (parm))
		    error ("parameter %u (%q+D) has incomplete type",
			   parmno, parm);
		  else
		    error ("%Jparameter %u has incomplete type",
			   parm, parmno);
		  TREE_VALUE (typelt) = error_mark_node;
		  TREE_TYPE (parm) = error_mark_node;
		}
	      else if (VOID_TYPE_P (type))
		{
		  if (DECL_NAME (parm))
		    warning (0, "parameter %u (%q+D) has void type",
			     parmno, parm);
		  else
		    warning (0, "%Jparameter %u has void type",
			     parm, parmno);
		}
	    }
	  if (DECL_NAME (parm) && TREE_USED (parm))
	    warn_if_shadowing (parm);
	}
      return arg_types;
    }
}
static tree grokparms ( struct c_arg_info * arg_info , bool funcdef_flag ) { tree arg_types = arg_info -> types ; if ( funcdef_flag && arg_info -> had_vla_unspec ) { error ( " " ) ; } if ( arg_types == 0 && ! funcdef_flag && ! in_system_header ) warning ( OPT_Wstrict_prototypes , " " ) ; if ( arg_types == error_mark_node ) return 0 ; else if ( arg_types && TREE_CODE ( TREE_VALUE ( arg_types ) ) == IDENTIFIER_NODE ) { if ( ! funcdef_flag ) pedwarn ( " " ) ; arg_info -> parms = arg_info -> types ; arg_info -> types = 0 ; return 0 ; } else { tree parm , type , typelt ; unsigned int parmno ; for ( parm = arg_info -> parms , typelt = arg_types , parmno = 1 ; parm ; parm = TREE_CHAIN ( parm ) , typelt = TREE_CHAIN ( typelt ) , parmno ++ ) { type = TREE_VALUE ( typelt ) ; if ( type == error_mark_node ) continue ; if ( ! COMPLETE_TYPE_P ( type ) ) { if ( funcdef_flag ) { if ( DECL_NAME ( parm ) ) error ( " " , parmno , parm ) ; else error ( " " , parm , parmno ) ; TREE_VALUE ( typelt ) = error_mark_node ; TREE_TYPE ( parm ) = error_mark_node ; } else if ( VOID_TYPE_P ( type ) ) { if ( DECL_NAME ( parm ) ) warning ( 0 , " " , parmno , parm ) ; else warning ( 0 , " " , parm , parmno ) ; } } if ( DECL_NAME ( parm ) && TREE_USED ( parm ) ) warn_if_shadowing ( parm ) ; } return arg_types ; } }
Decode the parameter-list info for a function type or function definition.
Decode the parameter - list info for a function type or function definition .
/* A function definition isn't function prototype scope C99 6.2.1p4.  */ /* C99 6.7.5.2p4 */ /* don't set TYPE_ARG_TYPES in this case */ /* If there is a parameter of incomplete type in a definition,
	 this is an error.  In a declaration this is valid, and a
	 struct or union type may be completed later, before any calls
	 or definition of the function.  In the case where the tag was
	 first declared within the parameter list, a warning has
	 already been given.  If a parameter has void type, then
	 however the function cannot be defined or called, so
	 warn.  */