Commit d4bf622f by Arnaud Charlet

[multiple changes]

2017-01-13  Gary Dismukes  <dismukes@adacore.com>

	* exp_util.adb: Minor reformatting.

2017-01-13  Yannick Moy  <moy@adacore.com>

	* exp_spark.adb: Code cleanup.
	* sem_ch9.adb (Analyze_Delay_Until): Resolve
	expression so that calls are identified as such inside delay
	until.

From-SVN: r244405
parent 53a5377a
2017-01-13 Gary Dismukes <dismukes@adacore.com>
* exp_util.adb: Minor reformatting.
2017-01-13 Yannick Moy <moy@adacore.com>
* exp_spark.adb: Code cleanup.
* sem_ch9.adb (Analyze_Delay_Until): Resolve
expression so that calls are identified as such inside delay
until.
2017-01-13 Ed Schonberg <schonberg@adacore.com> 2017-01-13 Ed Schonberg <schonberg@adacore.com>
* exp_util.adb (Insert_Actions): Handle Iterated_Component_Association. * exp_util.adb (Insert_Actions): Handle Iterated_Component_Association.
......
...@@ -124,36 +124,28 @@ package body Exp_SPARK is ...@@ -124,36 +124,28 @@ package body Exp_SPARK is
Aname : constant Name_Id := Attribute_Name (N); Aname : constant Name_Id := Attribute_Name (N);
Attr_Id : constant Attribute_Id := Get_Attribute_Id (Aname); Attr_Id : constant Attribute_Id := Get_Attribute_Id (Aname);
Loc : constant Source_Ptr := Sloc (N); Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Call : Node_Id; Expr : Node_Id;
Expr : Node_Id;
begin begin
if Attr_Id = Attribute_To_Address then if Attr_Id = Attribute_To_Address then
-- Extract argument to later reanalyze it in the new context -- Extract and convert argument to expected type for call
Expr := First (Expressions (N)); Expr :=
Nlists.Remove (Expr); Make_Type_Conversion (Loc,
Set_Etype (Expr, Empty); Subtype_Mark =>
Set_Analyzed (Expr, False); New_Occurrence_Of (RTE (RE_Integer_Address), Loc),
Expression => Relocate_Node (First (Expressions (N))));
-- Create the call and insert it in the tree -- Replace attribute reference with call
Call := Rewrite (N,
Make_Function_Call (Loc, Make_Function_Call (Loc,
Name => Name =>
New_Occurrence_Of (RTE (RE_To_Address), Loc), New_Occurrence_Of (RTE (RE_To_Address), Loc),
Parameter_Associations => New_List ( Parameter_Associations => New_List (Expr)));
Expr)); Analyze_And_Resolve (N, Typ);
Set_Etype (Call, Etype (N));
Rewrite (N, Call);
-- Reanalyze argument and call in the new context
Analyze_And_Resolve (Expr, Rtsfind.RTE (Rtsfind.RE_Integer_Address));
Analyze_And_Resolve (N, Etype (N));
end if; end if;
end Expand_SPARK_Attribute_Reference; end Expand_SPARK_Attribute_Reference;
......
...@@ -5709,10 +5709,10 @@ package body Exp_Util is ...@@ -5709,10 +5709,10 @@ package body Exp_Util is
-- an association that will generate a loop, its Loop_Actions -- an association that will generate a loop, its Loop_Actions
-- attribute is already initialized (see exp_aggr.adb). -- attribute is already initialized (see exp_aggr.adb).
-- The list of loop_actions can in turn generate additional ones, -- The list of Loop_Actions can in turn generate additional ones,
-- that are inserted before the associated node. If the associated -- that are inserted before the associated node. If the associated
-- node is outside the aggregate, the new actions are collected -- node is outside the aggregate, the new actions are collected
-- at the end of the loop actions, to respect the order in which -- at the end of the Loop_Actions, to respect the order in which
-- they are to be elaborated. -- they are to be elaborated.
when N_Component_Association when N_Component_Association
...@@ -5731,7 +5731,7 @@ package body Exp_Util is ...@@ -5731,7 +5731,7 @@ package body Exp_Util is
begin begin
-- Check whether these actions were generated by a -- Check whether these actions were generated by a
-- declaration that is part of the loop_ actions for -- declaration that is part of the Loop_Actions for
-- the component_association. -- the component_association.
Decl := Assoc_Node; Decl := Assoc_Node;
......
...@@ -1171,7 +1171,7 @@ package body Sem_Ch9 is ...@@ -1171,7 +1171,7 @@ package body Sem_Ch9 is
Check_SPARK_05_Restriction ("delay statement is not allowed", N); Check_SPARK_05_Restriction ("delay statement is not allowed", N);
Check_Restriction (No_Delay, N); Check_Restriction (No_Delay, N);
Check_Potentially_Blocking_Operation (N); Check_Potentially_Blocking_Operation (N);
Analyze (E); Analyze_And_Resolve (E);
Typ := First_Subtype (Etype (E)); Typ := First_Subtype (Etype (E));
if not Is_RTE (Typ, RO_CA_Time) and then if not Is_RTE (Typ, RO_CA_Time) and then
......
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