[multiple changes]

2014-02-24  Thomas Quinot  <quinot@adacore.com>

	* s-os_lib.adb (Errno_Message): Do not depend on Integer'Image.
	* s-oscons-tmplt.c: On VxWorks, include adaint.h only after
	vxWorks.h has been included.  Also ensure that file attributes
	related definitions are output even in cases where socket support
	is not enabled.
	* a-tags.adb: Code clean up.
	* Make-generated.in (OSCONS_CPP, OSCONS_EXTRACT): Use -iquote
	instead of -I to add the main ada source directory to the header
	search path, in order to avoid conflict between our own "types.h"
	and VxWork's <types.h>.

2014-02-24  Robert Dewar  <dewar@adacore.com>

	* atree.ads, atree.adb (Copy_Separate_Tree): Add Syntax_Only parameter.
	* debug.adb: Remove documentation of -gnatd.X, no longer used.
	* freeze.adb (Wrap_Imported_Subprogram): Fixed and activated.

2014-02-24  Bob Duff  <duff@adacore.com>

	* gnat_ugn.texi: Improve documentation of gnatpp.

From-SVN: r208083
This commit is contained in:
Arnaud Charlet 2014-02-24 18:01:19 +01:00
parent 47752af2e8
commit f1a3590ee2
10 changed files with 374 additions and 578 deletions

View File

@ -1,3 +1,26 @@
2014-02-24 Thomas Quinot <quinot@adacore.com>
* s-os_lib.adb (Errno_Message): Do not depend on Integer'Image.
* s-oscons-tmplt.c: On VxWorks, include adaint.h only after
vxWorks.h has been included. Also ensure that file attributes
related definitions are output even in cases where socket support
is not enabled.
* a-tags.adb: Code clean up.
* Make-generated.in (OSCONS_CPP, OSCONS_EXTRACT): Use -iquote
instead of -I to add the main ada source directory to the header
search path, in order to avoid conflict between our own "types.h"
and VxWork's <types.h>.
2014-02-24 Robert Dewar <dewar@adacore.com>
* atree.ads, atree.adb (Copy_Separate_Tree): Add Syntax_Only parameter.
* debug.adb: Remove documentation of -gnatd.X, no longer used.
* freeze.adb (Wrap_Imported_Subprogram): Fixed and activated.
2014-02-24 Bob Duff <duff@adacore.com>
* gnat_ugn.texi: Improve documentation of gnatpp.
2014-02-24 Thomas Quinot <quinot@adacore.com>
* g-stheme.adb, g-socthi-vms.adb, g-socthi-vms.ads,

View File

@ -67,12 +67,20 @@ $(ADA_GEN_SUBDIR)/stamp-nmake: $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/nma
touch $(ADA_GEN_SUBDIR)/stamp-nmake
# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
# for running it from $(ADA_GEN_SUBDIR)/bldtools/oscons
# for running it from $(ADA_GEN_SUBDIR)/bldtools/oscons.
OSCONS_CC=$(subst ./xgcc,../../../xgcc,$(subst -B./, -B../../../,$(GCC_FOR_TARGET)))
# The main ada source directory must be on the include path for #include "..."
# because s-oscons-tmplt.c requires adaint.h, gsocket.h, and any file included
# by these headers. However note that we must use -iquote, not -I, so that
# ada/types.h does not conflict with a same-named system header (VxWorks
# has a <types.h> header).
OSCONS_SRCDIR=$${_oscons_srcdir}
OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
-DTARGET=\"$(target)\" -I$(OSCONS_SRCDIR) s-oscons-tmplt.c > s-oscons-tmplt.i
OSCONS_EXTRACT=$(OSCONS_CC) -I$(OSCONS_SRCDIR) -S s-oscons-tmplt.i
-DTARGET=\"$(target)\" -iquote $(OSCONS_SRCDIR) s-oscons-tmplt.c > s-oscons-tmplt.i
OSCONS_EXTRACT=$(OSCONS_CC) -iquote $(OSCONS_SRCDIR) -S s-oscons-tmplt.i
# Note: if you need to build with a non-GNU compiler, you could adapt the
# following definitions (written for VMS DEC-C)

View File

