diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2025-01-06 12:06:59 +0100 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2025-01-13 11:52:57 +0100 |
commit | f9d22b7ac734a917f3ee379336ad764ccd6f74ca (patch) | |
tree | 0c0a3701eb98eca5217962de9410e8b2c1360143 | |
parent | 518fd9e9b18913997b9ed8120d2a85c7bd3528f9 (diff) | |
download | gcc-f9d22b7ac734a917f3ee379336ad764ccd6f74ca.zip gcc-f9d22b7ac734a917f3ee379336ad764ccd6f74ca.tar.gz gcc-f9d22b7ac734a917f3ee379336ad764ccd6f74ca.tar.bz2 |
ada: Simplify expansion of negative membership operator
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.
-rw-r--r-- | gcc/ada/exp_ch4.adb | 9 | ||||
-rw-r--r-- | gcc/ada/par-ch4.adb | 4 |
2 files changed, 4 insertions, 9 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index a7f759f..82978c7 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -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). diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 3f8d1f1..648a4cf 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -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; |