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]

Re: [Ada PATCH] don't modify record fields in update_pointer_to


> here you go: I changed to gnat_desig_equiv and added a bunch of comments
> to update_pointer_to.

Thanks a lot.  I have a last minute question though. :-)

+      /* Create the new array type and update old array pointers.  */
+      update_pointer_to
+	(TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))),
+	 gnat_substitute_in_type (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))),
+				  TREE_CHAIN (TYPE_FIELDS (new_ptr)), new_ref));
+
+      /* Make pointers to the dummy array also point to the new array.  */
+      update_pointer_to
+	(TREE_TYPE (TREE_TYPE (array_field)),
+	 TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))));

It seems to me that we can simplify this into:

+     /* Create the new array type and adjust pointers to the dummy array.  */
+      update_pointer_to
+	(TREE_TYPE (TREE_TYPE (array_field)),
+	 gnat_substitute_in_type (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (new_ptr))),
+				  TREE_CHAIN (TYPE_FIELDS (new_ptr)), new_ref));

What do you think?  At least it's clean on ACATS.

[No need to update again the patch, I'll do it if needed.]

-- 
Eric Botcazou


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