https://gcc.gnu.org/g:97b771f90a19d156bdf97d940cf9735a0a2e9efc

commit r16-3706-g97b771f90a19d156bdf97d940cf9735a0a2e9efc
Author: Ronan Desplanques <[email protected]>
Date:   Thu Aug 7 14:37:18 2025 +0200

    ada: Remove unnecessary if statement
    
    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.

Diff:
---
 gcc/ada/sem_ch3.adb | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 8ac0fd3bc915..96429361115e 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -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.

Reply via email to