summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-04 13:44:48 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-04 13:44:48 +0000
commit5edc3af9f92eeff0e93d496f287003124f4d4df0 (patch)
tree59050dadf44d73f3b2ea442fc54f6fb6a9c2fdf3 /gcc/fortran/trans-decl.c
parent35bf1214af3e291cd7c17e53eadd8c96425c9fad (diff)
downloadgcc-5edc3af9f92eeff0e93d496f287003124f4d4df0.tar.gz
gcc/
* tree.h (build_function_type_array): Declare. (build_varargs_function_type_array): Declare. (build_function_type_vec, build_varargs_function_type_vec): Define. * tree.c (build_function_type_array_1): New function. (build_function_type_array): New function. (build_varargs_function_type_array): New function. gcc/fortran/ * trans-decl.c (build_library_function_decl_1): Call build_function_type_vec. Adjust argument list building accordingly. * trans-intrinsic.c (gfc_get_intrinsic_lib_fndecl): Likewise. * trans-types.c (gfc_get_function_type): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173375 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index a5527d5f3c0..e597eb3179c 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -2478,8 +2478,7 @@ static tree
build_library_function_decl_1 (tree name, const char *spec,
tree rettype, int nargs, va_list p)
{
- tree arglist;
- tree argtype;
+ VEC(tree,gc) *arglist;
tree fntype;
tree fndecl;
int n;
@@ -2488,20 +2487,18 @@ build_library_function_decl_1 (tree name, const char *spec,
gcc_assert (current_function_decl == NULL_TREE);
/* Create a list of the argument types. */
- for (arglist = NULL_TREE, n = abs (nargs); n > 0; n--)
+ arglist = VEC_alloc (tree, gc, abs (nargs));
+ for (n = abs (nargs); n > 0; n--)
{
- argtype = va_arg (p, tree);
- arglist = gfc_chainon_list (arglist, argtype);
- }
-
- if (nargs >= 0)
- {
- /* Terminate the list. */
- arglist = chainon (arglist, void_list_node);
+ tree argtype = va_arg (p, tree);
+ VEC_quick_push (tree, arglist, argtype);
}
/* Build the function type and decl. */
- fntype = build_function_type (rettype, arglist);
+ if (nargs >= 0)
+ fntype = build_function_type_vec (rettype, arglist);
+ else
+ fntype = build_varargs_function_type_vec (rettype, arglist);
if (spec)
{
tree attr_args = build_tree_list (NULL_TREE,