From 06a7e989c234727320601e50fe3ee9754a6b7587 Mon Sep 17 00:00:00 2001 From: charlet Date: Mon, 5 Sep 2011 14:08:42 +0000 Subject: [PATCH] 2011-09-05 Johannes Kanig * 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 * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178547 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 12 ++++++++++++ gcc/ada/g-comlin.adb | 27 ++++++++++++++++----------- gcc/ada/g-comlin.ads | 12 ++++++++---- gcc/ada/sem_ch3.adb | 19 ++++++++++++------- 4 files changed, 48 insertions(+), 22 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0b6ae3f..12a9978 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2011-09-05 Johannes Kanig + + * 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 + + * 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 * prj-nmsc.adb: Minor reformatting. diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb index b0aa35a..e83ad51 100644 --- a/gcc/ada/g-comlin.adb +++ b/gcc/ada/g-comlin.adb @@ -3026,9 +3026,10 @@ package body GNAT.Command_Line is --------------- procedure Set_Usage - (Config : in out Command_Line_Configuration; - Usage : String := "[switches] [arguments]"; - Help : String := "") + (Config : in out Command_Line_Configuration; + Usage : String := "[switches] [arguments]"; + Help : String := ""; + Help_Msg : String := "") is begin if Config = null then @@ -3036,8 +3037,9 @@ package body GNAT.Command_Line is end if; Free (Config.Usage); - Config.Usage := new String'(Usage); - Config.Help := new String'(Help); + Config.Usage := new String'(Usage); + Config.Help := new String'(Help); + Config.Help_Msg := new String'(Help_Msg); end Set_Usage; ------------------ @@ -3222,12 +3224,15 @@ package body GNAT.Command_Line is & " [switches] [arguments]"); end if; - Display_Section_Help (""); - - if Config.Sections /= null and then Config.Switches /= null then - for S in Config.Sections'Range loop - Display_Section_Help (Config.Sections (S).all); - end loop; + if Config.Help_Msg /= null and then Config.Help_Msg.all /= "" then + Put_Line (Config.Help_Msg.all); + else + Display_Section_Help (""); + if Config.Sections /= null and then Config.Switches /= null then + for S in Config.Sections'Range loop + Display_Section_Help (Config.Sections (S).all); + end loop; + end if; end if; end Display_Help; diff --git a/gcc/ada/g-comlin.ads b/gcc/ada/g-comlin.ads index 893a674..9b2b005 100644 --- a/gcc/ada/g-comlin.ads +++ b/gcc/ada/g-comlin.ads @@ -664,11 +664,14 @@ package GNAT.Command_Line is -- Output is always initialized to the empty string. procedure Set_Usage - (Config : in out Command_Line_Configuration; - Usage : String := "[switches] [arguments]"; - Help : String := ""); + (Config : in out Command_Line_Configuration; + Usage : String := "[switches] [arguments]"; + Help : String := ""; + Help_Msg : String := ""); -- 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); -- Display the help for the tool (ie its usage, and its supported switches) @@ -1134,6 +1137,7 @@ private Aliases : Alias_Definitions_List; Usage : GNAT.OS_Lib.String_Access; Help : GNAT.OS_Lib.String_Access; + Help_Msg : GNAT.OS_Lib.String_Access; Switches : Switch_Definitions_List; -- List of expected switches (Used when expanding switch groups) end record; diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index ba3bbb7..8802ae5 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -772,8 +772,8 @@ package body Sem_Ch3 is Anon_Scope := Scope (Defining_Entity (Related_Nod)); end if; - -- For an access type definition, if the current scope is a child - -- unit it is the scope of the type. + -- For an access type definition, if the current scope is a child + -- unit it is the scope of the type. elsif Is_Compilation_Unit (Current_Scope) then Anon_Scope := Current_Scope; @@ -821,7 +821,7 @@ package body Sem_Ch3 is Set_Can_Use_Internal_Rep (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 -- because the itype will be used in the subsequent bodies. @@ -908,10 +908,10 @@ package body Sem_Ch3 is Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uMaster), - Constant_Present => True, - Object_Definition => + Constant_Present => True, + Object_Definition => New_Reference_To (RTE (RE_Master_Id), Loc), - Expression => + Expression => Make_Explicit_Dereference (Loc, New_Reference_To (RTE (RE_Current_Master), Loc))); @@ -16866,12 +16866,17 @@ package body Sem_Ch3 is -- function calls. The function call may have been given in prefixed -- notation, in which case the original node is an indexed component. -- 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 when N_Aggregate | N_Extension_Aggregate | N_Function_Call | N_Op => return True; + when N_Identifier => + return Present (Entity (Original_Node (Exp))) + and then Ekind (Entity (Original_Node (Exp))) = E_Function; + when N_Qualified_Expression => return OK_For_Limited_Init_In_05 -- 2.7.4