+2015-10-26 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * einfo.adb (First_Component): Update the assertion to allow
+ for concurrent types.
+ (First_Component_Or_Discriminant): Update the assertion to allow for
+ concurrent types.
+ * einfo.ads: Update the documentation of attributes First_Component
+ and First_Component_Or_Discriminant along with uses in entities.
+
+2015-10-26 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_res.adb (Resolve_Actuals): An effectively
+ volatile object may act as an actual when the corresponding
+ formal is of a non-scalar effectively volatile type, not just
+ a non-scalar volatile type.
+
+2015-10-26 Bob Duff <duff@adacore.com>
+
+ * sinfo.ads, sem_util.ads: Update comments.
+
+2015-10-26 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_prag.adb (Analyze_Refined_Depends_Global_Post): When dealing with
+ protected entries or protected subprograms, use the enclosing protected
+ type to ensure that the protected type declaration is declared
+ in a package spec. Remove an obsolete attempt to ensure the
+ aggregate for of pragma Refined_State as this routine is never
+ called in that case.
+
+2015-10-26 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): For
+ an element iterator loop, the element is a constant if the
+ container object is a constant, even if the container type has
+ a Variable_Indexing aspect.
+
2015-10-26 Bob Duff <duff@adacore.com>
* s-fileio.adb (Fopen_Mode): Use "r+" for Out_File/Stream_IO,
begin
pragma Assert
- (Is_Record_Type (Id) or else Is_Incomplete_Or_Private_Type (Id));
+ (Is_Concurrent_Type (Id)
+ or else Is_Incomplete_Or_Private_Type (Id)
+ or else Is_Record_Type (Id));
Comp_Id := First_Entity (Id);
while Present (Comp_Id) loop
begin
pragma Assert
- (Is_Record_Type (Id)
+ (Is_Concurrent_Type (Id)
or else Is_Incomplete_Or_Private_Type (Id)
+ or else Is_Record_Type (Id)
or else Has_Discriminants (Id));
Comp_Id := First_Entity (Id);
-- objects.
-- First_Component (synthesized)
--- Applies to record types. Returns the first component by following the
--- chain of declared entities for the record until a component is found
--- (one with an Ekind of E_Component). The discriminants are skipped. If
--- the record is null, then Empty is returned.
+-- Applies to incomplete, private, protected, record and task types.
+-- Returns the first component by following the chain of declared
+-- entities for the type a component is found (one with an Ekind of
+-- E_Component). The discriminants are skipped. If the record is null,
+-- then Empty is returned.
-- First_Component_Or_Discriminant (synthesized)
--- Similar to First_Component, but discriminants are not skipped, so will
--- find the first discriminant if discriminants are present.
+-- Similar to First_Component, but discriminants are not skipped, so will
+-- find the first discriminant if discriminants are present.
-- First_Entity (Node17)
-- Defined in all entities which act as scopes to which a list of
-- SPARK_Pragma_Inherited (Flag265)
-- Uses_Lock_Free (Flag188)
-- Uses_Sec_Stack (Flag95) ???
+ -- First_Component (synth)
+ -- First_Component_Or_Discriminant (synth)
-- Has_Entries (synth)
-- Has_Interrupt_Handler (synth)
-- Number_Entries (synth)
-- SPARK_Aux_Pragma_Inherited (Flag266)
-- SPARK_Pragma_Inherited (Flag265)
-- Uses_Sec_Stack (Flag95) ???
+ -- First_Component (synth)
+ -- First_Component_Or_Discriminant (synth)
-- Has_Entries (synth)
-- Number_Entries (synth)
-- (plus type attributes)
Set_Debug_Info_Needed (Id);
-- If the container does not have a variable indexing aspect,
- -- the element is a constant in the loop.
+ -- the element is a constant in the loop. The container itself
+ -- may be constant, in which case the element is a constant as
+ -- well. The container has been rewritten as a call to Iterate,
+ -- so examine original node.
if No (Find_Value_Of_Aspect
(Container_Typ, Aspect_Variable_Indexing))
+ or else not Is_Variable (Original_Node (Container))
then
Set_Ekind (Id, E_Constant);
end if;
return;
end if;
- -- The pragma can only apply to the body [stub] of a subprogram
+ -- A refined pragma can only apply to the body [stub] of a subprogram
-- declared in the visible part of a package. Retrieve the context of
-- the subprogram declaration.
Spec_Decl := Unit_Declaration_Node (Spec_Id);
- -- The proper context of a entry declaration is the declaration of
- -- the enclosing synchronized type.
+ -- When dealing with protected entries or protected subprograms, use
+ -- the enclosing protected type as the proper context.
- if Nkind (Spec_Decl) = N_Entry_Declaration then
- Spec_Decl := Parent (Parent (Spec_Decl));
+ if Ekind_In (Spec_Id, E_Entry,
+ E_Entry_Family,
+ E_Function,
+ E_Procedure)
+ and then Ekind (Scope (Spec_Id)) = E_Protected_Type
+ then
+ Spec_Decl := Declaration_Node (Scope (Spec_Id));
end if;
if Nkind (Parent (Spec_Decl)) /= N_Package_Specification then
Mark_Pragma_As_Ghost (N, Spec_Id);
- if Nam_In (Pname, Name_Refined_Depends,
- Name_Refined_Global,
- Name_Refined_State)
- then
+ if Nam_In (Pname, Name_Refined_Depends, Name_Refined_Global) then
Ensure_Aggregate_Form (Get_Argument (N, Spec_Id));
end if;
end Analyze_Refined_Depends_Global_Post;
and then Is_Effectively_Volatile_Object (A)
then
-- An effectively volatile object may act as an actual when the
- -- corresponding formal is of a non-scalar volatile type
- -- (SPARK RM 7.1.3(12)).
+ -- corresponding formal is of a non-scalar effectively volatile
+ -- type (SPARK RM 7.1.3(12)).
- if Is_Volatile (Etype (F))
- and then not Is_Scalar_Type (Etype (F))
+ if not Is_Scalar_Type (Etype (F))
+ and then Is_Effectively_Volatile (Etype (F))
then
null;
-- alternatives, and the warnings that may apply to them, are removed.
function First_Actual (Node : Node_Id) return Node_Id;
- -- Node is an N_Function_Call or N_Procedure_Call_Statement node. The
- -- result returned is the first actual parameter in declaration order
- -- (not the order of parameters as they appeared in the source, which
- -- can be quite different as a result of the use of named parameters).
- -- Empty is returned for a call with no parameters. The procedure for
- -- iterating through the actuals in declaration order is to use this
- -- function to find the first actual, and then use Next_Actual to obtain
- -- the next actual in declaration order. Note that the value returned
- -- is always the expression (not the N_Parameter_Association nodes,
- -- even if named association is used).
+ -- Node is an N_Function_Call, N_Procedure_Call_Statement or
+ -- N_Entry_Call_Statement node. The result returned is the first actual
+ -- parameter in declaration order (not the order of parameters as they
+ -- appeared in the source, which can be quite different as a result of the
+ -- use of named parameters). Empty is returned for a call with no
+ -- parameters. The procedure for iterating through the actuals in
+ -- declaration order is to use this function to find the first actual, and
+ -- then use Next_Actual to obtain the next actual in declaration order.
+ -- Note that the value returned is always the expression (not the
+ -- N_Parameter_Association nodes, even if named association is used).
procedure Gather_Components
(Typ : Entity_Id;
-- node. See description of this node in the section on semantic nodes.
-- N_Selected_Component
- -- Sloc points to period
+ -- Sloc points to the period
-- Prefix (Node3)
-- Selector_Name (Node2)
-- Associated_Node (Node4-Sem)