]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Simplify test for propagation of attributes to subtypes
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 29 Mar 2024 08:08:08 +0000 (09:08 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 May 2024 07:27:57 +0000 (09:27 +0200)
This changes the test to use the Is_Base_Type predicate and also removes the
superfluous call to Base_Type before First_Subtype.  No functional changes.

gcc/ada/

* gcc-interface/decl.cc (gnat_to_gnu_entity): Use the Is_Base_Type
predicate and remove superfluous calls to Base_Type.

gcc/ada/gcc-interface/decl.cc

index 6e40a157734bc3fa664f63e65b52e70181b3d2b3..f6a4c0631b6398960dc7ed3da34bc1d9a636fb0b 100644 (file)
@@ -506,11 +506,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
       /* Machine_Attributes on types are expected to be propagated to
         subtypes.  The corresponding Gigi_Rep_Items are only attached
         to the first subtype though, so we handle the propagation here.  */
-      if (Base_Type (gnat_entity) != gnat_entity
+      if (!Is_Base_Type (gnat_entity)
          && !Is_First_Subtype (gnat_entity)
-         && Has_Gigi_Rep_Item (First_Subtype (Base_Type (gnat_entity))))
-       prepend_attributes (&attr_list,
-                           First_Subtype (Base_Type (gnat_entity)));
+         && Has_Gigi_Rep_Item (First_Subtype (gnat_entity)))
+       prepend_attributes (&attr_list, First_Subtype (gnat_entity));
 
       /* Compute a default value for the size of an elementary type.  */
       if (Known_Esize (gnat_entity) && Is_Elementary_Type (gnat_entity))