]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Simplify check for No_Coextensions restriction
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 4 Dec 2024 15:26:45 +0000 (16:26 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 3 Jan 2025 15:39:13 +0000 (16:39 +0100)
Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* sem_res.adb (Resolve_Alocator): Move unrelated code out of a declare
block.

gcc/ada/sem_res.adb

index 27309b2e0192e99c4a6f9fbfafc9de905a731dc1..889cbd307b4c3dbffad5e14b484c0286d2b56af7 100644 (file)
@@ -5821,13 +5821,13 @@ package body Sem_Res is
               and then Nkind (Associated_Node_For_Itype (Typ)) =
                          N_Discriminant_Specification
             then
+               Check_Restriction (No_Coextensions, N);
+
                declare
                   Discr : constant Entity_Id :=
                     Defining_Identifier (Associated_Node_For_Itype (Typ));
 
                begin
-                  Check_Restriction (No_Coextensions, N);
-
                   --  Ada 2012 AI05-0052: If the designated type of the
                   --  allocator is limited, then the allocator shall not
                   --  be used to define the value of an access discriminant