]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Simplify expansion of negative membership operator
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 6 Jan 2025 11:06:59 +0000 (12:06 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 13 Jan 2025 10:52:57 +0000 (11:52 +0100)
Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* exp_ch4.adb: (Expand_N_Not_In): Preserve Alternatives in expanded
membership operator just like preserving Right_Opnd (though only
one of these fields is present at a time).
* par-ch4.adb (P_Membership_Test): Remove redundant setting of fields
to their default values.

gcc/ada/exp_ch4.adb
gcc/ada/par-ch4.adb

index a7f759fc8a57ca263225ce6ecfab104269618334..82978c775cf298306ee919751be85189c9df641d 100644 (file)
@@ -7727,12 +7727,9 @@ package body Exp_Ch4 is
         Make_Op_Not (Loc,
           Right_Opnd =>
             Make_In (Loc,
-              Left_Opnd  => Left_Opnd (N),
-              Right_Opnd => Right_Opnd (N))));
-
-      --  If this is a set membership, preserve list of alternatives
-
-      Set_Alternatives (Right_Opnd (N), Alternatives (Original_Node (N)));
+              Left_Opnd    => Left_Opnd (N),
+              Right_Opnd   => Right_Opnd (N),
+              Alternatives => Alternatives (N))));
 
       --  We want this to appear as coming from source if original does (see
       --  transformations in Expand_N_In).
index 3f8d1f1d2e34027ef6f9afdecbe24f9d9f349e7d..648a4cf64641895a928dd9257cffec6635d3c5ea 100644 (file)
@@ -3926,7 +3926,6 @@ package body Ch4 is
       if Token = Tok_Vertical_Bar then
          Error_Msg_Ada_2012_Feature ("set notation", Token_Ptr);
          Set_Alternatives (N, New_List (Alt));
-         Set_Right_Opnd   (N, Empty);
 
          --  Loop to accumulate alternatives
 
@@ -3940,8 +3939,7 @@ package body Ch4 is
       --  Not set case
 
       else
-         Set_Right_Opnd   (N, Alt);
-         Set_Alternatives (N, No_List);
+         Set_Right_Opnd (N, Alt);
       end if;
    end P_Membership_Test;