+2014-11-07 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * einfo.adb (Set_Is_Checked_Ghost_Entity,
+ Set_Is_Ignored_Ghost_Entity): Add exceptions to the assertion
+ check.
+ * sem_ch6.adb (Check_Conformance): Consider only
+ source subprograms when checking for Ghost conformance.
+ * sem_prag.adb (Analyze_Pragma): Handle the case
+ where pragma Ghost applies to a stand alone subprogram body that
+ acts as a compilation unit.
+ * sem_res.adb: Minor reformatting (merge if statements).
+
+2014-11-07 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_strm.adb (Build_Record_Or_Elementary_Input_Function):
+ Check whether underlying type is constrained before generating
+ the object declaration for the result object of the function.
+
2014-11-07 Robert Dewar <dewar@adacore.com>
* freeze.adb: Code clean up.
or else Ekind (Id) = E_Abstract_State
or else Ekind (Id) = E_Component
or else Ekind (Id) = E_Discriminant
+ or else Ekind (Id) = E_Exception
or else Ekind (Id) = E_Package_Body
or else Ekind (Id) = E_Subprogram_Body);
Set_Flag277 (Id, V);
or else Ekind (Id) = E_Abstract_State
or else Ekind (Id) = E_Component
or else Ekind (Id) = E_Discriminant
+ or else Ekind (Id) = E_Exception
or else Ekind (Id) = E_Package_Body
or else Ekind (Id) = E_Subprogram_Body);
Set_Flag278 (Id, V);
J := 1;
+ -- In the presence of multiple instantiations (as in uses of the Booch
+ -- components) the base type may be private, and the underlying type
+ -- already constrained, in which case there's no discriminant constraint
+ -- to construct.
+
if Has_Discriminants (Typ)
and then
No (Discriminant_Default_Value (First_Discriminant (Typ)))
+ and then not Is_Constrained (Underlying_Type (B_Typ))
then
Discr := First_Discriminant (B_Typ);
return;
-- Pragma Ghost behaves as a convention in the context of subtype
- -- conformance (SPARK RM 6.9(5)).
+ -- conformance (SPARK RM 6.9(5)). Do not check internally generated
+ -- subprograms as their spec may reside in a Ghost region and their
+ -- body not, or vice versa.
- elsif Is_Ghost_Entity (Old_Id) /= Is_Ghost_Entity (New_Id) then
+ elsif Comes_From_Source (Old_Id)
+ and then Comes_From_Source (New_Id)
+ and then Is_Ghost_Entity (Old_Id) /= Is_Ghost_Entity (New_Id)
+ then
Conformance_Error ("\ghost modes do not match!");
return;
end if;
-- pragma Ghost [ (boolean_EXPRESSION) ];
when Pragma_Ghost => Ghost : declare
- Context : constant Node_Id := Parent (N);
+ Context : Node_Id;
Expr : Node_Id;
Id : Entity_Id;
Orig_Stmt : Node_Id;
Check_No_Identifiers;
Check_At_Most_N_Arguments (1);
+ Context := Parent (N);
+
+ -- Handle compilation units
+
+ if Nkind (Context) = N_Compilation_Unit_Aux then
+ Context := Unit (Parent (Context));
+ end if;
+
Id := Empty;
Stmt := Prev (N);
while Present (Stmt) loop
end if;
-- The following checks are only relevant when SPARK_Mode is on as they
- -- are not standard Ada legality rules.
+ -- are not standard Ada legality rules. An effectively volatile object
+ -- subject to enabled properties Async_Writers or Effective_Reads must
+ -- appear in a specific context.
- if SPARK_Mode = On then
-
- -- An effectively volatile object subject to enabled properties
- -- Async_Writers or Effective_Reads must appear in a specific
- -- context.
-
- if Is_Object (E)
- and then Is_Effectively_Volatile (E)
- and then
- (Async_Writers_Enabled (E) or else Effective_Reads_Enabled (E))
- and then Comes_From_Source (N)
- then
- -- The effectively volatile objects appears in a "non-interfering
- -- context" as defined in SPARK RM 7.1.3(13).
+ if SPARK_Mode = On
+ and then Is_Object (E)
+ and then Is_Effectively_Volatile (E)
+ and then
+ (Async_Writers_Enabled (E) or else Effective_Reads_Enabled (E))
+ and then Comes_From_Source (N)
+ then
+ -- The effectively volatile objects appears in a "non-interfering
+ -- context" as defined in SPARK RM 7.1.3(13).
- if Is_OK_Volatile_Context (Par, N) then
- null;
+ if Is_OK_Volatile_Context (Par, N) then
+ null;
- -- Assume that references to effectively volatile objects that
- -- appear as actual parameters in a procedure call are always
- -- legal. A full legality check is done when the actuals are
- -- resolved.
+ -- Assume that references to effectively volatile objects that appear
+ -- as actual parameters in a procedure call are always legal. A full
+ -- legality check is done when the actuals are resolved.
- elsif Nkind (Par) = N_Procedure_Call_Statement then
- null;
+ elsif Nkind (Par) = N_Procedure_Call_Statement then
+ null;
- -- Otherwise the context causes a side effect with respect to the
- -- effectively volatile object.
+ -- Otherwise the context causes a side effect with respect to the
+ -- effectively volatile object.
- else
- SPARK_Msg_N
- ("volatile object cannot appear in this context "
- & "(SPARK RM 7.1.3(13))", N);
- end if;
+ else
+ SPARK_Msg_N
+ ("volatile object cannot appear in this context "
+ & "(SPARK RM 7.1.3(13))", N);
end if;
end if;