diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-22 03:03:26 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-22 03:03:26 +0000 |
commit | e4c782a134e6adc80f70ed963ef3add0c3b0a631 (patch) | |
tree | fba82591b7ddf05c50bf31d5234f1cecd1c31af6 /gcc/tree.c | |
parent | bfdbe640d24805d82ae462372777d450c13315cf (diff) | |
download | ppe42-gcc-e4c782a134e6adc80f70ed963ef3add0c3b0a631.tar.gz ppe42-gcc-e4c782a134e6adc80f70ed963ef3add0c3b0a631.zip |
* tree.h (type_num_arguments): Declare it.
* tree.c (type_num_arguments): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42418 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 22 |
1 files changed, 22 insertions, 0 deletions
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. */ |