+2014-07-17 Robert Dewar <dewar@adacore.com>
+
+ * gnat_rm.texi: Document new restriction No_Long_Long_Integers.
+ * exp_ch4.adb (Make_Array_Comparison_Op): Add note that we
+ could do this by actually expanding a real generic.
+ * a-tags.ads: Add comments about performance.
+ * sprint.adb (Sprint_Node_Actual, case N_Object_Declaration):
+ Print Etype of defining identifier, rather than the object
+ definition. More information.
+
+2014-07-17 Thomas Quinot <quinot@adacore.com>
+
+ * exp_dist.adb: Minor documentation clarification.
+
+2014-07-17 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_util.adb (Is_Aliased): Revert previous change.
+
+2014-07-17 Vincent Celier <celier@adacore.com>
+
+ * g-comlin.adb (Try_Help): New procedure.
+ (Getopt): Use new procedure Try_Help.
+ * g-comlin.ads (Try_Help): New procedure.
+
+2014-07-17 Bob Duff <duff@adacore.com>
+
+ * gnat_ugn.texi: Minor update.
+
2014-07-17 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Improve documentation of Unrestricted_Access.
-- --
------------------------------------------------------------------------------
-with System;
+-- The operations in this package provide the guarantee that all dispatching
+-- calls on primitive operations of tagged types and interfaces take constant
+-- time (in terms of source lines executed), that is to say, the cost of these
+-- calls is independent of the number of primitives of the type or interface,
+-- and independent of the number of ancestors or interface progenitors that a
+-- tagged type may have.
+
+-- The following subprograms of the public part of this package take constant
+-- time (in terms of source lines executed):
+
+-- Expanded_Name, Wide_Expanded_Name, Wide_Wide_Expanded_Name, External_Tag,
+-- Is_Descendant_At_Same_Level, Parent_Tag
+-- Descendant_Tag (when used with a library-level tagged type),
+-- Internal_Tag (when used with a library-level tagged type).
+
+-- The following subprograms of the public part of this package take non
+-- constant time (in terms of sources line executed):
+
+-- Descendant_Tag (when used with a locally defined tagged type)
+-- Internal_Tag (when used with a locally defined tagged type)
+-- Interface_Ancestor_Tagswith System
+
with System.Storage_Elements;
package Ada.Tags is
with Ada.Command_Line; use Ada.Command_Line;
+with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.IO; use GNAT.IO;
with GNAT.OS_Lib; use GNAT.OS_Lib;
if Argument_Count = 0 then
Usage;
else
- Put_Line ("type ""gnatclean --help"" for help");
+ Try_Help;
end if;
return;
-- do not need to generate an actual or formal generic part, just the
-- instantiated function itself.
+ -- Perhaps we could have the actual generic available in the run-time,
+ -- obtained by rtsfind, and actually expand a real instantiation ???
+
function Make_Array_Comparison_Op
(Typ : Entity_Id;
Nod : Node_Id) return Node_Id
Append_To (Decls, RPC_Receiver_Decl);
else
- -- Comments required here???
+ -- Case of RACW implementing a RAS with the GARLIC PCS: there is
+ -- no RPC receiver in that case, this is just an indication of
+ -- where to insert code in the tree (see comment in declaration of
+ -- type Stub_Structure).
RPC_Receiver_Decl := Last (Decls);
end if;
-- When a function call appears in Object.Operation format, the
-- original representation has two possible forms depending on the
-- availability of actual parameters:
- --
- -- Obj.Func_Call -- N_Selected_Component
- -- Obj.Func_Call (Param) -- N_Indexed_Component
+
+ -- Obj.Func_Call N_Selected_Component
+ -- Obj.Func_Call (Param) N_Indexed_Component
else
if Nkind (Expr) = N_Indexed_Component then
-- Start of processing for Is_Aliased
begin
- -- Aliasing in expression with actions does not matter because the
- -- scope of the transient object is always limited by the scope of
- -- the EWA. Such objects are always hooked and always finalized at
- -- the end of the EWA's scope.
-
- if Nkind (Rel_Node) = N_Expression_With_Actions then
- return False;
- end if;
-
Stmt := First_Stmt;
while Present (Stmt) loop
if Nkind (Stmt) = N_Object_Declaration then
function Is_Volatile_Reference (N : Node_Id) return Boolean is
begin
- if Nkind (N) in N_Has_Etype
- and then Present (Etype (N))
- and then Treat_As_Volatile (Etype (N))
- then
+ -- Only source references are to be treated as volatile, internally
+ -- generated stuff cannot have volatile external effects.
+
+ if not Comes_From_Source (N) then
+ return False;
+
+ -- Never true for reference to a type
+
+ elsif Is_Entity_Name (N) and then Is_Type (Entity (N)) then
+ return False;
+
+ -- True if object reference with volatile type
+
+ elsif Is_Volatile_Object (N) then
return True;
+ -- True if reference to volatile entity
+
elsif Is_Entity_Name (N) then
return Treat_As_Volatile (Entity (N));
+ -- True for slice of volatile array
+
elsif Nkind (N) = N_Slice then
return Is_Volatile_Reference (Prefix (N));
+ -- True if volatile component
+
elsif Nkind_In (N, N_Indexed_Component, N_Selected_Component) then
if (Is_Entity_Name (Prefix (N))
and then Has_Volatile_Components (Entity (Prefix (N))))
return Is_Volatile_Reference (Prefix (N));
end if;
+ -- Otherwise false
+
else
return False;
end if;
-- (this happens because routines Duplicate_Subexpr_XX implicitly invoke
-- Remove_Side_Effects).
- if No (Exp_Type)
- or else Ekind (Exp_Type) = E_Access_Attribute_Type
- then
+ if No (Exp_Type) or else Ekind (Exp_Type) = E_Access_Attribute_Type then
return;
-- No action needed for side-effect free expressions
Insert_Action (Exp, E);
-- If the expression has the form v.all then we can just capture the
- -- pointer, and then do an explicit dereference on the result.
+ -- pointer, and then do an explicit dereference on the result, but
+ -- this is not right if this is a volatile reference.
- elsif Nkind (Exp) = N_Explicit_Dereference then
+ elsif Nkind (Exp) = N_Explicit_Dereference
+ and then not Is_Volatile_Reference (Exp)
+ then
Def_Id := Make_Temporary (Loc, 'R', Exp);
Res :=
Make_Explicit_Dereference (Loc, New_Occurrence_Of (Def_Id, Loc));
-- This is needed for correctness in the case of a volatile object of
-- a non-volatile type because the Make_Reference call of the "default"
-- approach would generate an illegal access value (an access value
- -- cannot designate such an object - see Analyze_Reference). We skip
- -- using this scheme if we have an object of a volatile type and we do
- -- not have Name_Req set true (see comments for Side_Effect_Free).
-
- -- In Ada 2012 a qualified expression is an object, but for purposes of
- -- removing side effects it still need to be transformed into a separate
- -- declaration, particularly if the expression is an aggregate.
+ -- cannot designate such an object - see Analyze_Reference).
elsif Is_Object_Reference (Exp)
and then Nkind (Exp) /= N_Function_Call
+
+ -- In Ada 2012 a qualified expression is an object, but for purposes
+ -- of removing side effects it still need to be transformed into a
+ -- separate declaration, particularly in the case of an aggregate.
+
and then Nkind (Exp) /= N_Qualified_Expression
+
+ -- We skip using this scheme if we have an object of a volatile
+ -- type and we do not have Name_Req set true (see comments for
+ -- Side_Effect_Free).
+
and then (Name_Req or else not Treat_As_Volatile (Exp_Type))
then
Def_Id := Make_Temporary (Loc, 'R', Exp);
-- Start of processing for Side_Effect_Free
begin
+ -- If volatile reference, always consider it to have side effects
+
+ if Is_Volatile_Reference (N) then
+ return False;
+ end if;
+
-- Note on checks that could raise Constraint_Error. Strictly, if we
-- take advantage of 11.6, these checks do not count as side effects.
-- However, we would prefer to consider that they are side effects,
if Is_Entity_Name (N) then
+ -- A type reference is always side effect free
+
+ if Is_Type (Entity (N)) then
+ return True;
+
-- Variables are considered to be a side effect if Variable_Ref
-- is set or if we have a volatile reference and Name_Req is off.
-- If Name_Req is True then we can't help returning a name which
-- effectively allows multiple references in any case.
- if Is_Variable (N, Use_Original_Node => False) then
+ elsif Is_Variable (N, Use_Original_Node => False) then
return not Variable_Ref
and then (not Is_Volatile_Reference (N) or else Name_Req);
& ": unrecognized option '"
& Full_Switch (Parser)
& "'");
- Put_Line (Standard_Error,
- "Try `"
- & Base_Name (Ada.Command_Line.Command_Name)
- & " --help` for more information.");
+ Try_Help;
raise;
end loop;
end Build;
+ --------------
+ -- Try_Help --
+ --------------
+
+ -- Note: Any change to the message displayed should also be done in
+ -- gnatbind.adb that does not use this interface.
+
+ procedure Try_Help is
+ begin
+ Put_Line
+ (Standard_Error,
+ "try `" &
+ Base_Name (Ada.Command_Line.Command_Name) &
+ " --help` for more information.");
+ end Try_Help;
+
end GNAT.Command_Line;
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2013, AdaCore --
+-- Copyright (C) 1999-2014, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
--
-- Expanded has the same meaning as in Start.
+ procedure Try_Help;
+ -- Output a message on standard error to indicate how to get the usage for
+ -- the executable. This procedure should only be called when the executable
+ -- accepts switch --help. When this procedure is called by executable xxx,
+ -- the following message is displayed on standard error:
+ -- try `xxx --help` for more information.
+
private
Max_Depth : constant := 100;
* No_Local_Allocators::
* No_Local_Protected_Objects::
* No_Local_Timing_Events::
+* No_Long_Long_Integers::
* No_Nested_Finalization::
* No_Protected_Type_Allocators::
* No_Protected_Types::
* No_Local_Allocators::
* No_Local_Protected_Objects::
* No_Local_Timing_Events::
+* No_Long_Long_Integers::
* No_Nested_Finalization::
* No_Protected_Type_Allocators::
* No_Protected_Types::
[RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
declared at the library level.
+@node No_Long_Long_Integers
+@unnumberedsubsec No_Long_Long_Integers
+@findex No_Long_Long_Integers
+[GNAT] This partition-wide restriction forbids any explicit reference to
+type Standard.Long_Long_Integer, and also forbids declaring range types whose
+implicit base type is Long_Long_Integer, and modular types whose size exceeds
+Long_Integer'Size.
+
@node No_Nested_Finalization
@unnumberedsubsec No_Nested_Finalization
@findex No_Nested_Finalization
The output may be redirected by the following switches:
@table @option
+@item ^--output-dir=@var{dir}^/OUTPUT_DIR=@var{dir}^
+@cindex @option{^--output-dir^/OUTPUT_DIR^} (@command{gnatpp})
+Generate output file in directory @file{dir} with the same name as the input
+file. If @file{dir} is the same as the directory containing the input file,
+the input file is not processed; use @option{^-rnb^/REPLACE_NO_BACKUP^}
+if you want to update the input file in place.
+
@item ^-pipe^/STANDARD_OUTPUT^
@cindex @option{^-pipe^/STANDARD_OUTPUT^} (@command{gnatpp})
Send the output to @code{Standard_Output}
has the value @var{value}. Has no effect if no project is specified as
tool argument.
+@item --incremental
+@cindex @option{--incremental} @command{gnatpp}
+Incremental processing on a per-file basis. Source files are only
+processed if they have been modified, or if files they depend on have
+been modified. This is similar to the way gnatmake/gprbuild only
+compiles files that need to be recompiled.
+
@item --pp-off=@var{xxx}
@cindex @option{--pp-off} @command{gnatpp}
Use @code{--xxx} as the command to turn off pretty printing, instead
@item ^-j^/PROCESSES=^@var{n}
@cindex @option{^-j^/PROCESSES^} (@command{gnatpp})
-Use @var{n} processes to carry out the tree creations (internal representations
-of the argument sources). On a multiprocessor machine this speeds up processing
-of big sets of argument sources. If @var{n} is 0, then the maximum number of
-parallel tree creations is the number of core processors on the platform.
-This option cannot be used together with @option{^-r^/REPLACE^},
+Without @option{--incremental}, use @var{n} processes to carry out the
+tree creations (internal representations of the argument sources). On
+a multiprocessor machine this speeds up processing of big sets of
+argument sources. If @var{n} is 0, then the maximum number of parallel
+tree creations is the number of core processors on the platform. This
+option cannot be used together with @option{^-r^/REPLACE^},
@option{^-rf^/OVERRIDING_REPLACE^} or
@option{^-rnb^/REPLACE_NO_BACKUP^} option.
+With @option{--incremental}, use @var{n} @command{gnatpp} processes to
+perform pretty-printing in parallel. @var{n} = 0 means the same as
+above. In this case, @option{^-r^/REPLACE^},
+@option{^-rf^/OVERRIDING_REPLACE^} or
+@option{^-rnb^/REPLACE_NO_BACKUP^} options are allowed.
+
@cindex @option{^-t^/TIME^} (@command{gnatpp})
@item ^-t^/TIME^
Print out execution time.
Usage:
@smallexample
-gnat2xml [options] files
+gnat2xml [options] filenames [-files filename] [-cargs gcc_switches]
@end smallexample
-``files'' are the Ada source file names.
-
@noindent
-Options:
+options:
@smallexample
-h
--help -- generate usage information and quit, ignoring all other options
+--version -- print version and quit, ignoring all other options
-P @file{file} -- indicates the name of the project file that describes
the set of sources to be processed. The exact set of argument
--incremental -- incremental processing on a per-file basis. Source files are
only processed if they have been modified, or if files they depend
on have been modified. This is similar to the way gnatmake/gprbuild
- only compiles files that need to be recompiled. You need to use a project
- file for this to work.
+ only compiles files that need to be recompiled.
--output-dir=@var{dir} -- generate one .xml file for each Ada source file, in
directory @file{dir}. (Default is to generate the XML to standard
output.)
+-I <include-dir>
+ directories to search for dependencies
+ You can also set the ADA_INCLUDE_PATH environment variable for this.
+
--compact -- debugging version, with interspersed source, and a more
compact representation of "sloc". This version does not conform
to any schema.
--I <include-dir>
- directories to search for dependencies
- You can also set the ADA_INCLUDE_PATH environment variable for this.
+-files=filename - the name of a text file containing a list
+ of Ada source files to process
-q -- quiet
-
--v -- verbose (print out the command line options, and the names of
- output files as they are generated).
+-v -- verbose
-cargs ... -- options to pass to gcc
@end smallexample
Example:
@smallexample
-gnat2xml -v -mxml-files *.ad[sb] -cargs -gnat2012
+gnat2xml -v -output-dir=xml-files *.ad[sb]
@end smallexample
@noindent
if Argument_Count = 0 then
Bindusg.Display;
else
- Write_Line ("type ""gnatbind --help"" for help");
+ Write_Line ("try `gnatbind --help` for more information.");
end if;
Exit_Program (E_Fatal);
if Argument_Count = 0 then
Usage;
else
- Put_Line ("type ""gnatchop --help"" for help");
+ Try_Help;
end if;
return False;
end if;
when others =>
- Put_Line ("type ""gnatfind --help"" for help");
+ Try_Help;
raise Usage_Error;
end case;
end loop;
when GNAT.Command_Line.Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid switch : "
& GNAT.Command_Line.Full_Switch);
- Put_Line ("type ""gnatfind --help"" for help");
+ Try_Help;
raise Usage_Error;
when GNAT.Command_Line.Invalid_Parameter =>
Ada.Text_IO.Put_Line ("Parameter missing for : "
& GNAT.Command_Line.Full_Switch);
- Put_Line ("type ""gnatfind --help"" for help");
+ Try_Help;
raise Usage_Error;
when Xref_Lib.Invalid_Argument =>
Ada.Text_IO.Put_Line ("Invalid line or column in the pattern");
- Put_Line ("type ""gnatfind --help"" for help");
+ Try_Help;
raise Usage_Error;
end Parse_Cmd_Line;
if Argument_Count = 0 then
Write_Usage;
else
- Put_Line ("type ""gnatfind --help"" for help");
+ Try_Help;
raise Usage_Error;
end if;
end if;
Ada.Text_IO.Put_Line ("Error: for type hierarchy output you must "
& "specify only one file.");
Ada.Text_IO.New_Line;
- Put_Line ("type ""gnatfind --help"" for help");
+ Try_Help;
raise Usage_Error;
end if;
with Ada.Command_Line; use Ada.Command_Line;
-with GNAT.Case_Util; use GNAT.Case_Util;
+with GNAT.Command_Line; use GNAT.Command_Line;
+with GNAT.Case_Util; use GNAT.Case_Util;
procedure Gnatls is
pragma Ident (Gnat_Static_Version_String);
Set_Standard_Error;
Write_Str ("Can't use -l with another switch");
Write_Eol;
- Write_Line ("type ""gnatls --help"" for help");
+ Try_Help;
Exit_Program (E_Fatal);
end if;
if Argument_Count = 0 then
Usage;
else
- Write_Line ("type ""gnatls --help"" for help");
+ Try_Help;
end if;
end if;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
+with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.Dynamic_Tables;
with GNAT.OS_Lib; use GNAT.OS_Lib;
Patterns.Last
(Arguments.Table (Arguments.Last).Foreign_Patterns) = 0
then
- Put_Line ("type ""gnatname --help"" for help");
+ Try_Help;
return;
end if;
then
if Argument_Count = 0 then
Usage;
- else
- Put_Line ("type ""gnatname --help"" for help");
+ elsif not Usage_Output then
+ Try_Help;
end if;
return;
end if;
when others =>
- Put_Line ("type ""gnatxref --help"" for help");
+ Try_Help;
raise Usage_Error;
end case;
end loop;
if Ada.Strings.Fixed.Index (S, ":") /= 0 then
Ada.Text_IO.Put_Line
("Only file names are allowed on the command line");
- Put_Line ("type ""gnatxref --help"" for help");
+ Try_Help;
raise Usage_Error;
end if;
when GNAT.Command_Line.Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid switch : "
& GNAT.Command_Line.Full_Switch);
- Put_Line ("type ""gnatxref --help"" for help");
+ Try_Help;
raise Usage_Error;
when GNAT.Command_Line.Invalid_Parameter =>
Ada.Text_IO.Put_Line ("Parameter missing for : "
& GNAT.Command_Line.Full_Switch);
- Put_Line ("type ""gnatxref --help"" for help");
+ Try_Help;
raise Usage_Error;
end Parse_Cmd_Line;
if Argument_Count = 0 then
Write_Usage;
else
- Put_Line ("type ""gnatxref --help"" for help");
+ Try_Help;
raise Usage_Error;
end if;
end if;
if Argument_Count = 0 then
Usage;
else
- Put_Line ("type ""gnatprep --help"" for help");
+ GNAT.Command_Line.Try_Help;
end if;
return;
-- No output file specified, exit
- Put_Line ("type ""gnatprep --help"" for help");
+ GNAT.Command_Line.Try_Help;
return;
end if;
when GNAT.Command_Line.Invalid_Switch =>
Write_Str ("Invalid Switch: -");
Write_Line (GNAT.Command_Line.Full_Switch);
- Put_Line ("type ""gnatprep --help"" for help");
+ GNAT.Command_Line.Try_Help;
OS_Exit (1);
end;
end loop;
with Ada.Exceptions; use Ada.Exceptions;
with GNAT.Case_Util; use GNAT.Case_Util;
+with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
with GNAT.OS_Lib; use GNAT.OS_Lib;
if Argument_Count = 0 then
Usage;
else
- Write_Line ("type ""gnatmake --help"" for help");
+ Try_Help;
end if;
Finish_Program (Project_Tree, E_Success);
No_Implicit_Loops => True,
No_Initialize_Scalars => True,
No_Local_Protected_Objects => True,
- No_Long_Long_Integer => True,
+ No_Long_Long_Integers => True,
No_Protected_Type_Allocators => True,
No_Relative_Delay => True,
No_Requeue_Statements => True,
No_Local_Allocators, -- (RM H.4(8))
No_Local_Timing_Events, -- (RM D.7(10.2/2))
No_Local_Protected_Objects, -- Ada 2012 (D.7(10/1.3))
- No_Long_Long_Integer, -- GNAT
+ No_Long_Long_Integers, -- GNAT
No_Nested_Finalization, -- (RM D.7(4))
No_Protected_Type_Allocators, -- Ada 2012 (D.7 (10.3/2))
No_Protected_Types, -- (RM H.4(5))
end if;
if M_Val > 2 ** Standard_Long_Integer_Size then
- Check_Restriction (No_Long_Long_Integer, Mod_Expr);
+ Check_Restriction (No_Long_Long_Integers, Mod_Expr);
end if;
Set_Modulus (T, M_Val);
Base_Typ := Base_Type (Standard_Long_Integer);
elsif Can_Derive_From (Standard_Long_Long_Integer) then
- Check_Restriction (No_Long_Long_Integer, Def);
+ Check_Restriction (No_Long_Long_Integers, Def);
Base_Typ := Base_Type (Standard_Long_Long_Integer);
else
end if;
if Val = Standard_Long_Long_Integer then
- Check_Restriction (No_Long_Long_Integer, Post_Node);
+ Check_Restriction (No_Long_Long_Integers, Post_Node);
end if;
-- Check for violation of No_Dynamic_Attachment
-- If restriction No_Dynamic_Attachment is set, then it checks that the
-- entity is not one of the restricted names for this restriction.
--
- -- If restriction No_Long_Long_Integer is set, then it checks that the
+ -- If restriction No_Long_Long_Integers is set, then it checks that the
-- entity is not Standard.Long_Long_Integer.
--
-- If restriction No_Implementation_Identifiers is set, then it checks
Write_Str_With_Col_Check ("not null ");
end if;
- Sprint_Node (Object_Definition (Node));
+ -- Print type, we used to print the Object_Definition from
+ -- the node, but it is much more useful to print the Etype
+ -- of the defining identifier. For example, this will be a
+ -- clear reference to the Itype with the bounds in the case
+ -- of an unconstrained array type like String. The object
+ -- after all is constrained, even if its nominal subtype is
+ -- unconstrained.
+
+ Sprint_Node (Etype (Def_Id));
if Present (Expression (Node)) then
Write_Str (" := ");