]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Propagate Has_Inherit{able,ed}_Invariants to base types
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 11 May 2022 08:10:52 +0000 (10:10 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 2 Jun 2022 09:06:38 +0000 (09:06 +0000)
The two flags apply to base types only like Has_Own_Invariants.

gcc/ada/

* sem_util.adb (Propagate_DIC_Attributes): Add ??? comment.
(Propagate_Invariant_Attributes): Likewise.  Propagate the
Has_Inheritable_Invariants and Has_Inherited_Invariants to
the base type of the target type.

gcc/ada/sem_util.adb

index c231fbb1a72150ecb6ffc20ea1c66079918d8d03..265c11afe1c98f44b188f15bd60d83c8b711d55a 100644 (file)
@@ -27312,7 +27312,7 @@ package body Sem_Util is
          --  The setting of the attributes is intentionally conservative. This
          --  prevents accidental clobbering of enabled attributes. We need to
          --  call Base_Type twice, because it is sometimes not set to an actual
-         --  base type.
+         --  base type???
 
          if Has_Inherited_DIC (From_Typ) then
             Set_Has_Inherited_DIC (Base_Type (Base_Type (Typ)));
@@ -27362,14 +27362,14 @@ package body Sem_Util is
          --  The setting of the attributes is intentionally conservative. This
          --  prevents accidental clobbering of enabled attributes. We need to
          --  call Base_Type twice, because it is sometimes not set to an actual
-         --  base type.
+         --  base type???
 
          if Has_Inheritable_Invariants (From_Typ) then
-            Set_Has_Inheritable_Invariants (Typ);
+            Set_Has_Inheritable_Invariants (Base_Type (Base_Type (Typ)));
          end if;
 
          if Has_Inherited_Invariants (From_Typ) then
-            Set_Has_Inherited_Invariants (Typ);
+            Set_Has_Inherited_Invariants (Base_Type (Base_Type (Typ)));
          end if;
 
          if Has_Own_Invariants (From_Typ) then