https://gcc.gnu.org/g:3f20643b55eae2d3cfd327586e9b2ffceefbb00d

commit r17-1690-g3f20643b55eae2d3cfd327586e9b2ffceefbb00d
Author: Marc Poulhiès <[email protected]>
Date:   Fri Jun 5 14:25:10 2026 +0200

    ada: Minor cosmetic change: use Discard_Node
    
    Instead of using a dedicated block with a local variable, use the
    Discard_Node function.
    
    gcc/ada/ChangeLog:
    
            * exp_ch3.adb (Build_Implicit_Copy_Constructor)
            (Build_Implicit_Parameterless_Constructor): Refactor how node is
            discarded.

Diff:
---
 gcc/ada/exp_ch3.adb | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 96374dcdb12c..2f799b0a169f 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -1974,16 +1974,12 @@ package body Exp_Ch3 is
       Set_Parameter_Specifications (Spec_Node, Parameters);
       Freeze_Extra_Formals (Copy_Id);
 
-      declare
-         Ignore : Node_Id;
-      begin
-         Ignore :=
-           Make_Subprogram_Body (Loc,
-             Specification => Spec_Node,
-             Aspect_Specifications => Aspect_Specs,
-             Handled_Statement_Sequence =>
-               Make_Handled_Sequence_Of_Statements (Loc, Body_Stmts));
-      end;
+      Discard_Node (
+        Make_Subprogram_Body (Loc,
+          Specification => Spec_Node,
+          Aspect_Specifications => Aspect_Specs,
+          Handled_Statement_Sequence =>
+               Make_Handled_Sequence_Of_Statements (Loc, Body_Stmts)));
 
       Set_Is_Public (Copy_Id, Is_Public (Typ));
       Set_Is_Internal (Copy_Id);
@@ -2047,7 +2043,6 @@ package body Exp_Ch3 is
       --  Aspect Initialize enables default initialization
 
       declare
-         Ignore             : Node_Id;
          Default_Initialize : constant Node_Id :=
            Make_Aspect_Specification (Loc,
              Identifier => Make_Identifier (Loc, Name_Initialize),
@@ -2059,12 +2054,12 @@ package body Exp_Ch3 is
                      Box_Present => True)),
                  Is_Parenthesis_Aggregate => True));
       begin
-         Ignore :=
+         Discard_Node (
            Make_Subprogram_Body (Loc,
              Specification => Spec_Node,
              Handled_Statement_Sequence =>
                Make_Handled_Sequence_Of_Statements (Loc),
-             Aspect_Specifications => New_List (Default_Initialize));
+             Aspect_Specifications => New_List (Default_Initialize)));
       end;
 
       Set_Is_Public (Constructor_Id, Is_Public (Typ));

Reply via email to