From: Mark Mitchell Date: Tue, 22 May 2001 03:03:26 +0000 (+0000) Subject: tree.h (type_num_arguments): Declare it. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5d6a24c2e6bb180cf3f248f7c03296aa68f46c4;p=gcc.git tree.h (type_num_arguments): Declare it. * tree.h (type_num_arguments): Declare it. * tree.c (type_num_arguments): New function. From-SVN: r42418 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 79c18bf64ba..4b87a8c6e40 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-05-21 Mark Mitchell + + * tree.h (type_num_arguments): Declare it. + * tree.c (type_num_arguments): New function. + 2001-05-21 Richard Henderson * dwarf2out.c (current_funcdef_number): Move outside dwarf2 diff --git a/gcc/tree.c b/gcc/tree.c index 9245449ca23..866067be526 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3334,6 +3334,28 @@ type_list_equal (l1, l2) return t1 == t2; } +/* Returns the number of arguments to the FUNCTION_TYPE or METHOD_TYPE + given by TYPE. If the argument list accepts variable arguments, + then this function counts only the ordinary arguments. */ + +int +type_num_arguments (type) + tree type; +{ + int i = 0; + tree t; + + for (t = TYPE_ARG_TYPES (type); t; t = TREE_CHAIN (t)) + /* If the function does not take a variable number of arguments, + the last element in the list will have type `void'. */ + if (VOID_TYPE_P (TREE_VALUE (t))) + break; + else + ++i; + + return i; +} + /* Nonzero if integer constants T1 and T2 represent the same constant value. */ diff --git a/gcc/tree.h b/gcc/tree.h index e10352f7092..622eed3c971 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2520,6 +2520,7 @@ extern tree get_set_constructor_bytes PARAMS ((tree, unsigned char *, int)); extern tree get_callee_fndecl PARAMS ((tree)); extern void set_decl_assembler_name PARAMS ((tree)); +extern int type_num_arguments PARAMS ((tree)); /* In stmt.c */