Commit 57a3fca9 by Arnaud Charlet

[multiple changes]

2011-09-06  Robert Dewar  <dewar@adacore.com>

	* exp_ch7.adb, g-comlin.adb: Minor reformatting.

2011-09-06  Steve Baird  <baird@adacore.com>

	* exp_ch4.adb (Expand_Allocator_Expression): Look through
	derived subprograms in checking for presence of an
	Extra_Accessibility_Of_Result formal parameter.
	* exp_ch6.adb (Expand_Call): Look through derived subprograms in
	checking for presence of an Extra_Accessibility_Of_Result formal
	parameter.
	(Expand_Call.Add_Actual_Parameter): Fix a bug in the
	case where the Parameter_Associatiations attribute is already set,
	but set to an empty list.
	(Needs_Result_Accessibility_Level):
	Unconditionally return False. This is a temporary
	change, disabling the Extra_Accessibility_Of_Result
	mechanism.
	(Expand_Simple_Function_Return): Check for
	Extra_Accessibility_Of_Result parameter's presence instead of
	testing Ada_Version when generating a runtime accessibility
	check which makes use of the parameter.

From-SVN: r178571
parent eaed0c37
2011-09-06 Robert Dewar <dewar@adacore.com>
* exp_ch7.adb, g-comlin.adb: Minor reformatting.
2011-09-06 Steve Baird <baird@adacore.com>
* exp_ch4.adb (Expand_Allocator_Expression): Look through
derived subprograms in checking for presence of an
Extra_Accessibility_Of_Result formal parameter.
* exp_ch6.adb (Expand_Call): Look through derived subprograms in
checking for presence of an Extra_Accessibility_Of_Result formal
parameter.
(Expand_Call.Add_Actual_Parameter): Fix a bug in the
case where the Parameter_Associatiations attribute is already set,
but set to an empty list.
(Needs_Result_Accessibility_Level):
Unconditionally return False. This is a temporary
change, disabling the Extra_Accessibility_Of_Result
mechanism.
(Expand_Simple_Function_Return): Check for
Extra_Accessibility_Of_Result parameter's presence instead of
testing Ada_Version when generating a runtime accessibility
check which makes use of the parameter.
2011-09-06 Ed Schonberg <schonberg@adacore.com> 2011-09-06 Ed Schonberg <schonberg@adacore.com>
* exp_ch4.adb (Expand_N_Case_Expression): Actions created for the * exp_ch4.adb (Expand_N_Case_Expression): Actions created for the
......
...@@ -783,6 +783,8 @@ package body Exp_Ch4 is ...@@ -783,6 +783,8 @@ package body Exp_Ch4 is
Subp := Entity (Name (Exp)); Subp := Entity (Name (Exp));
end if; end if;
Subp := Ultimate_Alias (Subp);
if Present (Extra_Accessibility_Of_Result (Subp)) then if Present (Extra_Accessibility_Of_Result (Subp)) then
Add_Extra_Actual_To_Call Add_Extra_Actual_To_Call
(Subprogram_Call => Exp, (Subprogram_Call => Exp,
......
...@@ -1847,8 +1847,10 @@ package body Exp_Ch6 is ...@@ -1847,8 +1847,10 @@ package body Exp_Ch6 is
if No (Prev) then if No (Prev) then
if No (Parameter_Associations (Call_Node)) then if No (Parameter_Associations (Call_Node)) then
Set_Parameter_Associations (Call_Node, New_List); Set_Parameter_Associations (Call_Node, New_List);
Append (Insert_Param, Parameter_Associations (Call_Node));
end if; end if;
Append (Insert_Param, Parameter_Associations (Call_Node));
else else
Insert_After (Prev, Insert_Param); Insert_After (Prev, Insert_Param);
end if; end if;
...@@ -2754,7 +2756,8 @@ package body Exp_Ch6 is ...@@ -2754,7 +2756,8 @@ package body Exp_Ch6 is
-- passed in to it, then pass it in. -- passed in to it, then pass it in.
if Ekind_In (Subp, E_Function, E_Operator, E_Subprogram_Type) if Ekind_In (Subp, E_Function, E_Operator, E_Subprogram_Type)
and then Present (Extra_Accessibility_Of_Result (Subp)) and then
Present (Extra_Accessibility_Of_Result (Ultimate_Alias (Subp)))
then then
declare declare
Ancestor : Node_Id := Parent (Call_Node); Ancestor : Node_Id := Parent (Call_Node);
...@@ -2763,15 +2766,19 @@ package body Exp_Ch6 is ...@@ -2763,15 +2766,19 @@ package body Exp_Ch6 is
begin begin
-- Unimplemented: if Subp returns an anonymous access type, then -- Unimplemented: if Subp returns an anonymous access type, then
-- a) if the call is the operand of an explict conversion, then -- a) if the call is the operand of an explict conversion, then
-- the target type of the conversion (a named access type) -- the target type of the conversion (a named access type)
-- determines the accessibility level pass in; -- determines the accessibility level pass in;
-- b) if the call defines an access discriminant of an object -- b) if the call defines an access discriminant of an object
-- (e.g., the discriminant of an object being created by an -- (e.g., the discriminant of an object being created by an
-- allocator, or the discriminant of a function result), -- allocator, or the discriminant of a function result),
-- then the accessibility level to pass in is that of the -- then the accessibility level to pass in is that of the
-- discriminated object being initialized). -- discriminated object being initialized).
-- ???
while Nkind (Ancestor) = N_Qualified_Expression while Nkind (Ancestor) = N_Qualified_Expression
loop loop
Ancestor := Parent (Ancestor); Ancestor := Parent (Ancestor);
...@@ -2851,7 +2858,9 @@ package body Exp_Ch6 is ...@@ -2851,7 +2858,9 @@ package body Exp_Ch6 is
Scope_Depth (Current_Scope) + 1); Scope_Depth (Current_Scope) + 1);
end if; end if;
Add_Extra_Actual (Level, Extra_Accessibility_Of_Result (Subp)); Add_Extra_Actual
(Level,
Extra_Accessibility_Of_Result (Ultimate_Alias (Subp)));
end if; end if;
end; end;
end if; end if;
...@@ -6742,7 +6751,7 @@ package body Exp_Ch6 is ...@@ -6742,7 +6751,7 @@ package body Exp_Ch6 is
-- ensure that the function result does not outlive an -- ensure that the function result does not outlive an
-- object designated by one of it discriminants. -- object designated by one of it discriminants.
if Ada_Version >= Ada_2012 if Present (Extra_Accessibility_Of_Result (Scope_Id))
and then Has_Unconstrained_Access_Discriminants (R_Type) and then Has_Unconstrained_Access_Discriminants (R_Type)
then then
declare declare
...@@ -8320,6 +8329,9 @@ package body Exp_Ch6 is ...@@ -8320,6 +8329,9 @@ package body Exp_Ch6 is
return False; return False;
end Has_Unconstrained_Access_Discriminant_Component; end Has_Unconstrained_Access_Discriminant_Component;
Feature_Disabled : constant Boolean := True;
-- Temporary
-- Start of processing for Needs_Result_Accessibility_Level -- Start of processing for Needs_Result_Accessibility_Level
begin begin
...@@ -8328,6 +8340,9 @@ package body Exp_Ch6 is ...@@ -8328,6 +8340,9 @@ package body Exp_Ch6 is
if not Present (Func_Typ) then if not Present (Func_Typ) then
return False; return False;
elsif Feature_Disabled then
return False;
-- False if not a function, also handle enum-lit renames case -- False if not a function, also handle enum-lit renames case
elsif Func_Typ = Standard_Void_Type elsif Func_Typ = Standard_Void_Type
......
...@@ -1807,10 +1807,10 @@ package body Exp_Ch7 is ...@@ -1807,10 +1807,10 @@ package body Exp_Ch7 is
(Available_View (Designated_Type (Obj_Typ))) (Available_View (Designated_Type (Obj_Typ)))
and then Present (Expr) and then Present (Expr)
and then and then
(Is_Null_Access_BIP_Func_Call (Expr) (Is_Null_Access_BIP_Func_Call (Expr)
or else or else
(Is_Non_BIP_Func_Call (Expr) (Is_Non_BIP_Func_Call (Expr)
and then not Is_Related_To_Func_Return (Obj_Id))) and then not Is_Related_To_Func_Return (Obj_Id)))
then then
Processing_Actions (Has_No_Init => True); Processing_Actions (Has_No_Init => True);
...@@ -7035,17 +7035,14 @@ package body Exp_Ch7 is ...@@ -7035,17 +7035,14 @@ package body Exp_Ch7 is
function Alignment_Of (Typ : Entity_Id) return Node_Id; function Alignment_Of (Typ : Entity_Id) return Node_Id;
-- Subsidiary routine, generate the following attribute reference: -- Subsidiary routine, generate the following attribute reference:
--
-- Typ'Alignment -- Typ'Alignment
function Size_Of (Typ : Entity_Id) return Node_Id; function Size_Of (Typ : Entity_Id) return Node_Id;
-- Subsidiary routine, generate the following attribute reference: -- Subsidiary routine, generate the following attribute reference:
--
-- Typ'Size / Storage_Unit -- Typ'Size / Storage_Unit
function Double_Size_Of (Typ : Entity_Id) return Node_Id; function Double_Size_Of (Typ : Entity_Id) return Node_Id;
-- Subsidiary routine, generate the following expression: -- Subsidiary routine, generate the following expression:
--
-- 2 * Typ'Size / Storage_Unit -- 2 * Typ'Size / Storage_Unit
------------------ ------------------
......
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