From e462a42f40a3814273808606ef910b37c29f6930 Mon Sep 17 00:00:00 2001 From: charlet Date: Mon, 20 Jan 2014 15:36:52 +0000 Subject: [PATCH] 2014-01-20 Robert Dewar * exp_ch7.adb: Minor reformatting. * opt.ads: Minor comment updates. * sem.adb: Minor name change Is_Main_Unit => Is_Main_Unit_Or_Main_Unit_Spec. * sem_ch6.adb: Minor reformatting and code reorganization. 2014-01-20 Bob Duff * gnat_ugn.texi: Update gnatpp switches. 2014-01-20 Thomas Quinot * exp_ch9.adb: Minor comment edit. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206827 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 16 ++++++++++++++++ gcc/ada/exp_ch7.adb | 13 ++++++++----- gcc/ada/exp_ch9.adb | 4 +++- gcc/ada/gnat_ugn.texi | 19 +++++++++++++++---- gcc/ada/opt.ads | 9 +++++---- gcc/ada/sem.adb | 9 ++++----- gcc/ada/sem_ch6.adb | 4 +++- 7 files changed, 54 insertions(+), 20 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3e571ff..19369ae 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,21 @@ 2014-01-20 Robert Dewar + * exp_ch7.adb: Minor reformatting. + * opt.ads: Minor comment updates. + * sem.adb: Minor name change Is_Main_Unit => + Is_Main_Unit_Or_Main_Unit_Spec. + * sem_ch6.adb: Minor reformatting and code reorganization. + +2014-01-20 Bob Duff + + * gnat_ugn.texi: Update gnatpp switches. + +2014-01-20 Thomas Quinot + + * exp_ch9.adb: Minor comment edit. + +2014-01-20 Robert Dewar + * gnat_rm.texi: Document that Allow_Integer_Address is permitted only if System.Address is a private type. * opt.ads (Allow_Integer_Address): No longer set by -gnates. diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index e1a1d87..8a16033 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -7989,12 +7989,15 @@ package body Exp_Ch7 is -- optimize away the extra conditional expression, so we can do this -- modification unconditionally here. + -- Why don't we add a test of Opt.Preserve_Control_Flow here??? + if Is_Boolean_Type (Typ) then - Expr := Make_If_Expression (Loc, - Expressions => New_List ( - Expr, - New_Occurrence_Of (Standard_True, Loc), - New_Occurrence_Of (Standard_False, Loc))); + Expr := + Make_If_Expression (Loc, + Expressions => New_List ( + Expr, + New_Occurrence_Of (Standard_True, Loc), + New_Occurrence_Of (Standard_False, Loc))); end if; Insert_Actions (N, New_List ( diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index cdc1543..c505e16 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -1021,7 +1021,9 @@ package body Exp_Ch9 is -- If compiling with -fpreserve-control-flow, make sure we insert an -- IF statement so that the back-end knows to generate a conditional -- branch instruction, even if the condition is just the name of a - -- boolean object. + -- boolean object. Note that Expand_N_If_Statement knows to preserve + -- such redundant IF statements under -fpreserve-control-flow + -- (whether coming from this routine, or directly from source). if Opt.Suppress_Control_Flow_Optimizations then Stmt := Make_Implicit_If_Statement (Cond, diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 5acb851..6485e9d 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -14145,6 +14145,10 @@ Reformat comment blocks @item ^-c5^/COMMENTS_LAYOUT=KEEP_SPECIAL^ Keep unchanged special form comments +@item --comments-only +@cindex @option{--comments-only} @command{gnatpp} +Format just the comments. + @cindex @option{^-l@var{n}^/CONSTRUCT_LAYOUT^} (@command{gnatpp}) @item ^-l1^/CONSTRUCT_LAYOUT=GNAT^ GNAT-style layout (this is the default) @@ -14431,10 +14435,6 @@ Display Copyright and version, then exit disregarding all other options. @cindex @option{--help} @command{gnatpp} Display usage, then exit disregarding all other options. -@item --pp-new -@cindex @option{--pp-new} @command{gnatpp} -Use the new experimental formatting algorithms. This is the default. - @item --pp-old @cindex @option{--pp-old} @command{gnatpp} Use the old formatting algorithms. @@ -14659,6 +14659,17 @@ the comment) should be without any change moved from the argument source into reformatted source. This switch allows to preserve comments that are used as a special marks in the code (e.g.@: SPARK annotation). +@noindent +The @option{--comments-only} switch specifies that only the comments +are formatted; the rest of the program text is left alone. The +comments are formatted according to the -c3 and -c4 switches; other +formatting switches are ignored. For example, @option{--comments-only +-c4} means to fill comment paragraphs, and do nothing else. Likewise, +@option{--comments-only -c3} ensures comments start with at least two +spaces after @code{--}, and @option{--comments-only -c3 -c4} does +both. If @option{--comments-only} is given without @option{-c3} or +@option{-c4}, then gnatpp doesn't format anything. + @node Construct Layout @subsection Construct Layout diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index 58f0fe6..ea3dd20 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -1919,10 +1919,11 @@ package Opt is -- This procedure sets the switches to the appropriate initial values. The -- parameter Internal_Unit is True for an internal or predefined unit, and -- affects the way the switches are set (see above). Main_Unit is true if - -- switches are being set for the main unit (this affects setting of the - -- assert/debug pragma switches, which are normally set false by default - -- for an internal unit, except when the internal unit is the main unit, - -- in which case we use the command line settings). + -- switches are being set for the main unit or for the spec of the main + -- unit. This affects setting of the assert/debug pragma switches, which + -- are normally set false by default for an internal unit, except when the + -- internal unit is the main unit, in which case we use the command line + -- settings). procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type); -- This procedure restores a set of switch values previously saved by a diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index a175014..ced4d41 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -1322,15 +1322,14 @@ package body Sem is -- If the main unit is generic, every compiled unit, including its -- context, is compiled with expansion disabled. - -- configuration flags have special settings when compiling a predefined - -- file as a main unit. This applies to its spec as well. - - Is_Main_Unit : constant Boolean := + Is_Main_Unit_Or_Main_Unit_Spec : constant Boolean := Current_Sem_Unit = Main_Unit or else (Nkind (Unit (Cunit (Main_Unit))) = N_Package_Body and then Library_Unit (Cunit (Main_Unit)) = Cunit (Current_Sem_Unit)); + -- Configuration flags have special settings when compiling a predefined + -- file as a main unit. This applies to its spec as well. Ext_Main_Source_Unit : constant Boolean := In_Extended_Main_Source_Unit (Comp_Unit); @@ -1431,7 +1430,7 @@ package body Sem is Save_Opt_Config_Switches (Save_Config_Switches); Set_Opt_Config_Switches (Is_Internal_File_Name (Unit_File_Name (Current_Sem_Unit)), - Is_Main_Unit); + Is_Main_Unit_Or_Main_Unit_Spec); -- Save current non-partition-wide restrictions diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 995d084..9555dd1 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -457,9 +457,11 @@ package body Sem_Ch6 is -- and will be redone when analyzing the body. declare - Expr : Node_Id renames Expression (Ret); + Expr : constant Node_Id := Expression (Ret); + begin Set_Parent (Expr, Ret); + if not In_Instance then Preanalyze_Spec_Expression (Expr, Etype (Id)); end if; -- 2.7.4