This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto] Use nth_parm_type in validate_proto_after_old_defn.


Hi,

Attached is a patch to use validate_proto_after_old_defn.

The patch makes I start with 0 instead of 1 so that it can be fed to
nth_parm_type.

Tested on x86_64-pc-linux-gnu.  Committed to the LTO branch as
obvious.

Kazu Hirata

2006-07-16  Kazu Hirata  <kazu@codesourcery.com>

	* c-decl.c (validate_proto_after_old_defn): Use nth_parm_type.

Index: c-decl.c
===================================================================
--- c-decl.c	(revision 115362)
+++ c-decl.c	(working copy)
@@ -1079,12 +1079,11 @@ validate_proto_after_old_defn (tree newd
 
   oldargs = TYPE_ACTUAL_ARG_TYPES (oldtype);
   newargs = TYPE_ARG_TYPES (newtype);
-  i = 1;
 
-  for (;;)
+  for (i = 0;; i++)
     {
-      tree oldargtype = TYPE_MAIN_VARIANT (TREE_VALUE (oldargs));
-      tree newargtype = TYPE_MAIN_VARIANT (TREE_VALUE (newargs));
+      tree oldargtype = TYPE_MAIN_VARIANT (nth_parm_type (oldargs, i));
+      tree newargtype = TYPE_MAIN_VARIANT (nth_parm_type (newargs, i));
 
       if (END_OF_ARGLIST (oldargtype) && END_OF_ARGLIST (newargtype))
 	break;
@@ -1110,13 +1109,9 @@ validate_proto_after_old_defn (tree newd
 	{
 	  error ("prototype for %q+D declares argument %d"
 		 " with incompatible type",
-		 newdecl, i);
+		 newdecl, i + 1);
 	  return false;
 	}
-
-      oldargs = TREE_CHAIN (oldargs);
-      newargs = TREE_CHAIN (newargs);
-      i++;
     }
 
   /* If we get here, no errors were found, but do issue a warning


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]