]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove unnecessary if statement
authorRonan Desplanques <desplanques@adacore.com>
Thu, 7 Aug 2025 12:37:18 +0000 (14:37 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 9 Sep 2025 12:39:58 +0000 (14:39 +0200)
Calling Check_Nonoverridable_Aspects only makes sense when the full type
declaration being analyzed is the completion of a partial view, and the
one call site of this procedure ensures this. Therefore the handling of
all the possible cases of completion in the procedure that this patch
removes was useless.

gcc/ada/ChangeLog:

* sem_ch3.adb (Check_Nonoverridable_Aspects): Remove if statement.

gcc/ada/sem_ch3.adb

index 8ac0fd3bc9154e4d69ca4e604a8afc29725b2043..96429361115e23995c43fba32f88e15324d391a1 100644 (file)
@@ -3083,24 +3083,14 @@ package body Sem_Ch3 is
 
          --  Local variables
 
-         Prev_Aspects   : constant List_Id :=
-                            Aspect_Specifications (Parent (Def_Id));
-         Par_Type       : Entity_Id;
-         Prev_Aspect    : Node_Id;
+         Prev_Aspects : constant List_Id :=
+           Aspect_Specifications (Parent (Def_Id));
+         Prev_Aspect  : Node_Id;
+         Par_Type     : constant Entity_Id := Etype (T);
 
       --  Start of processing for Check_Nonoverridable_Aspects
 
       begin
-         --  Get parent type of derived type. Note that Prev is the entity in
-         --  the partial declaration, but its contents are now those of full
-         --  view, while Def_Id reflects the partial view.
-
-         if Is_Private_Type (Def_Id) then
-            Par_Type := Etype (Full_View (Def_Id));
-         else
-            Par_Type := Etype (Def_Id);
-         end if;
-
          --  If there is an inherited Implicit_Dereference, verify that it is
          --  made explicit in the partial view.