From: Piotr Trojanek Date: Wed, 9 Dec 2020 14:22:29 +0000 (+0100) Subject: [Ada] Refactor repeated checks for the expression of aspect Static X-Git-Tag: upstream/12.2.0~8495 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=189c58042ddde50ab07ee105d14c7a24d05f9482;p=platform%2Fupstream%2Fgcc.git [Ada] Refactor repeated checks for the expression of aspect Static gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Static): Refactor to have a single check for the expression being present; adapt comments. --- diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 2273887..25e3bd7 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -2610,25 +2610,23 @@ package body Sem_Ch13 is -- component type C, a similar rule applies to C." end if; - -- Preanalyze the expression (if any) when the aspect resides - -- in a generic unit. (Is this generic-related code necessary - -- for this aspect? It's modeled on what's done for aspect - -- Disable_Controlled. ???) + -- When the expression is present, it must be static. If it + -- evaluates to True, the expression function is treated as + -- a static function. Otherwise the aspect appears without + -- an expression and defaults to True. - if Inside_A_Generic then - if Present (Expr) then - Preanalyze_And_Resolve (Expr, Any_Boolean); - end if; + if Present (Expr) then + -- Preanalyze the expression when the aspect resides in a + -- generic unit. (Is this generic-related code necessary + -- for this aspect? It's modeled on what's done for aspect + -- Disable_Controlled. ???) - -- Otherwise the aspect resides in a nongeneric context + if Inside_A_Generic then + Preanalyze_And_Resolve (Expr, Any_Boolean); - else - -- When the expression statically evaluates to True, the - -- expression function is treated as a static function. - -- Otherwise the aspect appears without an expression and - -- defaults to True. + -- Otherwise the aspect resides in a nongeneric context - if Present (Expr) then + else Analyze_And_Resolve (Expr, Any_Boolean); -- Error if the boolean expression is not static