]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Only record types with discriminants can be unconstrained
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 5 Mar 2024 13:42:08 +0000 (14:42 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 17 May 2024 08:21:00 +0000 (10:21 +0200)
Remove redundant condition for detecting unconstrained record types.

Code cleanup; behavior is unaffected.

gcc/ada/

* sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Remove call
to Has_Discriminants; combine ELSIF branches.

gcc/ada/sem_prag.adb

index e57f42d9a54d5081246c285bcd181c4aaf48043d..02aad4d1caa259f0106131bafcce1202a1310314 100644 (file)
@@ -32971,13 +32971,10 @@ package body Sem_Prag is
       if Is_Tagged_Type (Typ) then
          return True;
 
-      elsif Is_Array_Type (Typ) then
-         return not Is_Constrained (Typ);
-
-      elsif Is_Record_Type (Typ) then
-         return Has_Discriminants (Typ) and then not Is_Constrained (Typ);
-
-      elsif Is_Private_Type (Typ) then
+      elsif Is_Array_Type (Typ)
+        or else Is_Record_Type (Typ)
+        or else Is_Private_Type (Typ)
+      then
          return not Is_Constrained (Typ);
 
       else