+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>
* exp_util.adb (Insert_Actions): Handle Iterated_Component_Association.
Aname : constant Name_Id := Attribute_Name (N);
Attr_Id : constant Attribute_Id := Get_Attribute_Id (Aname);
Loc : constant Source_Ptr := Sloc (N);
-
- Call : Node_Id;
- Expr : Node_Id;
+ Typ : constant Entity_Id := Etype (N);
+ Expr : Node_Id;
begin
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));
- Nlists.Remove (Expr);
- Set_Etype (Expr, Empty);
- Set_Analyzed (Expr, False);
+ Expr :=
+ Make_Type_Conversion (Loc,
+ Subtype_Mark =>
+ 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,
Name =>
New_Occurrence_Of (RTE (RE_To_Address), Loc),
- Parameter_Associations => New_List (
- Expr));
-
- 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));
+ Parameter_Associations => New_List (Expr)));
+ Analyze_And_Resolve (N, Typ);
end if;
end Expand_SPARK_Attribute_Reference;
-- an association that will generate a loop, its Loop_Actions
-- 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
-- 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.
when N_Component_Association
begin
-- 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.
Decl := Assoc_Node;
Check_SPARK_05_Restriction ("delay statement is not allowed", N);
Check_Restriction (No_Delay, N);
Check_Potentially_Blocking_Operation (N);
- Analyze (E);
+ Analyze_And_Resolve (E);
Typ := First_Subtype (Etype (E));
if not Is_RTE (Typ, RO_CA_Time) and then