* c-tree.h (build_arg_info): Declare.
* c-decl.c (build_arg_info): Define.
(get_parm_info): Call it. Delete initialization code.
* c-parser.c (c_parser_parms_declarator): Likewise.
(c_parser_parms_list_declaractor): Likewise.
From-SVN: r163014
+2010-08-08 Nathan Froyd <froydnj@codesourcery.com>
+
+ * c-tree.h (build_arg_info): Declare.
+ * c-decl.c (build_arg_info): Define.
+ (get_parm_info): Call it. Delete initialization code.
+ * c-parser.c (c_parser_parms_declarator): Likewise.
+ (c_parser_parms_list_declaractor): Likewise.
+
2010-08-08 Nathan Froyd <froydnj@codesourcery.com>
* c-tree.h (c_arg_tag): Define. Define a VEC containing it.
2010-08-08 Nathan Froyd <froydnj@codesourcery.com>
* c-tree.h (c_arg_tag): Define. Define a VEC containing it.
+/* Allocate and initialize a c_arg_info structure from the parser's
+ obstack. */
+
+struct c_arg_info *
+build_arg_info (void)
+{
+ struct c_arg_info *ret = XOBNEW (&parser_obstack, struct c_arg_info);
+ ret->parms = NULL_TREE;
+ ret->tags = NULL;
+ ret->types = NULL_TREE;
+ ret->others = NULL_TREE;
+ ret->pending_sizes = NULL;
+ ret->had_vla_unspec = 0;
+ return ret;
+}
+
/* Take apart the current scope and return a c_arg_info structure with
info on a parameter list just parsed.
/* Take apart the current scope and return a c_arg_info structure with
info on a parameter list just parsed.
get_parm_info (bool ellipsis)
{
struct c_binding *b = current_scope->bindings;
get_parm_info (bool ellipsis)
{
struct c_binding *b = current_scope->bindings;
- struct c_arg_info *arg_info = XOBNEW (&parser_obstack,
- struct c_arg_info);
+ struct c_arg_info *arg_info = build_arg_info ();
+
tree parms = 0;
VEC(c_arg_tag,gc) *tags = NULL;
tree types = 0;
tree parms = 0;
VEC(c_arg_tag,gc) *tags = NULL;
tree types = 0;
static bool explained_incomplete_types = false;
bool gave_void_only_once_err = false;
static bool explained_incomplete_types = false;
bool gave_void_only_once_err = false;
- arg_info->parms = 0;
- arg_info->tags = 0;
- arg_info->types = 0;
- arg_info->others = 0;
- arg_info->pending_sizes = 0;
arg_info->had_vla_unspec = current_scope->had_vla_unspec;
/* The bindings in this scope must not get put into a block.
arg_info->had_vla_unspec = current_scope->had_vla_unspec;
/* The bindings in this scope must not get put into a block.
static GTY (()) c_parser *the_parser;
static GTY (()) c_parser *the_parser;
/* Read in and lex a single token, storing it in *TOKEN. */
static void
/* Read in and lex a single token, storing it in *TOKEN. */
static void
}
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
}
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
- struct c_arg_info *ret = XOBNEW (&parser_obstack, struct c_arg_info);
- ret->parms = 0;
- ret->tags = 0;
+ struct c_arg_info *ret = build_arg_info ();
- ret->others = 0;
- ret->pending_sizes = 0;
- ret->had_vla_unspec = 0;
c_parser_consume_token (parser);
pop_scope ();
return ret;
c_parser_consume_token (parser);
pop_scope ();
return ret;
declarations. */
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
declarations. */
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
- struct c_arg_info *ret = XOBNEW (&parser_obstack, struct c_arg_info);
- ret->parms = 0;
- ret->tags = 0;
- ret->types = 0;
- ret->others = 0;
- ret->pending_sizes = 0;
- ret->had_vla_unspec = 0;
+ struct c_arg_info *ret = build_arg_info ();
c_parser_consume_token (parser);
return ret;
}
if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
{
c_parser_consume_token (parser);
return ret;
}
if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
{
- struct c_arg_info *ret = XOBNEW (&parser_obstack, struct c_arg_info);
- ret->parms = 0;
- ret->tags = 0;
- ret->others = 0;
- ret->pending_sizes = 0;
- ret->had_vla_unspec = 0;
+ struct c_arg_info *ret = build_arg_info ();
/* Suppress -Wold-style-definition for this case. */
ret->types = error_mark_node;
error_at (c_parser_peek_token (parser)->location,
/* Suppress -Wold-style-definition for this case. */
ret->types = error_mark_node;
error_at (c_parser_peek_token (parser)->location,
extern void finish_function (void);
extern tree finish_struct (location_t, tree, tree, tree,
struct c_struct_parse_info *);
extern void finish_function (void);
extern tree finish_struct (location_t, tree, tree, tree,
struct c_struct_parse_info *);
+extern struct c_arg_info *build_arg_info (void);
extern struct c_arg_info *get_parm_info (bool);
extern tree grokfield (location_t, struct c_declarator *,
struct c_declspecs *, tree, tree *);
extern struct c_arg_info *get_parm_info (bool);
extern tree grokfield (location_t, struct c_declarator *,
struct c_declspecs *, tree, tree *);