@ -31,7 +31,6 @@
with Ada.Exceptions;
with Ada.Unchecked_Conversion;
with System.CRTL; use System.CRTL;
with System.HTable;
with System.Storage_Elements; use System.Storage_Elements;
with System.WCh_Con; use System.WCh_Con;
@ -57,6 +56,10 @@ package body Ada.Tags is
-- table. This is Inline_Always since it is called from other Inline_
-- Always subprograms where we want no out of line code to be generated.
function Length (Str : Cstring_Ptr) return Natural;
-- Length of string represented by the given pointer (treating the string
-- as a C-style string, which is Nul terminated).
function OSD (T : Tag) return Object_Specific_Data_Ptr;
-- Ada 2005 (AI-251): Given a pointer T to a secondary dispatch table,
-- retrieve the address of the record containing the Object Specific
@ -270,11 +273,10 @@ package body Ada.Tags is
function Hash (F : System.Address) return HTable_Headers is
function H is new System.HTable.Hash (HTable_Headers);
Str : String (1 .. Integer (strlen (F)));
for Str'Address use F;
pragma Import (Ada, Str);
Str : constant Cstring_Ptr := To_Cstring_Ptr (F);
Res : constant HTable_Headers := H (Str (1 .. Length (Str)));
begin
return H (Str);
return Res;
end Hash;
-----------------
@ -283,9 +285,9 @@ package body Ada.Tags is
procedure Set_HT_Link (T : Tag; Next : Tag) is
TSD_Ptr : constant Addr_Ptr :=
To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size);
To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size);
TSD : constant Type_Specific_Data_Ptr :=
To_Type_Specific_Data_Ptr (TSD_Ptr.all);
To_Type_Specific_Data_Ptr (TSD_Ptr.all);
begin
TSD.HT_Link.all := Next;
end Set_HT_Link;
@ -308,10 +310,8 @@ package body Ada.Tags is
procedure Check_TSD (TSD : Type_Specific_Data_Ptr) is
T : Tag;
E_Tag_Len : constant Integer :=
Integer (strlen (TSD.External_Tag.all'Address));
E_Tag : String (1 .. E_Tag_Len);
E_Tag_Len : constant Integer := Length (TSD.External_Tag);
E_Tag : String (1 .. E_Tag_Len);
for E_Tag'Address use TSD.External_Tag.all'Address;
pragma Import (Ada, E_Tag);
@ -486,7 +486,7 @@ package body Ada.Tags is
TSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size);
TSD := To_Type_Specific_Data_Ptr (TSD_Ptr.all);
Result := TSD.Expanded_Name;
return Result (1 .. Integer (strlen (Result.all'Address)));
return Result (1 .. Length (Result));
end Expanded_Name;
------------------
@ -506,7 +506,7 @@ package body Ada.Tags is
TSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size);
TSD := To_Type_Specific_Data_Ptr (TSD_Ptr.all);
Result := TSD.External_Tag;
return Result (1 .. Integer (strlen (Result.all'Address)));
return Result (1 .. Length (Result));
end External_Tag;
---------------------
@ -730,6 +730,27 @@ package body Ada.Tags is
and then D_TSD.Access_Level = A_TSD.Access_Level;
end Is_Descendant_At_Same_Level;
------------
-- Length --
------------
-- Note: This unit is used in the Ravenscar runtime library, so it cannot
-- depend on System.CTRL. Furthermore, this happens on CPUs where the GCC
-- intrinsic strlen may not be available, so we need to recode our own Ada
-- version here.
function Length (Str : Cstring_Ptr) return Natural is
Len : Integer;
begin
Len := 1;
while Str (Len) /= ASCII.NUL loop
Len := Len + 1;
end loop;
return Len - 1;
end Length;
-------------------
-- Offset_To_Top --
-------------------

View File

@ -772,7 +772,10 @@ package body Atree is
-- Copy_Separate_Tree --
------------------------
function Copy_Separate_Tree (Source : Node_Id) return Node_Id is
function Copy_Separate_Tree
(Source : Node_Id;
Syntax_Only : Boolean := False) return Node_Id
is
New_Id : Node_Id;
function Copy_Entity (E : Entity_Id) return Entity_Id;
@ -793,6 +796,10 @@ package body Atree is
New_Ent : Entity_Id;
begin
-- Build appropriate node. Note that in this case, we do not need to
-- do any special casing for Syntax_Only, since the new node has no
-- Etype set, and is always unanalyzed.
case N_Entity (Nkind (E)) is
when N_Defining_Identifier =>
New_Ent := New_Entity (N_Defining_Identifier, Sloc (E));
@ -828,7 +835,7 @@ package body Atree is
if Has_Extension (E) then
Append (Copy_Entity (E), NL);
else
Append (Copy_Separate_Tree (E), NL);
Append (Copy_Separate_Tree (E, Syntax_Only), NL);
end if;
Next (E);
@ -847,7 +854,8 @@ package body Atree is
begin
if Field in Node_Range then
New_N := Union_Id (Copy_Separate_Tree (Node_Id (Field)));
New_N :=
Union_Id (Copy_Separate_Tree (Node_Id (Field), Syntax_Only));
if Parent (Node_Id (Field)) = Source then
Set_Parent (Node_Id (New_N), New_Id);
@ -898,6 +906,47 @@ package body Atree is
Set_Entity (New_Id, Empty);
end if;
-- This is the point at which we do the special processing for
-- the Syntax_Only flag being set:
if Syntax_Only then
-- Reset all Etype fields and Analyzed flags
if Nkind (New_Id) in N_Has_Etype then
Set_Etype (New_Id, Empty);
end if;
Set_Analyzed (New_Id, False);
-- Rather special case, if we have an expanded name, then change
-- it back into a selected component, so that the tree looks the
-- way it did coming out of the parser. This will change back
-- when we analyze the selected component node.
if Nkind (New_Id) = N_Expanded_Name then
-- The following code is a bit kludgy. It would be cleaner to
-- Add an entry Change_Expanded_Name_To_Selected_Component to
-- Sinfo.CN, but that's an earthquake, because it has the wrong
-- license, and Atree is used outside the compiler, e.g. in the
-- binder and in ASIS, so we don't want to add that dependency.
-- Consequently we have no choice but to hold our noses and do
-- the change manually. At least we are Atree, so this odd use
-- of Atree.Unchecked_Access is at least all in the family.
-- Change the node type
Atree.Unchecked_Access.Set_Nkind (New_Id, N_Selected_Component);
-- Clear the Chars field which is not present in a selected
-- component node, so we don't want a junk value around.
Set_Node1 (New_Id, Empty);
end if;
end if;
-- All done, return copied node
return New_Id;

View File

@ -494,7 +494,9 @@ package Atree is
-- is thus still attached to the tree. It is valid for Source to be Empty,
-- in which case Relocate_Node simply returns Empty as the result.
function Copy_Separate_Tree (Source : Node_Id) return Node_Id;
function Copy_Separate_Tree
(Source : Node_Id;
Syntax_Only : Boolean := False) return Node_Id;
-- Given a node that is the root of a subtree, Copy_Separate_Tree copies
-- the entire syntactic subtree, including recursively any descendants
-- whose parent field references a copied node (descendants not linked to
@ -505,6 +507,33 @@ package Atree is
-- is called on an unanalyzed tree, and no semantic information is copied.
-- However, to ensure that no entities are shared between the two when the
-- source is already analyzed, entity fields in the copy are zeroed out.
--
-- In addition, if Syntax_Only is set True, then when Copy_Separate_Tree
-- is applied Identical to Copy_Separate_Tree except that in the case of
-- applying it to an already analyzed tree, all Etype fields are reset,
-- and all Analyzed flags are set False. In addition, Expanded_Name
-- nodes are converted back into the original parser form (where they are
-- Selected_Components), so that renalysis does the right thing.
--
-- Note: it really seems like Copy_Separate_Tree could do these identical
-- steps unconditionally, and that nearly works, except for this one known
-- test case that fails:
--
-- 1. procedure III is
-- 2. procedure Proc2 is
-- 3. pragma Inline_Always (Proc2);
-- |
-- >>> argument of "INLINE_ALWAYS" must be entity in
-- current scope
--
-- 4. begin
-- 5. null;
-- 6. end Proc2;
-- 7. begin
-- 8. null;
-- 9. end III;
--
-- To be investigated ???
function Copy_Separate_List (Source : List_Id) return List_Id;
-- Applies Copy_Separate_Tree to each element of the Source list, returning

View File

@ -141,7 +141,7 @@ package body Debug is
-- d.U Ignore indirect calls for static elaboration
-- d.V
-- d.W Print out debugging information for Walk_Library_Items
-- d.X Activate wrapping of imported subprograms with pre/post conditions
-- d.X
-- d.Y
-- d.Z
@ -664,9 +664,6 @@ package body Debug is
-- the order in which units are walked. This is primarily for use in
-- debugging CodePeer mode.
-- d.X Activates Wrap_Imported_Subprogram in Freeze (not yet working so
-- this allows checkin of partial implementation).
-- d1 Error messages have node numbers where possible. Normally error
-- messages have only source locations. This option is useful when
-- debugging errors caused by expanded code, where the source location

View File

@ -3400,6 +3400,7 @@ package body Freeze is
procedure Wrap_Imported_Subprogram (E : Entity_Id) is
Loc : constant Source_Ptr := Sloc (E);
CE : constant Name_Id := Chars (E);
Spec : Node_Id;
Parms : List_Id;
Stmt : Node_Id;
@ -3412,29 +3413,30 @@ package body Freeze is
if not Is_Imported (E) then
return;
end if;
-- Test enabling conditions for wrapping
if Is_Subprogram (E)
elsif Is_Subprogram (E)
and then Present (Contract (E))
and then Present (Pre_Post_Conditions (Contract (E)))
and then not GNATprove_Mode
then
-- For now, activate this only if -gnatd.X is set, because there
-- are problems with this procedure, it is not working yet, but
-- we would like to be able to check it in ???
-- Here we do the wrap
if not Debug_Flag_Dot_XX then
Error_Msg_NE
("pre/post conditions on imported subprogram are not "
& "enforced??", E, Pre_Post_Conditions (Contract (E)));
goto Not_Wrapped;
end if;
-- Note on calls to Copy_Separate_Tree. The trees we are copying
-- here are fully analyzed, but we definitely want fully syntactic
-- unanalyzed trees in the body we construct, so that the analysis
-- generates the right visibility. So this is a case in which we
-- set Syntax_Only. See spec of Copy_Separate_Tree for details on
-- the use of this flag.
-- Acquire copy of Inline pragma
Iprag :=
Copy_Separate_Tree (Import_Pragma (E), Syntax_Only => True);
-- Fix up spec to be not imported any more
Iprag := Import_Pragma (E);
Set_Is_Imported (E, False);
Set_Interface_Name (E, Empty);
Set_Has_Completion (E, False);
@ -3449,7 +3451,7 @@ package body Freeze is
Parms := New_List;
Forml := First_Formal (E);
while Present (Forml) loop
Append_To (Parms, New_Occurrence_Of (Forml, Loc));
Append_To (Parms, Make_Identifier (Loc, Chars (Forml)));
Next_Formal (Forml);
end loop;
@ -3460,13 +3462,13 @@ package body Freeze is
Make_Simple_Return_Statement (Loc,
Expression =>
Make_Function_Call (Loc,
Name => New_Occurrence_Of (E, Loc),
Name => Make_Identifier (Loc, CE),
Parameter_Associations => Parms));
else
Stmt :=
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (E, Loc),
Name => Make_Identifier (Loc, CE),
Parameter_Associations => Parms);
end if;
@ -3474,33 +3476,34 @@ package body Freeze is
Bod :=
Make_Subprogram_Body (Loc,
Specification => Copy_Separate_Tree (Spec),
Specification =>
Copy_Separate_Tree (Spec, Syntax_Only => True),
Declarations => New_List (
Make_Subprogram_Declaration (Loc,
Specification => Copy_Separate_Tree (Spec)),
Copy_Separate_Tree (Iprag)),
Specification =>
Copy_Separate_Tree (Spec, Syntax_Only => True)),
Iprag),
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (Stmt),
End_Label => New_Occurrence_Of (E, Loc)));
End_Label => Make_Identifier (Loc, CE)));
-- Append the body to freeze result
Add_To_Result (Bod);
return;
end if;
-- Case of imported subprogram that does not get wrapped
<<Not_Wrapped>>
else
-- Set Is_Public. All imported entities need an external symbol
-- created for them since they are always referenced from another
-- object file. Note this used to be set when we set Is_Imported
-- back in Sem_Prag, but now we delay it to this point, since we
-- don't want to set this flag if we wrap an imported subprogram.
-- Set Is_Public. All imported entities need an external symbol
-- created for them since they are always referenced from another
-- object file. Note this used to be set when we set Is_Imported
-- back in Sem_Prag, but now we delay it to this point, since we
-- don't want to set this flag if we wrap an imported subprogram.
Set_Is_Public (E);
Set_Is_Public (E);
end if;
end Wrap_Imported_Subprogram;
-- Start of processing for Freeze_Entity

View File

@ -11319,7 +11319,7 @@ to be processed.
@item -X@var{name}=@var{value}
@cindex @option{-X} @command{gnatelim}
Indicates that external variable @var{name} in the argument project
has the @var{value} value. Has no effect if no project is specified as
has the value @var{value}. Has no effect if no project is specified as
tool argument.
@item ^-files^/FILES^=@var{filename}
@ -14076,25 +14076,23 @@ is now available.
To invoke the old formatting algorithms, use the @option{--pp-old} switch.
Support for @option{--pp-old} will be removed in some future version.
To produce a reformatted file, @command{gnatpp} generates and uses the ASIS
tree for the input source and thus requires the input to be syntactically and
semantically legal.
If this condition is not met, @command{gnatpp} will terminate with an
error message; no output file will be generated.
To produce a reformatted file, @command{gnatpp} invokes the Ada
compiler and generates and uses the ASIS tree for the input source;
thus the input must be legal Ada code.
@command{gnatpp} cannot process sources that contain
preprocessing directives.
If the compilation unit
contained in the input source depends semantically upon units located
outside the current directory, you have to provide the source search path
when invoking @command{gnatpp}, if these units are contained in files with
names that do not follow the GNAT file naming rules, you have to provide
the configuration file describing the corresponding naming scheme;
see the description of the @command{gnatpp}
switches below. Another possibility is to use a project file and to
call @command{gnatpp} through the @command{gnat} driver
(see @ref{The GNAT Driver and Project Files}).
If the compilation unit contained in the input source depends
semantically upon units located outside the current directory, you
have to provide the source search path when invoking
@command{gnatpp}. If these units are contained in files with names
that do not follow the GNAT file naming rules, you have to provide a
configuration file describing the corresponding naming scheme; see the
description of the @command{gnatpp} switches below. Another
possibility is to use a project file and to call @command{gnatpp}
through the @command{gnat} driver (see @ref{The GNAT Driver and
Project Files}).
The @command{gnatpp} command has the form
@ -14114,18 +14112,16 @@ output source file
@item
@var{filename} is the name (including the extension) of the source file to
reformat; ``wildcards'' or several file names on the same gnatpp command are
allowed. The file name may contain path information; it does not have to
reformat; wildcards or several file names on the same gnatpp command are
allowed. The file name may contain path information; it does not have to
follow the GNAT file naming rules
@item
@samp{@var{gcc_switches}} is a list of switches for
@command{gcc}. They will be passed on to all compiler invocations made by
@command{gnatelim} to generate the ASIS trees. Here you can provide
@command{gnatpp} to generate the ASIS trees. Here you can provide
@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path,
use the @option{-gnatec} switch to set the configuration file,
use the @option{-gnat05} switch if sources should be compiled in
Ada 2005 mode etc.
use the @option{-gnatec} switch to set the configuration file, etc.
@end itemize
@node Switches for gnatpp
@ -14149,10 +14145,6 @@ You may supply several such switches to @command{gnatpp}, but then
each must be specified in full, with both the name and the value.
Abbreviated forms (the name appearing once, followed by each value) are
not permitted.
For example, to set
the alignment of the assignment delimiter both in declarations and in
assignment statements, you must write @option{-A2A3}
(or @option{-A2 -A3}), but not @option{-A23}.
@end ifclear
@ifset vms
@ -14162,21 +14154,11 @@ word may have exactly one option, which specifies either upper case, lower
case, or mixed case), and thus exactly one such option can be in effect for
an invocation of @command{gnatpp}.
If more than one is supplied, the last one is used.
However, some qualifiers have options that are mutually compatible,
and then you may then supply several such options when invoking
@command{gnatpp}.
@end ifset
In most cases, it is obvious whether or not the
^values for a switch with a given name^options for a given qualifier^
are compatible with each other.
When the semantics might not be evident, the summaries below explicitly
indicate the effect.
@menu
* Alignment Control::
* Casing Control::
* Construct Layout Control::
* General Text Layout Control::
* Other Formatting Options::
* Setting the Source Search Path::
@ -14190,44 +14172,22 @@ indicate the effect.
@noindent
Programs can be easier to read if certain constructs are vertically aligned.
By default all alignments are set ON.
Through the @option{^-A0^/ALIGN=OFF^} switch you may reset the default to
OFF, and then use one or more of the other
^@option{-A@var{n}} switches^@option{/ALIGN} options^
to activate alignment for specific constructs.
By default alignment of the following constructs is set ON:
@code{:} in declarations, @code{:=} in initializations in declarations
@code{:=} in assignment statements, @code{=>} in associations, and
@code{at} keywords in the component clauses in record
representation clauses.
@table @option
@cindex @option{^-A@var{n}^/ALIGN^} (@command{gnatpp})
@ifset vms
@item /ALIGN=ON
Set all alignments to ON
@end ifset
@item ^-A0^/ALIGN=OFF^
Set all alignments to OFF
Set alignment to OFF
@item ^-A1^/ALIGN=COLONS^
Align @code{:} in declarations
@item ^-A2^/ALIGN=DECLARATIONS^
Align @code{:=} in initializations in declarations
@item ^-A3^/ALIGN=STATEMENTS^
Align @code{:=} in assignment statements
@item ^-A4^/ALIGN=ARROWS^
Align @code{=>} in associations
@item ^-A5^/ALIGN=COMPONENT_CLAUSES^
Align @code{at} keywords in the component clauses in record
representation clauses
@item ^-A1^/ALIGN=ON^
Set alignment to ON
@end table
@noindent
The @option{^-A^/ALIGN^} switches are mutually compatible; any combination
is allowed.
@node Casing Control
@subsection Casing Control
@cindex Casing control in @command{gnatpp}
@ -14240,10 +14200,6 @@ general rule for name casing but also override this rule
via a set of dictionary files.
Three types of casing are supported: lower case, upper case, and mixed case.
Lower and upper case are self-explanatory (but since some letters in
Latin1 and other GNAT-supported character sets
exist only in lower-case form, an upper case conversion will have no
effect on them.)
``Mixed case'' means that the first letter, and also each letter immediately
following an underscore, are converted to their uppercase forms;
all the other letters are converted to their lowercase forms.
@ -14369,10 +14325,6 @@ The @option{^-D-^/SPECIFIC_CASING^} and
@option{^-D@var{file}^/DICTIONARY=@var{file}^} switches are mutually
compatible.
@node Construct Layout Control
@subsection Construct Layout Control
@cindex Layout control in @command{gnatpp}
@noindent
This group of @command{gnatpp} switches controls the layout of comments and
complex syntactic constructs. See @ref{Formatting Comments} for details
@ -14381,53 +14333,31 @@ on their effect.
@table @option
@cindex @option{^-c@var{n}^/COMMENTS_LAYOUT^} (@command{gnatpp})
@item ^-c0^/COMMENTS_LAYOUT=UNTOUCHED^
All the comments remain unchanged
All comments remain unchanged.
@item ^-c1^/COMMENTS_LAYOUT=DEFAULT^
GNAT-style comment line indentation (this is the default).
@item ^-c2^/COMMENTS_LAYOUT=STANDARD_INDENT^
Reference-manual comment line indentation.
GNAT-style comment line indentation.
This is the default.
@item ^-c3^/COMMENTS_LAYOUT=GNAT_BEGINNING^
GNAT-style comment beginning
GNAT-style comment beginning.
@item ^-c4^/COMMENTS_LAYOUT=REFORMAT^
Reformat comment blocks
Fill comment blocks.
@item ^-c5^/COMMENTS_LAYOUT=KEEP_SPECIAL^
Keep unchanged special form comments
Keep unchanged special form comments.
This is the default.
@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)
@item ^-l2^/CONSTRUCT_LAYOUT=COMPACT^
Compact layout
@item ^-l3^/CONSTRUCT_LAYOUT=UNCOMPACT^
Uncompact layout
@cindex @option{^-N^/NOTABS^} (@command{gnatpp})
@item ^-N^/NOTABS^
All the VT characters are removed from the comment text. All the HT characters
are expanded with the sequences of space characters to get to the next tab
stops.
@cindex @option{^--no-separate-is^/NO_SEPARATE_IS^} (@command{gnatpp})
@item ^--no-separate-is^/NO_SEPARATE_IS^
Do not place the keyword @code{is} on a separate line in a subprogram body in
case if the spec occupies more than one line.
@cindex @option{^--separate-label^/SEPARATE_LABEL^} (@command{gnatpp})
@item ^--separate-label^/SEPARATE_LABEL^
Place statement label(s) on a separate line, with the following statement
on the next line.
@cindex @option{^--separate-loop-then^/SEPARATE_LOOP_THEN^} (@command{gnatpp})
@item ^--separate-loop-then^/SEPARATE_LOOP_THEN^
Place the keyword @code{loop} in FOR and WHILE loop statements and the
@ -14443,11 +14373,6 @@ incompatible with @option{^--separate-loop-then^/SEPARATE_LOOP_THEN^} option.
@item ^--use-on-new-line^/USE_ON_NEW_LINE^
Start each USE clause in a context clause from a separate line.
@cindex @option{^--separate-stmt-name^/STMT_NAME_ON_NEW_LINE^} (@command{gnatpp})
@item ^--separate-stmt-name^/STMT_NAME_ON_NEW_LINE^
Use a separate line for a loop or block statement name, but do not use an extra
indentation level for the statement itself.
@cindex @option{^--insert-blank-lines^/INSERT_BLANK_LINES^} (@command{gnatpp})
@item ^--insert-blank-lines^/INSERT_BLANK_LINES^
Insert blank lines where appropriate (between bodies and other large
@ -14462,28 +14387,16 @@ multiple blank lines down to one.
@ifclear vms
@noindent
The @option{-c1} and @option{-c2} switches are incompatible.
The @option{-c3} and @option{-c4} switches are compatible with each other and
also with @option{-c1} and @option{-c2}. The @option{-c0} switch disables all
the other comment formatting switches.
The @option{-l1}, @option{-l2}, and @option{-l3} switches are incompatible.
The @option{-c} switches are compatible with one another, except that
the @option{-c0} switch disables all other comment formatting
switches.
@end ifclear
@ifset vms
@noindent
For the @option{/COMMENTS_LAYOUT} qualifier:
@itemize @bullet
@item
The @option{DEFAULT} and @option{STANDARD_INDENT} options are incompatible.
@item
The @option{GNAT_BEGINNING} and @option{REFORMAT} options are compatible with
each other and also with @option{DEFAULT} and @option{STANDARD_INDENT}.
@end itemize
@noindent
The @option{GNAT}, @option{COMPACT}, and @option{UNCOMPACT} options for the
@option{/CONSTRUCT_LAYOUT} qualifier are incompatible.
For the @option{/COMMENTS_LAYOUT} qualifier,
The @option{GNAT_BEGINNING}, @option{REFORMAT}, and @option{DEFAULT}
options are compatible with one another.
@end ifset
@node General Text Layout Control
@ -14515,8 +14428,7 @@ line indentation is also 1)
@subsection Other Formatting Options
@noindent
These switches control the inclusion of missing end/exit labels, and
the indentation level in @b{case} statements, etc.
These switches control other formatting not listed above.
@table @option
@item --decimal-grouping=@var{n}
@ -14533,36 +14445,21 @@ Same as @code{--decimal-grouping}, but for based literals. For
example, with @code{--based-grouping=4}, @code{16#0001FFFE#} will be
changed to @code{16#0001_FFFE#}.
@item ^-e^/NO_MISSED_LABELS^
@cindex @option{^-e^/NO_MISSED_LABELS^} (@command{gnatpp})
Do not insert missing end/exit labels. An end label is the name of
a construct that may optionally be repeated at the end of the
construct's declaration;
e.g., the names of packages, subprograms, and tasks.
An exit label is the name of a loop that may appear as target
of an exit statement within the loop.
By default, @command{gnatpp} inserts these end/exit labels when
they are absent from the original source. This option suppresses such
insertion, so that the formatted source reflects the original.
@item ^--RM-style-spacing^/RM_STYLE_SPACING^
@cindex @option{^--RM-style-spacing^/RM_STYLE_SPACING^} (@command{gnatpp})
Do not insert an extra blank before various occurrences of
`(' and `:'. This also turns off alignment.
@item ^-ff^/FORM_FEED_AFTER_PRAGMA_PAGE^
@cindex @option{^-ff^/FORM_FEED_AFTER_PRAGMA_PAGE^} (@command{gnatpp})
Insert a Form Feed character after a pragma Page.
@item ^-T@var{nnn}^/MAX_INDENT=@var{nnn}^
@cindex @option{^-T^/MAX_INDENT^} (@command{gnatpp})
Do not use an additional indentation level for @b{case} alternatives
and variants if there are @var{nnn} or more (the default
value is 10).
If @var{nnn} is 0, an additional indentation level is
used for @b{case} alternatives and variants regardless of their number.
@item ^--call_threshold=@var{nnn}^/MAX_ACT=@var{nnn}^
@cindex @option{^--call_threshold^/MAX_ACT^} (@command{gnatpp})
If the number of parameter associations is greater than @var{nnn} and if at
least one association uses named notation, start each association from
a new line. If @var{nnn} is 0, no check for the number of associations
is made, this is the default.
is made; this is the default.
@item ^--par_threshold=@var{nnn}^/MAX_PAR=@var{nnn}^
@cindex @option{^--par_threshold^/MAX_PAR^} (@command{gnatpp})
@ -14576,24 +14473,20 @@ a new line. The default for @var{nnn} is 3.
@noindent
To define the search path for the input source file, @command{gnatpp}
uses the same switches as the GNAT compiler, with the same effects.
uses the same switches as the GNAT compiler, with the same effects:
@table @option
@item ^-I^/SEARCH=^@var{dir}
@cindex @option{^-I^/SEARCH^} (@command{gnatpp})
The same as the corresponding gcc switch
@item ^-I-^/NOCURRENT_DIRECTORY^
@cindex @option{^-I-^/NOCURRENT_DIRECTORY^} (@command{gnatpp})
The same as the corresponding gcc switch
@item ^-gnatec^/CONFIGURATION_PRAGMAS_FILE^=@var{path}
@cindex @option{^-gnatec^/CONFIGURATION_PRAGMAS_FILE^} (@command{gnatpp})
The same as the corresponding gcc switch
@item ^--RTS^/RUNTIME_SYSTEM^=@var{path}
@cindex @option{^--RTS^/RUNTIME_SYSTEM^} (@command{gnatpp})
The same as the corresponding gcc switch
@end table
@ -14601,9 +14494,9 @@ The same as the corresponding gcc switch
@subsection Output File Control
@noindent
By default the output is sent to the file whose name is obtained by appending
the ^@file{.pp}^@file{$PP}^ suffix to the name of the input file
(if the file with this name already exists, it is unconditionally overwritten).
By default the output is sent to a file whose name is obtained by appending
the ^@file{.pp}^@file{$PP}^ suffix to the name of the input file.
If the file with this name already exists, it is overwritten.
Thus if the input file is @file{^my_ada_proc.adb^MY_ADA_PROC.ADB^} then
@command{gnatpp} will produce @file{^my_ada_proc.adb.pp^MY_ADA_PROC.ADB$PP^}
as output file.
@ -14645,12 +14538,12 @@ creating any backup copy of the input source.
@item ^--eol=@var{xxx}^/END_OF_LINE=@var{xxx}^
@cindex @option{^--eol^/END_OF_LINE^} (@code{gnatpp})
Specifies the format of the reformatted output file. The @var{xxx}
^string specified with the switch^option^ may be either
Specifies the line-ending style of the reformatted output file. The @var{xxx}
^string specified with the switch^option^ may be:
@itemize @bullet
@item ``@option{^dos^DOS^}'' MS DOS style, lines end with CR LF characters
@item ``@option{^crlf^CRLF^}''
the same as @option{^crlf^CRLF^}
the same as @option{^dos^DOS^}
@item ``@option{^unix^UNIX^}'' UNIX style, lines end with LF character
@item ``@option{^lf^LF^}''
the same as @option{^unix^UNIX^}
@ -14658,8 +14551,7 @@ the same as @option{^unix^UNIX^}
@item ^-W^/RESULT_ENCODING=^@var{e}
@cindex @option{^-W^/RESULT_ENCODING=^} (@command{gnatpp})
Specify the wide character encoding method used to write the code in the
result file
Specify the wide character encoding method for the input and output files.
@var{e} is one of the following:
@itemize @bullet
@ -14686,8 +14578,7 @@ Brackets encoding (default value)
@end table
@noindent
Options @option{^-pipe^/STANDARD_OUTPUT^},
@option{^-o^/OUTPUT^} and
Options @option{^-o^/OUTPUT^} and
@option{^-of^/FORCED_OUTPUT^} are allowed only if the call to gnatpp
contains only one file to reformat.
Option
@ -14706,7 +14597,7 @@ The additional @command{gnatpp} switches are defined in this subsection.
@table @option
@item --version
@cindex @option{--version} @command{gnatpp}
Display Copyright and version, then exit disregarding all other options.
Display copyright and version, then exit disregarding all other options.
@item --help
@cindex @option{--help} @command{gnatpp}
@ -14716,7 +14607,7 @@ Display usage, then exit disregarding all other options.
@cindex @option{-P} @command{gnatpp}
Indicates the name of the project file that describes the set of sources
to be processed. The exact set of argument sources depends on other options
specified, see below.
specified; see below.
@item -U
@cindex @option{-U} @command{gnatpp}
@ -14734,7 +14625,7 @@ has no effect.
@item -X@var{name}=@var{value}
@cindex @option{-X} @command{gnatpp}
Indicates that external variable @var{name} in the argument project
has the @var{value} value. Has no effect if no project is specified as
has the value @var{value}. Has no effect if no project is specified as
tool argument.
@item --pp-off=@var{xxx}
@ -14774,16 +14665,12 @@ This option cannot be used together with @option{^-r^/REPLACE^},
Print out execution time.
@item ^-v^/VERBOSE^
@cindex @option{^-v^/VERBOSE^} (@code{gnatpp})
Verbose mode;
@command{gnatpp} generates version information and then
a trace of the actions it takes to produce or obtain the ASIS tree.
@cindex @option{^-v^/VERBOSE^} (@command{gnatpp})
Verbose mode
@item ^-w^/WARNINGS^
@cindex @option{^-w^/WARNINGS^} (@code{gnatpp})
Warning mode;
@command{gnatpp} generates a warning whenever it cannot provide
a required layout in the result source.
@item ^-q^/QUIET^
@cindex @option{^-q^/QUIET^} (@command{gnatpp})
Quiet mode
@end table
@noindent
@ -14797,15 +14684,14 @@ all the immediate units of the argument project.
@section Formatting Rules
@noindent
The following subsections show how @command{gnatpp} treats ``white space'',
The following subsections show how @command{gnatpp} treats white space,
comments, program layout, and name casing.
They provide the detailed descriptions of the switches shown above.
They provide detailed descriptions of the switches shown above.
@menu
* Disabling Pretty Printing::
* White Space and Empty Lines::
* Formatting Comments::
* Construct Layout::
* Name Casing::
@end menu
@ -14832,7 +14718,7 @@ be followed by arbitrary additional text. For example:
@cartouche
package Interrupts is
--!pp off -- turn off pretty printing so "Interrupt_Kind" lines up
type Interrupt_Kind is
type Interrupt_Kind is
(Asynchronous_Interrupt_Kind,
Synchronous_Interrupt_Kind,
Green_Interrupt_Kind);
@ -14842,12 +14728,12 @@ package Interrupts is
@end cartouche
@end smallexample
You can specify different comment strings using the gnatpp
@code{--pp-off} and @code{--pp-on} switches. For example, if you say
@code{gnatpp --pp-off=' pp-' *.ad?} then gnatpp will recognize
comments of the form @code{-- pp-} instead of @code{--!pp off} for
disabling pretty printing. Note that the leading @code{--} of the
comment is not included in the argument to these switches.
You can specify different comment strings using the @code{--pp-off}
and @code{--pp-on} switches. For example, if you say @code{gnatpp
--pp-off=' pp-' *.ad?} then gnatpp will recognize comments of the form
@code{-- pp-} instead of @code{--!pp off} for disabling pretty
printing. Note that the leading @code{--} of the comment is not
included in the argument to these switches.
@node White Space and Empty Lines
@subsection White Space and Empty Lines
@ -14856,31 +14742,17 @@ comment is not included in the argument to these switches.
@command{gnatpp} does not have an option to control space characters.
It will add or remove spaces according to the style illustrated by the
examples in the @cite{Ada Reference Manual}.
The output file will contain no lines with trailing white space.
The only format effectors
(see @cite{Ada Reference Manual}, paragraph 2.1(13))
that will appear in the output file are platform-specific line breaks,
and also format effectors within (but not at the end of) comments.
In particular, each horizontal tab character that is not inside
a comment will be treated as a space and thus will appear in the
output file as zero or more spaces depending on
the reformatting of the line in which it appears.
The only exception is a Form Feed character, which is inserted after a
pragma @code{Page} when @option{-ff} is set.
The output file will contain no lines with trailing ``white space'' (spaces,
format effectors).
Empty lines in the original source are preserved
only if they separate declarations or statements.
In such contexts, a
sequence of two or more empty lines is replaced by exactly one empty line.
Note that a blank line will be removed if it separates two ``comment blocks''
(a comment block is a sequence of whole-line comments).
In order to preserve a visual separation between comment blocks, use an
``empty comment'' (a line comprising only hyphens) rather than an empty line.
Likewise, if for some reason you wish to have a sequence of empty lines,
use a sequence of empty comments instead.
By default, a sequence of one or more blank lines in the input is
converted to a single blank line in the output; multiple blank lines
are squeezed down to one.
The @option{^--preserve-blank-lines^/PRESERVE_BLANK_LINES^} option
turns off the squeezing; each blank line in the input is copied
to the output.
The @option{^--insert-blank-lines^/INSERT_BLANK_LINES^} option
causes additional blank lines to be inserted if not already
present in the input (e.g. between bodies).
@node Formatting Comments
@subsection Formatting Comments
@ -14890,82 +14762,26 @@ Comments in Ada code are of two kinds:
@itemize @bullet
@item
a @emph{whole-line comment}, which appears by itself (possibly preceded by
``white space'') on a line
white space) on a line
@item
an @emph{end-of-line comment}, which follows some other Ada lexical element
on the same line.
an @emph{end-of-line comment}, which follows some other Ada code on
the same line.
@end itemize
@noindent
The indentation of a whole-line comment is that of either
the preceding or following line in
the formatted source, depending on switch settings as will be described below.
A whole-line comment is indented according to the surrounding code,
with some exceptions.
Comments that start in column 1 are kept there.
If possible, comments are not moved so far to the right that the maximum
line length is exceeded.
The @option{^-c0^/COMMENTS_LAYOUT=UNTOUCHED^} option
turns off comment formatting.
Special-form comments such as SPARK-style @code{--#...} are left alone.
For an end-of-line comment, @command{gnatpp} leaves the same number of spaces
between the end of the preceding Ada lexical element and the beginning
of the comment as appear in the original source,
unless either the comment has to be split to
satisfy the line length limitation, or else the next line contains a
whole line comment that is considered a continuation of this end-of-line
comment (because it starts at the same position).
In the latter two
cases, the start of the end-of-line comment is moved right to the nearest
multiple of the indentation level.
This may result in a ``line overflow'' (the right-shifted comment extending
beyond the maximum line length), in which case the comment is split as
described below.
There is a difference between @option{^-c1^/COMMENTS_LAYOUT=DEFAULT^}
(GNAT-style comment line indentation)
and @option{^-c2^/COMMENTS_LAYOUT=STANDARD_INDENT^}
(reference-manual comment line indentation).
With reference-manual style, a whole-line comment is indented as if it
were a declaration or statement at the same place
(i.e., according to the indentation of the preceding line(s)).
With GNAT style, a whole-line comment that is immediately followed by an
@b{if} or @b{case} statement alternative, a record variant, or the reserved
word @b{begin}, is indented based on the construct that follows it.
For example:
@smallexample @c ada
@cartouche
if A then
null;
-- some comment
else
null;
end if;
@end cartouche
@end smallexample
@noindent
Reference-manual indentation produces:
@smallexample @c ada
@cartouche
if A then
null;
-- some comment
else
null;
end if;
@end cartouche
@end smallexample
@noindent
while GNAT-style indentation produces:
@smallexample @c ada
@cartouche
if A then
null;
-- some comment
else
null;
end if;
@end cartouche
@end smallexample
For an end-of-line comment, @command{gnatpp} tries to leave the same
number of spaces between the end of the preceding Ada code and the
beginning of the comment as appear in the original source.
@noindent
The @option{^-c3^/COMMENTS_LAYOUT=GNAT_BEGINNING^} switch
@ -14981,57 +14797,10 @@ first non-blank character of the comment.
@end itemize
@noindent
For an end-of-line comment, if in the original source the next line is a
whole-line comment that starts at the same position
as the end-of-line comment,
then the whole-line comment (and all whole-line comments
that follow it and that start at the same position)
will start at this position in the output file.
@noindent
That is, if in the original source we have:
@smallexample @c ada
@cartouche
begin
A := B + C; -- B must be in the range Low1..High1
-- C must be in the range Low2..High2
--B+C will be in the range Low1+Low2..High1+High2
X := X + 1;
@end cartouche
@end smallexample
@noindent
Then in the formatted source we get
@smallexample @c ada
@cartouche
begin
A := B + C; -- B must be in the range Low1..High1
-- C must be in the range Low2..High2
-- B+C will be in the range Low1+Low2..High1+High2
X := X + 1;
@end cartouche
@end smallexample
@noindent
A comment that exceeds the line length limit will be split.
Unless switch
@option{^-c4^/COMMENTS_LAYOUT=REFORMAT^} (reformat comment blocks) is set and
the line belongs to a reformattable block, splitting the line generates a
@command{gnatpp} warning.
The @option{^-c4^/COMMENTS_LAYOUT=REFORMAT^} switch specifies that whole-line
comments may be reformatted in typical
word processor style (that is, moving words between lines and putting as
many words in a line as possible).
@noindent
The @option{^-c5^/COMMENTS_LAYOUT=KEEP_SPECIAL^} switch specifies, that comments
that has a special format (that is, a character that is neither a letter nor digit
not white space nor line break immediately following the leading @code{--} of
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).
The @option{^-c4^/COMMENTS_LAYOUT=REFORMAT^} switch specifies that
whole-line comments that form a paragraph will be filled in typical
word processor style (that is, moving words between lines to make the
lines other than the last similar in length ).
@noindent
The @option{--comments-only} switch specifies that only the comments
@ -15044,157 +14813,6 @@ 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
@noindent
In several cases the suggested layout in the Ada Reference Manual includes
an extra level of indentation that many programmers prefer to avoid. The
affected cases include:
@itemize @bullet
@item Record type declaration (RM 3.8)
@item Record representation clause (RM 13.5.1)
@item Loop statement in case if a loop has a statement identifier (RM 5.6)
@item Block statement in case if a block has a statement identifier (RM 5.6)
@end itemize
@noindent
In compact mode (when GNAT style layout or compact layout is set),
the pretty printer uses one level of indentation instead
of two. This is achieved in the record definition and record representation
clause cases by putting the @code{record} keyword on the same line as the
start of the declaration or representation clause, and in the block and loop
case by putting the block or loop header on the same line as the statement
identifier.
@noindent
The difference between GNAT style @option{^-l1^/CONSTRUCT_LAYOUT=GNAT^}
and compact @option{^-l2^/CONSTRUCT_LAYOUT=COMPACT^}
layout on the one hand, and uncompact layout
@option{^-l3^/CONSTRUCT_LAYOUT=UNCOMPACT^} on the other hand,
can be illustrated by the following examples:
@iftex
@cartouche
@multitable @columnfractions .5 .5
@item @i{GNAT style, compact layout} @tab @i{Uncompact layout}
@item
@smallexample @c ada
type q is record
a : integer;
b : integer;
end record;
@end smallexample
@tab
@smallexample @c ada
type q is
record
a : integer;
b : integer;
end record;
@end smallexample
@item
@smallexample @c ada
for q use record
a at 0 range 0 .. 31;
b at 4 range 0 .. 31;
end record;
@end smallexample
@tab
@smallexample @c ada
for q use
record
a at 0 range 0 .. 31;
b at 4 range 0 .. 31;
end record;
@end smallexample
@item
@smallexample @c ada
Block : declare
A : Integer := 3;
begin
Proc (A, A);
end Block;
@end smallexample
@tab
@smallexample @c ada
Block :
declare
A : Integer := 3;
begin
Proc (A, A);
end Block;
@end smallexample
@item
@smallexample @c ada
Clear : for J in 1 .. 10 loop
A (J) := 0;
end loop Clear;
@end smallexample
@tab
@smallexample @c ada
Clear :
for J in 1 .. 10 loop
A (J) := 0;
end loop Clear;
@end smallexample
@end multitable
@end cartouche
@end iftex
@ifnottex
@smallexample
@cartouche
GNAT style, compact layout Uncompact layout
type q is record type q is
a : integer; record
b : integer; a : integer;
end record; b : integer;
end record;
for q use record for q use
a at 0 range 0 .. 31; record
b at 4 range 0 .. 31; a at 0 range 0 .. 31;
end record; b at 4 range 0 .. 31;
end record;
Block : declare Block :
A : Integer := 3; declare
begin A : Integer := 3;
Proc (A, A); begin
end Block; Proc (A, A);
end Block;
Clear : for J in 1 .. 10 loop Clear :
A (J) := 0; for J in 1 .. 10 loop
end loop Clear; A (J) := 0;
end loop Clear;
@end cartouche
@end smallexample
@end ifnottex
@noindent
A further difference between GNAT style layout and compact layout is that
GNAT style layout inserts empty lines as separation for
compound statements, return statements and bodies.
Note that the layout specified by
@option{^--separate-stmt-name^/STMT_NAME_ON_NEW_LINE^}
for named block and loop statements overrides the layout defined by these
constructs by @option{^-l1^/CONSTRUCT_LAYOUT=GNAT^},
@option{^-l2^/CONSTRUCT_LAYOUT=COMPACT^} or
@option{^-l3^/CONSTRUCT_LAYOUT=UNCOMPACT^} option.
@node Name Casing
@subsection Name Casing
@ -15230,6 +14848,19 @@ Thus @command{gnatpp} acts as though the @option{^-n^/NAME_CASING^} switch
had affected the
casing for the defining occurrence of the name.
The options
@option{^-a@var{x}^/ATTRIBUTE^},
@option{^-k@var{x}^/KEYWORD_CASING^},
@option{^-ne@var{x}^/ENUM_CASING^},
@option{^-nt@var{x}^/TYPE_CASING^},
@option{^-nn@var{x}^/NUMBER_CASING^}, and
@option{^-p@var{x}^/PRAGMA_CASING^}
allow finer-grained control over casing for
attributes, keywords, enumeration literals,
types, named numbers and pragmas, respectively.
@option{^-nt@var{x}^/TYPE_CASING^} covers subtypes and
task and protected bodies as well.
Some names may need to be spelled with casing conventions that are not
covered by the upper-, lower-, and mixed-case transformations.
You can arrange correct casing by placing such names in a
@ -15241,25 +14872,23 @@ any @option{^-n^/NAME_CASING^} switch.
To handle the casing of Ada predefined names and the names from GNAT libraries,
@command{gnatpp} assumes a default dictionary file.
The name of each predefined entity is spelled with the same casing as is used
for the entity in the @cite{Ada Reference Manual}.
for the entity in the @cite{Ada Reference Manual} (usually mixed case).
The name of each entity in the GNAT libraries is spelled with the same casing
as is used in the declaration of that entity.
The @w{@option{^-D-^/SPECIFIC_CASING^}} switch suppresses the use of the
default dictionary file.
Instead, the casing for predefined and GNAT-defined names will be established
by the @option{^-n^/NAME_CASING^} switch or explicit dictionary files.
For example, by default the names @code{Ada.Text_IO} and @code{GNAT.OS_Lib}
will appear as just shown,
even in the presence of a @option{^-nU^/NAME_CASING=UPPER_CASE^} switch.
To ensure that even such names are rendered in uppercase,
additionally supply the @w{@option{^-D-^/SPECIFIC_CASING^}} switch
(or else, less conveniently, place these names in upper case in a dictionary
file).
The @w{@option{^-D-^/SPECIFIC_CASING^}} switch suppresses the use of
the default dictionary file. Instead, the casing for predefined and
GNAT-defined names will be established by the
@option{^-n^/NAME_CASING^} switch or explicit dictionary files. For
example, by default the names @code{Ada.Text_IO} and
@code{GNAT.OS_Lib} will appear as just shown, even in the presence of
a @option{^-nU^/NAME_CASING=UPPER_CASE^} switch. To ensure that even
such names are rendered in uppercase, additionally supply the
@w{@option{^-D-^/SPECIFIC_CASING^}} switch (or else place these names
in upper case in a dictionary file).
A dictionary file is
a plain text file; each line in this file can be either a blank line
(containing only space characters and ASCII.HT characters), an Ada comment
A dictionary file is a plain text file; each line in this file can be
either a blank line (containing only space characters), an Ada comment
line, or the specification of exactly one @emph{casing schema}.
A casing schema is a string that has the following syntax:
@ -15435,7 +15064,7 @@ Options:
Otherwise this option has no effect.
-X@var{name}=@var{value} -- indicates that external variable @var{name} in
the argument project has the @var{value} value. Has no effect if no
the argument project has the value @var{value}. Has no effect if no
project is specified as tool argument.
-mdir -- generate one .xml file for each Ada source file, in directory
@ -16817,7 +16446,7 @@ has no effect.
@item -X@var{name}=@var{value}
@cindex @option{-X} @command{gnatmetric}
Indicates that external variable @var{name} in the argument project
has the @var{value} value. Has no effect if no project is specified as
has the value @var{value}. Has no effect if no project is specified as
tool argument.
@item --subdirs=@var{dir}
@ -19712,7 +19341,7 @@ to be processed.
@item -X@var{name}=@var{value}
@cindex @option{-X} @command{gnatstub}
Indicates that external variable @var{name} in the argument project
has the @var{value} value. Has no effect if no project is specified as
has the value @var{value}. Has no effect if no project is specified as
tool argument.
@item ^-f^/FULL^

View File

@ -924,8 +924,35 @@ package body System.OS_Lib is
if C_Msg = Null_Address then
if Default /= "" then
return Default;
else
return "errno =" & Err'Img;
-- Note: for bootstrap reasons, it is impractical
-- to use Integer'Image here.
declare
Val : Integer;
First : Integer;
Buf : String (1 .. 20);
-- Buffer large enough to hold image of largest Integer values
begin
Val := abs Err;
First := Buf'Last;
loop
Buf (First) :=
Character'Val (Character'Pos ('0') + Val mod 10);
Val := Val / 10;
exit when Val = 0;
First := First - 1;
end loop;
if Err < 0 then
First := First - 1;
Buf (First) := '-';
end if;
return "errno = " & Buf (First .. Buf'Last);
end;
end if;
else

View File

@ -89,7 +89,6 @@ pragma Style_Checks ("M32766");
/* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
#include "gsocket.h"
#include "adaint.h"
#include <stdlib.h>
#include <string.h>
@ -114,12 +113,15 @@ pragma Style_Checks ("M32766");
/**
** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
** the case of runtime libraries that support sockets).
** the case of runtime libraries that support sockets). Note: this must
** be done before including adaint.h.
**/
# include <vxWorks.h>
#endif
#include "adaint.h"
#ifdef DUMMY
# if defined (TARGET)
@ -1344,30 +1346,6 @@ CND(SIZEOF_struct_servent, "struct servent")
CND(SIZEOF_sigset, "sigset")
#endif
/**
** Note: this constant can be used in the GNAT runtime library. In compiler
** units on the other hand, System.OS_Constants is not available, so we
** declare an Ada constant (Osint.File_Attributes_Size) independently, which
** is at least as large as sizeof (struct file_attributes), and we have an
** assertion at initialization of Osint checking that the size is indeed at
** least sufficient.
**/
#define SIZEOF_struct_file_attributes (sizeof (struct file_attributes))
CND(SIZEOF_struct_file_attributes, "struct file_attributes")
/**
** Maximal size of buffer for struct dirent. Note: Since POSIX.1 does not
** specify the size of the d_name field, and other nonstandard fields may
** precede that field within the dirent structure, we must make a conservative
** computation.
**/
{
struct dirent dent;
#define SIZEOF_struct_dirent_alloc \
((char*) &dent.d_name - (char*) &dent) + NAME_MAX + 1
CND(SIZEOF_struct_dirent_alloc, "struct dirent allocation")
}
/*
-- Fields of struct msghdr
@ -1508,6 +1486,38 @@ CND(PTHREAD_ONCE_SIZE, "pthread_once_t")
#endif /* __APPLE__ || __linux__ */
/*
--------------------------------
-- File and directory support --
--------------------------------
*/
/**
** Note: this constant can be used in the GNAT runtime library. In compiler
** units on the other hand, System.OS_Constants is not available, so we
** declare an Ada constant (Osint.File_Attributes_Size) independently, which
** is at least as large as sizeof (struct file_attributes), and we have an
** assertion at initialization of Osint checking that the size is indeed at
** least sufficient.
**/
#define SIZEOF_struct_file_attributes (sizeof (struct file_attributes))
CND(SIZEOF_struct_file_attributes, "struct file_attributes")
/**
** Maximal size of buffer for struct dirent. Note: Since POSIX.1 does not
** specify the size of the d_name field, and other nonstandard fields may
** precede that field within the dirent structure, we must make a conservative
** computation.
**/
{
struct dirent dent;
#define SIZEOF_struct_dirent_alloc \
((char*) &dent.d_name - (char*) &dent) + NAME_MAX + 1
CND(SIZEOF_struct_dirent_alloc, "struct dirent allocation")
}
/**
** System-specific constants follow
** Each section should be activated if compiling for the corresponding