From 5c12e9fbefcf47363492098361c74d7fabdf9e3a Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 27 Oct 2015 12:15:27 +0100 Subject: [PATCH] [multiple changes] 2015-10-27 Pascal Obry * a-dirval-mingw.adb: Remove some characters from Invalid_Character set. 2015-10-27 Ed Schonberg * exp_ch6.adb (Rewrite_Function_Call_For_C): Use a named associaion for the added actual in the call because previous actuals may also have been given by explicit associations. * lib-xref.adb: Minor style fixes. From-SVN: r229416 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/a-dirval-mingw.adb | 5 ++++- gcc/ada/exp_ch6.adb | 34 ++++++++++++++++++++++++++-------- gcc/ada/lib-xref.adb | 8 ++++---- 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a9ae75ebd37..da584a54bdb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2015-10-27 Pascal Obry + + * a-dirval-mingw.adb: Remove some characters from Invalid_Character set. + +2015-10-27 Ed Schonberg + + * exp_ch6.adb (Rewrite_Function_Call_For_C): Use a named + associaion for the added actual in the call because previous + actuals may also have been given by explicit associations. + * lib-xref.adb: Minor style fixes. + 2015-10-27 Arnaud Charlet * gnat1drv.adb: Remove hard coded restrictions. diff --git a/gcc/ada/a-dirval-mingw.adb b/gcc/ada/a-dirval-mingw.adb index bd8429c4767..de3b566274e 100644 --- a/gcc/ada/a-dirval-mingw.adb +++ b/gcc/ada/a-dirval-mingw.adb @@ -40,8 +40,11 @@ package body Ada.Directories.Validity is (NUL .. US | '\' => True, '/' | ':' | '*' | '?' => True, '"' | '<' | '>' | '|' => True, - DEL .. NBSP => True, + DEL => True, others => False); + -- Note that a valid file-name or path-name is implementation defined. + -- To support UTF-8 file and directory names, we do not want to be too + -- restrictive here. --------------------------------- -- Is_Path_Name_Case_Sensitive -- diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index fb919248a8b..dc03396ee42 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -8329,14 +8329,25 @@ package body Exp_Ch6 is --------------------------------- procedure Rewrite_Function_Call_For_C (N : Node_Id) is - Func_Id : constant Entity_Id := Entity (Name (N)); - Func_Decl : constant Node_Id := Unit_Declaration_Node (Func_Id); - Par : constant Node_Id := Parent (N); - Loc : constant Source_Ptr := Sloc (Par); - Proc_Id : constant Entity_Id := Defining_Entity (Next (Func_Decl)); - Actuals : List_Id; + Func_Id : constant Entity_Id := Entity (Name (N)); + Func_Decl : constant Node_Id := Unit_Declaration_Node (Func_Id); + Par : constant Node_Id := Parent (N); + Loc : constant Source_Ptr := Sloc (Par); + Proc_Id : constant Entity_Id := Defining_Entity (Next (Func_Decl)); + Actuals : List_Id; + Last_Formal : Entity_Id; begin + -- The actuals may be given by named associations, so the added + -- actual that is the target of the return value of the call must + -- be a named association as well, so we retrieve the name of the + -- generated out_formal. + + Last_Formal := First_Formal (Proc_Id); + while Present (Next_Formal (Last_Formal)) loop + Last_Formal := Next_Formal (Last_Formal); + end loop; + Actuals := Parameter_Associations (N); -- The original function may lack parameters @@ -8353,7 +8364,10 @@ package body Exp_Ch6 is -- Proc_Call (..., LHS); if Nkind (Par) = N_Assignment_Statement then - Append_To (Actuals, (Name (Par))); + Append_To (Actuals, + Make_Parameter_Association (Loc, + Selector_Name => Make_Identifier (Loc, Chars (Last_Formal)), + Explicit_Actual_Parameter => Name (Par))); Rewrite (Par, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc_Id, Loc), @@ -8388,7 +8402,11 @@ package body Exp_Ch6 is -- Generate: -- Proc_Call (..., Temp); - Append_To (Actuals, New_Occurrence_Of (Temp_Id, Loc)); + Append_To (Actuals, + Make_Parameter_Association (Loc, + Selector_Name => Make_Identifier (Loc, Chars (Last_Formal)), + Explicit_Actual_Parameter => + New_Occurrence_Of (Temp_Id, Loc))); Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc_Id, Loc), diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index b6c9a0e9ec0..f84a211b65e 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -66,7 +66,7 @@ package body Lib.Xref is Loc : Source_Ptr; -- Location of reference (Original_Location (Sloc field of N parameter - -- to Generate_Reference). Set to No_Location for the case of a + -- to Generate_Reference)). Set to No_Location for the case of a -- defining occurrence. Typ : Character; @@ -622,7 +622,7 @@ package body Lib.Xref is -- Do not generate references if we are within a postcondition sub- -- program, because the reference does not comes from source, and the - -- pre-analysis of the aspect has already created an entry for the ali + -- pre-analysis of the aspect has already created an entry for the ALI -- file at the proper source location. if Chars (Current_Scope) = Name_uPostconditions then @@ -1073,7 +1073,7 @@ package body Lib.Xref is end if; Add_Entry - ((Ent => Ent, + ((Ent => Ent, Loc => Ref, Typ => Actual_Typ, Eun => Get_Code_Unit (Def), @@ -1120,7 +1120,7 @@ package body Lib.Xref is and then In_Extended_Main_Source_Unit (N) then -- Handle case in which the full-view and partial-view of the - -- first private entity are swapped + -- first private entity are swapped. declare First_Private : Entity_Id := First_Private_Entity (E); -- 2.30.2