annotate gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 .. _Standard_and_Implementation_Defined_Restrictions:
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 ************************************************
kono
parents:
diff changeset
4 Standard and Implementation Defined Restrictions
kono
parents:
diff changeset
5 ************************************************
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 All Ada Reference Manual-defined Restriction identifiers are implemented:
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 * language-defined restrictions (see 13.12.1)
kono
parents:
diff changeset
10 * tasking restrictions (see D.7)
kono
parents:
diff changeset
11 * high integrity restrictions (see H.4)
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 GNAT implements additional restriction identifiers. All restrictions, whether
kono
parents:
diff changeset
14 language defined or GNAT-specific, are listed in the following.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 .. _Partition-Wide_Restrictions:
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 Partition-Wide Restrictions
kono
parents:
diff changeset
19 ===========================
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 There are two separate lists of restriction identifiers. The first
kono
parents:
diff changeset
22 set requires consistency throughout a partition (in other words, if the
kono
parents:
diff changeset
23 restriction identifier is used for any compilation unit in the partition,
kono
parents:
diff changeset
24 then all compilation units in the partition must obey the restriction).
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 Immediate_Reclamation
kono
parents:
diff changeset
27 ---------------------
kono
parents:
diff changeset
28 .. index:: Immediate_Reclamation
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 [RM H.4] This restriction ensures that, except for storage occupied by
kono
parents:
diff changeset
31 objects created by allocators and not deallocated via unchecked
kono
parents:
diff changeset
32 deallocation, any storage reserved at run time for an object is
kono
parents:
diff changeset
33 immediately reclaimed when the object no longer exists.
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 Max_Asynchronous_Select_Nesting
kono
parents:
diff changeset
36 -------------------------------
kono
parents:
diff changeset
37 .. index:: Max_Asynchronous_Select_Nesting
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
kono
parents:
diff changeset
40 selects. Violations of this restriction with a value of zero are
kono
parents:
diff changeset
41 detected at compile time. Violations of this restriction with values
kono
parents:
diff changeset
42 other than zero cause Storage_Error to be raised.
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 Max_Entry_Queue_Length
kono
parents:
diff changeset
45 ----------------------
kono
parents:
diff changeset
46 .. index:: Max_Entry_Queue_Length
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 [RM D.7] This restriction is a declaration that any protected entry compiled in
kono
parents:
diff changeset
49 the scope of the restriction has at most the specified number of
kono
parents:
diff changeset
50 tasks waiting on the entry at any one time, and so no queue is required.
kono
parents:
diff changeset
51 Note that this restriction is checked at run time. Violation of this
kono
parents:
diff changeset
52 restriction results in the raising of Program_Error exception at the point of
kono
parents:
diff changeset
53 the call.
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 .. index:: Max_Entry_Queue_Depth
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 The restriction ``Max_Entry_Queue_Depth`` is recognized as a
kono
parents:
diff changeset
58 synonym for ``Max_Entry_Queue_Length``. This is retained for historical
kono
parents:
diff changeset
59 compatibility purposes (and a warning will be generated for its use if
kono
parents:
diff changeset
60 warnings on obsolescent features are activated).
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 Max_Protected_Entries
kono
parents:
diff changeset
63 ---------------------
kono
parents:
diff changeset
64 .. index:: Max_Protected_Entries
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 [RM D.7] Specifies the maximum number of entries per protected type. The
kono
parents:
diff changeset
67 bounds of every entry family of a protected unit shall be static, or shall be
kono
parents:
diff changeset
68 defined by a discriminant of a subtype whose corresponding bound is static.
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 Max_Select_Alternatives
kono
parents:
diff changeset
71 -----------------------
kono
parents:
diff changeset
72 .. index:: Max_Select_Alternatives
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 Max_Storage_At_Blocking
kono
parents:
diff changeset
77 -----------------------
kono
parents:
diff changeset
78 .. index:: Max_Storage_At_Blocking
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
kono
parents:
diff changeset
81 Storage_Size that can be retained by a blocked task. A violation of this
kono
parents:
diff changeset
82 restriction causes Storage_Error to be raised.
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 Max_Task_Entries
kono
parents:
diff changeset
85 ----------------
kono
parents:
diff changeset
86 .. index:: Max_Task_Entries
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 [RM D.7] Specifies the maximum number of entries
kono
parents:
diff changeset
89 per task. The bounds of every entry family
kono
parents:
diff changeset
90 of a task unit shall be static, or shall be
kono
parents:
diff changeset
91 defined by a discriminant of a subtype whose
kono
parents:
diff changeset
92 corresponding bound is static.
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 Max_Tasks
kono
parents:
diff changeset
95 ---------
kono
parents:
diff changeset
96 .. index:: Max_Tasks
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 [RM D.7] Specifies the maximum number of task that may be created, not
kono
parents:
diff changeset
99 counting the creation of the environment task. Violations of this
kono
parents:
diff changeset
100 restriction with a value of zero are detected at compile
kono
parents:
diff changeset
101 time. Violations of this restriction with values other than zero cause
kono
parents:
diff changeset
102 Storage_Error to be raised.
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 No_Abort_Statements
kono
parents:
diff changeset
105 -------------------
kono
parents:
diff changeset
106 .. index:: No_Abort_Statements
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 [RM D.7] There are no abort_statements, and there are
kono
parents:
diff changeset
109 no calls to Task_Identification.Abort_Task.
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 No_Access_Parameter_Allocators
kono
parents:
diff changeset
112 ------------------------------
kono
parents:
diff changeset
113 .. index:: No_Access_Parameter_Allocators
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
116 occurrences of an allocator as the actual parameter to an access
kono
parents:
diff changeset
117 parameter.
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 No_Access_Subprograms
kono
parents:
diff changeset
120 ---------------------
kono
parents:
diff changeset
121 .. index:: No_Access_Subprograms
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
124 declarations of access-to-subprogram types.
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 No_Allocators
kono
parents:
diff changeset
127 -------------
kono
parents:
diff changeset
128 .. index:: No_Allocators
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
131 occurrences of an allocator.
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 No_Anonymous_Allocators
kono
parents:
diff changeset
134 -----------------------
kono
parents:
diff changeset
135 .. index:: No_Anonymous_Allocators
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
138 occurrences of an allocator of anonymous access type.
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 No_Asynchronous_Control
kono
parents:
diff changeset
141 -----------------------
kono
parents:
diff changeset
142 .. index:: No_Asynchronous_Control
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 [RM J.13] This restriction ensures at compile time that there are no semantic
kono
parents:
diff changeset
145 dependences on the predefined package Asynchronous_Task_Control.
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 No_Calendar
kono
parents:
diff changeset
148 -----------
kono
parents:
diff changeset
149 .. index:: No_Calendar
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 [GNAT] This restriction ensures at compile time that there are no semantic
kono
parents:
diff changeset
152 dependences on package Calendar.
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 No_Coextensions
kono
parents:
diff changeset
155 ---------------
kono
parents:
diff changeset
156 .. index:: No_Coextensions
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
159 coextensions. See 3.10.2.
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 No_Default_Initialization
kono
parents:
diff changeset
162 -------------------------
kono
parents:
diff changeset
163 .. index:: No_Default_Initialization
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 [GNAT] This restriction prohibits any instance of default initialization
kono
parents:
diff changeset
166 of variables. The binder implements a consistency rule which prevents
kono
parents:
diff changeset
167 any unit compiled without the restriction from with'ing a unit with the
kono
parents:
diff changeset
168 restriction (this allows the generation of initialization procedures to
kono
parents:
diff changeset
169 be skipped, since you can be sure that no call is ever generated to an
kono
parents:
diff changeset
170 initialization procedure in a unit with the restriction active). If used
kono
parents:
diff changeset
171 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
kono
parents:
diff changeset
172 is to prohibit all cases of variables declared without a specific
kono
parents:
diff changeset
173 initializer (including the case of OUT scalar parameters).
kono
parents:
diff changeset
174
kono
parents:
diff changeset
175 No_Delay
kono
parents:
diff changeset
176 --------
kono
parents:
diff changeset
177 .. index:: No_Delay
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
180 delay statements and no semantic dependences on package Calendar.
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 No_Dependence
kono
parents:
diff changeset
183 -------------
kono
parents:
diff changeset
184 .. index:: No_Dependence
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 [RM 13.12.1] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
187 dependences on a library unit.
kono
parents:
diff changeset
188
kono
parents:
diff changeset
189 No_Direct_Boolean_Operators
kono
parents:
diff changeset
190 ---------------------------
kono
parents:
diff changeset
191 .. index:: No_Direct_Boolean_Operators
kono
parents:
diff changeset
192
kono
parents:
diff changeset
193 [GNAT] This restriction ensures that no logical operators (and/or/xor)
kono
parents:
diff changeset
194 are used on operands of type Boolean (or any type derived from Boolean).
kono
parents:
diff changeset
195 This is intended for use in safety critical programs where the certification
kono
parents:
diff changeset
196 protocol requires the use of short-circuit (and then, or else) forms for all
kono
parents:
diff changeset
197 composite boolean operations.
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 No_Dispatch
kono
parents:
diff changeset
200 -----------
kono
parents:
diff changeset
201 .. index:: No_Dispatch
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
204 occurrences of ``T'Class``, for any (tagged) subtype ``T``.
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 No_Dispatching_Calls
kono
parents:
diff changeset
207 --------------------
kono
parents:
diff changeset
208 .. index:: No_Dispatching_Calls
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 [GNAT] This restriction ensures at compile time that the code generated by the
kono
parents:
diff changeset
211 compiler involves no dispatching calls. The use of this restriction allows the
kono
parents:
diff changeset
212 safe use of record extensions, classwide membership tests and other classwide
kono
parents:
diff changeset
213 features not involving implicit dispatching. This restriction ensures that
kono
parents:
diff changeset
214 the code contains no indirect calls through a dispatching mechanism. Note that
kono
parents:
diff changeset
215 this includes internally-generated calls created by the compiler, for example
kono
parents:
diff changeset
216 in the implementation of class-wide objects assignments. The
kono
parents:
diff changeset
217 membership test is allowed in the presence of this restriction, because its
kono
parents:
diff changeset
218 implementation requires no dispatching.
kono
parents:
diff changeset
219 This restriction is comparable to the official Ada restriction
kono
parents:
diff changeset
220 ``No_Dispatch`` except that it is a bit less restrictive in that it allows
kono
parents:
diff changeset
221 all classwide constructs that do not imply dispatching.
kono
parents:
diff changeset
222 The following example indicates constructs that violate this restriction.
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224
kono
parents:
diff changeset
225 .. code-block:: ada
kono
parents:
diff changeset
226
kono
parents:
diff changeset
227 package Pkg is
kono
parents:
diff changeset
228 type T is tagged record
kono
parents:
diff changeset
229 Data : Natural;
kono
parents:
diff changeset
230 end record;
kono
parents:
diff changeset
231 procedure P (X : T);
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 type DT is new T with record
kono
parents:
diff changeset
234 More_Data : Natural;
kono
parents:
diff changeset
235 end record;
kono
parents:
diff changeset
236 procedure Q (X : DT);
kono
parents:
diff changeset
237 end Pkg;
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 with Pkg; use Pkg;
kono
parents:
diff changeset
240 procedure Example is
kono
parents:
diff changeset
241 procedure Test (O : T'Class) is
kono
parents:
diff changeset
242 N : Natural := O'Size;-- Error: Dispatching call
kono
parents:
diff changeset
243 C : T'Class := O; -- Error: implicit Dispatching Call
kono
parents:
diff changeset
244 begin
kono
parents:
diff changeset
245 if O in DT'Class then -- OK : Membership test
kono
parents:
diff changeset
246 Q (DT (O)); -- OK : Type conversion plus direct call
kono
parents:
diff changeset
247 else
kono
parents:
diff changeset
248 P (O); -- Error: Dispatching call
kono
parents:
diff changeset
249 end if;
kono
parents:
diff changeset
250 end Test;
kono
parents:
diff changeset
251
kono
parents:
diff changeset
252 Obj : DT;
kono
parents:
diff changeset
253 begin
kono
parents:
diff changeset
254 P (Obj); -- OK : Direct call
kono
parents:
diff changeset
255 P (T (Obj)); -- OK : Type conversion plus direct call
kono
parents:
diff changeset
256 P (T'Class (Obj)); -- Error: Dispatching call
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 Test (Obj); -- OK : Type conversion
kono
parents:
diff changeset
259
kono
parents:
diff changeset
260 if Obj in T'Class then -- OK : Membership test
kono
parents:
diff changeset
261 null;
kono
parents:
diff changeset
262 end if;
kono
parents:
diff changeset
263 end Example;
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265
kono
parents:
diff changeset
266 No_Dynamic_Attachment
kono
parents:
diff changeset
267 ---------------------
kono
parents:
diff changeset
268 .. index:: No_Dynamic_Attachment
kono
parents:
diff changeset
269
kono
parents:
diff changeset
270 [RM D.7] This restriction ensures that there is no call to any of the
kono
parents:
diff changeset
271 operations defined in package Ada.Interrupts
kono
parents:
diff changeset
272 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
kono
parents:
diff changeset
273 Detach_Handler, and Reference).
kono
parents:
diff changeset
274
kono
parents:
diff changeset
275 .. index:: No_Dynamic_Interrupts
kono
parents:
diff changeset
276
kono
parents:
diff changeset
277 The restriction ``No_Dynamic_Interrupts`` is recognized as a
kono
parents:
diff changeset
278 synonym for ``No_Dynamic_Attachment``. This is retained for historical
kono
parents:
diff changeset
279 compatibility purposes (and a warning will be generated for its use if
kono
parents:
diff changeset
280 warnings on obsolescent features are activated).
kono
parents:
diff changeset
281
kono
parents:
diff changeset
282 No_Dynamic_Priorities
kono
parents:
diff changeset
283 ---------------------
kono
parents:
diff changeset
284 .. index:: No_Dynamic_Priorities
kono
parents:
diff changeset
285
kono
parents:
diff changeset
286 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
kono
parents:
diff changeset
287
kono
parents:
diff changeset
288 No_Entry_Calls_In_Elaboration_Code
kono
parents:
diff changeset
289 ----------------------------------
kono
parents:
diff changeset
290 .. index:: No_Entry_Calls_In_Elaboration_Code
kono
parents:
diff changeset
291
kono
parents:
diff changeset
292 [GNAT] This restriction ensures at compile time that no task or protected entry
kono
parents:
diff changeset
293 calls are made during elaboration code. As a result of the use of this
kono
parents:
diff changeset
294 restriction, the compiler can assume that no code past an accept statement
kono
parents:
diff changeset
295 in a task can be executed at elaboration time.
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 No_Enumeration_Maps
kono
parents:
diff changeset
298 -------------------
kono
parents:
diff changeset
299 .. index:: No_Enumeration_Maps
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 [GNAT] This restriction ensures at compile time that no operations requiring
kono
parents:
diff changeset
302 enumeration maps are used (that is Image and Value attributes applied
kono
parents:
diff changeset
303 to enumeration types).
kono
parents:
diff changeset
304
kono
parents:
diff changeset
305 No_Exception_Handlers
kono
parents:
diff changeset
306 ---------------------
kono
parents:
diff changeset
307 .. index:: No_Exception_Handlers
kono
parents:
diff changeset
308
kono
parents:
diff changeset
309 [GNAT] This restriction ensures at compile time that there are no explicit
kono
parents:
diff changeset
310 exception handlers. It also indicates that no exception propagation will
kono
parents:
diff changeset
311 be provided. In this mode, exceptions may be raised but will result in
kono
parents:
diff changeset
312 an immediate call to the last chance handler, a routine that the user
kono
parents:
diff changeset
313 must define with the following profile:
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315
kono
parents:
diff changeset
316 .. code-block:: ada
kono
parents:
diff changeset
317
kono
parents:
diff changeset
318 procedure Last_Chance_Handler
kono
parents:
diff changeset
319 (Source_Location : System.Address; Line : Integer);
kono
parents:
diff changeset
320 pragma Export (C, Last_Chance_Handler,
kono
parents:
diff changeset
321 "__gnat_last_chance_handler");
kono
parents:
diff changeset
322
kono
parents:
diff changeset
323
kono
parents:
diff changeset
324 The parameter is a C null-terminated string representing a message to be
kono
parents:
diff changeset
325 associated with the exception (typically the source location of the raise
kono
parents:
diff changeset
326 statement generated by the compiler). The Line parameter when nonzero
kono
parents:
diff changeset
327 represents the line number in the source program where the raise occurs.
kono
parents:
diff changeset
328
kono
parents:
diff changeset
329 No_Exception_Propagation
kono
parents:
diff changeset
330 ------------------------
kono
parents:
diff changeset
331 .. index:: No_Exception_Propagation
kono
parents:
diff changeset
332
kono
parents:
diff changeset
333 [GNAT] This restriction guarantees that exceptions are never propagated
kono
parents:
diff changeset
334 to an outer subprogram scope. The only case in which an exception may
kono
parents:
diff changeset
335 be raised is when the handler is statically in the same subprogram, so
kono
parents:
diff changeset
336 that the effect of a raise is essentially like a goto statement. Any
kono
parents:
diff changeset
337 other raise statement (implicit or explicit) will be considered
kono
parents:
diff changeset
338 unhandled. Exception handlers are allowed, but may not contain an
kono
parents:
diff changeset
339 exception occurrence identifier (exception choice). In addition, use of
kono
parents:
diff changeset
340 the package GNAT.Current_Exception is not permitted, and reraise
kono
parents:
diff changeset
341 statements (raise with no operand) are not permitted.
kono
parents:
diff changeset
342
kono
parents:
diff changeset
343 No_Exception_Registration
kono
parents:
diff changeset
344 -------------------------
kono
parents:
diff changeset
345 .. index:: No_Exception_Registration
kono
parents:
diff changeset
346
kono
parents:
diff changeset
347 [GNAT] This restriction ensures at compile time that no stream operations for
kono
parents:
diff changeset
348 types Exception_Id or Exception_Occurrence are used. This also makes it
kono
parents:
diff changeset
349 impossible to pass exceptions to or from a partition with this restriction
kono
parents:
diff changeset
350 in a distributed environment. If this restriction is active, the generated
kono
parents:
diff changeset
351 code is simplified by omitting the otherwise-required global registration
kono
parents:
diff changeset
352 of exceptions when they are declared.
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 No_Exceptions
kono
parents:
diff changeset
355 -------------
kono
parents:
diff changeset
356 .. index:: No_Exceptions
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
359 raise statements and no exception handlers.
kono
parents:
diff changeset
360
kono
parents:
diff changeset
361 No_Finalization
kono
parents:
diff changeset
362 ---------------
kono
parents:
diff changeset
363 .. index:: No_Finalization
kono
parents:
diff changeset
364
kono
parents:
diff changeset
365 [GNAT] This restriction disables the language features described in
kono
parents:
diff changeset
366 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
kono
parents:
diff changeset
367 performed by the compiler to support these features. The following types
kono
parents:
diff changeset
368 are no longer considered controlled when this restriction is in effect:
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370 *
kono
parents:
diff changeset
371 ``Ada.Finalization.Controlled``
kono
parents:
diff changeset
372 *
kono
parents:
diff changeset
373 ``Ada.Finalization.Limited_Controlled``
kono
parents:
diff changeset
374 *
kono
parents:
diff changeset
375 Derivations from ``Controlled`` or ``Limited_Controlled``
kono
parents:
diff changeset
376 *
kono
parents:
diff changeset
377 Class-wide types
kono
parents:
diff changeset
378 *
kono
parents:
diff changeset
379 Protected types
kono
parents:
diff changeset
380 *
kono
parents:
diff changeset
381 Task types
kono
parents:
diff changeset
382 *
kono
parents:
diff changeset
383 Array and record types with controlled components
kono
parents:
diff changeset
384
kono
parents:
diff changeset
385 The compiler no longer generates code to initialize, finalize or adjust an
kono
parents:
diff changeset
386 object or a nested component, either declared on the stack or on the heap. The
kono
parents:
diff changeset
387 deallocation of a controlled object no longer finalizes its contents.
kono
parents:
diff changeset
388
kono
parents:
diff changeset
389 No_Fixed_Point
kono
parents:
diff changeset
390 --------------
kono
parents:
diff changeset
391 .. index:: No_Fixed_Point
kono
parents:
diff changeset
392
kono
parents:
diff changeset
393 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
394 occurrences of fixed point types and operations.
kono
parents:
diff changeset
395
kono
parents:
diff changeset
396 No_Floating_Point
kono
parents:
diff changeset
397 -----------------
kono
parents:
diff changeset
398 .. index:: No_Floating_Point
kono
parents:
diff changeset
399
kono
parents:
diff changeset
400 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
401 occurrences of floating point types and operations.
kono
parents:
diff changeset
402
kono
parents:
diff changeset
403 No_Implicit_Conditionals
kono
parents:
diff changeset
404 ------------------------
kono
parents:
diff changeset
405 .. index:: No_Implicit_Conditionals
kono
parents:
diff changeset
406
kono
parents:
diff changeset
407 [GNAT] This restriction ensures that the generated code does not contain any
kono
parents:
diff changeset
408 implicit conditionals, either by modifying the generated code where possible,
kono
parents:
diff changeset
409 or by rejecting any construct that would otherwise generate an implicit
kono
parents:
diff changeset
410 conditional. Note that this check does not include run time constraint
kono
parents:
diff changeset
411 checks, which on some targets may generate implicit conditionals as
kono
parents:
diff changeset
412 well. To control the latter, constraint checks can be suppressed in the
kono
parents:
diff changeset
413 normal manner. Constructs generating implicit conditionals include comparisons
kono
parents:
diff changeset
414 of composite objects and the Max/Min attributes.
kono
parents:
diff changeset
415
kono
parents:
diff changeset
416 No_Implicit_Dynamic_Code
kono
parents:
diff changeset
417 ------------------------
kono
parents:
diff changeset
418 .. index:: No_Implicit_Dynamic_Code
kono
parents:
diff changeset
419 .. index:: trampoline
kono
parents:
diff changeset
420
kono
parents:
diff changeset
421 [GNAT] This restriction prevents the compiler from building 'trampolines'.
kono
parents:
diff changeset
422 This is a structure that is built on the stack and contains dynamic
kono
parents:
diff changeset
423 code to be executed at run time. On some targets, a trampoline is
kono
parents:
diff changeset
424 built for the following features: ``Access``,
kono
parents:
diff changeset
425 ``Unrestricted_Access``, or ``Address`` of a nested subprogram;
kono
parents:
diff changeset
426 nested task bodies; primitive operations of nested tagged types.
kono
parents:
diff changeset
427 Trampolines do not work on machines that prevent execution of stack
kono
parents:
diff changeset
428 data. For example, on windows systems, enabling DEP (data execution
kono
parents:
diff changeset
429 protection) will cause trampolines to raise an exception.
kono
parents:
diff changeset
430 Trampolines are also quite slow at run time.
kono
parents:
diff changeset
431
kono
parents:
diff changeset
432 On many targets, trampolines have been largely eliminated. Look at the
kono
parents:
diff changeset
433 version of system.ads for your target --- if it has
kono
parents:
diff changeset
434 Always_Compatible_Rep equal to False, then trampolines are largely
kono
parents:
diff changeset
435 eliminated. In particular, a trampoline is built for the following
kono
parents:
diff changeset
436 features: ``Address`` of a nested subprogram;
kono
parents:
diff changeset
437 ``Access`` or ``Unrestricted_Access`` of a nested subprogram,
kono
parents:
diff changeset
438 but only if pragma Favor_Top_Level applies, or the access type has a
kono
parents:
diff changeset
439 foreign-language convention; primitive operations of nested tagged
kono
parents:
diff changeset
440 types.
kono
parents:
diff changeset
441
kono
parents:
diff changeset
442 No_Implicit_Heap_Allocations
kono
parents:
diff changeset
443 ----------------------------
kono
parents:
diff changeset
444 .. index:: No_Implicit_Heap_Allocations
kono
parents:
diff changeset
445
kono
parents:
diff changeset
446 [RM D.7] No constructs are allowed to cause implicit heap allocation.
kono
parents:
diff changeset
447
kono
parents:
diff changeset
448 No_Implicit_Protected_Object_Allocations
kono
parents:
diff changeset
449 ----------------------------------------
kono
parents:
diff changeset
450 .. index:: No_Implicit_Protected_Object_Allocations
kono
parents:
diff changeset
451
kono
parents:
diff changeset
452 [GNAT] No constructs are allowed to cause implicit heap allocation of a
kono
parents:
diff changeset
453 protected object.
kono
parents:
diff changeset
454
kono
parents:
diff changeset
455 No_Implicit_Task_Allocations
kono
parents:
diff changeset
456 ----------------------------
kono
parents:
diff changeset
457 .. index:: No_Implicit_Task_Allocations
kono
parents:
diff changeset
458
kono
parents:
diff changeset
459 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
kono
parents:
diff changeset
460
kono
parents:
diff changeset
461 No_Initialize_Scalars
kono
parents:
diff changeset
462 ---------------------
kono
parents:
diff changeset
463 .. index:: No_Initialize_Scalars
kono
parents:
diff changeset
464
kono
parents:
diff changeset
465 [GNAT] This restriction ensures that no unit in the partition is compiled with
kono
parents:
diff changeset
466 pragma Initialize_Scalars. This allows the generation of more efficient
kono
parents:
diff changeset
467 code, and in particular eliminates dummy null initialization routines that
kono
parents:
diff changeset
468 are otherwise generated for some record and array types.
kono
parents:
diff changeset
469
kono
parents:
diff changeset
470 No_IO
kono
parents:
diff changeset
471 -----
kono
parents:
diff changeset
472 .. index:: No_IO
kono
parents:
diff changeset
473
kono
parents:
diff changeset
474 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
475 dependences on any of the library units Sequential_IO, Direct_IO,
kono
parents:
diff changeset
476 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
kono
parents:
diff changeset
477
kono
parents:
diff changeset
478 No_Local_Allocators
kono
parents:
diff changeset
479 -------------------
kono
parents:
diff changeset
480 .. index:: No_Local_Allocators
kono
parents:
diff changeset
481
kono
parents:
diff changeset
482 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
483 occurrences of an allocator in subprograms, generic subprograms, tasks,
kono
parents:
diff changeset
484 and entry bodies.
kono
parents:
diff changeset
485
kono
parents:
diff changeset
486 No_Local_Protected_Objects
kono
parents:
diff changeset
487 --------------------------
kono
parents:
diff changeset
488 .. index:: No_Local_Protected_Objects
kono
parents:
diff changeset
489
kono
parents:
diff changeset
490 [RM D.7] This restriction ensures at compile time that protected objects are
kono
parents:
diff changeset
491 only declared at the library level.
kono
parents:
diff changeset
492
kono
parents:
diff changeset
493 No_Local_Timing_Events
kono
parents:
diff changeset
494 ----------------------
kono
parents:
diff changeset
495 .. index:: No_Local_Timing_Events
kono
parents:
diff changeset
496
kono
parents:
diff changeset
497 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
kono
parents:
diff changeset
498 declared at the library level.
kono
parents:
diff changeset
499
kono
parents:
diff changeset
500 No_Long_Long_Integers
kono
parents:
diff changeset
501 ---------------------
kono
parents:
diff changeset
502 .. index:: No_Long_Long_Integers
kono
parents:
diff changeset
503
kono
parents:
diff changeset
504 [GNAT] This partition-wide restriction forbids any explicit reference to
kono
parents:
diff changeset
505 type Standard.Long_Long_Integer, and also forbids declaring range types whose
kono
parents:
diff changeset
506 implicit base type is Long_Long_Integer, and modular types whose size exceeds
kono
parents:
diff changeset
507 Long_Integer'Size.
kono
parents:
diff changeset
508
kono
parents:
diff changeset
509 No_Multiple_Elaboration
kono
parents:
diff changeset
510 -----------------------
kono
parents:
diff changeset
511 .. index:: No_Multiple_Elaboration
kono
parents:
diff changeset
512
kono
parents:
diff changeset
513 [GNAT] When this restriction is active, we are not requesting control-flow
kono
parents:
diff changeset
514 preservation with -fpreserve-control-flow, and the static elaboration model is
kono
parents:
diff changeset
515 used, the compiler is allowed to suppress the elaboration counter normally
kono
parents:
diff changeset
516 associated with the unit, even if the unit has elaboration code. This counter
kono
parents:
diff changeset
517 is typically used to check for access before elaboration and to control
kono
parents:
diff changeset
518 multiple elaboration attempts. If the restriction is used, then the
kono
parents:
diff changeset
519 situations in which multiple elaboration is possible, including non-Ada main
kono
parents:
diff changeset
520 programs and Stand Alone libraries, are not permitted and will be diagnosed
kono
parents:
diff changeset
521 by the binder.
kono
parents:
diff changeset
522
kono
parents:
diff changeset
523 No_Nested_Finalization
kono
parents:
diff changeset
524 ----------------------
kono
parents:
diff changeset
525 .. index:: No_Nested_Finalization
kono
parents:
diff changeset
526
kono
parents:
diff changeset
527 [RM D.7] All objects requiring finalization are declared at the library level.
kono
parents:
diff changeset
528
kono
parents:
diff changeset
529 No_Protected_Type_Allocators
kono
parents:
diff changeset
530 ----------------------------
kono
parents:
diff changeset
531 .. index:: No_Protected_Type_Allocators
kono
parents:
diff changeset
532
kono
parents:
diff changeset
533 [RM D.7] This restriction ensures at compile time that there are no allocator
kono
parents:
diff changeset
534 expressions that attempt to allocate protected objects.
kono
parents:
diff changeset
535
kono
parents:
diff changeset
536 No_Protected_Types
kono
parents:
diff changeset
537 ------------------
kono
parents:
diff changeset
538 .. index:: No_Protected_Types
kono
parents:
diff changeset
539
kono
parents:
diff changeset
540 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
541 declarations of protected types or protected objects.
kono
parents:
diff changeset
542
kono
parents:
diff changeset
543 No_Recursion
kono
parents:
diff changeset
544 ------------
kono
parents:
diff changeset
545 .. index:: No_Recursion
kono
parents:
diff changeset
546
kono
parents:
diff changeset
547 [RM H.4] A program execution is erroneous if a subprogram is invoked as
kono
parents:
diff changeset
548 part of its execution.
kono
parents:
diff changeset
549
kono
parents:
diff changeset
550 No_Reentrancy
kono
parents:
diff changeset
551 -------------
kono
parents:
diff changeset
552 .. index:: No_Reentrancy
kono
parents:
diff changeset
553
kono
parents:
diff changeset
554 [RM H.4] A program execution is erroneous if a subprogram is executed by
kono
parents:
diff changeset
555 two tasks at the same time.
kono
parents:
diff changeset
556
kono
parents:
diff changeset
557 No_Relative_Delay
kono
parents:
diff changeset
558 -----------------
kono
parents:
diff changeset
559 .. index:: No_Relative_Delay
kono
parents:
diff changeset
560
kono
parents:
diff changeset
561 [RM D.7] This restriction ensures at compile time that there are no delay
kono
parents:
diff changeset
562 relative statements and prevents expressions such as ``delay 1.23;`` from
kono
parents:
diff changeset
563 appearing in source code.
kono
parents:
diff changeset
564
kono
parents:
diff changeset
565 No_Requeue_Statements
kono
parents:
diff changeset
566 ---------------------
kono
parents:
diff changeset
567 .. index:: No_Requeue_Statements
kono
parents:
diff changeset
568
kono
parents:
diff changeset
569 [RM D.7] This restriction ensures at compile time that no requeue statements
kono
parents:
diff changeset
570 are permitted and prevents keyword ``requeue`` from being used in source
kono
parents:
diff changeset
571 code.
kono
parents:
diff changeset
572
kono
parents:
diff changeset
573 .. index:: No_Requeue
kono
parents:
diff changeset
574
kono
parents:
diff changeset
575 The restriction ``No_Requeue`` is recognized as a
kono
parents:
diff changeset
576 synonym for ``No_Requeue_Statements``. This is retained for historical
kono
parents:
diff changeset
577 compatibility purposes (and a warning will be generated for its use if
kono
parents:
diff changeset
578 warnings on oNobsolescent features are activated).
kono
parents:
diff changeset
579
kono
parents:
diff changeset
580 No_Secondary_Stack
kono
parents:
diff changeset
581 ------------------
kono
parents:
diff changeset
582 .. index:: No_Secondary_Stack
kono
parents:
diff changeset
583
kono
parents:
diff changeset
584 [GNAT] This restriction ensures at compile time that the generated code
kono
parents:
diff changeset
585 does not contain any reference to the secondary stack. The secondary
kono
parents:
diff changeset
586 stack is used to implement functions returning unconstrained objects
kono
parents:
diff changeset
587 (arrays or records) on some targets. Suppresses the allocation of
kono
parents:
diff changeset
588 secondary stacks for tasks (excluding the environment task) at run time.
kono
parents:
diff changeset
589
kono
parents:
diff changeset
590 No_Select_Statements
kono
parents:
diff changeset
591 --------------------
kono
parents:
diff changeset
592 .. index:: No_Select_Statements
kono
parents:
diff changeset
593
kono
parents:
diff changeset
594 [RM D.7] This restriction ensures at compile time no select statements of any
kono
parents:
diff changeset
595 kind are permitted, that is the keyword ``select`` may not appear.
kono
parents:
diff changeset
596
kono
parents:
diff changeset
597 No_Specific_Termination_Handlers
kono
parents:
diff changeset
598 --------------------------------
kono
parents:
diff changeset
599 .. index:: No_Specific_Termination_Handlers
kono
parents:
diff changeset
600
kono
parents:
diff changeset
601 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
kono
parents:
diff changeset
602 or to Ada.Task_Termination.Specific_Handler.
kono
parents:
diff changeset
603
kono
parents:
diff changeset
604 No_Specification_of_Aspect
kono
parents:
diff changeset
605 --------------------------
kono
parents:
diff changeset
606 .. index:: No_Specification_of_Aspect
kono
parents:
diff changeset
607
kono
parents:
diff changeset
608 [RM 13.12.1] This restriction checks at compile time that no aspect
kono
parents:
diff changeset
609 specification, attribute definition clause, or pragma is given for a
kono
parents:
diff changeset
610 given aspect.
kono
parents:
diff changeset
611
kono
parents:
diff changeset
612 No_Standard_Allocators_After_Elaboration
kono
parents:
diff changeset
613 ----------------------------------------
kono
parents:
diff changeset
614 .. index:: No_Standard_Allocators_After_Elaboration
kono
parents:
diff changeset
615
kono
parents:
diff changeset
616 [RM D.7] Specifies that an allocator using a standard storage pool
kono
parents:
diff changeset
617 should never be evaluated at run time after the elaboration of the
kono
parents:
diff changeset
618 library items of the partition has completed. Otherwise, Storage_Error
kono
parents:
diff changeset
619 is raised.
kono
parents:
diff changeset
620
kono
parents:
diff changeset
621 No_Standard_Storage_Pools
kono
parents:
diff changeset
622 -------------------------
kono
parents:
diff changeset
623 .. index:: No_Standard_Storage_Pools
kono
parents:
diff changeset
624
kono
parents:
diff changeset
625 [GNAT] This restriction ensures at compile time that no access types
kono
parents:
diff changeset
626 use the standard default storage pool. Any access type declared must
kono
parents:
diff changeset
627 have an explicit Storage_Pool attribute defined specifying a
kono
parents:
diff changeset
628 user-defined storage pool.
kono
parents:
diff changeset
629
kono
parents:
diff changeset
630 No_Stream_Optimizations
kono
parents:
diff changeset
631 -----------------------
kono
parents:
diff changeset
632 .. index:: No_Stream_Optimizations
kono
parents:
diff changeset
633
kono
parents:
diff changeset
634 [GNAT] This restriction affects the performance of stream operations on types
kono
parents:
diff changeset
635 ``String``, ``Wide_String`` and ``Wide_Wide_String``. By default, the
kono
parents:
diff changeset
636 compiler uses block reads and writes when manipulating ``String`` objects
kono
parents:
diff changeset
637 due to their supperior performance. When this restriction is in effect, the
kono
parents:
diff changeset
638 compiler performs all IO operations on a per-character basis.
kono
parents:
diff changeset
639
kono
parents:
diff changeset
640 No_Streams
kono
parents:
diff changeset
641 ----------
kono
parents:
diff changeset
642 .. index:: No_Streams
kono
parents:
diff changeset
643
kono
parents:
diff changeset
644 [GNAT] This restriction ensures at compile/bind time that there are no
kono
parents:
diff changeset
645 stream objects created and no use of stream attributes.
kono
parents:
diff changeset
646 This restriction does not forbid dependences on the package
kono
parents:
diff changeset
647 ``Ada.Streams``. So it is permissible to with
kono
parents:
diff changeset
648 ``Ada.Streams`` (or another package that does so itself)
kono
parents:
diff changeset
649 as long as no actual stream objects are created and no
kono
parents:
diff changeset
650 stream attributes are used.
kono
parents:
diff changeset
651
kono
parents:
diff changeset
652 Note that the use of restriction allows optimization of tagged types,
kono
parents:
diff changeset
653 since they do not need to worry about dispatching stream operations.
kono
parents:
diff changeset
654 To take maximum advantage of this space-saving optimization, any
kono
parents:
diff changeset
655 unit declaring a tagged type should be compiled with the restriction,
kono
parents:
diff changeset
656 though this is not required.
kono
parents:
diff changeset
657
kono
parents:
diff changeset
658 No_Task_Allocators
kono
parents:
diff changeset
659 ------------------
kono
parents:
diff changeset
660 .. index:: No_Task_Allocators
kono
parents:
diff changeset
661
kono
parents:
diff changeset
662 [RM D.7] There are no allocators for task types
kono
parents:
diff changeset
663 or types containing task subcomponents.
kono
parents:
diff changeset
664
kono
parents:
diff changeset
665 No_Task_At_Interrupt_Priority
kono
parents:
diff changeset
666 -----------------------------
kono
parents:
diff changeset
667 .. index:: No_Task_At_Interrupt_Priority
kono
parents:
diff changeset
668
kono
parents:
diff changeset
669 [GNAT] This restriction ensures at compile time that there is no
kono
parents:
diff changeset
670 Interrupt_Priority aspect or pragma for a task or a task type. As
kono
parents:
diff changeset
671 a consequence, the tasks are always created with a priority below
kono
parents:
diff changeset
672 that an interrupt priority.
kono
parents:
diff changeset
673
kono
parents:
diff changeset
674 No_Task_Attributes_Package
kono
parents:
diff changeset
675 --------------------------
kono
parents:
diff changeset
676 .. index:: No_Task_Attributes_Package
kono
parents:
diff changeset
677
kono
parents:
diff changeset
678 [GNAT] This restriction ensures at compile time that there are no implicit or
kono
parents:
diff changeset
679 explicit dependencies on the package ``Ada.Task_Attributes``.
kono
parents:
diff changeset
680
kono
parents:
diff changeset
681 .. index:: No_Task_Attributes
kono
parents:
diff changeset
682
kono
parents:
diff changeset
683 The restriction ``No_Task_Attributes`` is recognized as a synonym
kono
parents:
diff changeset
684 for ``No_Task_Attributes_Package``. This is retained for historical
kono
parents:
diff changeset
685 compatibility purposes (and a warning will be generated for its use if
kono
parents:
diff changeset
686 warnings on obsolescent features are activated).
kono
parents:
diff changeset
687
kono
parents:
diff changeset
688 No_Task_Hierarchy
kono
parents:
diff changeset
689 -----------------
kono
parents:
diff changeset
690 .. index:: No_Task_Hierarchy
kono
parents:
diff changeset
691
kono
parents:
diff changeset
692 [RM D.7] All (non-environment) tasks depend
kono
parents:
diff changeset
693 directly on the environment task of the partition.
kono
parents:
diff changeset
694
kono
parents:
diff changeset
695 No_Task_Termination
kono
parents:
diff changeset
696 -------------------
kono
parents:
diff changeset
697 .. index:: No_Task_Termination
kono
parents:
diff changeset
698
kono
parents:
diff changeset
699 [RM D.7] Tasks that terminate are erroneous.
kono
parents:
diff changeset
700
kono
parents:
diff changeset
701 No_Tasking
kono
parents:
diff changeset
702 ----------
kono
parents:
diff changeset
703 .. index:: No_Tasking
kono
parents:
diff changeset
704
kono
parents:
diff changeset
705 [GNAT] This restriction prevents the declaration of tasks or task types
kono
parents:
diff changeset
706 throughout the partition. It is similar in effect to the use of
kono
parents:
diff changeset
707 ``Max_Tasks => 0`` except that violations are caught at compile time
kono
parents:
diff changeset
708 and cause an error message to be output either by the compiler or
kono
parents:
diff changeset
709 binder.
kono
parents:
diff changeset
710
kono
parents:
diff changeset
711 No_Terminate_Alternatives
kono
parents:
diff changeset
712 -------------------------
kono
parents:
diff changeset
713 .. index:: No_Terminate_Alternatives
kono
parents:
diff changeset
714
kono
parents:
diff changeset
715 [RM D.7] There are no selective accepts with terminate alternatives.
kono
parents:
diff changeset
716
kono
parents:
diff changeset
717 No_Unchecked_Access
kono
parents:
diff changeset
718 -------------------
kono
parents:
diff changeset
719 .. index:: No_Unchecked_Access
kono
parents:
diff changeset
720
kono
parents:
diff changeset
721 [RM H.4] This restriction ensures at compile time that there are no
kono
parents:
diff changeset
722 occurrences of the Unchecked_Access attribute.
kono
parents:
diff changeset
723
kono
parents:
diff changeset
724 No_Unchecked_Conversion
kono
parents:
diff changeset
725 -----------------------
kono
parents:
diff changeset
726 .. index:: No_Unchecked_Conversion
kono
parents:
diff changeset
727
kono
parents:
diff changeset
728 [RM J.13] This restriction ensures at compile time that there are no semantic
kono
parents:
diff changeset
729 dependences on the predefined generic function Unchecked_Conversion.
kono
parents:
diff changeset
730
kono
parents:
diff changeset
731 No_Unchecked_Deallocation
kono
parents:
diff changeset
732 -------------------------
kono
parents:
diff changeset
733 .. index:: No_Unchecked_Deallocation
kono
parents:
diff changeset
734
kono
parents:
diff changeset
735 [RM J.13] This restriction ensures at compile time that there are no semantic
kono
parents:
diff changeset
736 dependences on the predefined generic procedure Unchecked_Deallocation.
kono
parents:
diff changeset
737
kono
parents:
diff changeset
738 No_Use_Of_Entity
kono
parents:
diff changeset
739 ----------------
kono
parents:
diff changeset
740 .. index:: No_Use_Of_Entity
kono
parents:
diff changeset
741
kono
parents:
diff changeset
742 [GNAT] This restriction ensures at compile time that there are no references
kono
parents:
diff changeset
743 to the entity given in the form ::
kono
parents:
diff changeset
744
kono
parents:
diff changeset
745 No_Use_Of_Entity => Name
kono
parents:
diff changeset
746
kono
parents:
diff changeset
747 where ``Name`` is the fully qualified entity, for example ::
kono
parents:
diff changeset
748
kono
parents:
diff changeset
749 No_Use_Of_Entity => Ada.Text_IO.Put_Line
kono
parents:
diff changeset
750
kono
parents:
diff changeset
751 Pure_Barriers
kono
parents:
diff changeset
752 -------------
kono
parents:
diff changeset
753 .. index:: Pure_Barriers
kono
parents:
diff changeset
754
kono
parents:
diff changeset
755 [GNAT] This restriction ensures at compile time that protected entry
kono
parents:
diff changeset
756 barriers are restricted to:
kono
parents:
diff changeset
757
kono
parents:
diff changeset
758 * components of the protected object (excluding selection from dereferences),
kono
parents:
diff changeset
759 * constant declarations,
kono
parents:
diff changeset
760 * named numbers,
kono
parents:
diff changeset
761 * enumeration literals,
kono
parents:
diff changeset
762 * integer literals,
kono
parents:
diff changeset
763 * real literals,
kono
parents:
diff changeset
764 * character literals,
kono
parents:
diff changeset
765 * implicitly defined comparison operators,
kono
parents:
diff changeset
766 * uses of the Standard."not" operator,
kono
parents:
diff changeset
767 * short-circuit operator,
kono
parents:
diff changeset
768 * the Count attribute
kono
parents:
diff changeset
769
kono
parents:
diff changeset
770 This restriction is a relaxation of the Simple_Barriers restriction,
kono
parents:
diff changeset
771 but still ensures absence of side effects, exceptions, and recursion
kono
parents:
diff changeset
772 during the evaluation of the barriers.
kono
parents:
diff changeset
773
kono
parents:
diff changeset
774 Simple_Barriers
kono
parents:
diff changeset
775 ---------------
kono
parents:
diff changeset
776 .. index:: Simple_Barriers
kono
parents:
diff changeset
777
kono
parents:
diff changeset
778 [RM D.7] This restriction ensures at compile time that barriers in entry
kono
parents:
diff changeset
779 declarations for protected types are restricted to either static boolean
kono
parents:
diff changeset
780 expressions or references to simple boolean variables defined in the private
kono
parents:
diff changeset
781 part of the protected type. No other form of entry barriers is permitted.
kono
parents:
diff changeset
782
kono
parents:
diff changeset
783 .. index:: Boolean_Entry_Barriers
kono
parents:
diff changeset
784
kono
parents:
diff changeset
785 The restriction ``Boolean_Entry_Barriers`` is recognized as a
kono
parents:
diff changeset
786 synonym for ``Simple_Barriers``. This is retained for historical
kono
parents:
diff changeset
787 compatibility purposes (and a warning will be generated for its use if
kono
parents:
diff changeset
788 warnings on obsolescent features are activated).
kono
parents:
diff changeset
789
kono
parents:
diff changeset
790 Static_Priorities
kono
parents:
diff changeset
791 -----------------
kono
parents:
diff changeset
792 .. index:: Static_Priorities
kono
parents:
diff changeset
793
kono
parents:
diff changeset
794 [GNAT] This restriction ensures at compile time that all priority expressions
kono
parents:
diff changeset
795 are static, and that there are no dependences on the package
kono
parents:
diff changeset
796 ``Ada.Dynamic_Priorities``.
kono
parents:
diff changeset
797
kono
parents:
diff changeset
798 Static_Storage_Size
kono
parents:
diff changeset
799 -------------------
kono
parents:
diff changeset
800 .. index:: Static_Storage_Size
kono
parents:
diff changeset
801
kono
parents:
diff changeset
802 [GNAT] This restriction ensures at compile time that any expression appearing
kono
parents:
diff changeset
803 in a Storage_Size pragma or attribute definition clause is static.
kono
parents:
diff changeset
804
kono
parents:
diff changeset
805 .. _Program_Unit_Level_Restrictions:
kono
parents:
diff changeset
806
kono
parents:
diff changeset
807
kono
parents:
diff changeset
808 Program Unit Level Restrictions
kono
parents:
diff changeset
809 ===============================
kono
parents:
diff changeset
810
kono
parents:
diff changeset
811 The second set of restriction identifiers
kono
parents:
diff changeset
812 does not require partition-wide consistency.
kono
parents:
diff changeset
813 The restriction may be enforced for a single
kono
parents:
diff changeset
814 compilation unit without any effect on any of the
kono
parents:
diff changeset
815 other compilation units in the partition.
kono
parents:
diff changeset
816
kono
parents:
diff changeset
817 No_Elaboration_Code
kono
parents:
diff changeset
818 -------------------
kono
parents:
diff changeset
819 .. index:: No_Elaboration_Code
kono
parents:
diff changeset
820
kono
parents:
diff changeset
821 [GNAT] This restriction ensures at compile time that no elaboration code is
kono
parents:
diff changeset
822 generated. Note that this is not the same condition as is enforced
kono
parents:
diff changeset
823 by pragma ``Preelaborate``. There are cases in which pragma
kono
parents:
diff changeset
824 ``Preelaborate`` still permits code to be generated (e.g., code
kono
parents:
diff changeset
825 to initialize a large array to all zeroes), and there are cases of units
kono
parents:
diff changeset
826 which do not meet the requirements for pragma ``Preelaborate``,
kono
parents:
diff changeset
827 but for which no elaboration code is generated. Generally, it is
kono
parents:
diff changeset
828 the case that preelaborable units will meet the restrictions, with
kono
parents:
diff changeset
829 the exception of large aggregates initialized with an others_clause,
kono
parents:
diff changeset
830 and exception declarations (which generate calls to a run-time
kono
parents:
diff changeset
831 registry procedure). This restriction is enforced on
kono
parents:
diff changeset
832 a unit by unit basis, it need not be obeyed consistently
kono
parents:
diff changeset
833 throughout a partition.
kono
parents:
diff changeset
834
kono
parents:
diff changeset
835 In the case of aggregates with others, if the aggregate has a dynamic
kono
parents:
diff changeset
836 size, there is no way to eliminate the elaboration code (such dynamic
kono
parents:
diff changeset
837 bounds would be incompatible with ``Preelaborate`` in any case). If
kono
parents:
diff changeset
838 the bounds are static, then use of this restriction actually modifies
kono
parents:
diff changeset
839 the code choice of the compiler to avoid generating a loop, and instead
kono
parents:
diff changeset
840 generate the aggregate statically if possible, no matter how many times
kono
parents:
diff changeset
841 the data for the others clause must be repeatedly generated.
kono
parents:
diff changeset
842
kono
parents:
diff changeset
843 It is not possible to precisely document
kono
parents:
diff changeset
844 the constructs which are compatible with this restriction, since,
kono
parents:
diff changeset
845 unlike most other restrictions, this is not a restriction on the
kono
parents:
diff changeset
846 source code, but a restriction on the generated object code. For
kono
parents:
diff changeset
847 example, if the source contains a declaration:
kono
parents:
diff changeset
848
kono
parents:
diff changeset
849
kono
parents:
diff changeset
850 .. code-block:: ada
kono
parents:
diff changeset
851
kono
parents:
diff changeset
852 Val : constant Integer := X;
kono
parents:
diff changeset
853
kono
parents:
diff changeset
854
kono
parents:
diff changeset
855 where X is not a static constant, it may be possible, depending
kono
parents:
diff changeset
856 on complex optimization circuitry, for the compiler to figure
kono
parents:
diff changeset
857 out the value of X at compile time, in which case this initialization
kono
parents:
diff changeset
858 can be done by the loader, and requires no initialization code. It
kono
parents:
diff changeset
859 is not possible to document the precise conditions under which the
kono
parents:
diff changeset
860 optimizer can figure this out.
kono
parents:
diff changeset
861
kono
parents:
diff changeset
862 Note that this the implementation of this restriction requires full
kono
parents:
diff changeset
863 code generation. If it is used in conjunction with "semantics only"
kono
parents:
diff changeset
864 checking, then some cases of violations may be missed.
kono
parents:
diff changeset
865
kono
parents:
diff changeset
866 When this restriction is active, we are not requesting control-flow
kono
parents:
diff changeset
867 preservation with -fpreserve-control-flow, and the static elaboration model is
kono
parents:
diff changeset
868 used, the compiler is allowed to suppress the elaboration counter normally
kono
parents:
diff changeset
869 associated with the unit. This counter is typically used to check for access
kono
parents:
diff changeset
870 before elaboration and to control multiple elaboration attempts.
kono
parents:
diff changeset
871
kono
parents:
diff changeset
872 No_Dynamic_Sized_Objects
kono
parents:
diff changeset
873 ------------------------
kono
parents:
diff changeset
874 .. index:: No_Dynamic_Sized_Objects
kono
parents:
diff changeset
875
kono
parents:
diff changeset
876 [GNAT] This restriction disallows certain constructs that might lead to the
kono
parents:
diff changeset
877 creation of dynamic-sized composite objects (or array or discriminated type).
kono
parents:
diff changeset
878 An array subtype indication is illegal if the bounds are not static
kono
parents:
diff changeset
879 or references to discriminants of an enclosing type.
kono
parents:
diff changeset
880 A discriminated subtype indication is illegal if the type has
kono
parents:
diff changeset
881 discriminant-dependent array components or a variant part, and the
kono
parents:
diff changeset
882 discriminants are not static. In addition, array and record aggregates are
kono
parents:
diff changeset
883 illegal in corresponding cases. Note that this restriction does not forbid
kono
parents:
diff changeset
884 access discriminants. It is often a good idea to combine this restriction
kono
parents:
diff changeset
885 with No_Secondary_Stack.
kono
parents:
diff changeset
886
kono
parents:
diff changeset
887 No_Entry_Queue
kono
parents:
diff changeset
888 --------------
kono
parents:
diff changeset
889 .. index:: No_Entry_Queue
kono
parents:
diff changeset
890
kono
parents:
diff changeset
891 [GNAT] This restriction is a declaration that any protected entry compiled in
kono
parents:
diff changeset
892 the scope of the restriction has at most one task waiting on the entry
kono
parents:
diff changeset
893 at any one time, and so no queue is required. This restriction is not
kono
parents:
diff changeset
894 checked at compile time. A program execution is erroneous if an attempt
kono
parents:
diff changeset
895 is made to queue a second task on such an entry.
kono
parents:
diff changeset
896
kono
parents:
diff changeset
897 No_Implementation_Aspect_Specifications
kono
parents:
diff changeset
898 ---------------------------------------
kono
parents:
diff changeset
899 .. index:: No_Implementation_Aspect_Specifications
kono
parents:
diff changeset
900
kono
parents:
diff changeset
901 [RM 13.12.1] This restriction checks at compile time that no
kono
parents:
diff changeset
902 GNAT-defined aspects are present. With this restriction, the only
kono
parents:
diff changeset
903 aspects that can be used are those defined in the Ada Reference Manual.
kono
parents:
diff changeset
904
kono
parents:
diff changeset
905 No_Implementation_Attributes
kono
parents:
diff changeset
906 ----------------------------
kono
parents:
diff changeset
907 .. index:: No_Implementation_Attributes
kono
parents:
diff changeset
908
kono
parents:
diff changeset
909 [RM 13.12.1] This restriction checks at compile time that no
kono
parents:
diff changeset
910 GNAT-defined attributes are present. With this restriction, the only
kono
parents:
diff changeset
911 attributes that can be used are those defined in the Ada Reference
kono
parents:
diff changeset
912 Manual.
kono
parents:
diff changeset
913
kono
parents:
diff changeset
914 No_Implementation_Identifiers
kono
parents:
diff changeset
915 -----------------------------
kono
parents:
diff changeset
916 .. index:: No_Implementation_Identifiers
kono
parents:
diff changeset
917
kono
parents:
diff changeset
918 [RM 13.12.1] This restriction checks at compile time that no
kono
parents:
diff changeset
919 implementation-defined identifiers (marked with pragma Implementation_Defined)
kono
parents:
diff changeset
920 occur within language-defined packages.
kono
parents:
diff changeset
921
kono
parents:
diff changeset
922 No_Implementation_Pragmas
kono
parents:
diff changeset
923 -------------------------
kono
parents:
diff changeset
924 .. index:: No_Implementation_Pragmas
kono
parents:
diff changeset
925
kono
parents:
diff changeset
926 [RM 13.12.1] This restriction checks at compile time that no
kono
parents:
diff changeset
927 GNAT-defined pragmas are present. With this restriction, the only
kono
parents:
diff changeset
928 pragmas that can be used are those defined in the Ada Reference Manual.
kono
parents:
diff changeset
929
kono
parents:
diff changeset
930 No_Implementation_Restrictions
kono
parents:
diff changeset
931 ------------------------------
kono
parents:
diff changeset
932 .. index:: No_Implementation_Restrictions
kono
parents:
diff changeset
933
kono
parents:
diff changeset
934 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
kono
parents:
diff changeset
935 identifiers (other than ``No_Implementation_Restrictions`` itself)
kono
parents:
diff changeset
936 are present. With this restriction, the only other restriction identifiers
kono
parents:
diff changeset
937 that can be used are those defined in the Ada Reference Manual.
kono
parents:
diff changeset
938
kono
parents:
diff changeset
939 No_Implementation_Units
kono
parents:
diff changeset
940 -----------------------
kono
parents:
diff changeset
941 .. index:: No_Implementation_Units
kono
parents:
diff changeset
942
kono
parents:
diff changeset
943 [RM 13.12.1] This restriction checks at compile time that there is no
kono
parents:
diff changeset
944 mention in the context clause of any implementation-defined descendants
kono
parents:
diff changeset
945 of packages Ada, Interfaces, or System.
kono
parents:
diff changeset
946
kono
parents:
diff changeset
947 No_Implicit_Aliasing
kono
parents:
diff changeset
948 --------------------
kono
parents:
diff changeset
949 .. index:: No_Implicit_Aliasing
kono
parents:
diff changeset
950
kono
parents:
diff changeset
951 [GNAT] This restriction, which is not required to be partition-wide consistent,
kono
parents:
diff changeset
952 requires an explicit aliased keyword for an object to which 'Access,
kono
parents:
diff changeset
953 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
kono
parents:
diff changeset
954 the 'Unrestricted_Access attribute for objects. Note: the reason that
kono
parents:
diff changeset
955 Unrestricted_Access is forbidden is that it would require the prefix
kono
parents:
diff changeset
956 to be aliased, and in such cases, it can always be replaced by
kono
parents:
diff changeset
957 the standard attribute Unchecked_Access which is preferable.
kono
parents:
diff changeset
958
kono
parents:
diff changeset
959 No_Implicit_Loops
kono
parents:
diff changeset
960 -----------------
kono
parents:
diff changeset
961 .. index:: No_Implicit_Loops
kono
parents:
diff changeset
962
kono
parents:
diff changeset
963 [GNAT] This restriction ensures that the generated code of the unit marked
kono
parents:
diff changeset
964 with this restriction does not contain any implicit ``for`` loops, either by
kono
parents:
diff changeset
965 modifying the generated code where possible, or by rejecting any construct
kono
parents:
diff changeset
966 that would otherwise generate an implicit ``for`` loop. If this restriction is
kono
parents:
diff changeset
967 active, it is possible to build large array aggregates with all static
kono
parents:
diff changeset
968 components without generating an intermediate temporary, and without generating
kono
parents:
diff changeset
969 a loop to initialize individual components. Otherwise, a loop is created for
kono
parents:
diff changeset
970 arrays larger than about 5000 scalar components. Note that if this restriction
kono
parents:
diff changeset
971 is set in the spec of a package, it will not apply to its body.
kono
parents:
diff changeset
972
kono
parents:
diff changeset
973 No_Obsolescent_Features
kono
parents:
diff changeset
974 -----------------------
kono
parents:
diff changeset
975 .. index:: No_Obsolescent_Features
kono
parents:
diff changeset
976
kono
parents:
diff changeset
977 [RM 13.12.1] This restriction checks at compile time that no obsolescent
kono
parents:
diff changeset
978 features are used, as defined in Annex J of the Ada Reference Manual.
kono
parents:
diff changeset
979
kono
parents:
diff changeset
980 No_Wide_Characters
kono
parents:
diff changeset
981 ------------------
kono
parents:
diff changeset
982 .. index:: No_Wide_Characters
kono
parents:
diff changeset
983
kono
parents:
diff changeset
984 [GNAT] This restriction ensures at compile time that no uses of the types
kono
parents:
diff changeset
985 ``Wide_Character`` or ``Wide_String`` or corresponding wide
kono
parents:
diff changeset
986 wide types
kono
parents:
diff changeset
987 appear, and that no wide or wide wide string or character literals
kono
parents:
diff changeset
988 appear in the program (that is literals representing characters not in
kono
parents:
diff changeset
989 type ``Character``).
kono
parents:
diff changeset
990
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
991 Static_Dispatch_Tables
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
992 ----------------------
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
993 .. index:: Static_Dispatch_Tables
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
994
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
995 [GNAT] This restriction checks at compile time that all the artifacts
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
996 associated with dispatch tables can be placed in read-only memory.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
997
111
kono
parents:
diff changeset
998 SPARK_05
kono
parents:
diff changeset
999 --------
kono
parents:
diff changeset
1000 .. index:: SPARK_05
kono
parents:
diff changeset
1001
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1002 [GNAT] This restriction checks at compile time that some constructs forbidden
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1003 in SPARK 2005 are not present. Note that SPARK 2005 has been superseded by
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1004 SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1005 a codebase respects SPARK 2014 restrictions, mark the code with pragma or
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1006 aspect ``SPARK_Mode``, and run the tool GNATprove at Stone assurance level, as
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1007 follows::
111
kono
parents:
diff changeset
1008
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1009 gnatprove -P project.gpr --mode=stone
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1010
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1011 or equivalently::
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1012
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1013 gnatprove -P project.gpr --mode=check_all
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1014
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1015 With restriction ``SPARK_05``, error messages related to SPARK 2005 restriction
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1016 have the form:
111
kono
parents:
diff changeset
1017
kono
parents:
diff changeset
1018 ::
kono
parents:
diff changeset
1019
kono
parents:
diff changeset
1020 violation of restriction "SPARK_05" at <source-location>
kono
parents:
diff changeset
1021 <error message>
kono
parents:
diff changeset
1022
kono
parents:
diff changeset
1023 .. index:: SPARK
kono
parents:
diff changeset
1024
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1025 The restriction ``SPARK`` is recognized as a synonym for ``SPARK_05``. This is
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1026 retained for historical compatibility purposes (and an unconditional warning
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1027 will be generated for its use, advising replacement by ``SPARK_05``).
111
kono
parents:
diff changeset
1028
kono
parents:
diff changeset
1029 This is not a replacement for the semantic checks performed by the
kono
parents:
diff changeset
1030 SPARK Examiner tool, as the compiler currently only deals with code,
kono
parents:
diff changeset
1031 not SPARK 2005 annotations, and does not guarantee catching all
kono
parents:
diff changeset
1032 cases of constructs forbidden by SPARK 2005.
kono
parents:
diff changeset
1033
kono
parents:
diff changeset
1034 Thus it may well be the case that code which passes the compiler with
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1035 the SPARK 2005 restriction is rejected by the SPARK Examiner, e.g. due to
111
kono
parents:
diff changeset
1036 the different visibility rules of the Examiner based on SPARK 2005
kono
parents:
diff changeset
1037 ``inherit`` annotations.
kono
parents:
diff changeset
1038
kono
parents:
diff changeset
1039 This restriction can be useful in providing an initial filter for code
kono
parents:
diff changeset
1040 developed using SPARK 2005, or in examining legacy code to see how far
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1041 it is from meeting SPARK 2005 restrictions.
111
kono
parents:
diff changeset
1042
kono
parents:
diff changeset
1043 The list below summarizes the checks that are performed when this
kono
parents:
diff changeset
1044 restriction is in force:
kono
parents:
diff changeset
1045
kono
parents:
diff changeset
1046 * No block statements
kono
parents:
diff changeset
1047 * No case statements with only an others clause
kono
parents:
diff changeset
1048 * Exit statements in loops must respect the SPARK 2005 language restrictions
kono
parents:
diff changeset
1049 * No goto statements
kono
parents:
diff changeset
1050 * Return can only appear as last statement in function
kono
parents:
diff changeset
1051 * Function must have return statement
kono
parents:
diff changeset
1052 * Loop parameter specification must include subtype mark
kono
parents:
diff changeset
1053 * Prefix of expanded name cannot be a loop statement
kono
parents:
diff changeset
1054 * Abstract subprogram not allowed
kono
parents:
diff changeset
1055 * User-defined operators not allowed
kono
parents:
diff changeset
1056 * Access type parameters not allowed
kono
parents:
diff changeset
1057 * Default expressions for parameters not allowed
kono
parents:
diff changeset
1058 * Default expressions for record fields not allowed
kono
parents:
diff changeset
1059 * No tasking constructs allowed
kono
parents:
diff changeset
1060 * Label needed at end of subprograms and packages
kono
parents:
diff changeset
1061 * No mixing of positional and named parameter association
kono
parents:
diff changeset
1062 * No access types as result type
kono
parents:
diff changeset
1063 * No unconstrained arrays as result types
kono
parents:
diff changeset
1064 * No null procedures
kono
parents:
diff changeset
1065 * Initial and later declarations must be in correct order (declaration can't come after body)
kono
parents:
diff changeset
1066 * No attributes on private types if full declaration not visible
kono
parents:
diff changeset
1067 * No package declaration within package specification
kono
parents:
diff changeset
1068 * No controlled types
kono
parents:
diff changeset
1069 * No discriminant types
kono
parents:
diff changeset
1070 * No overloading
kono
parents:
diff changeset
1071 * Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
kono
parents:
diff changeset
1072 * Access attribute not allowed
kono
parents:
diff changeset
1073 * Allocator not allowed
kono
parents:
diff changeset
1074 * Result of catenation must be String
kono
parents:
diff changeset
1075 * Operands of catenation must be string literal, static char or another catenation
kono
parents:
diff changeset
1076 * No conditional expressions
kono
parents:
diff changeset
1077 * No explicit dereference
kono
parents:
diff changeset
1078 * Quantified expression not allowed
kono
parents:
diff changeset
1079 * Slicing not allowed
kono
parents:
diff changeset
1080 * No exception renaming
kono
parents:
diff changeset
1081 * No generic renaming
kono
parents:
diff changeset
1082 * No object renaming
kono
parents:
diff changeset
1083 * No use clause
kono
parents:
diff changeset
1084 * Aggregates must be qualified
kono
parents:
diff changeset
1085 * Nonstatic choice in array aggregates not allowed
kono
parents:
diff changeset
1086 * The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
kono
parents:
diff changeset
1087 * No mixing of positional and named association in aggregate, no multi choice
kono
parents:
diff changeset
1088 * AND, OR and XOR for arrays only allowed when operands have same static bounds
kono
parents:
diff changeset
1089 * Fixed point operands to * or / must be qualified or converted
kono
parents:
diff changeset
1090 * Comparison operators not allowed for Booleans or arrays (except strings)
kono
parents:
diff changeset
1091 * Equality not allowed for arrays with non-matching static bounds (except strings)
kono
parents:
diff changeset
1092 * Conversion / qualification not allowed for arrays with non-matching static bounds
kono
parents:
diff changeset
1093 * Subprogram declaration only allowed in package spec (unless followed by import)
kono
parents:
diff changeset
1094 * Access types not allowed
kono
parents:
diff changeset
1095 * Incomplete type declaration not allowed
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1096 * Object and subtype declarations must respect SPARK 2005 restrictions
111
kono
parents:
diff changeset
1097 * Digits or delta constraint not allowed
kono
parents:
diff changeset
1098 * Decimal fixed point type not allowed
kono
parents:
diff changeset
1099 * Aliasing of objects not allowed
kono
parents:
diff changeset
1100 * Modular type modulus must be power of 2
kono
parents:
diff changeset
1101 * Base not allowed on subtype mark
kono
parents:
diff changeset
1102 * Unary operators not allowed on modular types (except not)
kono
parents:
diff changeset
1103 * Untagged record cannot be null
kono
parents:
diff changeset
1104 * No class-wide operations
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1105 * Initialization expressions must respect SPARK 2005 restrictions
111
kono
parents:
diff changeset
1106 * Nonstatic ranges not allowed except in iteration schemes
kono
parents:
diff changeset
1107 * String subtypes must have lower bound of 1
kono
parents:
diff changeset
1108 * Subtype of Boolean cannot have constraint
kono
parents:
diff changeset
1109 * At most one tagged type or extension per package
kono
parents:
diff changeset
1110 * Interface is not allowed
kono
parents:
diff changeset
1111 * Character literal cannot be prefixed (selector name cannot be character literal)
kono
parents:
diff changeset
1112 * Record aggregate cannot contain 'others'
kono
parents:
diff changeset
1113 * Component association in record aggregate must contain a single choice
kono
parents:
diff changeset
1114 * Ancestor part cannot be a type mark
kono
parents:
diff changeset
1115 * Attributes 'Image, 'Width and 'Value not allowed
kono
parents:
diff changeset
1116 * Functions may not update globals
kono
parents:
diff changeset
1117 * Subprograms may not contain direct calls to themselves (prevents recursion within unit)
kono
parents:
diff changeset
1118 * Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
kono
parents:
diff changeset
1119
kono
parents:
diff changeset
1120 The following restrictions are enforced, but note that they are actually more
kono
parents:
diff changeset
1121 strict that the latest SPARK 2005 language definition:
kono
parents:
diff changeset
1122
kono
parents:
diff changeset
1123 * No derived types other than tagged type extensions
kono
parents:
diff changeset
1124 * Subtype of unconstrained array must have constraint
kono
parents:
diff changeset
1125
kono
parents:
diff changeset
1126 This list summarises the main SPARK 2005 language rules that are not
kono
parents:
diff changeset
1127 currently checked by the SPARK_05 restriction:
kono
parents:
diff changeset
1128
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1129 * SPARK 2005 annotations are treated as comments so are not checked at all
111
kono
parents:
diff changeset
1130 * Based real literals not allowed
kono
parents:
diff changeset
1131 * Objects cannot be initialized at declaration by calls to user-defined functions
kono
parents:
diff changeset
1132 * Objects cannot be initialized at declaration by assignments from variables
kono
parents:
diff changeset
1133 * Objects cannot be initialized at declaration by assignments from indexed/selected components
kono
parents:
diff changeset
1134 * Ranges shall not be null
kono
parents:
diff changeset
1135 * A fixed point delta expression must be a simple expression
kono
parents:
diff changeset
1136 * Restrictions on where renaming declarations may be placed
kono
parents:
diff changeset
1137 * Externals of mode 'out' cannot be referenced
kono
parents:
diff changeset
1138 * Externals of mode 'in' cannot be updated
kono
parents:
diff changeset
1139 * Loop with no iteration scheme or exits only allowed as last statement in main program or task
kono
parents:
diff changeset
1140 * Subprogram cannot have parent unit name
kono
parents:
diff changeset
1141 * SPARK 2005 inherited subprogram must be prefixed with overriding
kono
parents:
diff changeset
1142 * External variables (or functions that reference them) may not be passed as actual parameters
kono
parents:
diff changeset
1143 * Globals must be explicitly mentioned in contract
kono
parents:
diff changeset
1144 * Deferred constants cannot be completed by pragma Import
kono
parents:
diff changeset
1145 * Package initialization cannot read/write variables from other packages
kono
parents:
diff changeset
1146 * Prefix not allowed for entities that are directly visible
kono
parents:
diff changeset
1147 * Identifier declaration can't override inherited package name
kono
parents:
diff changeset
1148 * Cannot use Standard or other predefined packages as identifiers
kono
parents:
diff changeset
1149 * After renaming, cannot use the original name
kono
parents:
diff changeset
1150 * Subprograms can only be renamed to remove package prefix
kono
parents:
diff changeset
1151 * Pragma import must be immediately after entity it names
kono
parents:
diff changeset
1152 * No mutual recursion between multiple units (this can be checked with gnatcheck)
kono
parents:
diff changeset
1153
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1154 Note that if a unit is compiled in Ada 95 mode with the SPARK 2005 restriction,
111
kono
parents:
diff changeset
1155 violations will be reported for constructs forbidden in SPARK 95,
kono
parents:
diff changeset
1156 instead of SPARK 2005.