Debian Codegraph @

source_2020/safety.mss

raw
1 @Comment{ $Source: e:\\cvsroot/ARM/Source/safety.mss,v $ }
2 @Comment{ $Revision: 1.68 $ $Date: 2020/06/03 00:09:01 $ $Author: randy $ }
3 @Part(safety, Root="ada.mss")
4
5 @Comment{$Date: 2020/06/03 00:09:01 $}
6 @LabeledRevisedNormativeAnnex{Version=[2],
7 New=[High Integrity Systems], Old=[Safety and Security]}
8
9 @begin{Intro}
10 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00347-01]}
11 @Leading@Defn{safety-critical systems}
12 @Defn{secure systems}
13 This Annex addresses requirements for @Chg{Version=[2],
14 New=[high integrity ],Old=[]}systems @Chg{Version=[2],New=[(including],
15 Old=[that are]} safety@Chg{Version=[2],New=[-],Old=[ ]}critical
16 @Chg{Version=[2],New=[systems and],Old=[or have]}
17 security@Chg{Version=[2],New=[-critical systems)],Old=[ constraints]}. It
18 provides facilities and specifies documentation requirements that relate to
19 several needs:
20 @begin{Itemize}
21 Understanding program execution;
22
23 Reviewing object code;
24
25 Restricting language constructs whose usage might
26 complicate the demonstration of program correctness
27 @end{Itemize}
28 @ChgNote{The following paragraph is missing a number in the original version.
29 To give it a number in the new version, it is marked as an insertion.}
30 @ChgRef{Version=[0],Kind=[Added]}
31 @Chg{New=[],Old=[@Noparanum@;]}Execution understandability
32 is supported by pragma Normalize_Scalars, and also by
33 requirements for the implementation to document the effect of a program
34 in the presence of a bounded error or where the language rules leave
35 the effect unspecified.
36 @PDefn{unspecified}
37
38 The @nt[pragma]s Reviewable and Restrictions relate to the other
39 requirements addressed by this Annex.
40 @end{Intro}
41
42 @begin{Notes}
43 The @attr[Valid] attribute (see @RefSecNum(The Valid Attribute)) is
44 also useful in addressing these needs,
45 to avoid problems that could otherwise arise from scalars
46 that have values outside their declared range constraints.
47 @begin{Discussion}
48
49 The Annex tries to provide high assurance rather than language features.
50 However, it is not possible, in general, to test for high assurance. For any
51 specific language feature, it is possible to demonstrate its presence by a
52 functional test, as in the ACVC. One can also check for the presence of some
53 documentation requirements, but it is not easy to determine objectively that
54 the documentation is @lquotes@;adequate@rquotes@;.
55
56 @end{Discussion}
57 @end{Notes}
58
59 @begin{Extend83}
60 @Defn{extensions to Ada 83}
61 This Annex is new to Ada 95.
62 @end{Extend83}
63
64 @begin{DiffWord95}
65 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00347-01]}
66 @ChgAdded{Version=[2],Text=[The title of this annex was changed to better
67 reflect its purpose and scope. High integrity systems has become the standard
68 way of identifying systems that have high reliability requirements; it
69 subsumes terms such as safety and security. Moreover, the annex does not
70 include any security specific features and as such the previous title is
71 somewhat misleading.]}
72 @end{DiffWord95}
73
74 @LabeledClause{Pragma Normalize_Scalars}
75 @begin{Intro}
76 This pragma ensures that an otherwise
77 uninitialized scalar object is set to a
78 predictable value, but out of range if possible.
79 @begin[discussion]
80 The goal of the pragma is to reduce the impact of a bounded error
81 that results from a reference to an uninitialized scalar object, by
82 having such a reference violate a range check and thus raise
83 Constraint_Error.
84 @end[discussion]
85 @end{Intro}
86
87 @begin{Syntax}
88 @begin{SyntaxText}
89 @Leading@Keepnext@;The form of a @nt{pragma} Normalize_Scalars is as follows:
90 @end{SyntaxText}
91
92 @PragmaSyn`@key{pragma} @prag(Normalize_Scalars);'
93 @end{Syntax}
94
95 @begin{LinkTime}
96 @PDefn2{Term=[configuration pragma], Sec=(Normalize_Scalars)}
97 @PDefn2{Term=[pragma, configuration], Sec=(Normalize_Scalars)}
98 Pragma Normalize_Scalars is a configuration pragma.
99 It applies to all
100 @nt[compilation_unit]s included in a partition.
101 @end{LinkTime}
102
103 @begin{DocReq}
104 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]}
105 If a @nt{pragma} Normalize_Scalars applies,
106 the implementation shall document the implicit initial @Chg{Version=[2],
107 New=[values],Old=[value]} for scalar subtypes,
108 and shall identify each case in which such a value is used
109 and is not an invalid representation.
110 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[If
111 a @nt{pragma} Normalize_Scalars applies, the implicit initial values of
112 scalar subtypes shall be documented. Such a value should be an
113 invalid representation when possible; any cases when is it not shall be
114 documented.]}]}
115 @begin{Honest}
116 It's slightly inaccurate to say that the value is a
117 representation, but the point should be clear anyway.
118 @end{Honest}
119 @begin{Discussion}
120
121 By providing a type with a size specification so that spare bits are
122 present, it is possible to force an implementation of Normalize_Scalars to use
123 an out of range value. This can be tested for by ensuring that
124 Constraint_Error is raised. Similarly, for an unconstrained integer type, in
125 which no spare bit is surely present, one can check that the initialization
126 takes place to the value specified in the documentation of the
127 implementation. For a floating point type, spare bits might not
128 be available, but a range constraint can provide the ability to use an out
129 of range value.
130
131 If it is difficult to document the general rule for the implicit initial
132 value, the implementation might choose instead to record the value on
133 the object code listing or similar output produced during compilation.
134
135 @end{Discussion}
136 @end{DocReq}
137
138 @begin{ImplAdvice}
139 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]}
140 Whenever possible, the implicit initial @Chg{Version=[2],
141 New=[values],Old=[value]} for a scalar subtype
142 should be an invalid representation
143 (see @RefSecNum{Data Validity}).
144 @begin{Discussion}
145
146 When an out of range value is used for the initialization,
147 it is likely that constraint checks will detect it.
148 In addition, it can be detected by the Valid attribute.
149
150 @ChgRef{Version=[2],Kind=[AddedNormal]}
151 @ChgAdded{Version=[2],Text=[This rule is included in the documentation
152 requirements, and thus does not need a separate summary item.]}
153
154 @end{Discussion}
155 @end{ImplAdvice}
156
157 @begin{Notes}
158 The initialization requirement applies to
159 uninitialized scalar objects that are subcomponents of composite
160 objects, to allocated objects, and to stand-alone objects. It also
161 applies to scalar @key{out} parameters. Scalar
162 subcomponents of composite @key{out} parameters are initialized to the
163 corresponding part of the actual, by virtue of
164 @RefSecNum(Parameter Associations).
165
166 The initialization requirement does not apply to a scalar for which
167 pragma Import has been specified,
168 since initialization of an imported object is performed
169 solely by the foreign language environment
170 (see @RefSecNum[Interfacing Aspects]).
171
172 The use of pragma Normalize_Scalars in conjunction with
173 Pragma Restrictions(No_Exceptions) may result in erroneous execution
174 (see @RefSecNum[High Integrity Restrictions]).
175 @begin{Discussion}
176
177 Since the effect of an access to an out of range value will often be to
178 raise Constraint_Error, it is clear that suppressing the exception mechanism
179 could result in erroneous execution. In particular, the assignment to an
180 array, with the array index out of range, will result in a write to an
181 arbitrary store location, having unpredictable effects.
182
183 @end{Discussion}
184 @end{Notes}
185
186 @LabeledClause{Documentation of Implementation Decisions}
187
188 @begin{DocReq}
189 @PDefn{unspecified}
190 The implementation shall document the range of effects for each
191 situation that the language rules identify as either a
192 bounded error or as having an unspecified effect.
193 If the implementation can constrain the effects of erroneous
194 execution for a given construct,
195 then it shall document such constraints.
196 @Redundant[The documentation might be provided either
197 independently of any compilation unit or partition, or as part of an annotated
198 listing for a given unit or partition.
199 See also @RefSecNum(Conformity of an Implementation with the Standard), and
200 @RefSecNum(Structure).]
201 @ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0],
202 Text=[@ChgDeleted{Version=[2],
203 Text=[Information regarding bounded errors and erroneous execution.]}]}
204 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[
205 The range of effects for each bounded error and each unspecified effect.
206 If the effects of a given erroneous construct are
207 constrained, the constraints shall be documented.]}]}
208
209 @end{DocReq}
210
211 @begin{Notes}
212 Among the situations to be
213 documented are the conventions
214 chosen for parameter passing, the methods used for the management of
215 run-time storage, and the method used to evaluate numeric expressions if
216 this involves extended range or extra precision.
217 @begin{Discussion}
218
219 Look up @lquotes@;unspecified@rquotes@; and @lquotes@;erroneous execution@rquotes@;
220 in the index for a list of the cases.
221
222 The management of run-time storage is particularly important. For safety
223 applications, it is often necessary to show that a program cannot raise
224 Storage_Error, and for security applications that information cannot leak
225 via the run-time system. Users are likely to prefer a simple storage model
226 that can be easily validated.
227
228 The documentation could helpfully take into account that users may well
229 adopt a subset to avoid some forms of erroneous execution, for instance, not
230 using the abort statement, so that the effects of a partly completed
231 @nt{assignment_statement} do not have to be considered in the validation of a
232 program
233 (see @RefSecNum{Abort of a Task - Abort of a Sequence of Statements}).
234 For this reason documentation linked to an actual compilation may be
235 most useful. Similarly, an implementation may be able to take into
236 account use of the Restrictions pragma.
237
238 @end{Discussion}
239 @end{Notes}
240
241
242 @LabeledClause{Reviewable Object Code}
243
244 @begin{Intro}
245 Object code review and validation are supported by
246 pragmas Reviewable and Inspection_Point.
247 @end{Intro}
248
249 @LabeledSubClause{Pragma Reviewable}
250 @begin{Intro}
251 This pragma directs the implementation to
252 provide information to
253 facilitate analysis and review of a program's
254 object code, in particular to allow determination of
255 execution time and storage usage and to identify the
256 correspondence between the source and object programs.
257 @begin{Discussion}
258
259 Since the purpose of this pragma is to provide information to the user,
260 it is hard to objectively test for conformity. In practice, users want
261 the information in an easily understood and convenient form, but neither
262 of these properties can be easily measured.
263
264 @end{Discussion}
265 @end{Intro}
266
267 @begin{Syntax}
268 @begin{SyntaxText}
269 @Leading@Keepnext@;The form of a @nt{pragma} Reviewable is as follows:
270 @end{SyntaxText}
271
272 @PragmaSyn`@key{pragma} @prag(Reviewable);'
273 @end{Syntax}
274
275 @begin{LinkTime}
276 @PDefn2{Term=[configuration pragma], Sec=(Reviewable)}
277 @PDefn2{Term=[pragma, configuration], Sec=(Reviewable)}
278 Pragma Reviewable is a configuration pragma.
279 It applies to all
280 @nt[compilation_unit]s included in a partition.
281 @end{LinkTime}
282
283 @begin{ImplReq}
284 @Leading@;The implementation shall provide the following
285 information for any compilation unit to which such a
286 pragma applies:
287 @begin{Discussion}
288
289 The list of requirements can be checked for, even if issues like
290 intelligibility are not addressed.
291
292 @end{Discussion}
293 @begin{itemize}
294 Where compiler-generated runtime checks remain;
295 @begin{Discussion}
296
297 A constraint check which is implemented via a check on the upper and lower
298 bound should clearly be indicated. If a check is implicit in the form of
299 machine instructions used (such an overflow checking), this should also be
300 covered by the documentation. It is particularly important to cover those
301 checks which are not obvious from the source code, such as that for stack
302 overflow.
303
304 @end{Discussion}
305
306 An identification of any construct with a language-defined check
307 that is recognized prior to run time as certain to fail
308 if executed
309 (even if the generation of runtime checks has been suppressed);
310 @begin{Discussion}
311
312 In this case, if the compiler determines that a check must fail, the user
313 should be informed of this. However, since it is not in general possible to
314 know what the compiler will detect, it is not easy to test for this. In
315 practice, it is thought that compilers claiming conformity to this Annex
316 will perform significant optimizations and therefore @i{will} detect such
317 situations. Of course, such events could well indicate a programmer error.
318
319 @end{Discussion}
320
321 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00209-01]}
322 For each @Chg{Version=[2],New=[read of],Old=[reference to]} a scalar object,
323 an identification of the @Chg{Version=[2],New=[read],Old=[reference]} as
324 either @lquotes@;known to be initialized,@rquotes@; or
325 @lquotes@;possibly uninitialized,@rquotes@;
326 independent of whether pragma Normalize_Scalars applies;
327 @begin{Discussion}
328
329 This issue again raises the question as to what the compiler has determined.
330 A lazy implementation could clearly mark all scalars as @lquotes@;possibly
331 uninitialized@rquotes@;, but this would be very unhelpful to the user. It should be
332 possible to analyze a range of scalar uses and note the percentage in each
333 class. Note that an access marked @lquotes@;known to be initialized@rquotes@; does not imply
334 that the value is in range, since the initialization could be from an
335 (erroneous) call of unchecked conversion, or by means external to the Ada
336 program.
337
338 @end{Discussion}
339
340 Where run-time support routines are implicitly invoked;
341 @begin{Discussion}
342
343 Validators will need to know the calls invoked in order to check for the
344 correct functionality. For instance, for some safety applications, it may be
345 necessary to ensure that certain sections of code can execute in a
346 particular time.
347
348 @end{Discussion}
349
350 @Leading@Keepnext@;An object code listing, including:
351 @begin{inneritemize}
352 Machine instructions, with relative offsets;
353 @begin{Discussion}
354
355 The machine instructions should be in a format that is easily understood,
356 such as the symbolic format of the assembler. The relative offsets are
357 needed in numeric format, to check any alignment restrictions that the
358 architecture might impose.
359
360 @end{Discussion}
361
362 Where each data object is stored during its lifetime;
363 @begin{Discussion}
364
365 This requirement implies that if the optimizer assigns a variable to a
366 register, this needs to be evident.
367
368 @end{Discussion}
369
370 Correspondence with the source program, including an identification of the
371 code produced per declaration and per statement.
372 @begin{Discussion}
373
374 This correspondence will be quite complex when extensive optimization is
375 performed. In particular, address calculation to access some data structures
376 could be moved from the actual access. However, when all the machine code
377 arising from a statement or declaration is in one basic block, this must be
378 indicated by the implementation.
379
380 @end{Discussion}
381 @end{inneritemize}
382
383 An identification of each construct for which the implementation detects
384 the possibility of erroneous execution;
385 @begin{Discussion}
386
387 This requirement is quite vague. In general, it is hard for compilers to detect
388 erroneous execution and therefore the requirement will be rarely invoked. However,
389 if the pragma Suppress is used and the compiler can show that a predefined
390 exception will be raised, then such an identification would be useful.
391
392 @end{Discussion}
393
394 @Trailing@;For each subprogram, block, task,
395 or other construct implemented by
396 reserving and subsequently freeing an area on a run-time stack,
397 an identification
398 of the length of the fixed-size portion of the area and an indication
399 of whether the non-fixed size portion is reserved on the stack
400 or in a dynamically-managed storage region.
401 @begin{Discussion}
402 This requirement is vital for those requiring to show that the storage
403 available to a program is sufficient. This is crucial in those cases in
404 which the internal checks for stack overflow are suppressed (perhaps by
405 @key[pragma] Restrictions(No_Exceptions)).
406 @end{Discussion}
407 @end{itemize}
408
409 @Leading@;The implementation shall provide the following
410 information for any partition to which the
411 pragma applies:
412 @begin{Itemize}
413 An object code listing of the entire partition, including
414 initialization and finalization code as well as
415 run-time
416 system components, and with an identification of those instructions and
417 data that will be relocated at load time;
418 @begin{Discussion}
419 The object code listing should enable a validator to estimate
420 upper bounds for the time taken by critical parts of a program.
421 Similarly, by an analysis of the entire partition, it should be possible
422 to ensure that the storage requirements are suitably bounded,
423 assuming that the partition was written in an appropriate
424 manner.@end{discussion}
425
426 A description of the run-time model relevant to the partition.
427 @begin{Discussion}
428 For example,
429 a description of the storage model is vital,
430 since the Ada language does not explicitly define such a model.
431 @end{Discussion}
432 @end{itemize}
433 @end{ImplReq}
434
435 @Chgnote{The following paragraph is missing a number in the original version.
436 To give it a number in the new version, it is marked as an insertion.}
437 @ChgRef{Version=[0],Kind=[Added]}
438 @Chg{New=[],Old=[@Noparanum@;]}The implementation shall provide control- and data-flow
439 information, both within each compilation unit and across
440 the compilation units of the partition.
441 @begin{Discussion}
442
443 This requirement is quite vague, since it is unclear what control and data
444 flow information the compiler has produced. It is really a plea not to throw
445 away information that could be useful to the validator. Note that the data
446 flow information is relevant to the detection of @lquotes@;possibly uninitialized@rquotes@;
447 objects referred to above.
448
449 @end{Discussion}
450 @begin{ImplAdvice}
451 The implementation should provide the above
452 information in both a human-readable
453 and machine-readable form,
454 and should document the latter so as to ease further
455 processing by automated tools.
456 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
457 Text=[The information produced by @nt{pragma} Reviewable should be
458 provided in both a human-readable and machine-readable form, and the
459 latter form should be documented.]}]}
460
461 Object code listings should be provided both in a symbolic
462 format and also in an appropriate numeric format (such as
463 hexadecimal or octal).
464 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
465 Text=[Object code listings should be provided both in a symbolic
466 format and in a numeric format.]}]}
467 @begin{Reason}
468
469 This is to enable other tools to perform any analysis that the user
470 needed to aid validation.
471 The format should be in some agreed form.
472
473 @end{Reason}
474 @end{ImplAdvice}
475
476 @begin{Notes}
477 The order of elaboration of library units will be documented
478 even in the absence of @nt[pragma] Reviewable
479 (see @RefSecNum{Program Execution}).
480 @end{Notes}
481
482 @begin[discussion]
483 There might be some interactions between pragma Reviewable and compiler
484 optimizations. For example,
485 an implementation may disable some
486 optimizations when pragma Reviewable is in force
487 if it would be overly complicated to
488 provide
489 the detailed information to allow review of the optimized object code.
490 See also @nt<pragma> Optimize (@RefSecNum{Pragmas}).
491 @end[discussion]
492
493 @begin{DiffWord95}
494 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00209-01]}
495 @ChgAdded{Version=[2],Text=[The wording was clarified that pragma Reviewable
496 applies to each read of an object, as it makes no sense to talk about the
497 state of an object that will immediately be overwritten.]}
498 @end{DiffWord95}
499
500 @LabeledSubClause{Pragma Inspection_Point}
501 @begin{Intro}
502 An occurrence of a pragma Inspection_Point identifies a set of objects each of
503 whose values is to be
504 available at the point(s) during program execution corresponding to the
505 position of the pragma in the compilation unit.
506 The purpose of such a pragma is to facilitate code validation.
507 @begin{Discussion}
508
509 Inspection points are a high level equivalent of break points used by
510 debuggers.
511
512 @end{Discussion}
513 @end{Intro}
514
515 @begin{Syntax}
516 @begin{SyntaxText}
517 @Leading@Keepnext@;The form of a @nt{pragma} Inspection_Point is as follows:
518 @end{SyntaxText}
519
520 @PragmaSyn`@key{pragma} @prag(Inspection_Point)[(@SynI{object_}@Syn2{name} {, @SynI{object_}@Syn2{name}})];'
521 @end{Syntax}
522
523 @begin{Legality}
524 A pragma Inspection_Point is allowed wherever a
525 @nt[declarative_item]
526 or @nt[statement] is allowed.
527 Each @SynI{object_}name shall statically denote the declaration of an object.
528 @begin{Discussion}
529
530 The static denotation is required, since no dynamic evaluation of a name
531 is involved in this pragma.
532
533 @end{Discussion}
534 @end{Legality}
535
536 @begin{StaticSem}
537 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0093],ARef=[AI95-00207-01]}
538 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]}
539 @Defn{inspection point}
540 An @i{inspection point} is a point in the object code
541 corresponding to the occurrence of a pragma Inspection_@!Point in the
542 compilation unit.
543 @Defn{inspectable object}
544 An object is @i{inspectable} at an inspection point if the corresponding
545 pragma Inspection_Point either has an argument denoting that object,
546 or has no arguments@Chg{New=[ and the @Chg{Version=[2],New=[declaration
547 of the ],Old=[]}object is visible at the inspection point],Old=[]}.
548 @begin{ramification}
549 If a pragma Inspection_Point is in an in-lined subprogram, there
550 might be numerous inspection points in the object code corresponding to
551 the single occurrence of the pragma in the source; similar considerations
552 apply if such a pragma is in a generic, or in a loop that has
553 been @lquotes@;unrolled@rquotes@; by an optimizer.
554
555 @ChgRef{Version=[1],Kind=[Added],Ref=[8652/0093],ARef=[AI95-00207-01]}
556 @ChgAdded{Version=[1],Text=[The short form of the pragma is a convenient shorthand for
557 listing all objects which could be explicitly made inspectable by the long
558 form of the pragma; thus only visible objects are made inspectable by it.
559 Objects that are not visible at the point of the pragma are not made
560 inspectable by the short form pragma. This is necessary so that implementations
561 need not keep information about (or prevent optimizations on) a unit simply
562 because some other unit @i<might> contain a short form Inspection_Point
563 pragma.]}
564 @end{ramification}
565 @begin{Discussion}
566 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0093],ARef=[AI95-00207-01]}
567 If the short form of the pragma is used, then all@Chg{New=[ visible],Old=[]}
568 objects are inspectable.
569 This implies that @Chg{New=[global objects from other compilation units],
570 Old=[objects out of scope at the point of the pragma]} are inspectable. A good
571 interactive debugging system could provide information
572 similar to a post-mortem dump at such inspection points. The annex does
573 not require that any inspection facility is provided, merely that the
574 information is available to understand the state of the machine at those
575 points.
576 @end{Discussion}
577 @end{StaticSem}
578
579 @begin{RunTime}
580 Execution of a pragma Inspection_Point has no effect.
581 @begin{Discussion}
582
583 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
584 Although an inspection point has no (semantic) effect,
585 the removal or adding @Chg{Version=[2],New=[of ],Old=[]}a new point could
586 change the machine code generated by the compiler.
587
588 @end{Discussion}
589 @end{RunTime}
590
591 @begin{ImplReq}
592 Reaching an inspection point is an external interaction
593 with respect to the values
594 of the inspectable objects at that point
595 (see @RefSecNum{Conformity of an Implementation with the Standard}).
596 @begin{Ramification}
597 The compiler is inhibited from moving an assignment to
598 an inspectable variable past an inspection point for that variable.
599 On the other hand, the evaluation of an expression that might raise
600 an exception may be moved past an inspection point
601 (see @RefSecNum[Exceptions and Optimization]).@end{ramification}
602 @end{ImplReq}
603
604 @begin{DocReq}
605 For each inspection point,
606 the implementation shall
607 identify a mapping between each inspectable object and the machine resources
608 (such as memory locations or registers) from which the object's value
609 can be obtained.
610 @ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0],
611 Text=[@ChgDeleted{Version=[2],
612 Text=[Implementation-defined aspects of pragma Inspection_Point.]}]}
613 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
614 Text=[For each inspection point, a mapping between each inspectable object
615 and the machine resources where the object's value can be obtained shall
616 be provided.]}]}
617 @end{DocReq}
618
619 @begin{Notes}
620 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00209-01]}
621 The implementation is not allowed to perform @lquotes@;dead store elimination@rquotes@; on
622 the last assignment to a variable prior to a point where the
623 variable is inspectable.
624 Thus an inspection point has the effect of an
625 implicit @Chg{Version=[2],New=[read of],Old=[reference to]} each of its
626 inspectable objects.
627
628 Inspection points are useful in maintaining a correspondence between the
629 state of the program in source code terms, and the machine state during
630 the program's execution. Assertions about the values of program objects
631 can be tested in machine terms at inspection points. Object code between
632 inspection points can be processed by automated tools to
633 verify programs mechanically.
634 @begin{Discussion}
635
636 Although it is not a requirement of the annex, it would be useful if the
637 state of the stack and heap could be interrogated. This would allow users
638 to check that a program did not have a `storage leak'.
639
640 @end{Discussion}
641
642 The identification of the mapping from source program objects to machine
643 resources is allowed to be in the form of an
644 annotated object listing, in human-readable or tool-processable form.
645 @begin{Discussion}
646
647 In principle, it is easy to check an implementation for this pragma, since
648 one merely needs to check the content of objects against those values
649 known from the source listing. In practice, one needs a tool similar
650 to an interactive debugger to perform the check.
651
652 @end{Discussion}
653 @end{Notes}
654
655 @begin{DiffWord95}
656 @ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0093],ARef=[AI95-00207-01]}
657 @ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the definition of
658 the Inspection_Point pragma to apply to only variables visible at the point
659 of the pragma. Otherwise, the compiler would have to assume that some
660 other code somewhere could have a pragma Inspection_Point, preventing many
661 optimizations (such as unused object elimination).]}
662 @end{DiffWord95}
663
664
665 @LabeledRevisedClause{Version=[2],New=[High Integrity Restrictions],Old=[Safety and Security Restrictions]}
666 @begin{Intro}
667 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]}
668 This @Chg{Version=[3],New=[subclause],Old=[clause]} defines restrictions that can be used with pragma
669 Restrictions (see @RefSecNum(Pragma Restrictions and Pragma Profile)); these
670 facilitate the demonstration of program correctness by allowing
671 tailored versions of the run-time system.
672 @begin{Discussion}
673
674 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]}
675 Note that the restrictions are absolute. If a partition has 100 library
676 units and just one needs Unchecked_Conversion, then the pragma cannot be
677 used to ensure the other 99 units do not use Unchecked_Conversion. Note also
678 that these are restrictions on all Ada code within a partition, and
679 therefore it @Chg{Version=[3],New=[might],Old=[may]} not be evident
680 from the specification of a package whether a restriction can be imposed.
681
682 @end{Discussion}
683 @end{Intro}
684
685 @begin{StaticSem}
686 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00347-01],ARef=[AI95-00394-01]}
687 @ChgDeleted{Version=[2],Text=[The following restrictions,
688 the same as in @RefSecNum{Tasking Restrictions},
689 apply in this Annex:
690 No_Task_@!Hierarchy,
691 No_Abort_@!Statement,
692 No_Implicit_@!Heap_@!Allocation,
693 Max_@!Task_@!Entries is 0,
694 Max_@!Asynchronous_@!Select_@!Nesting is 0, and
695 Max_@!Tasks is 0.
696 @redundant[The last three restrictions are checked prior to program execution.]]}
697
698 @Trailing@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00394-01]}
699 The following @Chg{Version=[2],New=[@SynI{restriction_}@nt{identifier}s are
700 language defined:],Old=[additional restrictions apply in this Annex.]}
701
702 @leading@keepnext@b{Tasking-related restriction:}
703
704 @begin{Description}
705 @Trailing@;@Defn2{Term=[restrictions],Sec=(No_Protected_Types)}@Chg{Version=[3],New=[@Defn{No_Protected_Types restriction}],
706 Old=[]}No_Protected_Types @\There
707 are no declarations of protected types or protected objects.
708 @end{Description}
709
710 @leading@keepnext@b{Memory-management related restrictions:}
711
712 @begin{Description}
713 @Defn2{Term=[restrictions],Sec=(No_Allocators)}@Chg{Version=[3],New=[@Defn{No_Allocators restriction}],
714 Old=[]}No_Allocators @\There are no
715 occurrences of an @nt{allocator}.
716
717 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0042],ARef=[AI95-00130]}
718 @Defn2{Term=[restrictions],Sec=(No_Local_Allocators)}@Chg{Version=[3],New=[@Defn{No_Local_Allocators restriction}],
719 Old=[]}No_Local_Allocators @\@nt{Allocator}s
720 are prohibited in subprograms, generic subprograms,
721 tasks, and entry bodies@Chg{New=[],Old=[; instantiations of generic packages
722 are also prohibited in these contexts]}.
723 @begin[Ramification]
724 Thus @nt{allocator}s are permitted only in expressions whose
725 evaluation can only be performed before the main subprogram is invoked.
726 @end[Ramification]
727 @begin[Reason]
728 @ChgRef{Version=[1],Kind=[Deleted],Ref=[8652/0042],ARef=[AI95-00130]}
729 @ChgNote{The associated rule has been deleted.}
730 @ChgDeleted{Version=[1],Text=[The reason for the prohibition against
731 instantiations of
732 generic packages is to avoid contract model violations.
733 An alternative would be to prohibit @nt{allocator}s from generic
734 packages, but it seems preferable to allow generality on the
735 defining side and then place the restrictions on the usage (instantiation),
736 rather than inhibiting what can be in the generic while
737 liberalizing where they can be instantiated.]}
738 @end[Reason]
739
740 @ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0152-1],ARef=[AI05-0262-1]}
741 @ChgAdded{Version=[3],Text=[@Defn2{Term=[restrictions],Sec=(No_Anonymous_Allocators)}@Defn{No_Anonymous_Allocators restriction}
742 No_Anonymous_Allocators @\There are no @nt{allocator}s of anonymous access types.]}
743
744 @ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0190-1]}
745 @ChgAdded{Version=[3],Text=[@Defn2{Term=[restrictions],Sec=(No_Coextensions)}@Defn{No_Coextensions restriction}
746 No_Coextensions @\There are no coextensions. See @RefSecNum{Operations of Access Types}.]}
747
748 @ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0190-1]}
749 @ChgAdded{Version=[3],Text=[@Defn2{Term=[restrictions],
750 Sec=(No_Access_Parameter_Allocators)}@Defn{No_Access_Parameter_Allocators restriction}
751 No_Access_Parameter_Allocators @\@nt{Allocator}s
752 are not permitted as the actual parameter to an access parameter.
753 See @RefSecNum{Subprogram Declarations}.]}
754
755 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00394-01]}
756 @Comment{We can't reuse this paragraph for the above, because there is no
757 way to have the hanging marker in both the added and deleted text (and since it
758 isn't in Ada 2005 at all).}
759 @ChgDeleted{Version=[2],Text=[@Defn2{Term=[restrictions],
760 Sec=(No_Unchecked_Deallocation)}No_Unchecked_Deallocation @\Semantic
761 dependence on Unchecked_Deallocation is not allowed.]}
762 @begin{Discussion}
763 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
764 @ChgDeleted{Version=[2],Text=[This restriction would be useful in those
765 contexts in which heap storage is needed on program start-up, but need not be
766 increased subsequently. The danger of a dangling pointer can therefore be
767 avoided.]}
768 @end{Discussion}
769
770 @Trailing@;Immediate_Reclamation @\Except for storage occupied by objects created by
771 @nt{allocator}s and not deallocated via unchecked deallocation, any storage
772 reserved at run time for an object is immediately reclaimed when the
773 object no longer exists.
774 @Defn2{Term=[restrictions],Sec=(Immediate_Reclamation)}@Chg{Version=[3],New=[@Defn{Immediate_Reclamation restriction}],
775 Old=[]}
776 @begin{Discussion}
777 Immediate reclamation would apply to storage created by the compiler, such
778 as for a return value from a function whose size is not known at the
779 call site.
780 @end{Discussion}
781 @end{Description}
782
783 @leading@keepnext@b{Exception-related restriction:}
784
785 @begin{Description}
786 @Trailing@Defn2{Term=[restrictions],Sec=(No_Exceptions)}@Chg{Version=[3],New=[@Defn{No_Exceptions restriction}],
787 Old=[]}No_Exceptions @\@nt{Raise_statement}s
788 and @nt{exception_handler}s are not allowed.
789 No language-defined runtime checks are generated;
790 however, a runtime check performed automatically by the hardware
791 is permitted.
792 @begin{Discussion}
793
794 This restriction mirrors a method of working that is quite common in the
795 safety area. The programmer is required to show that exceptions cannot be
796 raised. Then a simplified run-time system is used without exception
797 handling. However, some hardware checks may still be enforced. If the
798 software check would have failed, or if the hardware check actually fails,
799 then the execution of the program is unpredictable.
800 There are obvious dangers in this approach, but it is similar to
801 programming at the assembler level.
802
803 @end{Discussion}
804 @end{Description}
805
806 @leading@keepnext@b{Other restrictions:}
807
808 @begin{Description}
809 @Defn2{Term=[restrictions],Sec=(No_Floating_Point)}@Chg{Version=[3],New=[@Defn{No_Floating_Point restriction}],
810 Old=[]}No_Floating_Point @\Uses of predefined floating point types and
811 operations, and declarations of new floating point types, are
812 not allowed.
813 @begin{Discussion}
814
815 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
816 The intention is to avoid the use of floating point hardware at run time,
817 but this is expressed in
818 language terms. It is conceivable that floating point is used implicitly in
819 some contexts, say fixed point type conversions of high accuracy. However,
820 the @ImplReqTitle below make it clear that the restriction would apply
821 to the @lquotes@;run-time system@rquotes@; and hence not be allowed.
822 This @Chg{Version=[2],New=[restriction],Old=[parameter]} could be used to
823 inform a compiler that a variant of the architecture is being used which does
824 not have floating point instructions.
825
826 @end{Discussion}
827
828 @Defn2{Term=[restrictions],Sec=(No_Fixed_Point)}@Chg{Version=[3],New=[@Defn{No_Fixed_Point restriction}],
829 Old=[]}No_Fixed_Point @\Uses of predefined fixed point types and
830 operations, and declarations of new fixed point types, are
831 not allowed.
832 @begin{Discussion}
833
834 This restriction would have the side effect of prohibiting the
835 @nt{delay_relative_statement}.
836 As with the No_Floating_Point restriction, this might be used to
837 avoid any question of rounding errors. Unless an Ada run-time is written in
838 Ada, it seems hard to rule out implicit use of fixed point, since at the
839 machine level, fixed point is virtually the same as integer arithmetic.
840
841 @end{Discussion}
842
843 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00394-01]}
844 @ChgDeleted{Version=[2],Text=[@Defn2{Term=[restrictions],
845 Sec=(No_Unchecked_Conversion)}No_Unchecked_Conversion @\Semantic dependence
846 on the predefined generic Unchecked_Conversion is not allowed.]}
847 @begin{Discussion}
848 @ChgRef{Version=[2],Kind=[DeletedNoDelMsg]}
849 @ChgDeleted{Version=[2],Text=[Most critical applications would require
850 some restrictions or additional validation checks on uses of unchecked
851 conversion. If the application does not require the functionality, then
852 this restriction provides a means of ensuring the design requirement has
853 been satisfied. The same applies to several of the following restrictions.]}
854 @end{Discussion}
855
856 No_Access_Subprograms @\The declaration of access-to-subprogram types
857 is not allowed.
858 @Defn2{Term=[restrictions],Sec=(No_Access_Subprograms)}@Chg{Version=[3],New=[@Defn{No_Access_Subprograms restriction}],
859 Old=[]}
860 @begin{Discussion}@ChgNote{Moved from above}
861 @ChgRef{Version=[2],Kind=[Added]}
862 @ChgAdded{Version=[2],Text=[Most critical applications would require
863 some restrictions or additional validation checks on uses of
864 access-to-subprogram types. If the application does not require the
865 functionality, then this restriction provides a means of ensuring the design
866 requirement has been satisfied. The same applies to several of the following
867 restrictions, and to restriction No_Dependence => Ada.Unchecked_Conversion.]}
868 @end{Discussion}
869
870 @Defn2{Term=[restrictions],Sec=(No_Unchecked_Access)}@Chg{Version=[3],New=[@Defn{No_Unchecked_Access restriction}],
871 Old=[]}No_Unchecked_Access @\The @attr[Unchecked_Access] attribute
872 is not allowed.
873
874 @Defn2{Term=[restrictions],Sec=(No_Dispatch)}@Chg{Version=[3],New=[@Defn{No_Dispatch restriction}],
875 Old=[]}No_Dispatch @\Occurrences of T'Class are not allowed, for any
876 (tagged)
877 subtype T.
878
879 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
880 @ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0318-1]}
881 @Defn2{Term=[restrictions],Sec=(No_IO)}@Chg{Version=[3],New=[@Defn{No_IO restriction}],
882 Old=[]}No_IO @\Semantic dependence on
883 any of the library units
884 Sequential_IO, Direct_IO, Text_IO, Wide_Text_IO, @Chg{Version=[2],
885 New=[Wide_Wide_Text_IO, ],Old=[]}@Chg{Version=[5],New=[],Old=[or ]}Stream_IO@Chg{Version=[5],New=[,
886 or Directories],Old=[]} is not allowed.
887 @begin{Discussion}
888
889 Excluding the input-output facilities of an implementation may be needed
890 in those environments which cannot support the supplied functionality.
891 A program in such an environment is likely to require some low level
892 facilities or a call on a non-Ada feature.
893
894 @end{Discussion}
895
896 @Defn2{Term=[restrictions],Sec=(No_Delay)}@Chg{Version=[3],New=[@Defn{No_Delay restriction}],
897 Old=[]}No_Delay @\@nt[Delay_Statement]s
898 and semantic dependence on package Calendar
899 are not allowed.
900 @begin[Ramification]
901 This implies that @nt[delay_alternative]s in a
902 @nt[select_statement] are prohibited.
903
904 The purpose of this restriction is to avoid the need for timing facilities
905 within the run-time system.
906
907 @end[ramification]
908
909 @Defn2{Term=[restrictions],Sec=(No_Recursion)}@Chg{Version=[3],New=[@Defn{No_Recursion restriction}],
910 Old=[]}No_Recursion @\As part of the execution of a subprogram, the same
911 subprogram is not invoked.
912
913 @Defn2{Term=[restrictions],Sec=(No_Reentrancy)}@Chg{Version=[3],New=[@Defn{No_Reentrancy restriction}],
914 Old=[]}No_Reentrancy @\During the execution of a subprogram by a task, no other
915 task invokes the same subprogram.
916
917 @ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0079-3]}
918 @ChgAdded{Version=[5],Text=[@Defn2{Term=[restrictions],Sec=(No_Unspecified_Globals)}
919 @Defn{No_Unspecified_Globals restriction}No_Unspecified_Globals@\No
920 library-level entity shall have a Global aspect of Unspecified,
921 either explicitly or by default. No library-level entity shall
922 have a Global'Class aspect of Unspecified, explicitly or by
923 default, if it is used as part of a dispatching call.]}
924
925 @begin{Ramification}
926 @ChgRef{Version=[5],Kind=[AddedNormal]}
927 @ChgAdded{Version=[5],Text=[Global'Class need not be specified on an
928 operation if there are no dispatching calls to the operation, or if all
929 of the dispatching calls are covered by
930 @nt{dispatching_operation_specifier}s for operations with such calls
931 (see @RefSecNum{Extensions to Global and Global'Class Aspects}).]}
932 @end{Ramification}
933
934 @ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0079-3]}
935 @ChgAdded{Version=[5],Type=[Leading],Text=[@Defn2{Term=[restrictions],Sec=(No_Hidden_Indirect_Globals)}
936 @Defn{No_Hidden_Indirect_Globals restriction}No_Hidden_Indirect_Globals@\When
937 within a context where the applicable Global aspect is neither
938 Unspecified nor @key[in out all], any execution within such a
939 context does neither of the following:]}
940
941 @begin{Itemize}
942 @ChgRef{Version=[5],Kind=[Added]}
943 @ChgAdded{Version=[5],Text=[Update a variable that is reachable via a
944 sequence of zero or more dereferences of access-to-object values from
945 a formal parameter of mode @key[in] (after any @key[overriding] @en
946 see @RefSecNum{Extensions to Global and Global'Class Aspects}), or from
947 a global that is not within the applicable global variable set,
948 or has mode @key[in];]}
949
950 @ChgRef{Version=[5],Kind=[Added]}
951 @ChgAdded{Version=[5],Text=[Read a variable that is updatable via a
952 sequence of zero or more dereferences of access-to-object values
953 from a global that is not within the applicable global variable set.]}
954 @end{Itemize}
955
956 @begin{Ramification}
957 @ChgRef{Version=[5],Kind=[AddedNormal]}
958 @ChgAdded{Version=[5],Text=[The above two rules specify that any
959 indirect references are covered by the Global or formal
960 parameter modes that apply, and are @i{not} subject to
961 alternative paths of access (such as aliasing) that could
962 result in conflicts.]}
963 @end{Ramification}
964
965 @ChgRef{Version=[5],Kind=[Added]}
966 @ChgAdded{Version=[5],NoPrefix=[T],Text=[For the purposes of the above
967 rules, if an applicable global variable set includes a package name,
968 and the collection of some pool-specific access type (see
969 @RefSecNum{Completion and Finalization}) is implicitly declared in a
970 part of the declarative region of the package included within the
971 global variable set, then all objects allocated from that
972 collection are considered included within the global variable set.]}
973
974 @ChgRef{Version=[5],Kind=[Added]}
975 @ChgAdded{Version=[5],NoPrefix=[T],Text=[The consequences of violating the
976 No_Hidden_Indirect_Globals restriction is implementation-defined. Any
977 aspects or other means for identifying such violations prior to or
978 during execution are implementation-defined.]}
979 @ChgImplDef{Version=[5],Kind=[Added],Text=[@ChgAdded{Version=[5],
980 Text=[The consequences of violating No_Hidden_Indirect_Globals.]}]}
981
982 @begin{Discussion}
983 @ChgRef{Version=[5],Kind=[AddedNormal]}
984 @ChgAdded{Version=[5],Text=[We do not make violations automatically
985 erroneous, because if the implementation chooses to never fully
986 trust it, there is nothing erroneous that can happen. If an
987 implementation chooses to trust the restriction, and performs
988 some optimization as a result of the restriction, the
989 implementation would define such a violation as erroneous. Such
990 an implementation might also endeavor to detect most violations,
991 perhaps by providing additional aspects, thereby reducing the
992 situations which result in erroneous execution. Implementations
993 might detect some but not all violations of the restrictions.
994 Implementations that completely ignore the restriction should
995 treat the restriction as an unsupported capability of
996 @RefSec{High Integrity Systems}.]}
997 @end{Discussion}
998
999 @end{description}
1000 @end{StaticSem}
1001
1002 @begin{Runtime}
1003
1004 @ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0020-1],ARef=[AI12-0340-1]}
1005 @ChgAdded{Version=[5],Type=[Leading],Text=[The following
1006 @SynI{restriction_parameter_}@nt{identifier} is language defined:]}
1007
1008 @begin{description}
1009
1010 @ChgRef{Version=[5],Kind=[Added]}
1011 @ChgAdded{Version=[5],Text=[@Defn2{Term=[restrictions],Sec=(Max_Image_Length)}
1012 @Defn{Max_Image_Length restriction}Max_Image_Length@\Specifies the maximum
1013 length for the result of an Image, Wide_Image, or Wide_Wide_Image attribute.
1014 Violation of this restriction results in the raising of Program_Error at
1015 the point of the invocation of an
1016 image attribute.@Defn2{Term=(Program_Error),Sec=(raised by failure of runtime check)}
1017 @IndexCheck{Program_Error_Check}]}
1018
1019 @end{description}
1020
1021 @end{Runtime}
1022
1023 @begin{ImplReq}
1024
1025 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00394-01]}
1026 @ChgRef{Version=[5],Kind=[RevisedAdded]}@ChgNote{Just a paragraph number change}
1027 @ChgAdded{Version=[2],Type=[Leading],Text=[An implementation of this Annex
1028 shall support:]}
1029 @begin{Itemize}
1030 @ChgRef{Version=[2],Kind=[Added]}
1031 @ChgRef{Version=[5],Kind=[RevisedAdded]}@ChgNote{Just a paragraph number change}
1032 @ChgAdded{Version=[2],Text=[the restrictions defined in this subclause; and]}
1033
1034 @ChgRef{Version=[2],Kind=[Added]}
1035 @ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0189-1]}
1036 @ChgRef{Version=[5],Kind=[RevisedAdded]}@ChgNote{Just a paragraph number change}
1037 @ChgAdded{Version=[2],Text=[the following restrictions defined in
1038 @RefSecNum{Tasking Restrictions}: No_Task_Hierarchy,
1039 No_Abort_Statement, No_Implicit_Heap_Allocation@Chg{Version=[3],New=[,
1040 No_Standard_Allocators_After_Elaboration], Old=[]}; and]}
1041
1042 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00347-01]}
1043 @ChgRef{Version=[5],Kind=[RevisedAdded]}@ChgNote{Just a paragraph number change}
1044 @ChgAdded{Version=[2],Text=[the @key{pragma} Profile(Ravenscar); and]}
1045 @begin{Discussion}
1046 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00347-01]}
1047 @ChgAdded{Version=[2],Text=[The reference to pragma Profile(Ravenscar) is
1048 intended to show that properly restricted tasking is appropriate for use
1049 in high integrity systems. The Ada 95
1050 Annex seemed to suggest that tasking was inappropriate for such systems.]}
1051 @end{Discussion}
1052
1053 @ChgRef{Version=[2],Kind=[Added]}
1054 @ChgRef{Version=[5],Kind=[RevisedAdded]}@ChgNote{Just a paragraph number change}
1055 @ChgAdded{Version=[2],Type=[Leading],Text=[the following uses of
1056 @SynI{restriction_parameter_}@nt{identifier}s defined in
1057 @RefSecNum{Tasking Restrictions}@Redundant[, which are checked
1058 prior to program execution]:]}
1059 @begin{InnerItemize}
1060 @ChgRef{Version=[2],Kind=[Added]}
1061 @ChgRef{Version=[5],Kind=[RevisedAdded]}@ChgNote{Just a paragraph number change}
1062 @ChgAdded{Version=[2],Text=[Max_Task_Entries => 0,]}
1063
1064 @ChgRef{Version=[2],Kind=[Added]}
1065 @ChgRef{Version=[5],Kind=[RevisedAdded]}@ChgNote{Just a paragraph number change}
1066 @ChgAdded{Version=[2],Text=[Max_Asynchronous_Select_Nesting => 0, and]}
1067
1068 @ChgRef{Version=[2],Kind=[Added]}
1069 @ChgRef{Version=[5],Kind=[RevisedAdded]}@ChgNote{Just a paragraph number change}
1070 @ChgAdded{Version=[2],Text=[Max_Tasks => 0.]}
1071 @end{InnerItemize}
1072 @end{Itemize}
1073
1074 @ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0020-1],ARef=[AI12-0340-1]}
1075 @ChgAdded{Version=[5],Text=[If a Max_Image_Length restriction applies to any
1076 compilation unit in the partition, then for any subtype S, S'Image,
1077 S'Wide_Image, and S'Wide_Wide_Image
1078 shall be implemented within that partition without any dynamic allocation.]}
1079
1080 @begin{ImplNote}
1081 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0340-1]}
1082 @ChgAdded{Version=[5],Text=[Assuming the @ImplAdviceTitle is followed, this
1083 can be accomplished by using an object of the
1084 Text_Buffers.Bounded.Buffer_Type with the maximum characters as specified
1085 in the Max_Image_Length restriction.]}
1086 @end{ImplNote}
1087
1088 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0263-1],ARef=[AI05-0272-1]}
1089 @ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0308-1]}
1090 If an implementation supports @nt[pragma] Restrictions for a particular
1091 argument, then except for the restrictions
1092 @Chg{Version=[5],New=[],Old=[No_Unchecked_Deallocation,
1093 No_Unchecked_Conversion, ]}No_Access_Subprograms,
1094 @Chg{Version=[3],New=[],Old=[and ]}No_Unchecked_Access,
1095 @Chg{Version=[3],New=[No_Specification_of_Aspect, No_Use_of_Attribute,
1096 No_Use_of_Pragma, @Chg{Version=[5],New=[No_Dependence =>
1097 Ada.Unchecked_Conversion, ],Old=[]}and
1098 @Chg{Version=[5],New=[],Old=[the equivalent use of]}
1099 No_Dependence@Chg{Version=[5],New=[ => Ada.Unchecked_Deallocation],Old=[]},
1100 ],Old=[]}the associated restriction applies to the run-time system.
1101 @begin[reason]
1102 Permission is granted for the run-time system to use the specified
1103 otherwise-restricted features, since the use of these features may
1104 simplify the run-time system by allowing more of it to be written
1105 in Ada.
1106 @end[reason]
1107 @begin{Discussion}
1108
1109 The restrictions that are applied to the partition are also applied to the
1110 run-time system. For example, if No_Floating_Point is specified,
1111 then an implementation that uses floating point for implementing the delay
1112 statement (say) would require that No_Floating_Point is
1113 only used in conjunction with No_Delay. It is clearly important that
1114 restrictions are effective so that Max_Tasks=0 does imply that tasking is
1115 not used, even implicitly (for input-output, say).
1116
1117 An implementation of tasking could be produced based upon a run-time
1118 system written in Ada in which the rendezvous was controlled by
1119 protected types. In this case, No_Protected_Types could only be used in
1120 conjunction with Max_Task_Entries=0. Other implementation dependencies
1121 could be envisaged.
1122
1123 If the run-time system is not written in Ada, then the wording needs to be
1124 applied in an appropriate fashion.
1125
1126 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0263-1]}
1127 @ChgRef{Version=[5],Kind=[DeletedNoDelMsg],ARef=[AI12-0308-1]}
1128 @ChgAdded{Version=[3],Text=[@Chg{Version=[5],New=[],Old=["the equivalent use
1129 of No_Dependence" refers to @exam{No_Dependence => Ada.Unchecked_Conversion} and
1130 the like, not all uses of No_Dependence.]}]}
1131
1132 @end{Discussion}
1133
1134 @end{ImplReq}
1135
1136 @begin{DocReq}
1137 If a pragma Restrictions(No_Exceptions) is specified, the implementation
1138 shall document the effects of all constructs where language-defined checks are
1139 still performed automatically (for example, an overflow check performed
1140 by the processor).
1141 @ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0],
1142 Text=[@ChgDeleted{Version=[2],
1143 Text=[Implementation-defined aspects of pragma Restrictions.]}]}
1144 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[
1145 If a pragma Restrictions(No_Exceptions) is specified, the effects of all
1146 constructs where language-defined checks are still performed.]}]}
1147 @begin{Discussion}
1148
1149 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
1150 The documentation requirements here are quite difficult to satisfy. One
1151 method is to review the object code generated and determine the checks that
1152 are still present, either explicitly, or implicitly within the architecture.
1153 As another example from that of overflow, consider the question of
1154 @Chg{Version=[2],New=[dereferencing],Old=[deferencing]} a null pointer.
1155 This could be undertaken by a memory access trap
1156 when checks are performed. When checks are suppressed via the argument
1157 No_Exceptions, it would not be necessary to have the memory access trap
1158 mechanism enabled.
1159
1160 @end{Discussion}
1161 @end{DocReq}
1162
1163 @begin{Erron}
1164 @PDefn2{Term=(erroneous execution),Sec=(cause)}
1165 Program execution is erroneous if pragma Restrictions(No_Exceptions)
1166 has been specified and the conditions arise under which a generated
1167 language-defined runtime check would fail.
1168 @begin{Discussion}
1169
1170 The situation here is very similar to the application of pragma Suppress.
1171 Since users are removing some of the protection the language
1172 provides, they had better be careful!
1173
1174 @end{Discussion}
1175
1176 @PDefn2{Term=(erroneous execution),Sec=(cause)}
1177 Program execution is erroneous if pragma Restrictions(No_Recursion)
1178 has been specified and a subprogram is invoked as part of its
1179 own execution,
1180 or if pragma Restrictions(No_Reentrancy) has been specified and
1181 during the execution of a subprogram by a task, another task invokes
1182 the same subprogram.
1183 @begin{Discussion}
1184
1185 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]}
1186 In practice, many implementations @Chg{Version=[3],New=[might],Old=[may]}
1187 not exploit the absence of recursion
1188 or need for reentrancy, in which case the program execution would be
1189 unaffected by the use of recursion or reentrancy, even though the program is
1190 still formally erroneous.
1191
1192 @end{Discussion}
1193 @end{Erron}
1194
1195 @ChgNote{I can't find any reason in the normative wording for this item;
1196 therefore I've removed it. The notes below (commented out anyway) refer only
1197 to a nonstandard mode, which is irrelevant in the Standard.}
1198 @ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0],
1199 Text=[@ChgDeleted{Version=[2],
1200 Text=[Any restrictions on pragma Restrictions.]}]}
1201
1202 @begin{Notes}
1203 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1204 @ChgAdded{Version=[2],Text=[Uses of @Syni{restriction_parameter_}@nt{identifier}
1205 No_Dependence defined in @RefSecNum{Language-Defined Restrictions and Profiles}:
1206 No_Dependence => Ada.@!Unchecked_@!Deallocation and No_Dependence =>
1207 Ada.@!Unchecked_@!Conversion may be appropriate for high-integrity systems.
1208 Other uses of No_Dependence can also be appropriate for high-integrity
1209 systems.]}
1210 @begin{Discussion}
1211 @ChgRef{Version=[2],Kind=[AddedNormal]}
1212 @ChgAdded{Version=[2],Text=[The specific mention of these two uses
1213 is meant to replace the identifiers now banished to
1214 @RefSec{Dependence Restriction Identifiers}.]}
1215
1216 @ChgRef{Version=[2],Kind=[AddedNormal]}
1217 @ChgAdded{Version=[2],Text=[Restriction No_Dependence => Ada.Unchecked_Deallocation
1218 would be useful in those
1219 contexts in which heap storage is needed on program start-up, but need not be
1220 increased subsequently. The danger of a dangling pointer can therefore be
1221 avoided.]}@ChgNote{Moved down from above.}
1222 @end{Discussion}
1223
1224 @end{Notes}
1225
1226 @begin{comment}
1227 @begin{Notes}
1228 The standard mode for pragma Restrictions is that a
1229 compilation unit
1230 (or a partition if at link time) is illegal
1231 if it makes use of a feature identified in the pragma.
1232 However, an implementation is allowed to have a mode of operation
1233 where it issues a warning message versus rejecting the unit or partition,
1234 and where the run-time system supplied for the partition
1235 includes support for the identified feature.
1236
1237 An implementation need not independently support the restrictions
1238 identified above, but may instead require that if a particular
1239 restriction is identified in a @nt(pragma) Restrictions, then
1240 other restrictions (the exact set of which is implementation defined)
1241 need also to be identified.
1242
1243 In such a case, if the additional
1244 restrictions are not specified in a @nt(pragma) Restrictions, and
1245 a unit or partition uses such a feature, the implementation should
1246 @begin{itemize}
1247 issue a warning that the pragma is being ignored (that is, the
1248 full RTS is being used),
1249
1250 identify to the user the additional restrictions that need to be
1251 specified in the pragma in order to obtain the reduced RTS, and
1252 identify any constructs that would use any of the features so
1253 proscribed
1254 @end{itemize}
1255 @end{Notes}
1256 @end{comment}
1257
1258 @begin{Extend95}
1259 @ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0042],ARef=[AI95-00130-01]}
1260 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1261 No_Local_Allocators no longer prohibits generic instantiations.]}
1262 @end{Extend95}
1263
1264 @begin{DiffWord95}
1265 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
1266 @ChgAdded{Version=[2],Text=[Wide_Wide_Text_IO (which is new) is added to the
1267 No_IO restriction.]}
1268
1269 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00347-01]}
1270 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]}
1271 @ChgAdded{Version=[2],Text=[The title of this @Chg{Version=[3],New=[subclause],Old=[clause]} was changed to match the
1272 change to the Annex title. Pragma Profile(Ravenscar) is part of this annex.]}
1273
1274 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1275 @ChgAdded{Version=[2],Text=[Restriction No_Dependence is used instead of
1276 special @i<restriction_>@nt<identifier>s. The old names are banished to
1277 Obsolescent Features (see @RefSecNum{Dependence Restriction Identifiers}).]}
1278
1279 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1280 @ChgAdded{Version=[2],Text=[The bizarre wording @lquotes@;apply in this
1281 Annex@rquotes (which no one quite can explain the meaning of) is banished.]}
1282 @end{DiffWord95}
1283
1284 @begin{Extend2005}
1285 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0152-1],ARef=[AI05-0190-1]}
1286 @ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005}Restrictions
1287 No_Anonymous_Allocators, No_Coextensions, and No_Access_Parameter_Allocators
1288 are new.]}
1289 @end{Extend2005}
1290
1291 @begin{DiffWord2005}
1292 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0189-1]}
1293 @ChgAdded{Version=[3],Text=[New restriction
1294 No_Standard_Allocators_After_Elaboration is added to the list of
1295 restrictions that are required by this annex.]}
1296
1297 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0263-1]}
1298 @ChgAdded{Version=[3],Text=[@b<Correction:> Ada 2005 restriction No_Dependence
1299 is added where needed (this was missed in Ada 2005).]}
1300
1301 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0272-1]}
1302 @ChgAdded{Version=[3],Text=[Restrictions against individual aspects, pragmas,
1303 and attributes do not apply to the run-time system, in order that an
1304 implementation can use whatever aspects, pragmas, and attributes are needed
1305 to do the job. For instance, attempting to write a run-time system for Linux
1306 that does not use the Import aspect would be very difficult and probably is
1307 not what the user is trying to prevent anyway.]}
1308 @end{DiffWord2005}
1309
1310 @begin{Incompatible2012}
1311 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0318-1]}
1312 @ChgAdded{Version=[5],Text=[@Defn{incompatibilities with Ada 2012}@b<Correction:>
1313 Restriction No_IO now excludes use of Ada.Directories. If a program using
1314 No_IO used Ada.Directories, it would be legal in Ada 2012 and illegal
1315 in Ada 202x. However, given the role of Ada.Directories as a support package
1316 for the other packages that are excluded by No_IO, it seems unlikely that
1317 any use of the restriction would use this package (and it's possible that
1318 implementations wouldn't support its use with No_IO anyway).]}
1319 @end{Incompatible2012}
1320
1321 @begin{Extend2012}
1322 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0020-1]}
1323 @ChgAdded{Version=[5],Text=[@Defn{extensions to Ada 2012}Restriction
1324 Max_Image_Length is new.]}
1325
1326 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1327 @ChgAdded{Version=[5],Text=[Restrictions No_Unspecified_Globals
1328 and No_Hidden_Indirect_Globals are new.]}
1329 @end{Extend2012}
1330
1331
1332
1333 @LabeledAddedSubClause{Version=[5],Name=[Aspect No_Controlled_Parts]}
1334
1335 @begin{StaticSem}
1336
1337 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0256-1]}
1338 @ChgAdded{Version=[5],Type=[Leading],Text=[For a type, the following
1339 type-related, operational aspect may be specified:]}
1340
1341 @begin{Description}
1342 @ChgRef{Version=[5],Kind=[AddedNormal]}
1343 @ChgAdded{Version=[5],Text=[No_Controlled_Parts@\The type of this aspect
1344 is Boolean. If True, requires that the type and any
1345 descendants do not have any controlled parts. If specified, the
1346 value of the expression shall be static. If not specified, the value of
1347 this aspect is False.]}
1348
1349 @ChgAspectDesc{Version=[5],Kind=[AddedNormal],Aspect=[No_Controlled_Parts],
1350 Text=[@ChgAdded{Version=[5],Text=[A specification that a type and
1351 its descendants do not have controlled parts.]}]}
1352 @end{Description}
1353
1354 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0256-1]}
1355 @ChgAdded{Version=[5],Text=[The No_Controlled_Parts aspect is nonoverridable
1356 (see @RefSecNum{Aspect Specifications}).]}
1357 @end{StaticSem}
1358
1359 @begin{Legality}
1360
1361 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0256-1]}
1362 @ChgAdded{Version=[5],Text=[If No_Controlled_Parts is True for a type, no
1363 component of the type shall have a controlled part nor shall the type itself be
1364 controlled. In addition to the places where @LegalityTitle normally apply
1365 (see @RefSecNum{Generic Instantiation}), this rule also applies in the private
1366 part of an instance of a generic unit.@PDefn{generic contract issue}]}
1367
1368 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0256-1]}
1369 @ChgAdded{Version=[5],Text=[When enforcing the above rule within a generic body,
1370 a generic formal private type and a generic formal derived type of a composite
1371 type are considered to have a controlled part.]}
1372
1373 @begin{Reason}
1374 @ChgRef{Version=[5],Kind=[AddedNormal]}
1375 @ChgAdded{Version=[5],Text=[This is a typical generic assume-the-worst rule.]}
1376 @end{Reason}
1377
1378 @end{Legality}
1379
1380 @begin{Extend2012}
1381 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0256-1]}
1382 @ChgAdded{Version=[5],Text=[@Defn{extensions to Ada 2012}Aspect
1383 No_Controlled_Parts is new.]}
1384 @end{Extend2012}
1385
1386
1387
1388 @LabeledAddedClause{Version=[2],Name=[Pragma Detect_Blocking]}
1389
1390 @begin{Intro}
1391 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1392 @ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0267-1]}
1393 @ChgAdded{Version=[2],Text=[The following @nt{pragma}
1394 @Chg{Version=[5],New=[requires],Old=[forces]} an implementation
1395 to detect potentially blocking operations @Chg{Version=[5],New=[during
1396 the execution of],Old=[within]} a protected operation@Chg{Version=[5],New=[ or
1397 a parallel construct],Old=[]}.]}
1398 @end{Intro}
1399
1400 @begin{Syntax}
1401 @begin{SyntaxText}
1402 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1403 @ChgAdded{Version=[2],Type=[Leading],Keepnext=[T],Text=[The form of a
1404 @nt{pragma} Detect_Blocking is as follows:]}
1405 @end{SyntaxText}
1406 @ChgRef{Version=[2],Kind=[AddedNormal]}
1407 @AddedPragmaSyn<Version=[2],@ChgAdded{Version=[2],
1408 Text=[@key{pragma} @prag<Detect_Blocking>;]}>
1409 @end{Syntax}
1410
1411 @begin{LinkTime}
1412 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1413 @ChgAdded{Version=[2],Text=[@PDefn2{Term=[configuration pragma], Sec=(Detect_Blocking)}
1414 @PDefn2{Term=[pragma, configuration], Sec=(Detect_Blocking)}
1415 A @nt{pragma} Detect_Blocking is a configuration
1416 pragma.]}
1417 @end{LinkTime}
1418
1419 @begin{RunTime}
1420 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1421 @ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0247-1],ARef=[AI12-0267-1]}
1422 @ChgAdded{Version=[2],Text=[An implementation is required to detect a
1423 potentially blocking operation @Chg{Version=[5],New=[that occurs during the
1424 execution of],Old=[within]}
1425 a protected operation@Chg{Version=[5],New=[ or a parallel construct defined
1426 within a compilation unit to which the pragma applies],Old=[]},
1427 and to raise@Defn2{Term=(Program_Error),Sec=(raised by deteection of a bounded error)}
1428 Program_Error (see @Chg{Version=[5],New=[@RefSecNum{Intertask Communication}],
1429 Old=[@RefSecNum{Protected Subprograms and Protected Actions}]}).]}
1430 @end{RunTime}
1431
1432 @begin{ImplPerm}
1433 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1434 @ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0267-1]}
1435 @ChgAdded{Version=[2],Text=[An implementation is allowed to reject a
1436 @nt{compilation_unit} @Chg{Version=[5],New=[to which a
1437 pragma Detect_Blocking applies ],Old=[]}if a potentially blocking operation
1438 is present directly within an @nt{entry_body}@Chg{Version=[5],New=[,],Old=[ or]}
1439 the body of a protected subprogram@Chg{Version=[5],New=[, or a parallel construct
1440 occurring within the compilation unit],Old=[]}.]}
1441 @end{ImplPerm}
1442
1443 @begin{Notes}
1444 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1445 @ChgAdded{Version=[2],Text=[An operation that causes a task to be blocked
1446 within a foreign language domain is not defined to be potentially blocking,
1447 and need not be detected.]}
1448 @end{Notes}
1449
1450 @begin{Extend95}
1451 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1452 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1453 Pragma Detect_Blocking is new.]}
1454 @end{Extend95}
1455
1456 @begin{Extend2012}
1457 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI12-0267-1]}
1458 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 2012}
1459 Pragma Detect_Blocking now applies to parallel constructs as well as
1460 protected actions.]}
1461 @end{Extend2012}
1462
1463
1464 @RMNewPageVer{Version=[2]}@Comment{For printed version of Ada 2005 RM}
1465 @LabeledAddedClause{Version=[2],Name=[Pragma Partition_Elaboration_Policy]}
1466
1467 @begin{Intro}
1468 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1469 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]}
1470 @ChgAdded{Version=[2],Text=[This @Chg{Version=[3],New=[subclause],Old=[clause]}
1471 defines a @nt{pragma} for user control over elaboration policy.]}
1472 @end{Intro}
1473
1474 @begin{Syntax}
1475 @begin{SyntaxText}
1476 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1477 @ChgAdded{Version=[2],Type=[Leading],Keepnext=[T],Text=[The form of a
1478 @nt{pragma} Partition_Elaboration_Policy is as follows:]}
1479 @end{SyntaxText}
1480 @ChgRef{Version=[2],Kind=[AddedNormal]}
1481 @AddedPragmaSyn<Version=[2],@ChgAdded{Version=[2],
1482 Text=[@key{pragma} @prag<Partition_Elaboration_Policy> (@SynI<policy_>@Syn2<identifier>);]}>
1483
1484 @begin{SyntaxText}
1485 @ChgRef{Version=[2],Kind=[AddedNormal]}
1486 @ChgAdded{Version=[2],Text=[The @SynI<policy_>@nt{identifier} shall be either
1487 Sequential, Concurrent or an implementation-defined identifier.]}
1488 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[Implementation-defined
1489 @SynI<policy_>@nt<identifier>s allowed in a @nt{pragma} Partition_Elaboration_Policy.],Old=[]}]}
1490
1491 @begin{Ramification}
1492 @ChgRef{Version=[3],Kind=[AddedNormal]}
1493 @ChgAdded{Version=[3],Text=[Note that the Ravenscar profile (see
1494 @RefSecNum{The Ravenscar and Jorvik Profiles}) has nothing to say about which
1495 Partition_Elaboration_Policy is used. This was intentionally omitted from the
1496 profile, as there was no agreement as to whether the Sequential policy should
1497 be required for Ravenscar programs. As such it was defined separately.]}
1498 @end{Ramification}
1499 @end{SyntaxText}
1500 @end{Syntax}
1501
1502 @begin{LinkTime}
1503 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1504 @ChgAdded{Version=[2],Text=[@PDefn2{Term=[configuration pragma], Sec=(Partition_Elaboration_Policy)}
1505 @PDefn2{Term=[pragma, configuration], Sec=(Partition_Elaboration_Policy)}
1506 A @nt{pragma} Partition_Elaboration_Policy is a configuration pragma.
1507 It specifies the elaboration policy for a partition.
1508 At most one elaboration policy shall be specified for a partition.]}
1509
1510 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1511 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]}
1512 @ChgAdded{Version=[2],Text=[If the Sequential policy is
1513 specified for a partition@Chg{Version=[3],New=[,],Old=[]} then pragma
1514 Restrictions (No_Task_Hierarchy) shall also be specified for the partition.]}
1515 @end{LinkTime}
1516
1517 @begin{RunTime}
1518 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1519 @ChgAdded{Version=[2],Text=[Notwithstanding@Defn{notwithstanding} what this
1520 International Standard
1521 says elsewhere, this @nt{pragma} allows partition elaboration rules concerning
1522 task activation and interrupt attachment to be changed. If the
1523 @SynI{policy_}@nt{identifier} is Concurrent, or if there is no pragma
1524 Partition_Elaboration_Policy defined for the partition, then the rules defined
1525 elsewhere in this Standard apply.]}
1526
1527 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1528 @ChgAdded{Version=[2],Type=[Leading],Text=[If the partition elaboration policy
1529 is Sequential, then task activation and interrupt attachment are performed in
1530 the following sequence of steps:]}
1531
1532 @begin{Itemize}
1533 @ChgRef{Version=[2],Kind=[AddedNormal]}
1534 @ChgAdded{Version=[2],Text=[The activation of all library-level tasks and the
1535 attachment of interrupt handlers are deferred until all library units are
1536 elaborated.]}
1537
1538 @ChgRef{Version=[2],Kind=[AddedNormal]}
1539 @ChgAdded{Version=[2],Text=[The interrupt handlers are attached by the
1540 environment task.]}
1541
1542 @ChgRef{Version=[2],Kind=[AddedNormal]}
1543 @ChgAdded{Version=[2],Text=[The environment task is suspended while the
1544 library-level tasks are activated.]}
1545
1546 @ChgRef{Version=[2],Kind=[AddedNormal]}
1547 @ChgAdded{Version=[2],Text=[The environment task executes the main subprogram
1548 (if any) concurrently with these executing tasks.]}
1549 @end{Itemize}
1550
1551 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1552 @ChgAdded{Version=[2],Text=[If several dynamic interrupt handler attachments for
1553 the same interrupt are deferred, then the most recent call of
1554 Attach_Handler or Exchange_Handler determines which handler is attached.]}
1555
1556 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1557 @ChgAdded{Version=[2],Text=[If any deferred task activation fails, Tasking_Error
1558 is raised at the beginning of the sequence of statements of the
1559 body of the environment task prior to calling the
1560 main subprogram.]}
1561
1562 @end{RunTime}
1563
1564 @begin{ImplAdvice}
1565 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1566 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]}
1567 @ChgAdded{Version=[2],Text=[If the partition elaboration policy is Sequential
1568 and the Environment task becomes permanently blocked during
1569 elaboration@Chg{Version=[3],New=[,],Old=[]} then the partition is deadlocked and
1570 it is recommended that the partition be immediately terminated.]}
1571 @ChgImplAdvice{Version=[3],Kind=[Revised],InitialVersion=[2],
1572 Text=[@ChgAdded{Version=[2],
1573 Text=[If the partition elaboration policy is Sequential
1574 and the Environment task becomes permanently blocked during
1575 elaboration@Chg{Version=[3],New=[,],Old=[]} then
1576 the partition should be immediately terminated.]}]}
1577
1578 @end{ImplAdvice}
1579
1580 @begin{ImplPerm}
1581 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1582 @ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]}
1583 @ChgAdded{Version=[2],Text=[If the partition elaboration policy is Sequential
1584 and any task activation fails@Chg{Version=[3],New=[,],Old=[]} then an
1585 implementation may immediately terminate the active partition to mitigate the
1586 hazard posed by continuing to execute with a subset of the tasks being active.]}
1587 @end{ImplPerm}
1588
1589 @begin{Notes}
1590 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00421-01]}
1591 @ChgAdded{Version=[2],Text=[If any deferred task activation fails, the
1592 environment task is unable to handle the Tasking_Error exception and completes
1593 immediately. By contrast, if the partition elaboration policy is Concurrent,
1594 then this exception could be handled within a library unit.]}
1595 @end{Notes}
1596
1597
1598 @begin{Extend95}
1599 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1600 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1601 @nt{Pragma} Partition_Elaboration_Policy is new.]}
1602 @end{Extend95}
1603
1604
1605 @LabeledAddedClause{Version=[5],Name=[Extensions to Global and Global'Class Aspects]}
1606
1607 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1608 @ChgAdded{Version=[5],Text=[In addition to the entities specified in
1609 @RefSecNum{The Global and Global'Class Aspects}, the Global aspect may be
1610 specified for a subtype (including a formal subtype), formal package,
1611 formal subprogram, and formal object of an anonymous
1612 access-to-subprogram type.]}
1613
1614 @begin{Syntax}
1615
1616 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1617 @ChgAdded{Version=[5],Type=[Leading],Text=[The following additional syntax is
1618 provided for specifying Global and Global'Class aspects, to more precisely
1619 describe the use of generic formal parameters and dispatching calls within
1620 the execution of an operation:]}
1621
1622 @ChgRef{Version=[5],Kind=[AddedNormal]}
1623 @noprefix@AddedSyn{Version=[5],lhs=<@Chg{Version=[5],New=<extended_global_aspect_definition>,Old=<>}>,
1624 rhs="@Chg{Version=[5],New=<
1625 @key[use] @Syn2{formal_parameter_designator}
1626 | @key[do] @Syn2{dispatching_operation_specifier}>,Old=<>}"}
1627
1628 @ChgRef{Version=[5],Kind=[AddedNormal]}
1629 @noprefix@AddedSyn{Version=[5],lhs=<@Chg{Version=[5],New=<extended_global_aspect_element>,Old=<>}>,
1630 rhs="@Chg{Version=[5],New=<
1631 @key[use] @Syn2{formal_parameter_set}
1632 | @key[do] @Syn2{dispatching_operation_set}>,Old=<>}"}
1633
1634 @ChgRef{Version=[5],Kind=[AddedNormal]}
1635 @noprefix@AddedSyn{Version=[5],lhs=<@Chg{Version=[5],New=<extended_global_mode>,Old=<>}>,
1636 rhs="@Chg{Version=[5],New=<
1637 @key[overriding] @Syn2{basic_global_mode}>,Old=<>}"}
1638
1639 @ChgRef{Version=[5],Kind=[AddedNormal]}
1640 @noprefix@AddedSyn{Version=[5],lhs=<@Chg{Version=[5],New=<formal_parameter_designator>,Old=<>}>,
1641 rhs="@Chg{Version=[5],New=<
1642 @Syn2{formal_group_designator}
1643 | @Syn2{formal_parameter_name}>,Old=<>}"}
1644
1645 @ChgRef{Version=[5],Kind=[AddedNormal]}
1646 @noprefix@AddedSyn<Version=[5],lhs=<@Chg{Version=[5],New=<formal_parameter_set>,Old=<>}>,
1647 rhs="@Chg<Version=[5],New=<
1648 @Syn2{formal_group_designator}
1649 | @Syn2[formal_parameter_name]{, @Syn2[formal_parameter_name]}>,Old=<>>">
1650
1651 @ChgRef{Version=[5],Kind=[AddedNormal]}
1652 @noprefix@AddedSyn{Version=[5],lhs=<@Chg{Version=[5],New=<formal_group_designator>,Old=<>}>,
1653 rhs="@Chg{Version=[5],New=<@key[null] | @key[all]>,Old=<>}"}
1654
1655 @ChgRef{Version=[5],Kind=[AddedNormal]}
1656 @noprefix@AddedSyn{Version=[5],lhs=<@Chg{Version=[5],New=<formal_parameter_name>,Old=<>}>,
1657 rhs="@Chg{Version=[5],New=<
1658 @SynI{formal_}@Syn2{subtype_mark}
1659 | @SynI{formal_subprogram_}@Syn2{name}
1660 | @SynI{formal_access_to_subprogram_object_}@Syn2{name}>,Old=<>}"}
1661
1662 @ChgRef{Version=[5],Kind=[AddedNormal]}
1663 @noprefix@AddedSyn<Version=[5],lhs=<@Chg{Version=[5],New=<dispatching_operation_set>,Old=<>}>,
1664 rhs="@Chg<Version=[5],New=<
1665 @Syn2[dispatching_operation_specifier]{, @Syn2[dispatching_operation_specifier]}>,Old=<>>">
1666
1667 @ChgRef{Version=[5],Kind=[AddedNormal]}
1668 @noprefix@AddedSyn{Version=[5],lhs=<@Chg{Version=[5],New=<dispatching_operation_specifier>,Old=<>}>,
1669 rhs="@Chg{Version=[5],New=<
1670 @SynI{dispatching_operation_}@Syn2{name} (@SynI{object_}@Syn2{name})>,Old=<>}"}
1671
1672 @end{Syntax}
1673
1674 @begin{Resolution}
1675
1676 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1677 @ChgAdded{Version=[5],Text=[A @nt{formal_parameter_name} shall resolve to
1678 statically denote a formal subtype, a formal subprogram, or a formal object of
1679 an anonymous access-to-subprogram type.]}
1680
1681 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1682 @ChgAdded{Version=[5],Text=[The @SynI{object_}@nt{name} that is associated with
1683 an @key[overriding] mode shall resolve to statically denote a formal object, or
1684 a formal parameter of the associated entity.]}
1685
1686 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1687 @ChgAdded{Version=[5],Text=[The @SynI{object_}@nt{name} of a
1688 @nt{dispatching_operation_specifier} shall resolve to
1689 statically name an object (including possibly a formal parameter) of a
1690 tagged class-wide type @i{T}'Class; the @SynI{dispatching_operation_}@nt{name} of
1691 the @nt{dispatching_operation_specifier} shall resolve to statically denote a
1692 dispatching operation associated with @i{T}.]}
1693
1694 @end{Resolution}
1695
1696 @begin{StaticSem}
1697
1698 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1699 @ChgAdded{Version=[5],Text=[The presence of the reserved word @b<overriding>
1700 in a global mode indicates that the specification is overriding the mode of a
1701 formal parameter with another mode to reflect the overall effect of an
1702 invocation of the callable entity on the state associated with the
1703 corresponding actual parameter.]}
1704
1705 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1706 @ChgAdded{Version=[5],Text=[The @nt{extended_global_aspect_definition} and
1707 @nt{extended_global_aspect_element} can be used to define as part of the
1708 Global aspect the @i<formal parameter set>@Defn{formal parameter set} and
1709 the @i<dispatching operation set>@Defn{dispatching operation set} used within
1710 an operation. The formal parameter set is identified by a set of formal
1711 parameter names after the reserved word @key[use]. Alternatively, the reserved
1712 word @key[null] may be used to indicate none of the generic formal parameters,
1713 or @key[all] to indicate all of the generic formal parameters, of any enclosing
1714 generic unit (or visible formal package) might be used within the execution of
1715 the operation. If there is no formal parameter set specified for an
1716 operation declared within a generic unit, it defaults to @key[use all].]}
1717
1718 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1719 @ChgAdded{Version=[5],Text=[The dispatching operation set is identified by
1720 a set of @nt{dispatching_operation_specifier}s after the reserved word
1721 @key[do]. It indicates that the Global effects of dispatching calls that
1722 @i<match>@Defn2{Term=[match],Sec=(dispatching call to a @nt{dispatching_operation_specifier})}
1723 one of the specifiers need not be accounted for by other elements of the
1724 Global aspect, but are instead to be accounted for by the invoker of the
1725 operation. A dispatching call @i<matches> a @nt{dispatching_operation_specifier}
1726 if the @nt{name} or @nt{prefix} of the call statically denotes the same
1727 operation(s) as that of the @nt{dispatching_operation_specifier}, and at least
1728 one of the objects controlling the call is denoted by a name that statically
1729 names the same object as that denoted by the @i<object_>@nt{name} of the
1730 @nt{dispatching_operation_specifier}. In the absence of any
1731 @nt{dispatching_operation_specifier}s, all dispatching calls within the
1732 operation are presumed to have the effects determined by the set of
1733 Global'Class aspects that apply to the invoked dispatching operation.]}
1734
1735 @begin{Ramification}
1736 @ChgRef{Version=[5],Kind=[AddedNormal]}
1737 @ChgAdded{Version=[5],Text=[The object @ldquote@;controlling the call@rdquote
1738 is not necessarily a controlling parameter of the call if the call is a
1739 function with a controlling result or has parameters that is such a
1740 function. It @i<is> one of the objects that provide the dispatching tag used
1741 for the call; that could, for example, be a parameter of a function used as
1742 a parameter to the call, or an object being assigned to, or a parameter of
1743 an enclosing call.]}
1744 @end{Ramification}
1745
1746 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1747 @ChgAdded{Version=[5],Text=[The Global aspect for a subtype identifies the
1748 global variables that might be referenced during default initialization,
1749 adjustment as part of
1750 assignment, finalization of an object of the subtype, or conversion to
1751 the subtype, including the evaluation of any assertion expressions that
1752 apply. If not specified for the first subtype of a derived type, the
1753 aspect defaults to that of the ancestor subtype; if not specified for a
1754 nonderived first subtype the aspect defaults to that of the enclosing
1755 library unit. If not specified for a nonfirst subtype @i<S>, the Global
1756 aspect defaults to that of the subtype identified in the
1757 @nt{subtype_indication} defining @i<S>.]}
1758
1759 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1760 @ChgAdded{Version=[5],Text=[The Global'Class aspect may be specified for the
1761 first subtype of a tagged type @i<T>, indicating an upper bound on the Global
1762 aspect of any descendant of @i<T>. If not specified, it defaults to Unspecified.]}
1763
1764 @end{StaticSem}
1765
1766 @begin{Legality}
1767
1768 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1769 @ChgAdded{Version=[5],Text=[For a tagged subtype @i<T>, each mode of its
1770 Global aspect shall identify a subset of the variables identified by the
1771 corresponding mode, or by the @key[in out] mode, of the Global'Class aspect
1772 of the first subtype of any ancestor of @i<T>.]}
1773
1774 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1775 @ChgAdded{Version=[5],Text=[If the formal parameter set is anything but
1776 @key[all] in the Global aspect for an operation declared within a generic
1777 unit, then the only generic formal subtypes that may be used, the only
1778 formal subprograms that may be called, and the only formal objects of an
1779 anonymous access-to-subprogram type that may be dereferenced as part of a call
1780 or passed as the actual for an access parameter, are those included in the
1781 formal parameter set.]}
1782
1783 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1784 @ChgAdded{Version=[5],Text=[Any dispatching call occurring within the
1785 operation that does not match a @nt{dispatching_operation_specifier} is checked
1786 using the Global'Class aspect(s) applicable to the dispatching operation; if
1787 there is a match, there is no checking against other elements of the Global
1788 aspect(s) applicable at the point of call.]}
1789
1790 @end{Legality}
1791
1792 @begin{Extend2012}
1793 @ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0079-3]}
1794 @ChgAdded{Version=[5],Text=[@Defn{extensions to Ada 2012}
1795 These extensions to the Global aspect are new.]}
1796 @end{Extend2012}
1797
1798