diff options
author | Ed Schonberg <schonberg@adacore.com> | 2013-09-10 14:48:04 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-09-10 16:48:04 +0200 |
commit | 31dd3f4bf63e160b62ed3d3f3cb4ac231b9f85bf (patch) | |
tree | f44b642b02a3180daac40203e5e2292b62b92bdd /gcc/ada/sprint.adb | |
parent | 3f910f7bd1d59423694c6a4ab73c8eaa30714f06 (diff) | |
download | gcc-31dd3f4bf63e160b62ed3d3f3cb4ac231b9f85bf.zip gcc-31dd3f4bf63e160b62ed3d3f3cb4ac231b9f85bf.tar.gz gcc-31dd3f4bf63e160b62ed3d3f3cb4ac231b9f85bf.tar.bz2 |
sem_ch12.adb (Analyze_Package_Instantiation): If the instantiation is a compilation unit...
2013-09-10 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Analyze_Package_Instantiation): If the
instantiation is a compilation unit, analyze aspects before
analyzing the package declaration for the instance.
* sem_ch13.adb (Analyze_Aspect_Specifications): If the
corresponding node is a package instantiation, insert generated
pragmas at the head of visible declarations.
* sem_prag.adb (Analyze_Pragma, case Preelaborate): In an instance
do not ignore the pragma if it comes from an aspect specification
in the instance, and not from the generic unit.
* sprint.adb (Sprint_Node_Actual): For a package declaration that
is an instantiation, print aspects after declaration.
From-SVN: r202453
Diffstat (limited to 'gcc/ada/sprint.adb')
-rw-r--r-- | gcc/ada/sprint.adb | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index 8526716..82d6ce5 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -2479,6 +2479,18 @@ package body Sprint is Sprint_Node_Sloc (Specification (Node)); Write_Char (';'); + -- If this is an instantiation, get the aspects from the original + -- instantiation node. + + if Is_Generic_Instance (Defining_Entity (Node)) + and then Has_Aspects ( + Package_Instantiation (Defining_Entity (Node))) + then + Sprint_Aspect_Specifications + (Package_Instantiation (Defining_Entity (Node)), + Semicolon => True); + end if; + when N_Package_Instantiation => Extra_Blank_Line; Write_Indent_Str_Sloc ("package "); @@ -2499,12 +2511,27 @@ package body Sprint is Write_Str_With_Col_Check_Sloc ("package "); Sprint_Node (Defining_Unit_Name (Node)); - if Nkind_In (Parent (Node), N_Package_Declaration, - N_Generic_Package_Declaration) + if Nkind (Parent (Node)) = N_Generic_Package_Declaration and then Has_Aspects (Parent (Node)) then Sprint_Aspect_Specifications (Parent (Node), Semicolon => False); + + -- An instantiation is rewritten as a package declaration, but + -- the aspects belong to the instantiation node. + + elsif Nkind (Parent (Node)) = N_Package_Declaration then + declare + Pack : constant Entity_Id := Defining_Entity (Node); + + begin + if not Is_Generic_Instance (Pack) then + if Has_Aspects (Parent (Node)) then + Sprint_Aspect_Specifications + (Parent (Node), Semicolon => False); + end if; + end if; + end; end if; Write_Str (" is"); |