summaryrefslogtreecommitdiff
path: root/gcc/ada/einfo.ads
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2011-08-04 13:35:20 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-04 15:35:20 +0200
commitdac3bede918b07ddb13d2efae1fbda9f4d81468f (patch)
tree3271b6f6746528c923b82c8e00d9fe866622065a /gcc/ada/einfo.ads
parent6a2e5d0f3d52360a6a0f036a19cedffbd4b8bd42 (diff)
downloadgcc-dac3bede918b07ddb13d2efae1fbda9f4d81468f.tar.gz
gnat_rm.texi: Document new pragma and aspect.
2011-08-04 Yannick Moy <moy@adacore.com> * gnat_rm.texi: Document new pragma and aspect. * aspects.adb, aspects.ads (Aspect_Id): new value Aspect_Test_Case (No_Duplicates_Allowed): new constant array defining whether duplicates aspects of each kind can appear on the same declaration. * einfo.adb, einfo.ads (Spec_PPC_List): replace field with Contract field, which points to a node holding the previous Spec_PPC_List. * exp_ch9.adb, sem_ch6.adb, sem_prag.adb: Reach to Spec_PPC_List through the indirection with Contract. * exp_util.adb (Insert_Actions): raise Program_Error on N_Contract node * par-prag.adb (Prag): do nothing on Test_Case pragma * sem.adb (Analyze): abort on N_Contract, on which Analyze should not be called directly. * sem_attr.adb (Analyze_Attribute): allow attribute 'Result in component Ensures of Test_Case. * sem_ch12.adb, sem_ch6.adb, sem_ch9.adb (Analyze_Generic_Subprogram_Declaration, Analyze_Subprogram_Instantiation, Analyze_Abstract_Subprogram_Declaration, Analyze_Subprogram_Body_Helper, Analyze_Subprogram_Specification, Analyze_Entry_Declaration): insert contract in subprogram node at point of definition * sem_ch13.adb (Aspect_Loop): do not raise error on duplicate Test_Case aspect (Analyze_Aspect_Specifications): analyze Test_Case aspect and create corresponding pragma (Check_Aspect_At_Freeze_Point): raise Program_Error on Test_Case aspect * sem_ch3.adb (Analyze_Declarations): insert analysis of test-cases, similar to the analysis of pre/post (Derive_Subprogram): insert contract in subprogram node at point of derivation. * sem_prag.adb, sem_prag.ads (Check_Arg_Is_String_Literal, Check_Identifier): new checking procedures to be called in treatment of pragmas (Check_Test_Case): new procedure to check that a Test_Case aspect or pragma is well-formed. This does not check currently that 'Result is used only in the Ensures component of a Test_Case. (Analyze_Pragma): add case for Test_Case (Analyze_TC_In_Decl_Part): pre-analyze the Requires and Ensures components of a Test_Case. (Preanalyze_TC_Args): new procedure to preanalyze the boolean expressions in the 3rd (and 4th if present) arguments of a Test_Case pragma, treated as spec expressions. (Sig_Flags): add value -1 for Test_Case. * sem_util.adb, sem_util.ads (Get_Ensures_From_Test_Case_Pragma, Get_Requires_From_Test_Case_Pragma): getters for both expression components of a Test_Case. * sinfo.adb, sinfo.ads (N_Contract): new kind of node used as indirection between an entry or [generic] subprogram entity and its pre/post + test-cases. (Spec_PPC_List, Spec_TC_List, Set_Spec_PPC_List, Set_Spec_TC_List): get/set for fields of an N_Contract node. * snames.ads-tmpl (Name_Test_Case, Name_Ensures, Name_Mode, Name_Normal, Name_Requires, Name_Robustness, Pragma_Test_Case): new names and pragma for Test_Case. * sprint.adb (Sprint_Node): raise Program_Error on N_Contract node From-SVN: r177384
Diffstat (limited to 'gcc/ada/einfo.ads')
-rw-r--r--gcc/ada/einfo.ads27
1 files changed, 12 insertions, 15 deletions
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 3fb2e41b93b..29baab0b43e 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -1009,6 +1009,11 @@ package Einfo is
-- accept statement for a member of the family, and in the prefix of
-- 'COUNT when it applies to a family member.
+-- Contract (Node24)
+-- Present in entries, and in subprogram and generic subprogram entities.
+-- Points to the contract of the entity, holding both pre- and
+-- postconditions as well as test-cases.
+
-- Entry_Parameters_Type (Node15)
-- Present in entries. Points to the access-to-record type that is
-- constructed by the expander to hold a reference to the parameter
@@ -3641,14 +3646,6 @@ package Einfo is
-- case where there is a separate spec, where this field references
-- the corresponding parameter entities in the spec.
--- Spec_PPC_List (Node24)
--- Present in entries, and in subprogram and generic subprogram entities.
--- Points to a list of Precondition and Postcondition pragma nodes for
--- preconditions and postconditions declared in the spec. The last pragma
--- encountered is at the head of this list, so it is in reverse order of
--- textual appearance. Note that this includes precondition/postcondition
--- pragmas generated to correspond to Pre/Post aspects.
-
-- Static_Predicate (List25)
-- Present in discrete types/subtypes with predicates (Has_Predicates
-- set True). Points to a list of expression and N_Range nodes that
@@ -5126,7 +5123,7 @@ package Einfo is
-- Accept_Address (Elist21)
-- Scope_Depth_Value (Uint22)
-- Protection_Object (Node23) (protected kind)
- -- Spec_PPC_List (Node24) (for entry only)
+ -- Contract (Node24) (for entry only)
-- PPC_Wrapper (Node25)
-- Default_Expressions_Processed (Flag108)
-- Entry_Accepted (Flag152)
@@ -5226,7 +5223,7 @@ package Einfo is
-- Generic_Renamings (Elist23) (for an instance)
-- Inner_Instances (Elist23) (generic case only)
-- Protection_Object (Node23) (for concurrent kind)
- -- Spec_PPC_List (Node24)
+ -- Contract (Node24)
-- Interface_Alias (Node25)
-- Overridden_Operation (Node26)
-- Wrapped_Entity (Node27) (non-generic case only)
@@ -5490,7 +5487,7 @@ package Einfo is
-- Generic_Renamings (Elist23) (for an instance)
-- Inner_Instances (Elist23) (generic case only)
-- Protection_Object (Node23) (for concurrent kind)
- -- Spec_PPC_List (Node24)
+ -- Contract (Node24)
-- Interface_Alias (Node25)
-- Static_Initialization (Node26) (init_proc only)
-- Overridden_Operation (Node26) (never for init proc)
@@ -6039,6 +6036,7 @@ package Einfo is
function Entry_Formal (Id : E) return E;
function Entry_Index_Constant (Id : E) return E;
function Entry_Index_Type (Id : E) return E;
+ function Contract (Id : E) return N;
function Entry_Parameters_Type (Id : E) return E;
function Enum_Pos_To_Rep (Id : E) return E;
function Enumeration_Pos (Id : E) return U;
@@ -6333,7 +6331,6 @@ package Einfo is
function Size_Depends_On_Discriminant (Id : E) return B;
function Small_Value (Id : E) return R;
function Spec_Entity (Id : E) return E;
- function Spec_PPC_List (Id : E) return N;
function Static_Predicate (Id : E) return S;
function Storage_Size_Variable (Id : E) return E;
function Static_Elaboration_Desired (Id : E) return B;
@@ -6626,6 +6623,7 @@ package Einfo is
procedure Set_Entry_Component (Id : E; V : E);
procedure Set_Entry_Formal (Id : E; V : E);
procedure Set_Entry_Index_Constant (Id : E; V : E);
+ procedure Set_Contract (Id : E; V : N);
procedure Set_Entry_Parameters_Type (Id : E; V : E);
procedure Set_Enum_Pos_To_Rep (Id : E; V : E);
procedure Set_Enumeration_Pos (Id : E; V : U);
@@ -6926,7 +6924,6 @@ package Einfo is
procedure Set_Size_Known_At_Compile_Time (Id : E; V : B := True);
procedure Set_Small_Value (Id : E; V : R);
procedure Set_Spec_Entity (Id : E; V : E);
- procedure Set_Spec_PPC_List (Id : E; V : N);
procedure Set_Static_Predicate (Id : E; V : S);
procedure Set_Storage_Size_Variable (Id : E; V : E);
procedure Set_Static_Elaboration_Desired (Id : E; V : B);
@@ -7280,6 +7277,7 @@ package Einfo is
pragma Inline (Component_Clause);
pragma Inline (Component_Size);
pragma Inline (Component_Type);
+ pragma Inline (Contract);
pragma Inline (Corresponding_Concurrent_Type);
pragma Inline (Corresponding_Discriminant);
pragma Inline (Corresponding_Equality);
@@ -7664,7 +7662,6 @@ package Einfo is
pragma Inline (Size_Known_At_Compile_Time);
pragma Inline (Small_Value);
pragma Inline (Spec_Entity);
- pragma Inline (Spec_PPC_List);
pragma Inline (Static_Predicate);
pragma Inline (Storage_Size_Variable);
pragma Inline (Static_Elaboration_Desired);
@@ -7724,6 +7721,7 @@ package Einfo is
pragma Inline (Set_Component_Clause);
pragma Inline (Set_Component_Size);
pragma Inline (Set_Component_Type);
+ pragma Inline (Set_Contract);
pragma Inline (Set_Corresponding_Concurrent_Type);
pragma Inline (Set_Corresponding_Discriminant);
pragma Inline (Set_Corresponding_Equality);
@@ -8063,7 +8061,6 @@ package Einfo is
pragma Inline (Set_Size_Known_At_Compile_Time);
pragma Inline (Set_Small_Value);
pragma Inline (Set_Spec_Entity);
- pragma Inline (Set_Spec_PPC_List);
pragma Inline (Set_Static_Predicate);
pragma Inline (Set_Storage_Size_Variable);
pragma Inline (Set_Static_Elaboration_Desired);