Commit 8da1a312 by Arnaud Charlet

[multiple changes]

2011-09-05  Johannes Kanig  <kanig@adacore.com>

	* g-comlin.adb (Set_Usage): Additional optional argument to set help
	message.
	(Display_Help): display the user given help message, if available.

2011-09-05  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (OK_For_Limited_Init_In_05): The expression
	is legal if the original node is an identifier that is a
	parameterless function call.

From-SVN: r178547
parent 69b73847
2011-09-05 Johannes Kanig <kanig@adacore.com>
* g-comlin.adb (Set_Usage): Additional optional argument to set help
message.
(Display_Help): display the user given help message, if available.
2011-09-05 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (OK_For_Limited_Init_In_05): The expression
is legal if the original node is an identifier that is a
parameterless function call.
2011-09-05 Pascal Obry <obry@adacore.com> 2011-09-05 Pascal Obry <obry@adacore.com>
* prj-nmsc.adb: Minor reformatting. * prj-nmsc.adb: Minor reformatting.
......
...@@ -3026,9 +3026,10 @@ package body GNAT.Command_Line is ...@@ -3026,9 +3026,10 @@ package body GNAT.Command_Line is
--------------- ---------------
procedure Set_Usage procedure Set_Usage
(Config : in out Command_Line_Configuration; (Config : in out Command_Line_Configuration;
Usage : String := "[switches] [arguments]"; Usage : String := "[switches] [arguments]";
Help : String := "") Help : String := "";
Help_Msg : String := "")
is is
begin begin
if Config = null then if Config = null then
...@@ -3036,8 +3037,9 @@ package body GNAT.Command_Line is ...@@ -3036,8 +3037,9 @@ package body GNAT.Command_Line is
end if; end if;
Free (Config.Usage); Free (Config.Usage);
Config.Usage := new String'(Usage); Config.Usage := new String'(Usage);
Config.Help := new String'(Help); Config.Help := new String'(Help);
Config.Help_Msg := new String'(Help_Msg);
end Set_Usage; end Set_Usage;
------------------ ------------------
...@@ -3222,12 +3224,15 @@ package body GNAT.Command_Line is ...@@ -3222,12 +3224,15 @@ package body GNAT.Command_Line is
& " [switches] [arguments]"); & " [switches] [arguments]");
end if; end if;
Display_Section_Help (""); if Config.Help_Msg /= null and then Config.Help_Msg.all /= "" then
Put_Line (Config.Help_Msg.all);
if Config.Sections /= null and then Config.Switches /= null then else
for S in Config.Sections'Range loop Display_Section_Help ("");
Display_Section_Help (Config.Sections (S).all); if Config.Sections /= null and then Config.Switches /= null then
end loop; for S in Config.Sections'Range loop
Display_Section_Help (Config.Sections (S).all);
end loop;
end if;
end if; end if;
end Display_Help; end Display_Help;
......
...@@ -664,11 +664,14 @@ package GNAT.Command_Line is ...@@ -664,11 +664,14 @@ package GNAT.Command_Line is
-- Output is always initialized to the empty string. -- Output is always initialized to the empty string.
procedure Set_Usage procedure Set_Usage
(Config : in out Command_Line_Configuration; (Config : in out Command_Line_Configuration;
Usage : String := "[switches] [arguments]"; Usage : String := "[switches] [arguments]";
Help : String := ""); Help : String := "";
Help_Msg : String := "");
-- Defines the general format of the call to the application, and a short -- Defines the general format of the call to the application, and a short
-- help text. These are both displayed by Display_Help -- help text. These are both displayed by Display_Help. When a non-empty
-- Help_Msg is given, it is used by Display_Help instead of the
-- automatically generated list of supported switches.
procedure Display_Help (Config : Command_Line_Configuration); procedure Display_Help (Config : Command_Line_Configuration);
-- Display the help for the tool (ie its usage, and its supported switches) -- Display the help for the tool (ie its usage, and its supported switches)
...@@ -1134,6 +1137,7 @@ private ...@@ -1134,6 +1137,7 @@ private
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;
Help_Msg : 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;
......
...@@ -772,8 +772,8 @@ package body Sem_Ch3 is ...@@ -772,8 +772,8 @@ package body Sem_Ch3 is
Anon_Scope := Scope (Defining_Entity (Related_Nod)); Anon_Scope := Scope (Defining_Entity (Related_Nod));
end if; end if;
-- For an access type definition, if the current scope is a child -- For an access type definition, if the current scope is a child
-- unit it is the scope of the type. -- unit it is the scope of the type.
elsif Is_Compilation_Unit (Current_Scope) then elsif Is_Compilation_Unit (Current_Scope) then
Anon_Scope := Current_Scope; Anon_Scope := Current_Scope;
...@@ -821,7 +821,7 @@ package body Sem_Ch3 is ...@@ -821,7 +821,7 @@ package body Sem_Ch3 is
Set_Can_Use_Internal_Rep Set_Can_Use_Internal_Rep
(Anon_Type, not Always_Compatible_Rep_On_Target); (Anon_Type, not Always_Compatible_Rep_On_Target);
-- If the anonymous access is associated with a protected operation -- If the anonymous access is associated with a protected operation,
-- create a reference to it after the enclosing protected definition -- create a reference to it after the enclosing protected definition
-- because the itype will be used in the subsequent bodies. -- because the itype will be used in the subsequent bodies.
...@@ -908,10 +908,10 @@ package body Sem_Ch3 is ...@@ -908,10 +908,10 @@ package body Sem_Ch3 is
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_uMaster), Make_Defining_Identifier (Loc, Name_uMaster),
Constant_Present => True, Constant_Present => True,
Object_Definition => Object_Definition =>
New_Reference_To (RTE (RE_Master_Id), Loc), New_Reference_To (RTE (RE_Master_Id), Loc),
Expression => Expression =>
Make_Explicit_Dereference (Loc, Make_Explicit_Dereference (Loc,
New_Reference_To (RTE (RE_Current_Master), Loc))); New_Reference_To (RTE (RE_Current_Master), Loc)));
...@@ -16866,12 +16866,17 @@ package body Sem_Ch3 is ...@@ -16866,12 +16866,17 @@ package body Sem_Ch3 is
-- function calls. The function call may have been given in prefixed -- function calls. The function call may have been given in prefixed
-- notation, in which case the original node is an indexed component. -- notation, in which case the original node is an indexed component.
-- If the function is parameterless, the original node was an explicit -- If the function is parameterless, the original node was an explicit
-- dereference. -- dereference. The function may also be parameterless, in which case
-- the source node is just an identifier.
case Nkind (Original_Node (Exp)) is case Nkind (Original_Node (Exp)) is
when N_Aggregate | N_Extension_Aggregate | N_Function_Call | N_Op => when N_Aggregate | N_Extension_Aggregate | N_Function_Call | N_Op =>
return True; return True;
when N_Identifier =>
return Present (Entity (Original_Node (Exp)))
and then Ekind (Entity (Original_Node (Exp))) = E_Function;
when N_Qualified_Expression => when N_Qualified_Expression =>
return return
OK_For_Limited_Init_In_05 OK_For_Limited_Init_In_05
......
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