+2017-04-28 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb (Complete_Object_Operation): When rewriting the
+ controlling actual in a prefixed call, preserve the original node
+ information if the prefix itself has been rewritten, for ASIS use.
+
+2017-04-28 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_ch6.adb (Insert_Post_Call_Actions):
+ Code clean up. Insert the post-call actions after an enclosing
+ procedure call when N denotes a function call and appears as an
+ actual parameter in the procedure call.
+
+2017-04-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * freeze.adb (Check_Component_Storage_Order): If there is a clause
+ for the component, also reject the attribute if the component
+ doesn't end on a byte boundary and its scalar storage order is
+ different from that of the enclosing record type.
+
2017-04-28 Javier Miranda <miranda@adacore.com>
* atree.ads (Info_Messages): Removed.
------------------------------
procedure Insert_Post_Call_Actions (N : Node_Id; Post_Call : List_Id) is
+ Context : constant Node_Id := Parent (N);
+
begin
if Is_Empty_List (Post_Call) then
return;
-- call or indexing, i.e. an expression context as well.
if not Is_List_Member (N)
- or else Nkind_In (Parent (N), N_Function_Call, N_Indexed_Component)
+ or else Nkind_In (Context, N_Function_Call, N_Indexed_Component)
then
-- In Ada 2012 the call may be a function call in an expression
-- (since OUT and IN OUT parameters are now allowed for such calls).
-- corresponding statement list.
else
- declare
- P : Node_Id;
-
- begin
- P := Parent (N);
- pragma Assert (Nkind_In (P, N_Entry_Call_Alternative,
- N_Triggering_Alternative));
+ pragma Assert (Nkind_In (Context, N_Entry_Call_Alternative,
+ N_Triggering_Alternative));
- if Is_Non_Empty_List (Statements (P)) then
- Insert_List_Before_And_Analyze
- (First (Statements (P)), Post_Call);
- else
- Set_Statements (P, Post_Call);
- end if;
- end;
+ if Is_Non_Empty_List (Statements (Context)) then
+ Insert_List_Before_And_Analyze
+ (First (Statements (Context)), Post_Call);
+ else
+ Set_Statements (Context, Post_Call);
+ end if;
end if;
+ -- A procedure call is always part of a declarative or statement list,
+ -- however a function call may appear nested within a construct. Most
+ -- cases of function call nesting are handled in the special case above.
+ -- The only exception is when the function call acts as an actual in a
+ -- procedure call. In this case the function call is in a list, but the
+ -- post-call actions must be inserted after the procedure call.
+
+ elsif Nkind (Context) = N_Procedure_Call_Statement then
+ Insert_Actions_After (Context, Post_Call);
+
-- Otherwise, normal case where N is in a statement sequence, just put
-- the post-call stuff after the call statement.
Comp_Byte_Aligned : Boolean;
pragma Warnings (Off, Comp_Byte_Aligned);
- -- Set for the record case, True if Comp starts on a byte boundary
+ -- Set for the record case, True if Comp is aligned on byte boundaries
-- (in which case it is allowed to have different storage order).
Comp_SSO_Differs : Boolean;
else
-- If a component clause is present, check if the component starts
- -- on a storage element boundary. Otherwise conservatively assume
- -- it does so only in the case where the record is not packed.
+ -- and ends on byte boundaries. Otherwise conservatively assume it
+ -- does so only in the case where the record is not packed.
if Present (Component_Clause (Comp)) then
Comp_Byte_Aligned :=
- Normalized_First_Bit (Comp) mod System_Storage_Unit = 0;
+ (Normalized_First_Bit (Comp) mod System_Storage_Unit = 0)
+ and then
+ (Esize (Comp) mod System_Storage_Unit = 0);
else
Comp_Byte_Aligned := not Is_Packed (Encl_Type);
end if;
Actuals : List_Id;
begin
+ -- Obj may already have been rewritten if it involves an implicit
+ -- dereference (e.g. if it is an access to a limited view). Preserve
+ -- a link to the original node for ASIS use.
+
+ if not Comes_From_Source (Obj) then
+ Set_Original_Node (Dummy, Original_Node (Obj));
+ end if;
+
-- Common case covering 1) Call to a procedure and 2) Call to a
-- function that has some additional actuals.