aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-03-29 09:08:08 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-21 09:27:57 +0200
commit9fbf129bade8014d1fd7ab8ecd255df7e12570f0 (patch)
treead3f3ff130bc1b67f12909cc3f57ded3c5e1f158
parentbf69349b8d974ff2a2518976e69724d21aa1f423 (diff)
downloadgcc-9fbf129bade8014d1fd7ab8ecd255df7e12570f0.zip
gcc-9fbf129bade8014d1fd7ab8ecd255df7e12570f0.tar.gz
gcc-9fbf129bade8014d1fd7ab8ecd255df7e12570f0.tar.bz2
ada: Simplify test for propagation of attributes to subtypes
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.
-rw-r--r--gcc/ada/gcc-interface/decl.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 6e40a15..f6a4c06 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -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))