From 5e024b97f260f393589293e2635a98ca361f57b2 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Mon, 21 Dec 2020 13:37:27 +0100 Subject: [PATCH] [Ada] Cleanup processing of aspect Dynamic_Predicate gcc/ada/ * sem_ch13.adb (Build_Predicate_Functions): Fix typo in comment. (Resolve_Aspect_Expressions): Fix typo in comment; remove redundant check for no aspects; simplify with Discard_Node. --- gcc/ada/sem_ch13.adb | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 005c7b0..1df37d9 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -9998,7 +9998,7 @@ package body Sem_Ch13 is -- Do not generate predicate bodies within a generic unit. The -- expressions have been analyzed already, and the bodies play - -- no role if not within an executable unit. However, if a statc + -- no role if not within an executable unit. However, if a static -- predicate is present it must be processed for legality checks -- such as case coverage in an expression. @@ -14914,7 +14914,7 @@ package body Sem_Ch13 is Find_Direct_Name (N); Set_Entity (N, Empty); - -- The name is component association needs no resolution. + -- The name is component association needs no resolution elsif Nkind (N) = N_Component_Association then Dummy := Resolve_Name (Expression (N)); @@ -14936,10 +14936,6 @@ package body Sem_Ch13 is -- Start of processing for Resolve_Aspect_Expressions begin - if No (ASN) then - return; - end if; - while Present (ASN) loop if Nkind (ASN) = N_Aspect_Specification and then Entity (ASN) = E then declare @@ -14976,16 +14972,12 @@ package body Sem_Ch13 is -- discriminants of the type. if No (Predicate_Function (E)) then - declare - FDecl : constant Node_Id := - Build_Predicate_Function_Declaration (E); - pragma Unreferenced (FDecl); + Discard_Node + (Build_Predicate_Function_Declaration (E)); - begin - Push_Type (E); - Resolve_Aspect_Expression (Expr); - Pop_Type (E); - end; + Push_Type (E); + Resolve_Aspect_Expression (Expr); + Pop_Type (E); end if; when Pre_Post_Aspects => -- 2.7.4