aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2011-05-06 01:39:32 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2011-05-06 01:39:32 +0000
commitd7d058c58a02241c63e6c3cc0099bc5d7f68a153 (patch)
treed0e3b28d94d444177d67f138a799899a7a7ffe5d /gcc
parent6174da1b28176c4879ec55581325b4648fc72096 (diff)
downloadgcc-d7d058c58a02241c63e6c3cc0099bc5d7f68a153.zip
gcc-d7d058c58a02241c63e6c3cc0099bc5d7f68a153.tar.gz
gcc-d7d058c58a02241c63e6c3cc0099bc5d7f68a153.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/gcc-interface/decl.c25
-rw-r--r--gcc/ada/gcc-interface/utils.c16
3 files changed, 30 insertions, 17 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index dbc0647..922460c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-05 Nathan Froyd <froydnj@codesourcery.com>
+
+ * 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.
+
2011-05-05 Eric Botcazou <ebotcazou@adacore.com>
PR ada/48844
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index b5406e9..e014d04 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -8330,23 +8330,27 @@ intrin_types_incompatible_p (tree t1, tree t2)
static bool
intrin_arglists_compatible_p (intrin_binding_t * inb)
{
- tree ada_args = TYPE_ARG_TYPES (inb->ada_fntype);
- tree btin_args = TYPE_ARG_TYPES (inb->btin_fntype);
+ function_args_iterator ada_iter, btin_iter;
+
+ function_args_iter_init (&ada_iter, inb->ada_fntype);
+ function_args_iter_init (&btin_iter, inb->btin_fntype);
/* Sequence position of the last argument we checked. */
int argpos = 0;
- while (ada_args != 0 || btin_args != 0)
+ while (1)
{
- tree ada_type, btin_type;
+ tree ada_type = function_args_iter_cond (&ada_iter);
+ tree btin_type = function_args_iter_cond (&btin_iter);
+
+ /* If we've exhausted both lists simultaneously, we're done. */
+ if (ada_type == NULL_TREE && btin_type == NULL_TREE)
+ break;
/* If one list is shorter than the other, they fail to match. */
- if (ada_args == 0 || btin_args == 0)
+ if (ada_type == NULL_TREE || btin_type == NULL_TREE)
return false;
- ada_type = TREE_VALUE (ada_args);
- btin_type = TREE_VALUE (btin_args);
-
/* If we're done with the Ada args and not with the internal builtin
args, or the other way around, complain. */
if (ada_type == void_type_node
@@ -8373,8 +8377,9 @@ intrin_arglists_compatible_p (intrin_binding_t * inb)
return false;
}
- ada_args = TREE_CHAIN (ada_args);
- btin_args = TREE_CHAIN (btin_args);
+
+ function_args_iter_next (&ada_iter);
+ function_args_iter_next (&btin_iter);
}
return true;
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)",