static struct c_expr c_parser_expression_conv (c_parser *);
static VEC(tree,gc) *c_parser_expr_list (c_parser *, bool, bool,
VEC(tree,gc) **);
-static void c_parser_release_expr_list (VEC(tree,gc) *);
-static tree c_parser_vec_to_tree_list (VEC(tree,gc) *);
static void c_parser_omp_construct (c_parser *);
static void c_parser_omp_threadprivate (c_parser *);
static void c_parser_omp_barrier (c_parser *);
tree tree_list;
c_parser_consume_token (parser);
expr_list = c_parser_expr_list (parser, false, true, NULL);
- tree_list = c_parser_vec_to_tree_list (expr_list);
+ tree_list = build_tree_list_vec (expr_list);
attr_args = tree_cons (NULL_TREE, arg1, tree_list);
- c_parser_release_expr_list (expr_list);
+ release_tree_vector (expr_list);
}
}
else
else
{
expr_list = c_parser_expr_list (parser, false, true, NULL);
- attr_args = c_parser_vec_to_tree_list (expr_list);
- c_parser_release_expr_list (expr_list);
+ attr_args = build_tree_list_vec (expr_list);
+ release_tree_vector (expr_list);
}
}
attr = build_tree_list (attr_name, attr_args);
expr.value = error_mark_node;
break;
}
+ loc = c_parser_peek_token (parser)->location;
t1 = c_parser_type_name (parser);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
else
{
tree type_expr = NULL_TREE;
- expr.value = build_va_arg (e1.value, groktypename (t1,
- &type_expr,
- NULL));
+ expr.value = c_build_va_arg (e1.value,
+ groktypename (t1, &type_expr, NULL),
+ loc);
if (type_expr)
{
expr.value = build2 (C_MAYBE_CONST_EXPR,
expr.original_type = NULL;
if (exprlist != NULL)
{
- c_parser_release_expr_list (exprlist);
- c_parser_release_expr_list (origtypes);
+ release_tree_vector (exprlist);
+ release_tree_vector (origtypes);
}
break;
case CPP_DOT:
nonempty-expr-list , assignment-expression
*/
-/* We cache two vectors, to save most allocation and deallocation. */
-static GTY((deletable)) VEC(tree,gc) *cached_expr_list_1;
-static GTY((deletable)) VEC(tree,gc) *cached_expr_list_2;
-
static VEC(tree,gc) *
c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p,
VEC(tree,gc) **p_orig_types)
VEC(tree,gc) *orig_types;
struct c_expr expr;
- if (cached_expr_list_1 != NULL)
- {
- ret = cached_expr_list_1;
- cached_expr_list_1 = NULL;
- VEC_truncate (tree, ret, 0);
- }
- else if (cached_expr_list_2 != NULL)
- {
- ret = cached_expr_list_2;
- cached_expr_list_2 = NULL;
- VEC_truncate (tree, ret, 0);
- }
- else
- ret = VEC_alloc (tree, gc, 16);
-
+ ret = make_tree_vector ();
if (p_orig_types == NULL)
orig_types = NULL;
else
- {
- if (cached_expr_list_2 != NULL)
- {
- orig_types = cached_expr_list_2;
- cached_expr_list_2 = NULL;
- VEC_truncate (tree, orig_types, 0);
- }
- else
- orig_types = VEC_alloc (tree, gc, 16);
- }
+ orig_types = make_tree_vector ();
expr = c_parser_expr_no_commas (parser, NULL);
if (convert_p)
*p_orig_types = orig_types;
return ret;
}
-
-/* Release a vector returned by c_parser_expr_list. */
-
-static void
-c_parser_release_expr_list (VEC(tree,gc) *vec)
-{
- if (cached_expr_list_1 == NULL)
- cached_expr_list_1 = vec;
- else if (cached_expr_list_2 == NULL)
- cached_expr_list_2 = vec;
- else
- VEC_free (tree, gc, vec);
-}
-
-/* Convert a vector, as returned by c_parser_expr_list, to a
- tree_list. */
-
-static tree
-c_parser_vec_to_tree_list (VEC(tree,gc) *vec)
-{
- tree ret = NULL_TREE;
- tree *pp = &ret;
- unsigned int i;
- tree t;
- for (i = 0; VEC_iterate (tree, vec, i, t); ++i)
- {
- *pp = build_tree_list (NULL, t);
- pp = &TREE_CHAIN (*pp);
- }
- return ret;
-}
\f
/* Parse Objective-C-specific constructs. */
else
{
/* We have a comma expression, we will collapse later. */
- ret = c_parser_vec_to_tree_list (expr_list);
+ ret = build_tree_list_vec (expr_list);
}
- c_parser_release_expr_list (expr_list);
+ release_tree_vector (expr_list);
return ret;
}