annotate gcc/ada/contracts.ads @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- C O N T R A C T S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 2015-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This package contains routines that perform analysis and expansion of
kono
parents:
diff changeset
27 -- various contracts.
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 with Types; use Types;
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 package Contracts is
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 procedure Add_Contract_Item (Prag : Node_Id; Id : Entity_Id);
kono
parents:
diff changeset
34 -- Add pragma Prag to the contract of a constant, entry, entry family,
kono
parents:
diff changeset
35 -- [generic] package, package body, protected unit, [generic] subprogram,
kono
parents:
diff changeset
36 -- subprogram body, variable or task unit denoted by Id. The following are
kono
parents:
diff changeset
37 -- valid pragmas:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
38 --
111
kono
parents:
diff changeset
39 -- Abstract_State
kono
parents:
diff changeset
40 -- Async_Readers
kono
parents:
diff changeset
41 -- Async_Writers
kono
parents:
diff changeset
42 -- Attach_Handler
kono
parents:
diff changeset
43 -- Constant_After_Elaboration
kono
parents:
diff changeset
44 -- Contract_Cases
kono
parents:
diff changeset
45 -- Depends
kono
parents:
diff changeset
46 -- Effective_Reads
kono
parents:
diff changeset
47 -- Effective_Writes
kono
parents:
diff changeset
48 -- Extensions_Visible
kono
parents:
diff changeset
49 -- Global
kono
parents:
diff changeset
50 -- Initial_Condition
kono
parents:
diff changeset
51 -- Initializes
kono
parents:
diff changeset
52 -- Interrupt_Handler
kono
parents:
diff changeset
53 -- Part_Of
kono
parents:
diff changeset
54 -- Postcondition
kono
parents:
diff changeset
55 -- Precondition
kono
parents:
diff changeset
56 -- Refined_Depends
kono
parents:
diff changeset
57 -- Refined_Global
kono
parents:
diff changeset
58 -- Refined_Post
kono
parents:
diff changeset
59 -- Refined_States
kono
parents:
diff changeset
60 -- Test_Case
kono
parents:
diff changeset
61 -- Volatile_Function
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 procedure Analyze_Contracts (L : List_Id);
kono
parents:
diff changeset
64 -- Analyze the contracts of all eligible constructs found in list L
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 procedure Analyze_Entry_Or_Subprogram_Body_Contract (Body_Id : Entity_Id);
kono
parents:
diff changeset
67 -- Analyze all delayed pragmas chained on the contract of entry or
kono
parents:
diff changeset
68 -- subprogram body Body_Id as if they appeared at the end of a declarative
kono
parents:
diff changeset
69 -- region. Pragmas in question are:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
70 --
111
kono
parents:
diff changeset
71 -- Contract_Cases (stand alone subprogram body)
kono
parents:
diff changeset
72 -- Depends (stand alone subprogram body)
kono
parents:
diff changeset
73 -- Global (stand alone subprogram body)
kono
parents:
diff changeset
74 -- Postcondition (stand alone subprogram body)
kono
parents:
diff changeset
75 -- Precondition (stand alone subprogram body)
kono
parents:
diff changeset
76 -- Refined_Depends
kono
parents:
diff changeset
77 -- Refined_Global
kono
parents:
diff changeset
78 -- Refined_Post
kono
parents:
diff changeset
79 -- Test_Case (stand alone subprogram body)
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 procedure Analyze_Entry_Or_Subprogram_Contract
kono
parents:
diff changeset
82 (Subp_Id : Entity_Id;
kono
parents:
diff changeset
83 Freeze_Id : Entity_Id := Empty);
kono
parents:
diff changeset
84 -- Analyze all delayed pragmas chained on the contract of entry or
kono
parents:
diff changeset
85 -- subprogram Subp_Id as if they appeared at the end of a declarative
kono
parents:
diff changeset
86 -- region. The pragmas in question are:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
87 --
111
kono
parents:
diff changeset
88 -- Contract_Cases
kono
parents:
diff changeset
89 -- Depends
kono
parents:
diff changeset
90 -- Global
kono
parents:
diff changeset
91 -- Postcondition
kono
parents:
diff changeset
92 -- Precondition
kono
parents:
diff changeset
93 -- Test_Case
kono
parents:
diff changeset
94 --
kono
parents:
diff changeset
95 -- Freeze_Id is the entity of a [generic] package body or a [generic]
kono
parents:
diff changeset
96 -- subprogram body which "freezes" the contract of Subp_Id.
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 procedure Analyze_Object_Contract
kono
parents:
diff changeset
99 (Obj_Id : Entity_Id;
kono
parents:
diff changeset
100 Freeze_Id : Entity_Id := Empty);
kono
parents:
diff changeset
101 -- Analyze all delayed pragmas chained on the contract of object Obj_Id as
kono
parents:
diff changeset
102 -- if they appeared at the end of the declarative region. The pragmas to be
kono
parents:
diff changeset
103 -- considered are:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
104 --
111
kono
parents:
diff changeset
105 -- Async_Readers
kono
parents:
diff changeset
106 -- Async_Writers
kono
parents:
diff changeset
107 -- Depends (single concurrent object)
kono
parents:
diff changeset
108 -- Effective_Reads
kono
parents:
diff changeset
109 -- Effective_Writes
kono
parents:
diff changeset
110 -- Global (single concurrent object)
kono
parents:
diff changeset
111 -- Part_Of
kono
parents:
diff changeset
112 --
kono
parents:
diff changeset
113 -- Freeze_Id is the entity of a [generic] package body or a [generic]
kono
parents:
diff changeset
114 -- subprogram body which "freezes" the contract of Obj_Id.
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 procedure Analyze_Package_Body_Contract
kono
parents:
diff changeset
117 (Body_Id : Entity_Id;
kono
parents:
diff changeset
118 Freeze_Id : Entity_Id := Empty);
kono
parents:
diff changeset
119 -- Analyze all delayed pragmas chained on the contract of package body
kono
parents:
diff changeset
120 -- Body_Id as if they appeared at the end of a declarative region. The
kono
parents:
diff changeset
121 -- pragmas that are considered are:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
122 --
111
kono
parents:
diff changeset
123 -- Refined_State
kono
parents:
diff changeset
124 --
kono
parents:
diff changeset
125 -- Freeze_Id is the entity of a [generic] package body or a [generic]
kono
parents:
diff changeset
126 -- subprogram body which "freezes" the contract of Body_Id.
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 procedure Analyze_Package_Contract (Pack_Id : Entity_Id);
kono
parents:
diff changeset
129 -- Analyze all delayed pragmas chained on the contract of package Pack_Id
kono
parents:
diff changeset
130 -- as if they appeared at the end of a declarative region. The pragmas
kono
parents:
diff changeset
131 -- that are considered are:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
132 --
111
kono
parents:
diff changeset
133 -- Initial_Condition
kono
parents:
diff changeset
134 -- Initializes
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 procedure Analyze_Protected_Contract (Prot_Id : Entity_Id);
kono
parents:
diff changeset
137 -- Analyze all delayed pragmas chained on the contract of protected unit
kono
parents:
diff changeset
138 -- Prot_Id if they appeared at the end of a declarative region. Currently
kono
parents:
diff changeset
139 -- there are no such pragmas.
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 procedure Analyze_Subprogram_Body_Stub_Contract (Stub_Id : Entity_Id);
kono
parents:
diff changeset
142 -- Analyze all delayed pragmas chained on the contract of subprogram body
kono
parents:
diff changeset
143 -- stub Stub_Id as if they appeared at the end of a declarative region. The
kono
parents:
diff changeset
144 -- pragmas in question are:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
145 --
111
kono
parents:
diff changeset
146 -- Contract_Cases
kono
parents:
diff changeset
147 -- Depends
kono
parents:
diff changeset
148 -- Global
kono
parents:
diff changeset
149 -- Postcondition
kono
parents:
diff changeset
150 -- Precondition
kono
parents:
diff changeset
151 -- Refined_Depends
kono
parents:
diff changeset
152 -- Refined_Global
kono
parents:
diff changeset
153 -- Refined_Post
kono
parents:
diff changeset
154 -- Test_Case
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 procedure Analyze_Task_Contract (Task_Id : Entity_Id);
kono
parents:
diff changeset
157 -- Analyze all delayed pragmas chained on the contract of task unit Task_Id
kono
parents:
diff changeset
158 -- as if they appeared at the end of a declarative region. The pragmas in
kono
parents:
diff changeset
159 -- question are:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
160 --
111
kono
parents:
diff changeset
161 -- Depends
kono
parents:
diff changeset
162 -- Global
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 procedure Create_Generic_Contract (Unit : Node_Id);
kono
parents:
diff changeset
165 -- Create a contract node for a generic package, generic subprogram, or a
kono
parents:
diff changeset
166 -- generic body denoted by Unit by collecting all source contract-related
kono
parents:
diff changeset
167 -- pragmas in the contract of the unit.
kono
parents:
diff changeset
168
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
169 procedure Freeze_Previous_Contracts (Body_Decl : Node_Id);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
170 -- Freeze the contracts of all source constructs found in the declarative
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
171 -- list which contains entry, package, protected, subprogram, or task body
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
172 -- denoted by Body_Decl. In addition, freeze the contract of the nearest
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
173 -- enclosing package body.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
174
111
kono
parents:
diff changeset
175 procedure Inherit_Subprogram_Contract
kono
parents:
diff changeset
176 (Subp : Entity_Id;
kono
parents:
diff changeset
177 From_Subp : Entity_Id);
kono
parents:
diff changeset
178 -- Inherit relevant contract items from source subprogram From_Subp. Subp
kono
parents:
diff changeset
179 -- denotes the destination subprogram. The inherited items are:
kono
parents:
diff changeset
180 -- Extensions_Visible
kono
parents:
diff changeset
181 -- ??? it would be nice if this routine handles Pre'Class and Post'Class
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 procedure Instantiate_Subprogram_Contract (Templ : Node_Id; L : List_Id);
kono
parents:
diff changeset
184 -- Instantiate all source pragmas found in the contract of the generic
kono
parents:
diff changeset
185 -- subprogram declaration template denoted by Templ. The instantiated
kono
parents:
diff changeset
186 -- pragmas are added to list L.
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 procedure Save_Global_References_In_Contract
kono
parents:
diff changeset
189 (Templ : Node_Id;
kono
parents:
diff changeset
190 Gen_Id : Entity_Id);
kono
parents:
diff changeset
191 -- Save all global references found within the aspect specifications and
kono
parents:
diff changeset
192 -- the contract-related source pragmas assocated with generic template
kono
parents:
diff changeset
193 -- Templ. Gen_Id denotes the entity of the analyzed generic copy.
kono
parents:
diff changeset
194
kono
parents:
diff changeset
195 end Contracts;