From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id EFAEB38582B9; Tue, 8 Nov 2022 08:42:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EFAEB38582B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667896937; bh=/Jyoopbpc2R6VADFAMNJgE3+r7wOCa3rfxY7Xp/odqs=; h=From:To:Subject:Date:From; b=Pid3yDv3QGmxYMo32DXyJRwQ5pM25rXui4Z5NiDrHH/Z6K7N/aGJyH+0bB6TLe6l8 ete1x7wZW9LA34XIvY0SdxLQLU9w6rNHvfpBLkpYyFAP7+S4FLk2Y51N4co9+RwrCP 7gOt6Dvy+3pOzd/cmR6JOxBzspDZpRitBaW+mh0g= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3798] ada: Clean up call to check if aspects are present X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 45656a992eb18bfefe2e6e20d3b425afe945af28 X-Git-Newrev: 11f892571c7ab4964f16c0d432e6f5a9b4a091f1 Message-Id: <20221108084217.EFAEB38582B9@sourceware.org> Date: Tue, 8 Nov 2022 08:42:17 +0000 (GMT) List-Id: https://gcc.gnu.org/g:11f892571c7ab4964f16c0d432e6f5a9b4a091f1 commit r13-3798-g11f892571c7ab4964f16c0d432e6f5a9b4a091f1 Author: Piotr Trojanek Date: Wed Oct 26 09:58:47 2022 +0200 ada: Clean up call to check if aspects are present Code cleanup; semantics is unaffected. gcc/ada/ * exp_ch6.adb, exp_put_image.adb, sem_aggr.adb, sem_attr.adb, sem_ch5.adb, sem_type.adb, sem_util.adb: Replace "Present (Find_Aspect (...))" with "Has_Aspect". Diff: --- gcc/ada/exp_ch6.adb | 4 ++-- gcc/ada/exp_put_image.adb | 2 +- gcc/ada/sem_aggr.adb | 2 +- gcc/ada/sem_attr.adb | 4 ++-- gcc/ada/sem_ch5.adb | 2 +- gcc/ada/sem_type.adb | 2 +- gcc/ada/sem_util.adb | 14 ++++++-------- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index fce7a7cebf5..1466e4dc36a 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -3305,8 +3305,8 @@ package body Exp_Ch6 is or else No (Aspect) -- Do not fold if multiple applicable predicate aspects - or else Present (Find_Aspect (Subt, Aspect_Static_Predicate)) - or else Present (Find_Aspect (Subt, Aspect_Predicate)) + or else Has_Aspect (Subt, Aspect_Static_Predicate) + or else Has_Aspect (Subt, Aspect_Predicate) or else Augments_Other_Dynamic_Predicate (Aspect) or else CodePeer_Mode then diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb index f90f0206f27..eaedebe4001 100644 --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -1045,7 +1045,7 @@ package body Exp_Put_Image is declare U_Type : constant Entity_Id := Underlying_Type (Entity (Prefix (N))); begin - if Present (Find_Aspect (U_Type, Aspect_Put_Image)) then + if Has_Aspect (U_Type, Aspect_Put_Image) then return True; end if; diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 4da05dd7317..3a093d26007 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1052,7 +1052,7 @@ package body Sem_Aggr is elsif Is_Array_Type (Typ) and then Null_Record_Present (N) then Error_Msg_N ("null record forbidden in array aggregate", N); - elsif Present (Find_Aspect (Typ, Aspect_Aggregate)) + elsif Has_Aspect (Typ, Aspect_Aggregate) and then Ekind (Typ) /= E_Record_Type and then Ada_Version >= Ada_2022 then diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 299ea04959c..de4e8aa681c 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -5996,8 +5996,8 @@ package body Sem_Attr is -- Verify that prefix can be iterated upon. if Is_Array_Type (Typ) - or else Present (Find_Aspect (Typ, Aspect_Default_Iterator)) - or else Present (Find_Aspect (Typ, Aspect_Iterable)) + or else Has_Aspect (Typ, Aspect_Default_Iterator) + or else Has_Aspect (Typ, Aspect_Iterable) then null; else diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 5f0629d32b3..7bca6d39dd2 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2191,7 +2191,7 @@ package body Sem_Ch5 is if Is_Array_Type (Typ) or else Is_Reversible_Iterator (Typ) or else - (Present (Find_Aspect (Typ, Aspect_Iterable)) + (Has_Aspect (Typ, Aspect_Iterable) and then Present (Get_Iterable_Type_Primitive (Typ, Name_Previous))) diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index 2fc82d14016..718c29754c1 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -1007,7 +1007,7 @@ package body Sem_Type is elsif Ada_Version >= Ada_2022 and then T2 = Any_Composite - and then Present (Find_Aspect (T1, Aspect_Aggregate)) + and then Has_Aspect (T1, Aspect_Aggregate) then return True; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 71548dcca17..e43581ec6e9 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -13309,7 +13309,7 @@ package body Sem_Util is begin return Nkind (Exp) = N_Aggregate - and then Present (Find_Aspect (Etype (Exp), Aspect_Aggregate)) + and then Has_Aspect (Etype (Exp), Aspect_Aggregate) and then not Is_Record_Aggregate; end Is_Container_Aggregate; @@ -21718,18 +21718,16 @@ package body Sem_Util is -- type has the appropriate user-defined literal aspect. return (Nkind (N) in N_Numeric_Or_String_Literal - and then Present (Find_Aspect (Typ, Literal_Aspect_Map (Nkind (N))))) + and then Has_Aspect (Typ, Literal_Aspect_Map (Nkind (N)))) or else (Is_Entity_Name (N) and then Present (Entity (N)) and then ((Ekind (Entity (N)) = E_Named_Integer - and then - Present (Find_Aspect (Typ, Aspect_Integer_Literal))) + and then Has_Aspect (Typ, Aspect_Integer_Literal)) or else (Ekind (Entity (N)) = E_Named_Real - and then - Present (Find_Aspect (Typ, Aspect_Real_Literal))))); + and then Has_Aspect (Typ, Aspect_Real_Literal)))); end Is_User_Defined_Literal; -------------------------------------- @@ -32563,7 +32561,7 @@ package body Sem_Util is (Typ : Entity_Id) return Boolean is begin - return Present (Find_Aspect (Typ, Aspect_Designated_Storage_Model)); + return Has_Aspect (Typ, Aspect_Designated_Storage_Model); end Has_Designated_Storage_Model_Aspect; ----------------------------------- @@ -32573,7 +32571,7 @@ package body Sem_Util is function Has_Storage_Model_Type_Aspect (Typ : Entity_Id) return Boolean is begin - return Present (Find_Aspect (Typ, Aspect_Storage_Model_Type)); + return Has_Aspect (Typ, Aspect_Storage_Model_Type); end Has_Storage_Model_Type_Aspect; --------------------------