From d7d058c58a02241c63e6c3cc0099bc5d7f68a153 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 6 May 2011 01:39:32 +0000 Subject: don't use TYPE_ARG_TYPES in the Ada frontend don't use TYPE_ARG_TYPES in the Ada frontend * gcc-interface/decl.c (intrin_arglists_compatible_p): Use iterators instead of accessing TYPE_ARG_TYPES directly. * gcc-interface/utils.c (handle_nonnull_attribute): Likewise. From-SVN: r173466 --- gcc/ada/gcc-interface/utils.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gcc/ada/gcc-interface/utils.c') diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 57a62ab..1703a8b 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -5210,7 +5210,6 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), a pointer argument. */ for (attr_arg_num = 1; args; args = TREE_CHAIN (args)) { - tree argument; unsigned HOST_WIDE_INT arg_num = 0, ck_num; if (!get_nonnull_operand (TREE_VALUE (args), &arg_num)) @@ -5221,18 +5220,21 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), return NULL_TREE; } - argument = TYPE_ARG_TYPES (type); - if (argument) + if (prototype_p (type)) { - for (ck_num = 1; ; ck_num++) + function_args_iterator iter; + tree argument; + + function_args_iter_init (&iter, type); + for (ck_num = 1; ; ck_num++, function_args_iter_next (&iter)) { + argument = function_args_iter_cond (&iter); if (!argument || ck_num == arg_num) break; - argument = TREE_CHAIN (argument); } if (!argument - || TREE_CODE (TREE_VALUE (argument)) == VOID_TYPE) + || TREE_CODE (argument) == VOID_TYPE) { error ("nonnull argument with out-of-range operand number " "(argument %lu, operand %lu)", @@ -5241,7 +5243,7 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), return NULL_TREE; } - if (TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE) + if (TREE_CODE (argument) != POINTER_TYPE) { error ("nonnull argument references non-pointer operand " "(argument %lu, operand %lu)", -- cgit v1.1