From: Ronan Desplanques Date: Tue, 4 Mar 2025 12:16:39 +0000 (+0100) Subject: ada: Remove redundant error checking X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fefac6864133950da1c61ab81c56bc3c68a57fcb;p=thirdparty%2Fgcc.git ada: Remove redundant error checking This patch removes a test for a condition that can never be false. gcc/ada/ChangeLog: * sem_attr.adb (Analyze_Attribute): Remove test. --- diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index bf4d68447c9..d4034d28da6 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -5693,19 +5693,15 @@ package body Sem_Attr is when Attribute_Partition_ID => Check_E0; - if P_Type /= Any_Type then - if not Is_Library_Level_Entity (Entity (P)) then - Error_Attr_P - ("prefix of % attribute must be library-level entity"); + if not Is_Library_Level_Entity (Entity (P)) then + Error_Attr_P + ("prefix of % attribute must be library-level entity"); - -- The defining entity of prefix should not be declared inside a - -- Pure unit. RM E.1(8). Is_Pure was set during declaration. + -- The defining entity of prefix should not be declared inside a + -- Pure unit. RM E.1(8). Is_Pure was set during declaration. - elsif Is_Entity_Name (P) - and then Is_Pure (Entity (P)) - then - Error_Attr_P ("prefix of% attribute must not be declared pure"); - end if; + elsif Is_Entity_Name (P) and then Is_Pure (Entity (P)) then + Error_Attr_P ("prefix of% attribute must not be declared pure"); end if; Set_Etype (N, Universal_Integer);