This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: new build_function_type_list()
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Richard Henderson <rth at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Jul 2002 10:13:57 -0700
- Subject: Re: new build_function_type_list()
- References: <20020630010750.GA15938@redhat.com> <49100000.1025540442@gandalf.codesourcery.com>
> Explicitly adding the "void_list_node" makes it impossible to create
> a varargs type using your new function.
i tried to code a function that would address the most common cases.
> And, your "first" parameter is confusing because it is really the return
> type.
ok
how about this?
2002-07-01 Aldy Hernandez <aldyh@redhat.com>
* tree.c (build_function_type_list): Update function comment.
Rename first argument to return_type.
Index: tree.c
===================================================================
RCS file: /cvs/uberbaum/gcc/tree.c,v
retrieving revision 1.265
diff -c -p -r1.265 tree.c
*** tree.c 30 Jun 2002 01:19:54 -0000 1.265
--- tree.c 1 Jul 2002 17:12:29 -0000
*************** build_function_type (value_type, arg_typ
*** 3801,3817 ****
return t;
}
! /* Like build_function_type, but take a vararg list of nodes. The
! list of nodes should end with a NULL_TREE. This is typically used
! for creating function types for builtins. */
tree
! build_function_type_list VPARAMS ((tree first, ...))
{
tree t, args, last;
! VA_OPEN (p, first);
! VA_FIXEDARG (p, tree, first);
t = va_arg (p, tree);
for (args = NULL_TREE; t != NULL_TREE; t = va_arg (p, tree))
--- 3801,3819 ----
return t;
}
! /* Build a function type. The RETURN_TYPE is the type retured by the
! function. The ARG_TYPE is the first argument type -- or NULL_TREE
! if there are no arguments. If additional arguments are provided,
! they are additional argument types. The list of argument types
! must always be terminated by NULL_TREE. */
tree
! build_function_type_list VPARAMS ((tree return_type, ...))
{
tree t, args, last;
! VA_OPEN (p, return_type);
! VA_FIXEDARG (p, tree, return_type);
t = va_arg (p, tree);
for (args = NULL_TREE; t != NULL_TREE; t = va_arg (p, tree))
*************** build_function_type_list VPARAMS ((tree
*** 3820,3826 ****
last = args;
args = nreverse (args);
TREE_CHAIN (last) = void_list_node;
! args = build_function_type (first, args);
VA_CLOSE (p);
return args;
--- 3822,3828 ----
last = args;
args = nreverse (args);
TREE_CHAIN (last) = void_list_node;
! args = build_function_type (return_type, args);
VA_CLOSE (p);
return args;