+2015-10-27 Pascal Obry <obry@adacore.com>
+
+ * a-dirval-mingw.adb: Remove some characters from Invalid_Character set.
+
+2015-10-27 Ed Schonberg <schonberg@adacore.com>
+
+ * 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 <charlet@adacore.com>
* gnat1drv.adb: Remove hard coded restrictions.
(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 --
---------------------------------
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
-- 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),
-- 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),
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;
-- 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
end if;
Add_Entry
- ((Ent => Ent,
+ ((Ent => Ent,
Loc => Ref,
Typ => Actual_Typ,
Eun => Get_Code_Unit (Def),
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);