diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-01 14:50:07 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-01 14:50:07 +0200 |
commit | 1c54829e233dc0cf9470d899a4223adaddcf58b0 (patch) | |
tree | 592fedc48daee6974dff82477bfaa858be60a327 /gcc/ada/sprint.adb | |
parent | 9eea4346af869733ba91b92d40a78de3541d3be0 (diff) | |
download | gcc-1c54829e233dc0cf9470d899a4223adaddcf58b0.zip gcc-1c54829e233dc0cf9470d899a4223adaddcf58b0.tar.gz gcc-1c54829e233dc0cf9470d899a4223adaddcf58b0.tar.bz2 |
[multiple changes]
2011-08-01 Robert Dewar <dewar@adacore.com>
* par-endh.adb: Minor reformatting.
2011-08-01 Robert Dewar <dewar@adacore.com>
* aspects.ads, aspects.adb: Add aspects for library unit pragmas
(Pre_Post_Aspects): New subtype.
* par-ch12.adb (P_Generic): New syntax for aspects in packages
* par-ch13.adb (P_Aspect_Specifications): Add Semicolon parameter
* par-ch7.adb (P_Package): Remove Decl parameter
(P_Package): Handle new syntax for aspects (before IS)
* par-ch9.adb (P_Protected_Definition): Remove Decl parameter, handle
new aspect syntax
(P_Task_Definition): Remove Decl parameter, handle new aspect syntax
* par.adb (P_Aspect_Specifications): Add Semicolon parameter
(P_Package): Remove Decl parameter
* sem_ch13.adb (Analyze_Aspect_Specifications): Handle library unit
aspects
* sem_ch7.adb (Analyze_Package_Declaration): Analyze new format aspect
specs
* sem_util.ads, sem_util.adb (Static_Boolean): New function
* sinfo.ads: Document new syntax for aspects in packages etc.
* sprint.adb: Handle new syntax of aspects before IS in package
2011-08-01 Thomas Quinot <quinot@adacore.com>
* atree.ads: Minor reformatting.
* sem_prag.adb: Minor reformatting.
2011-08-01 Robert Dewar <dewar@adacore.com>
* exp_util.adb (Insert_Actions): Fix error in handling Actions for
case expr alternative.
2011-08-01 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb: Fix typo.
From-SVN: r177027
Diffstat (limited to 'gcc/ada/sprint.adb')
-rw-r--r-- | gcc/ada/sprint.adb | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index e984b5b..7c069165 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -183,11 +183,16 @@ package body Sprint is procedure Sprint_And_List (List : List_Id); -- Print the given list with items separated by vertical "and" - procedure Sprint_Aspect_Specifications (Node : Node_Id); + procedure Sprint_Aspect_Specifications + (Node : Node_Id; + Semicolon : Boolean); -- Node is a declaration node that has aspect specifications (Has_Aspects - -- flag set True). It is called after outputting the terminating semicolon - -- for the related node. The effect is to remove the semicolon and print - -- the aspect specifications, followed by a terminating semicolon. + -- flag set True). It outputs the aspect specifications. For the case + -- of Semicolon = True, it is called after outputting the terminating + -- semicolon for the related node. The effect is to remove the semicolon + -- and print the aspect specifications followed by a terminating semicolon. + -- For the case of Semicolon False, no semicolon is removed or output, and + -- all the aspects are printed on a single line. procedure Sprint_Bar_List (List : List_Id); -- Print the given list with items separated by vertical bars @@ -630,16 +635,24 @@ package body Sprint is -- Sprint_Aspect_Specifications -- ---------------------------------- - procedure Sprint_Aspect_Specifications (Node : Node_Id) is + procedure Sprint_Aspect_Specifications + (Node : Node_Id; + Semicolon : Boolean) + is AS : constant List_Id := Aspect_Specifications (Node); A : Node_Id; begin - Write_Erase_Char (';'); - Indent := Indent + 2; - Write_Indent; - Write_Str ("with "); - Indent := Indent + 5; + if Semicolon then + Write_Erase_Char (';'); + Indent := Indent + 2; + Write_Indent; + Write_Str ("with "); + Indent := Indent + 5; + + else + Write_Str (" with "); + end if; A := First (AS); loop @@ -658,11 +671,16 @@ package body Sprint is exit when No (A); Write_Char (','); - Write_Indent; + + if Semicolon then + Write_Indent; + end if; end loop; - Indent := Indent - 7; - Write_Char (';'); + if Semicolon then + Indent := Indent - 7; + Write_Char (';'); + end if; end Sprint_Aspect_Specifications; --------------------- @@ -2411,6 +2429,14 @@ package body Sprint is when N_Package_Specification => Write_Str_With_Col_Check_Sloc ("package "); Sprint_Node (Defining_Unit_Name (Node)); + + if Nkind (Parent (Node)) = N_Package_Declaration + and then Has_Aspects (Parent (Node)) + then + Sprint_Aspect_Specifications + (Parent (Node), Semicolon => False); + end if; + Write_Str (" is"); Sprint_Indented_List (Visible_Declarations (Node)); @@ -3176,8 +3202,11 @@ package body Sprint is end if; end case; - if Has_Aspects (Node) then - Sprint_Aspect_Specifications (Node); + -- Print aspects, except for special case of package declaration, + -- where the aspects are printed inside the package specification. + + if Has_Aspects (Node) and Nkind (Node) /= N_Package_Declaration then + Sprint_Aspect_Specifications (Node, Semicolon => True); end if; if Nkind (Node) in N_Subexpr |