public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2197] [Ada] Reorder preanalysis of static expression functions
@ 2021-07-09 12:38 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-09 12:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:81956c08f74be83aa61cba6c112b92cdc0198a66

commit r12-2197-g81956c08f74be83aa61cba6c112b92cdc0198a66
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Fri May 28 15:32:16 2021 +0200

    [Ada] Reorder preanalysis of static expression functions
    
    gcc/ada/
    
            * sem_ch6.adb (Analyze_Expression_Function): Reorder code.

Diff:
---
 gcc/ada/sem_ch6.adb | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 0ecac3fed4e..d5432536846 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -524,6 +524,12 @@ package body Sem_Ch6 is
             Install_Formals (Def_Id);
             Preanalyze_Spec_Expression (Expr, Typ);
             End_Scope;
+         else
+            Push_Scope (Def_Id);
+            Install_Formals (Def_Id);
+            Preanalyze_Formal_Expression (Expr, Typ);
+            Check_Limited_Return (Orig_N, Expr, Typ);
+            End_Scope;
          end if;
 
          --  If this is a wrapper created in an instance for a formal
@@ -561,16 +567,6 @@ package body Sem_Ch6 is
             end;
          end if;
 
-         --  Preanalyze the expression if not already done above
-
-         if not Inside_A_Generic then
-            Push_Scope (Def_Id);
-            Install_Formals (Def_Id);
-            Preanalyze_Formal_Expression (Expr, Typ);
-            Check_Limited_Return (Orig_N, Expr, Typ);
-            End_Scope;
-         end if;
-
          --  In the case of an expression function marked with the aspect
          --  Static, we need to check the requirement that the function's
          --  expression is a potentially static expression. This is done


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-09 12:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 12:38 [gcc r12-2197] [Ada] Reorder preanalysis of static expression functions Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).