diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-12-09 15:22:29 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-04-28 05:38:12 -0400 |
commit | 189c58042ddde50ab07ee105d14c7a24d05f9482 (patch) | |
tree | 42e41b2841de496a99d51f9df1ffbccc0c8a96cd /gcc | |
parent | 12e67086ad2777e1f583124f15210ee0323533c3 (diff) | |
download | gcc-189c58042ddde50ab07ee105d14c7a24d05f9482.zip gcc-189c58042ddde50ab07ee105d14c7a24d05f9482.tar.gz gcc-189c58042ddde50ab07ee105d14c7a24d05f9482.tar.bz2 |
[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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 28 |
1 files changed, 13 insertions, 15 deletions
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 |