FreeBSD/contrib/gcc/cp/parser.c
/* Parse a new-type-id.

   new-type-id:
     type-specifier-seq new-declarator [opt]

   Returns the TYPE allocated.  If the new-type-id indicates an array
   type, *NELTS is set to the number of elements in the last array
   bound; the TYPE will not include the last array bound.  */
Parse a new-type-id.

Returns the TYPE allocated.  If the new-type-id indicates an array
type, *NELTS is set to the number of elements in the last array
bound; the TYPE will not include the last array bound.
Parse a new - type - id . Returns the TYPE allocated . If the new - type - id indicates an array type * NELTS is set to the number of elements in the last array bound ; the TYPE will not include the last array bound .
static tree
cp_parser_new_type_id (cp_parser* parser, tree *nelts)
{
  cp_decl_specifier_seq type_specifier_seq;
  cp_declarator *new_declarator;
  cp_declarator *declarator;
  cp_declarator *outer_declarator;
  const char *saved_message;
  tree type;
  saved_message = parser->type_definition_forbidden_message;
  parser->type_definition_forbidden_message
    = "types may not be defined in a new-type-id";
  cp_parser_type_specifier_seq (parser, false,
				&type_specifier_seq);
  parser->type_definition_forbidden_message = saved_message;
  new_declarator = cp_parser_new_declarator_opt (parser);
  *nelts = NULL_TREE;
  declarator = new_declarator;
  outer_declarator = NULL;
  while (declarator && (declarator->kind == cdk_pointer
			|| declarator->kind == cdk_ptrmem))
    {
      outer_declarator = declarator;
      declarator = declarator->declarator;
    }
  while (declarator
	 && declarator->kind == cdk_array
	 && declarator->declarator
	 && declarator->declarator->kind == cdk_array)
    {
      outer_declarator = declarator;
      declarator = declarator->declarator;
    }
  if (declarator && declarator->kind == cdk_array)
    {
      *nelts = declarator->u.array.bounds;
      if (*nelts == error_mark_node)
	*nelts = integer_one_node;
      if (outer_declarator)
	outer_declarator->declarator = declarator->declarator;
      else
	new_declarator = NULL;
    }
  type = groktypename (&type_specifier_seq, new_declarator);
  if (TREE_CODE (type) == ARRAY_TYPE && *nelts == NULL_TREE)
    {
      *nelts = array_type_nelts_top (type);
      type = TREE_TYPE (type);
    }
  return type;
}
static tree cp_parser_new_type_id ( cp_parser * parser , tree * nelts ) { cp_decl_specifier_seq type_specifier_seq ; cp_declarator * new_declarator ; cp_declarator * declarator ; cp_declarator * outer_declarator ; const char * saved_message ; tree type ; saved_message = parser -> type_definition_forbidden_message ; parser -> type_definition_forbidden_message = " " ; cp_parser_type_specifier_seq ( parser , false , & type_specifier_seq ) ; parser -> type_definition_forbidden_message = saved_message ; new_declarator = cp_parser_new_declarator_opt ( parser ) ; * nelts = NULL_TREE ; declarator = new_declarator ; outer_declarator = NULL ; while ( declarator && ( declarator -> kind == cdk_pointer || declarator -> kind == cdk_ptrmem ) ) { outer_declarator = declarator ; declarator = declarator -> declarator ; } while ( declarator && declarator -> kind == cdk_array && declarator -> declarator && declarator -> declarator -> kind == cdk_array ) { outer_declarator = declarator ; declarator = declarator -> declarator ; } if ( declarator && declarator -> kind == cdk_array ) { * nelts = declarator -> u . array . bounds ; if ( * nelts == error_mark_node ) * nelts = integer_one_node ; if ( outer_declarator ) outer_declarator -> declarator = declarator -> declarator ; else new_declarator = NULL ; } type = groktypename ( & type_specifier_seq , new_declarator ) ; if ( TREE_CODE ( type ) == ARRAY_TYPE && * nelts == NULL_TREE ) { * nelts = array_type_nelts_top ( type ) ; type = TREE_TYPE ( type ) ; } return type ; }
Parse a new-type-id.
Parse a new - type - id .
/* The type-specifier sequence must not contain type definitions.
     (It cannot contain declarations of new types either, but if they
     are not definitions we will catch that because they are not
     complete.)  */ /* Parse the type-specifier-seq.  */ /*is_condition=*/ /* Restore the old message.  */ /* Parse the new-declarator.  */ /* Determine the number of elements in the last array dimension, if
     any.  */ /* Skip down to the last array dimension.  */