+2014-11-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Make_Call_Into_Operator): In ASIS mode, propagate
+ back the resolved operands to the original call node, taking
+ into account that the original call may have named associations.
+
+2014-11-20 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * inline.adb (Has_Some_Contract): Change the
+ guard to test the Ekind of the entity rather than the Analyzed
+ flag. This handles partially analyzed contexts.
+
+2014-11-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Object_Renaming): In Ada 83 mode, do
+ not reject the renaming of a function result if the renaming
+ does not come for source.
+
+2014-11-20 Robert Dewar <dewar@adacore.com>
+
+ * exp_util.ads: Minor addition of ??? clause.
+
+2014-11-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Is_Variable): For an Ada 2012 implicit
+ dereference introduced for an indexing opertion, check that the
+ type of the corresponding access discriminant is not an access
+ to constant.
+
+2014-11-20 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_ch6.adb (Find_Corresponding_Spec): Inherit
+ the ghostness of the matching spec, the same way convention
+ is inherited.
+
2014-11-20 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch3.adb (Analyze_Object_Declaration): Swap a couple of
-- Note: this function can be costly and must be invoked with special care.
-- Possibly we could introduce a flag at parse time indicating the presence
-- of an address clause to speed this up???
+ --
+ -- Note: currently this function does not scan the private part, that seems
+ -- like a potential bug ???
procedure Force_Evaluation
(Exp : Node_Id;
begin
-- A call to an expression function may precede the actual body which
-- is inserted at the end of the enclosing declarations. Ensure that
- -- the related entity is analyzed before inspecting the contract.
+ -- the related entity is decorated before inspecting the contract.
- if Analyzed (Id) then
+ if Is_Subprogram_Or_Generic_Subprogram (Id) then
Items := Contract (Id);
return Present (Items)
-- spec to match a body, full conformance is expected.
if In_Instance then
+
+ -- Inherit the convention and "ghostness" of the matching
+ -- spec to ensure proper full and subtype conformance.
+
Set_Convention (Designator, Convention (E));
+ if Is_Ghost_Entity (E) then
+ Set_Is_Ghost_Entity (Designator);
+ end if;
+
-- Skip past subprogram bodies and subprogram renamings that
-- may appear to have a matching spec, but that aren't fully
-- conformant with it. That can occur in cases where an
if Nkind (Nam) = N_Function_Call then
case Ada_Version is
- -- Usage is illegal in Ada 83
+ -- Usage is illegal in Ada 83, but renamings are also introduced
+ -- during expansion, and error does not apply to those.
when Ada_83 =>
- if Comes_From_Source (Nam) then
+ if Comes_From_Source (N) then
Error_Msg_N
("(Ada 83) cannot rename function return object", Nam);
end if;
and then Nkind (N) in N_Op
and then Nkind (Original_Node (N)) = N_Function_Call
then
- if Is_Binary then
- Rewrite (First (Parameter_Associations (Original_Node (N))),
- Relocate_Node (Left_Opnd (N)));
- Rewrite (Next (First (Parameter_Associations (Original_Node (N)))),
- Relocate_Node (Right_Opnd (N)));
- else
- Rewrite (First (Parameter_Associations (Original_Node (N))),
- Relocate_Node (Right_Opnd (N)));
- end if;
+ declare
+ L : constant Node_Id := Left_Opnd (N);
+ R : constant Node_Id := Right_Opnd (N);
+
+ Old_First : constant Node_Id :=
+ First (Parameter_Associations (Original_Node (N)));
+ Old_Sec : Node_Id;
+
+ begin
+ if Is_Binary then
+ Old_Sec := Next (Old_First);
+
+ -- If the original call has named associations, replace the
+ -- explicit actual parameter in the association with the proper
+ -- resolved operand.
+
+ if Nkind (Old_First) = N_Parameter_Association then
+ if Chars (Selector_Name (Old_First)) =
+ Chars (First_Entity (Op_Id))
+ then
+ Rewrite (Explicit_Actual_Parameter (Old_First),
+ Relocate_Node (L));
+ else
+ Rewrite (Explicit_Actual_Parameter (Old_First),
+ Relocate_Node (R));
+ end if;
+
+ else
+ Rewrite (Old_First, Relocate_Node (L));
+ end if;
+
+ if Nkind (Old_Sec) = N_Parameter_Association then
+ if Chars (Selector_Name (Old_Sec)) =
+ Chars (First_Entity (Op_Id))
+ then
+ Rewrite (Explicit_Actual_Parameter (Old_Sec),
+ Relocate_Node (L));
+ else
+ Rewrite (Explicit_Actual_Parameter (Old_Sec),
+ Relocate_Node (R));
+ end if;
+
+ else
+ Rewrite (Old_Sec, Relocate_Node (R));
+ end if;
+
+ else
+ if Nkind (Old_First) = N_Parameter_Association then
+ Rewrite (Explicit_Actual_Parameter (Old_First),
+ Relocate_Node (R));
+ else
+ Rewrite (Old_First, Relocate_Node (R));
+ end if;
+ end if;
+ end;
Set_Parent (Original_Node (N), Parent (N));
end if;
Is_Variable_Prefix (Original_Node (Prefix (N)));
-- in Ada 2012, the dereference may have been added for a type with
- -- a declared implicit dereference aspect.
+ -- a declared implicit dereference aspect. Check that it is not an
+ -- access to constant.
elsif Nkind (N) = N_Explicit_Dereference
and then Present (Etype (Orig_Node))
and then Ada_Version >= Ada_2012
and then Has_Implicit_Dereference (Etype (Orig_Node))
+ and then not Is_Access_Constant (Etype (Prefix (N)))
then
return True;