2014-01-20 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Jan 2014 15:36:52 +0000 (15:36 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Jan 2014 15:36:52 +0000 (15:36 +0000)
* 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  <duff@adacore.com>

* gnat_ugn.texi: Update gnatpp switches.

2014-01-20  Thomas Quinot  <quinot@adacore.com>

* 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
gcc/ada/exp_ch7.adb
gcc/ada/exp_ch9.adb
gcc/ada/gnat_ugn.texi
gcc/ada/opt.ads
gcc/ada/sem.adb
gcc/ada/sem_ch6.adb

index 3e571ff..19369ae 100644 (file)
@@ -1,5 +1,21 @@
 2014-01-20  Robert Dewar  <dewar@adacore.com>
 
+       * 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  <duff@adacore.com>
+
+       * gnat_ugn.texi: Update gnatpp switches.
+
+2014-01-20  Thomas Quinot  <quinot@adacore.com>
+
+       * exp_ch9.adb: Minor comment edit.
+
+2014-01-20  Robert Dewar  <dewar@adacore.com>
+
        * 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.
index e1a1d87..8a16033 100644 (file)
@@ -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 (
index cdc1543..c505e16 100644 (file)
@@ -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,
index 5acb851..6485e9d 100644 (file)
@@ -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
 
index 58f0fe6..ea3dd20 100644 (file)
@@ -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
index a175014..ced4d41 100644 (file)
@@ -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
 
index 995d084..9555dd1 100644 (file)
@@ -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;