Commit 85c3f0b9 by Arnaud Charlet

[multiple changes]

2010-10-12  Javier Miranda  <miranda@adacore.com>

	* exp_util.adb (Side_Effect_Free): Return true for object renaming
	declarations that were previously generated by Remove_Side_Effects.

2010-10-12  Emmanuel Briot  <briot@adacore.com>

	* xref_lib.adb (Get_Full_Type): Display "private variable" instead of
	"???" when an entity is defined as "*" in the ALI file.
	* g-comlin.ads, g-comlin.adb: Fix handling of null parameters.
	Minor reformatting.

From-SVN: r165371
parent b799980e
2010-10-12 Javier Miranda <miranda@adacore.com>
* exp_util.adb (Side_Effect_Free): Return true for object renaming
declarations that were previously generated by Remove_Side_Effects.
2010-10-12 Emmanuel Briot <briot@adacore.com>
* xref_lib.adb (Get_Full_Type): Display "private variable" instead of
"???" when an entity is defined as "*" in the ALI file.
* g-comlin.ads, g-comlin.adb: Fix handling of null parameters.
Minor reformatting.
2010-10-12 Emmanuel Briot <briot@adacore.com> 2010-10-12 Emmanuel Briot <briot@adacore.com>
* g-comlin.adb, g-comlin.ads (Display_Help, Getopt, Current_Section, * g-comlin.adb, g-comlin.ads (Display_Help, Getopt, Current_Section,
......
...@@ -4645,6 +4645,20 @@ package body Exp_Util is ...@@ -4645,6 +4645,20 @@ package body Exp_Util is
and then Ekind (Entity (Original_Node (N))) /= E_Constant and then Ekind (Entity (Original_Node (N))) /= E_Constant
then then
return False; return False;
-- Remove_Side_Effects generates an object renaming declaration to
-- capture the expression of a class-wide expression. In VM targets
-- the frontend performs no expansion for dispatching calls to
-- class-wide types since they are handled by the VM. Hence, we must
-- locate here if this node corresponds to a previous invocation of
-- Remove_Side_Effects to avoid a never ending loop in the frontend.
elsif VM_Target /= No_VM
and then not Comes_From_Source (N)
and then Is_Class_Wide_Type (Etype (N))
and then Nkind (Parent (N)) = N_Object_Renaming_Declaration
then
return True;
end if; end if;
-- For other than entity names and compile time known values, -- For other than entity names and compile time known values,
......
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
-- High level package for command line parsing and manipulation -- High level package for command line parsing and manipulation
-------------------------------------- ----------------------------------------
-- Simple parsing of the command line -- Simple Parsing of the Command Line --
-------------------------------------- ----------------------------------------
-- This package provides an interface for parsing command line arguments, -- This package provides an interface for parsing command line arguments,
-- when they are either read from Ada.Command_Line or read from a string list. -- when they are either read from Ada.Command_Line or read from a string list.
...@@ -84,9 +84,9 @@ ...@@ -84,9 +84,9 @@
-- when Invalid_Parameter => Put_Line ("No parameter for " & Full_Switch); -- when Invalid_Parameter => Put_Line ("No parameter for " & Full_Switch);
-- end; -- end;
------------- --------------
-- Sections -- Sections --
------------- --------------
-- A more complicated example would involve the use of sections for the -- A more complicated example would involve the use of sections for the
-- switches, as for instance in gnatmake. The same command line is used to -- switches, as for instance in gnatmake. The same command line is used to
...@@ -113,9 +113,9 @@ ...@@ -113,9 +113,9 @@
-- end loop; -- end loop;
-- end; -- end;
------------------------------ -------------------------------
-- Parsing a list of strings -- Parsing a List of Strings --
------------------------------ -------------------------------
-- The examples above show how to parse the command line when the arguments -- The examples above show how to parse the command line when the arguments
-- are read directly from Ada.Command_Line. However, these arguments can also -- are read directly from Ada.Command_Line. However, these arguments can also
...@@ -144,9 +144,9 @@ ...@@ -144,9 +144,9 @@
-- Free (Parser); -- Free (Parser);
-- end; -- end;
---------------------------------------------- -------------------------------------------
-- High level command line configuration -- High-Level Command Line Configuration --
---------------------------------------------- -------------------------------------------
-- As shown above, the code is still relatively low-level. For instance, there -- As shown above, the code is still relatively low-level. For instance, there
-- is no way to indicate which switches are related (thus if "-l" and "--long" -- is no way to indicate which switches are related (thus if "-l" and "--long"
...@@ -219,9 +219,9 @@ ...@@ -219,9 +219,9 @@
-- Optimization and Verbose have been properly initialized, either to the -- Optimization and Verbose have been properly initialized, either to the
-- default value or to the value found on the command line. -- default value or to the value found on the command line.
---------------------------------------------- ------------------------------------------------
-- Creating and manipulating the command line -- Creating and Manipulating the Command Line --
---------------------------------------------- ------------------------------------------------
-- This package provides mechanisms to create and modify command lines by -- This package provides mechanisms to create and modify command lines by
-- adding or removing arguments from them. The resulting command line is kept -- adding or removing arguments from them. The resulting command line is kept
...@@ -276,6 +276,7 @@ ...@@ -276,6 +276,7 @@
-- and will not be grouped with other parts of the command line. -- and will not be grouped with other parts of the command line.
with Ada.Command_Line; with Ada.Command_Line;
with GNAT.Directory_Operations; with GNAT.Directory_Operations;
with GNAT.OS_Lib; with GNAT.OS_Lib;
with GNAT.Regexp; with GNAT.Regexp;
...@@ -537,12 +538,14 @@ package GNAT.Command_Line is ...@@ -537,12 +538,14 @@ package GNAT.Command_Line is
----------------- -----------------
-- Configuring -- -- Configuring --
----------------- -----------------
-- The following subprograms are used to manipulate a command line -- The following subprograms are used to manipulate a command line
-- represented as a string (for instance "-g -O2"), as well as parsing -- represented as a string (for instance "-g -O2"), as well as parsing
-- the switches from such a string. They provide high-level configurations -- the switches from such a string. They provide high-level configurations
-- to define aliases (a switch is equivalent to one or more other switches) -- to define aliases (a switch is equivalent to one or more other switches)
-- or grouping of switches ("-gnatyac" is equivalent to "-gnatya" and -- or grouping of switches ("-gnatyac" is equivalent to "-gnatya" and
-- "-gnatyc"). -- "-gnatyc").
-- See the top of this file for examples on how to use these subprograms -- See the top of this file for examples on how to use these subprograms
type Command_Line_Configuration is private; type Command_Line_Configuration is private;
...@@ -553,8 +556,10 @@ package GNAT.Command_Line is ...@@ -553,8 +556,10 @@ package GNAT.Command_Line is
-- Indicates a new switch section. All switches belonging to the same -- Indicates a new switch section. All switches belonging to the same
-- section are ordered together, preceded by the section. They are placed -- section are ordered together, preceded by the section. They are placed
-- at the end of the command line (as in "gnatmake somefile.adb -cargs -g") -- at the end of the command line (as in "gnatmake somefile.adb -cargs -g")
-- The section name should not include the leading '-'. --
-- So for instance in the case of gnatmake we would use: -- The section name should not include the leading '-'. So for instance in
-- the case of gnatmake we would use:
--
-- Define_Section (Config, "cargs"); -- Define_Section (Config, "cargs");
-- Define_Section (Config, "bargs"); -- Define_Section (Config, "bargs");
...@@ -567,12 +572,13 @@ package GNAT.Command_Line is ...@@ -567,12 +572,13 @@ package GNAT.Command_Line is
-- be expanded as Expanded. For instance, for the GNAT compiler switches, -- be expanded as Expanded. For instance, for the GNAT compiler switches,
-- we would define "-gnatwa" as an alias for "-gnatwcfijkmopruvz", ie some -- we would define "-gnatwa" as an alias for "-gnatwcfijkmopruvz", ie some
-- default warnings to be activated. -- default warnings to be activated.
--
-- This expansion is only done within the specified section, which must -- This expansion is only done within the specified section, which must
-- have been defined first through a call to [Define_Section]. -- have been defined first through a call to [Define_Section].
procedure Define_Prefix procedure Define_Prefix
(Config : in out Command_Line_Configuration; (Config : in out Command_Line_Configuration;
Prefix : String); Prefix : String);
-- Indicates that all switches starting with the given prefix should be -- Indicates that all switches starting with the given prefix should be
-- grouped. For instance, for the GNAT compiler we would define "-gnatw" as -- grouped. For instance, for the GNAT compiler we would define "-gnatw" as
-- a prefix, so that "-gnatwu -gnatwv" can be grouped into "-gnatwuv" It is -- a prefix, so that "-gnatwu -gnatwv" can be grouped into "-gnatwuv" It is
...@@ -666,14 +672,14 @@ package GNAT.Command_Line is ...@@ -666,14 +672,14 @@ package GNAT.Command_Line is
function Get_Switches function Get_Switches
(Config : Command_Line_Configuration; (Config : Command_Line_Configuration;
Section : String := ""; Switch_Char : Character := '-';
Switch_Char : Character := '-') return String; Section : String := "") return String;
-- Get the switches list as expected by Getopt, for a specific section of -- Get the switches list as expected by Getopt, for a specific section of
-- the command line. This list is built using all switches defined -- the command line. This list is built using all switches defined
-- previously via Define_Switch above. -- previously via Define_Switch above.
function Section_Delimiters function Section_Delimiters
(Config : Command_Line_Configuration) return String; (Config : Command_Line_Configuration) return String;
-- Return a string suitable for use in Initialize_Option_Scan -- Return a string suitable for use in Initialize_Option_Scan
procedure Free (Config : in out Command_Line_Configuration); procedure Free (Config : in out Command_Line_Configuration);
...@@ -728,13 +734,16 @@ package GNAT.Command_Line is ...@@ -728,13 +734,16 @@ package GNAT.Command_Line is
------------------------------ ------------------------------
-- Generating command lines -- -- Generating command lines --
------------------------------ ------------------------------
-- Once the command line configuration has been created, you can build your -- Once the command line configuration has been created, you can build your
-- own command line. This will be done in general because you need to spawn -- own command line. This will be done in general because you need to spawn
-- external tools from your application. -- external tools from your application.
-- Although it could be done by concatenating strings, the following -- Although it could be done by concatenating strings, the following
-- subprograms will properly take care of grouping switches when possible, -- subprograms will properly take care of grouping switches when possible,
-- so as to keep the command line as short as possible. They also provide a -- so as to keep the command line as short as possible. They also provide a
-- way to remove a switch from an existing command line. -- way to remove a switch from an existing command line.
-- For instance: -- For instance:
-- declare -- declare
-- Config : Command_Line_Configuration; -- Config : Command_Line_Configuration;
...@@ -920,11 +929,12 @@ package GNAT.Command_Line is ...@@ -920,11 +929,12 @@ package GNAT.Command_Line is
Args : out GNAT.OS_Lib.Argument_List_Access; Args : out GNAT.OS_Lib.Argument_List_Access;
Expanded : Boolean := False; Expanded : Boolean := False;
Switch_Char : Character := '-'); Switch_Char : Character := '-');
-- This is a wrapper using the Command_Line_Iterator. -- This is a wrapper using the Command_Line_Iterator. It provides a simple
-- It provides a simple way to get all switches (grouped as much as -- way to get all switches (grouped as much as possible), and possibly
-- possible), and possibly create an Opt_Parser. -- create an Opt_Parser.
-- [Args] must be freed by the caller. --
-- [Expanded] has the same meaning as in [Start]. -- Args must be freed by the caller.
-- Expanded has the same meaning as in Start.
private private
...@@ -1020,7 +1030,7 @@ private ...@@ -1020,7 +1030,7 @@ private
end record; end record;
Command_Line_Parser_Data : aliased Opt_Parser_Data Command_Line_Parser_Data : aliased Opt_Parser_Data
(Ada.Command_Line.Argument_Count); (Ada.Command_Line.Argument_Count);
-- The internal data used when parsing the command line -- The internal data used when parsing the command line
type Opt_Parser is access all Opt_Parser_Data; type Opt_Parser is access all Opt_Parser_Data;
...@@ -1057,24 +1067,24 @@ private ...@@ -1057,24 +1067,24 @@ private
-- [Switch] includes the leading '-' -- [Switch] includes the leading '-'
type Alias_Definition is record type Alias_Definition is record
Alias : GNAT.OS_Lib.String_Access; Alias : GNAT.OS_Lib.String_Access;
Expansion : GNAT.OS_Lib.String_Access; Expansion : GNAT.OS_Lib.String_Access;
Section : GNAT.OS_Lib.String_Access; Section : GNAT.OS_Lib.String_Access;
end record; end record;
type Alias_Definitions is array (Natural range <>) of Alias_Definition; type Alias_Definitions is array (Natural range <>) of Alias_Definition;
type Alias_Definitions_List is access all Alias_Definitions; type Alias_Definitions_List is access all Alias_Definitions;
type Command_Line_Configuration_Record is record type Command_Line_Configuration_Record is record
Prefixes : GNAT.OS_Lib.Argument_List_Access; Prefixes : GNAT.OS_Lib.Argument_List_Access;
-- The list of prefixes -- The list of prefixes
Sections : GNAT.OS_Lib.Argument_List_Access; Sections : GNAT.OS_Lib.Argument_List_Access;
-- The list of sections -- The list of sections
Aliases : Alias_Definitions_List; Aliases : Alias_Definitions_List;
Usage : GNAT.OS_Lib.String_Access; Usage : GNAT.OS_Lib.String_Access;
Help : GNAT.OS_Lib.String_Access; Help : GNAT.OS_Lib.String_Access;
Switches : Switch_Definitions_List; Switches : Switch_Definitions_List;
-- List of expected switches (Used when expanding switch groups) -- List of expected switches (Used when expanding switch groups)
end record; end record;
type Command_Line_Configuration is access Command_Line_Configuration_Record; type Command_Line_Configuration is access Command_Line_Configuration_Record;
......
...@@ -555,6 +555,7 @@ package body Xref_Lib is ...@@ -555,6 +555,7 @@ package body Xref_Lib is
when 'Y' => return "entry"; when 'Y' => return "entry";
when '+' => return "private type"; when '+' => return "private type";
when '*' => return "private variable";
-- The above should be the only possibilities, but for this kind -- The above should be the only possibilities, but for this kind
-- of informational output, we don't want to bomb if we find -- of informational output, we don't want to bomb if we find
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment