Commit 86b8fed1 by Nathan Froyd Committed by Nathan Froyd

call.c (build_call_n): Call XALLOCAVEC instead of alloca.

	* call.c (build_call_n): Call XALLOCAVEC instead of alloca.
	(build_op_delete_call): Likewise.
	(build_over_call): Likewise.
	* cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise.
	* pt.c (process_partial_specialization): Likewise.
	(tsubst_template_args): Likewise.
	* semantics.c (finish_asm_stmt): Likewise.

From-SVN: r160485
parent 8d681dbf
2010-06-09 Nathan Froyd <froydnj@codesourcery.com>
* call.c (build_call_n): Call XALLOCAVEC instead of alloca.
(build_op_delete_call): Likewise.
(build_over_call): Likewise.
* cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise.
* pt.c (process_partial_specialization): Likewise.
(tsubst_template_args): Likewise.
* semantics.c (finish_asm_stmt): Likewise.
2010-06-08 Nathan Sidwell <nathan@codesourcery.com> 2010-06-08 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (record_key_method_defined): New, broken out of ... * decl.c (record_key_method_defined): New, broken out of ...
......
...@@ -282,7 +282,7 @@ build_call_n (tree function, int n, ...) ...@@ -282,7 +282,7 @@ build_call_n (tree function, int n, ...)
return build_call_a (function, 0, NULL); return build_call_a (function, 0, NULL);
else else
{ {
tree *argarray = (tree *) alloca (n * sizeof (tree)); tree *argarray = XALLOCAVEC (tree, n);
va_list ap; va_list ap;
int i; int i;
...@@ -4756,7 +4756,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size, ...@@ -4756,7 +4756,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
/* The placement args might not be suitable for overload /* The placement args might not be suitable for overload
resolution at this point, so build the call directly. */ resolution at this point, so build the call directly. */
int nargs = call_expr_nargs (placement); int nargs = call_expr_nargs (placement);
tree *argarray = (tree *) alloca (nargs * sizeof (tree)); tree *argarray = XALLOCAVEC (tree, nargs);
int i; int i;
argarray[0] = addr; argarray[0] = addr;
for (i = 1; i < nargs; i++) for (i = 1; i < nargs; i++)
...@@ -5624,7 +5624,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ...@@ -5624,7 +5624,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
nargs = VEC_length (tree, args) + (first_arg != NULL_TREE ? 1 : 0); nargs = VEC_length (tree, args) + (first_arg != NULL_TREE ? 1 : 0);
if (parmlen > nargs) if (parmlen > nargs)
nargs = parmlen; nargs = parmlen;
argarray = (tree *) alloca (nargs * sizeof (tree)); argarray = XALLOCAVEC (tree, nargs);
/* The implicit parameters to a constructor are not considered by overload /* The implicit parameters to a constructor are not considered by overload
resolution, and must be of the proper type. */ resolution, and must be of the proper type. */
......
...@@ -981,7 +981,7 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) ...@@ -981,7 +981,7 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
return NULL; return NULL;
nargs = list_length (DECL_ARGUMENTS (fn)); nargs = list_length (DECL_ARGUMENTS (fn));
argarray = (tree *) alloca (nargs * sizeof (tree)); argarray = XALLOCAVEC (tree, nargs);
defparm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn))); defparm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
if (arg2) if (arg2)
......
...@@ -3875,10 +3875,10 @@ process_partial_specialization (tree decl) ...@@ -3875,10 +3875,10 @@ process_partial_specialization (tree decl)
or some such would have been OK. */ or some such would have been OK. */
tpd.level = TMPL_PARMS_DEPTH (current_template_parms); tpd.level = TMPL_PARMS_DEPTH (current_template_parms);
tpd.parms = (int *) alloca (sizeof (int) * ntparms); tpd.parms = XALLOCAVEC (int, ntparms);
memset (tpd.parms, 0, sizeof (int) * ntparms); memset (tpd.parms, 0, sizeof (int) * ntparms);
tpd.arg_uses_template_parms = (int *) alloca (sizeof (int) * nargs); tpd.arg_uses_template_parms = XALLOCAVEC (int, nargs);
memset (tpd.arg_uses_template_parms, 0, sizeof (int) * nargs); memset (tpd.arg_uses_template_parms, 0, sizeof (int) * nargs);
for (i = 0; i < nargs; ++i) for (i = 0; i < nargs; ++i)
{ {
...@@ -3993,12 +3993,11 @@ process_partial_specialization (tree decl) ...@@ -3993,12 +3993,11 @@ process_partial_specialization (tree decl)
if (!tpd2.parms) if (!tpd2.parms)
{ {
/* We haven't yet initialized TPD2. Do so now. */ /* We haven't yet initialized TPD2. Do so now. */
tpd2.arg_uses_template_parms tpd2.arg_uses_template_parms = XALLOCAVEC (int, nargs);
= (int *) alloca (sizeof (int) * nargs);
/* The number of parameters here is the number in the /* The number of parameters here is the number in the
main template, which, as checked in the assertion main template, which, as checked in the assertion
above, is NARGS. */ above, is NARGS. */
tpd2.parms = (int *) alloca (sizeof (int) * nargs); tpd2.parms = XALLOCAVEC (int, nargs);
tpd2.level = tpd2.level =
TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (maintmpl)); TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (maintmpl));
} }
...@@ -8525,7 +8524,7 @@ tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -8525,7 +8524,7 @@ tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl)
tree orig_t = t; tree orig_t = t;
int len = TREE_VEC_LENGTH (t); int len = TREE_VEC_LENGTH (t);
int need_new = 0, i, expanded_len_adjust = 0, out; int need_new = 0, i, expanded_len_adjust = 0, out;
tree *elts = (tree *) alloca (len * sizeof (tree)); tree *elts = XALLOCAVEC (tree, len);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
......
...@@ -1219,7 +1219,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, ...@@ -1219,7 +1219,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
tree operand; tree operand;
int i; int i;
oconstraints = (const char **) alloca (noutputs * sizeof (char *)); oconstraints = XALLOCAVEC (const char *, noutputs);
string = resolve_asm_operand_names (string, output_operands, string = resolve_asm_operand_names (string, output_operands,
input_operands, labels); input_operands, labels);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment