From: Piotr Trojanek Date: Thu, 20 Feb 2020 11:10:53 +0000 (+0100) Subject: [Ada] Simplify detection of static membership choices X-Git-Tag: basepoints/gcc-12~7102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ea95664954775a1a85c9ea097877754984807aa;p=thirdparty%2Fgcc.git [Ada] Simplify detection of static membership choices 2020-06-10 Piotr Trojanek gcc/ada/ * sem_ch13.adb (All_Membership_Choices_Static): Assert an AST property documented in sinfo.ads and simplify an excessive condition. --- diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index fda31776eb0a..61f5e45bb57a 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -844,11 +844,16 @@ package body Sem_Ch13 is function All_Membership_Choices_Static (Expr : Node_Id) return Boolean is pragma Assert (Nkind (Expr) in N_Membership_Test); begin - return ((Present (Right_Opnd (Expr)) - and then Is_Static_Choice (Right_Opnd (Expr))) - or else - (Present (Alternatives (Expr)) - and then All_Static_Choices (Alternatives (Expr)))); + pragma Assert + (Present (Right_Opnd (Expr)) + xor + Present (Alternatives (Expr))); + + if Present (Right_Opnd (Expr)) then + return Is_Static_Choice (Right_Opnd (Expr)); + else + return All_Static_Choices (Alternatives (Expr)); + end if; end All_Membership_Choices_Static; ------------------------