* 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
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.
-- 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 (
-- 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,
@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)
@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.
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
-- 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
-- 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);
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
-- 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;