aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/contracts.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/contracts.adb')
-rw-r--r--gcc/ada/contracts.adb22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index 8b94a67..810458a 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -110,8 +110,8 @@ package body Contracts is
-- Expand the contracts of a subprogram body and its correspoding spec (if
-- any). This routine processes all [refined] pre- and postconditions as
-- well as Always_Terminates, Contract_Cases, Exceptional_Cases,
- -- Subprogram_Variant, invariants and predicates. Body_Id denotes the
- -- entity of the subprogram body.
+ -- Program_Exit, Subprogram_Variant, invariants and predicates. Body_Id
+ -- denotes the entity of the subprogram body.
procedure Preanalyze_Condition
(Subp : Entity_Id;
@@ -235,6 +235,7 @@ package body Contracts is
-- Interrupt_Handler
-- Postcondition
-- Precondition
+ -- Program_Exit
-- Side_Effects
-- Subprogram_Variant
-- Test_Case
@@ -267,6 +268,7 @@ package body Contracts is
| Name_Contract_Cases
| Name_Exceptional_Cases
| Name_Exit_Cases
+ | Name_Program_Exit
| Name_Subprogram_Variant
| Name_Test_Case
then
@@ -647,9 +649,9 @@ package body Contracts is
end if;
-- Deal with preconditions, [refined] postconditions, Always_Terminates,
- -- Contract_Cases, Exceptional_Cases, Subprogram_Variant, invariants and
- -- predicates associated with body and its spec. Do not expand the
- -- contract of subprogram body stubs.
+ -- Contract_Cases, Exceptional_Cases, Program_Exit, Subprogram_Variant,
+ -- invariants and predicates associated with body and its spec. Do not
+ -- expand the contract of subprogram body stubs.
if Nkind (Body_Decl) = N_Subprogram_Body then
Expand_Subprogram_Contract (Body_Id);
@@ -797,6 +799,9 @@ package body Contracts is
elsif Prag_Nam = Name_Exceptional_Cases then
Analyze_Exceptional_Cases_In_Decl_Part (Prag);
+ elsif Prag_Nam = Name_Program_Exit then
+ Analyze_Program_Exit_In_Decl_Part (Prag);
+
elsif Prag_Nam = Name_Subprogram_Variant then
Analyze_Subprogram_Variant_In_Decl_Part (Prag);
@@ -1413,6 +1418,7 @@ package body Contracts is
-- Global
-- Postcondition
-- Precondition
+ -- Program_Exit
-- Subprogram_Variant
-- Test_Case
@@ -2422,6 +2428,7 @@ package body Contracts is
-- verify the return value.
Result := Make_Defining_Identifier (Loc, Name_uResult);
+ Mutate_Ekind (Result, E_Constant);
Set_Etype (Result, Typ);
-- Add an invariant check when the return type has invariants and
@@ -2761,6 +2768,9 @@ package body Contracts is
elsif Pragma_Name (Prag) = Name_Exit_Cases then
Expand_Pragma_Exit_Cases (Prag);
+ elsif Pragma_Name (Prag) = Name_Program_Exit then
+ Expand_Pragma_Program_Exit (Prag);
+
elsif Pragma_Name (Prag) = Name_Subprogram_Variant then
Expand_Pragma_Subprogram_Variant
(Prag => Prag,
@@ -4909,7 +4919,7 @@ package body Contracts is
Install_Formals (Subp);
Inside_Class_Condition_Preanalysis := True;
- Preanalyze_Spec_Expression (Expr, Standard_Boolean);
+ Preanalyze_And_Resolve_Spec_Expression (Expr, Standard_Boolean);
Inside_Class_Condition_Preanalysis := False;
End_Scope;