aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-05-22 03:03:26 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-05-22 03:03:26 +0000
commitf5d6a24c2e6bb180cf3f248f7c03296aa68f46c4 (patch)
treefba82591b7ddf05c50bf31d5234f1cecd1c31af6 /gcc/tree.c
parentca29c7970a6811153860b391e1c0aa057c2d1556 (diff)
downloadgcc-f5d6a24c2e6bb180cf3f248f7c03296aa68f46c4.zip
gcc-f5d6a24c2e6bb180cf3f248f7c03296aa68f46c4.tar.gz
gcc-f5d6a24c2e6bb180cf3f248f7c03296aa68f46c4.tar.bz2
tree.h (type_num_arguments): Declare it.
* tree.h (type_num_arguments): Declare it. * tree.c (type_num_arguments): New function. From-SVN: r42418
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 9245449..866067b 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. */