diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-13 11:24:28 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-13 11:24:28 +0100 |
commit | da9683f4dbc85066c290798a14d1158f804f92a2 (patch) | |
tree | c30d14feaa65425fda4394198a472a663338db04 /gcc/ada/sem_ch3.adb | |
parent | 3de3a1be9ee8c46efce3714cbbecaae0c7efe3f0 (diff) | |
download | gcc-da9683f4dbc85066c290798a14d1158f804f92a2.zip gcc-da9683f4dbc85066c290798a14d1158f804f92a2.tar.gz gcc-da9683f4dbc85066c290798a14d1158f804f92a2.tar.bz2 |
[multiple changes]
2017-01-13 Yannick Moy <moy@adacore.com>
* inline.adb (Remove_Aspects_And_Pragmas): Add Unused to the
list of pragmas to remove. Remove pragmas from the list of
statements in the body to inline.
* namet.adb, namet.ads (Nam_In): New version with 12 parameters.
2017-01-13 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Resolve_Aspects): New procedure, subsidiary of
Analyze_Declarations, to analyze and resolve the expressions of
aspect specifications in the current declarative list, so that
the expressions have proper entity and type info. This is needed
for ASIS when there is no subsequent expansion to generate this
semantic information.
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Use Etype of
original expression, to suppress cascaded errors when expression
has been constant-folded.
(Resolve_Aspect_Expressions, Resolve_Name): Preserve entities in
ASIS mode, because there is no subsequent expansion to decorate
the tree.
From-SVN: r244409
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index ab1e8c0..24ac69f 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -2178,6 +2178,10 @@ package body Sem_Ch3 is -- If the states have visible refinement, remove the visibility of each -- constituent at the end of the package body declaration. + procedure Resolve_Aspects; + -- Utility to resolve the expressions of aspects at the end of a list of + -- declarations. + ----------------- -- Adjust_Decl -- ----------------- @@ -2369,6 +2373,21 @@ package body Sem_Ch3 is end if; end Remove_Visible_Refinements; + --------------------- + -- Resolve_Aspects -- + --------------------- + + procedure Resolve_Aspects is + E : Entity_Id; + + begin + E := First_Entity (Current_Scope); + while Present (E) loop + Resolve_Aspect_Expressions (E); + Next_Entity (E); + end loop; + end Resolve_Aspects; + -- Local variables Context : Node_Id := Empty; @@ -2451,13 +2470,31 @@ package body Sem_Ch3 is and then not Is_Child_Unit (Current_Scope) and then No (Generic_Parent (Parent (L))) then - null; + -- This is needed in all cases to catch visibility errors in + -- aspect expressions, but several large user tests are now + -- rejected. Pending notification we restrict this call to + -- ASIS mode. + + if ASIS_Mode then + Resolve_Aspects; + end if; elsif L /= Visible_Declarations (Parent (L)) or else No (Private_Declarations (Parent (L))) or else Is_Empty_List (Private_Declarations (Parent (L))) then Adjust_Decl; + + -- In compilation mode the expansion of freeze node takes care + -- of resolving expressions of all aspects in the list. In ASIS + -- mode this must be done explicitly. + + if ASIS_Mode + and then Scope (Current_Scope) = Standard_Standard + then + Resolve_Aspects; + end if; + Freeze_All (First_Entity (Current_Scope), Decl); Freeze_From := Last_Entity (Current_Scope); @@ -2473,16 +2510,7 @@ package body Sem_Ch3 is -- pragmas do not appear in the original generic tree. elsif Serious_Errors_Detected = 0 then - declare - E : Entity_Id; - - begin - E := First_Entity (Current_Scope); - while Present (E) loop - Resolve_Aspect_Expressions (E); - Next_Entity (E); - end loop; - end; + Resolve_Aspects; end if; -- If next node is a body then freeze all types before the body. |