bool is_method, bool is_constructor,
bool is_destructor, int spc)
{
- tree arg;
- const tree node = TREE_TYPE (func);
+ tree type = TREE_TYPE (func);
+ tree arg = TYPE_ARG_TYPES (type);
+ tree t;
char buf[17];
- int num = 0, num_args = 0, have_args = true, have_ellipsis = false;
+ int num, num_args = 0, have_args = true, have_ellipsis = false;
/* Compute number of arguments. */
- arg = TYPE_ARG_TYPES (node);
-
if (arg)
{
while (TREE_CHAIN (arg) && arg != error_mark_node)
pp_left_paren (buffer);
}
+ /* For a function, see if we have the corresponding arguments. */
if (TREE_CODE (func) == FUNCTION_DECL)
- arg = DECL_ARGUMENTS (func);
+ {
+ arg = DECL_ARGUMENTS (func);
+ for (t = arg, num = 0; t; t = DECL_CHAIN (t))
+ num++;
+ if (num < num_args)
+ arg = NULL_TREE;
+ }
else
arg = NULL_TREE;
- if (arg == NULL_TREE)
+ /* Otherwise, only print the types. */
+ if (!arg)
{
have_args = false;
- arg = TYPE_ARG_TYPES (node);
-
- if (arg && TREE_CODE (TREE_VALUE (arg)) == VOID_TYPE)
- arg = NULL_TREE;
+ arg = TYPE_ARG_TYPES (type);
}
if (is_constructor)
arg = TREE_CHAIN (arg);
- /* Print the argument names (if available) & types. */
-
+ /* Print the argument names (if available) and types. */
for (num = 1; num <= num_args; num++)
{
if (have_args)
pp_string (buffer, buf);
}
- dump_ada_node (buffer, TREE_TYPE (arg), node, spc, false, true);
+ dump_ada_node (buffer, TREE_TYPE (arg), type, spc, false, true);
}
else
{
sprintf (buf, "arg%d : ", num);
pp_string (buffer, buf);
- dump_ada_node (buffer, TREE_VALUE (arg), node, spc, false, true);
+ dump_ada_node (buffer, TREE_VALUE (arg), type, spc, false, true);
}
/* If the type is a pointer to a tagged type, we need to differentiate
if (num_args > 0)
pp_right_paren (buffer);
- if (is_constructor || !VOID_TYPE_P (TREE_TYPE (node)))
+ if (is_constructor || !VOID_TYPE_P (TREE_TYPE (type)))
{
pp_string (buffer, " return ");
- tree type = is_constructor ? DECL_CONTEXT (func) : TREE_TYPE (node);
- dump_ada_node (buffer, type, type, spc, false, true);
+ tree rtype = is_constructor ? DECL_CONTEXT (func) : TREE_TYPE (type);
+ dump_ada_node (buffer, rtype, rtype, spc, false, true);
}
}