Debian Codegraph @

source_2005/safety.mss

raw
1 @Comment{ $Source: e:\\cvsroot/ARM/Source/safety.mss,v $ }
2 @Comment{ $Revision: 1.39 $ $Date: 2006/10/19 06:40:32 $ $Author: Randy $ }
3 @Part(safety, Root="ada.mss")
4
5 @Comment{$Date: 2006/10/19 06:40:32 $}
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 Pragmas]).
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],Text=[@ChgDeleted{Version=[2],
202 Text=[Information regarding bounded errors and erroneous execution.]}]}
203 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[
204 The range of effects for each bounded error and each unspecified effect.
205 If the effects of a given erroneous construct are
206 constrained, the constraints shall be documented.]}]}
207
208 @end{DocReq}
209
210 @begin{Notes}
211 Among the situations to be
212 documented are the conventions
213 chosen for parameter passing, the methods used for the management of
214 run-time storage, and the method used to evaluate numeric expressions if
215 this involves extended range or extra precision.
216 @begin{Discussion}
217
218 Look up @lquotes@;unspecified@rquotes@; and @lquotes@;erroneous execution@rquotes@;
219 in the index for a list of the cases.
220
221 The management of run-time storage is particularly important. For safety
222 applications, it is often necessary to show that a program cannot raise
223 Storage_Error, and for security applications that information cannot leak
224 via the run-time system. Users are likely to prefer a simple storage model
225 that can be easily validated.
226
227 The documentation could helpfully take into account that users may well
228 adopt a subset to avoid some forms of erroneous execution, for instance, not
229 using the abort statement, so that the effects of a partly completed
230 @nt{assignment_statement} do not have to be considered in the validation of a
231 program
232 (see @RefSecNum{Abort of a Task - Abort of a Sequence of Statements}).
233 For this reason documentation linked to an actual compilation may be
234 most useful. Similarly, an implementation may be able to take into
235 account use of the Restrictions pragma.
236
237 @end{Discussion}
238 @end{Notes}
239
240
241 @LabeledClause{Reviewable Object Code}
242
243 @begin{Intro}
244 Object code review and validation are supported by
245 pragmas Reviewable and Inspection_Point.
246 @end{Intro}
247
248 @LabeledSubClause{Pragma Reviewable}
249 @begin{Intro}
250 This pragma directs the implementation to
251 provide information to
252 facilitate analysis and review of a program's
253 object code, in particular to allow determination of
254 execution time and storage usage and to identify the
255 correspondence between the source and object programs.
256 @begin{Discussion}
257
258 Since the purpose of this pragma is to provide information to the user,
259 it is hard to objectively test for conformity. In practice, users want
260 the information in an easily understood and convenient form, but neither
261 of these properties can be easily measured.
262
263 @end{Discussion}
264 @end{Intro}
265
266 @begin{Syntax}
267 @begin{SyntaxText}
268 @Leading@Keepnext@;The form of a @nt{pragma} Reviewable is as follows:
269 @end{SyntaxText}
270
271 @PragmaSyn`@key{pragma} @prag(Reviewable);'
272 @end{Syntax}
273
274 @begin{LinkTime}
275 @PDefn2{Term=[configuration pragma], Sec=(Reviewable)}
276 @PDefn2{Term=[pragma, configuration], Sec=(Reviewable)}
277 Pragma Reviewable is a configuration pragma.
278 It applies to all
279 @nt[compilation_unit]s included in a partition.
280 @end{LinkTime}
281
282 @begin{ImplReq}
283 @Leading@;The implementation shall provide the following
284 information for any compilation unit to which such a
285 pragma applies:
286 @begin{Discussion}
287
288 The list of requirements can be checked for, even if issues like
289 intelligibility are not addressed.
290
291 @end{Discussion}
292 @begin{itemize}
293 Where compiler-generated run-time checks remain;
294 @begin{Discussion}
295
296 A constraint check which is implemented via a check on the upper and lower
297 bound should clearly be indicated. If a check is implicit in the form of
298 machine instructions used (such an overflow checking), this should also be
299 covered by the documentation. It is particularly important to cover those
300 checks which are not obvious from the source code, such as that for stack
301 overflow.
302
303 @end{Discussion}
304
305 An identification of any construct with a language-defined check
306 that is recognized prior to run time as certain to fail
307 if executed
308 (even if the generation of run-time checks has been suppressed);
309 @begin{Discussion}
310
311 In this case, if the compiler determines that a check must fail, the user
312 should be informed of this. However, since it is not in general possible to
313 know what the compiler will detect, it is not easy to test for this. In
314 practice, it is thought that compilers claiming conformity to this Annex
315 will perform significant optimizations and therefore @i{will} detect such
316 situations. Of course, such events could well indicate a programmer error.
317
318 @end{Discussion}
319
320 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00209-01]}
321 For each @Chg{Version=[2],New=[read of],Old=[reference to]} a scalar object,
322 an identification of the @Chg{Version=[2],New=[read],Old=[reference]} as
323 either @lquotes@;known to be initialized,@rquotes@; or
324 @lquotes@;possibly uninitialized,@rquotes@;
325 independent of whether pragma Normalize_Scalars applies;
326 @begin{Discussion}
327
328 This issue again raises the question as to what the compiler has determined.
329 A lazy implementation could clearly mark all scalars as @lquotes@;possibly
330 uninitialized@rquotes@;, but this would be very unhelpful to the user. It should be
331 possible to analyze a range of scalar uses and note the percentage in each
332 class. Note that an access marked @lquotes@;known to be initialized@rquotes@; does not imply
333 that the value is in range, since the initialization could be from an
334 (erroneous) call of unchecked conversion, or by means external to the Ada
335 program.
336
337 @end{Discussion}
338
339 Where run-time support routines are implicitly invoked;
340 @begin{Discussion}
341
342 Validators will need to know the calls invoked in order to check for the
343 correct functionality. For instance, for some safety applications, it may be
344 necessary to ensure that certain sections of code can execute in a
345 particular time.
346
347 @end{Discussion}
348
349 @Leading@Keepnext@;An object code listing, including:
350 @begin{inneritemize}
351 Machine instructions, with relative offsets;
352 @begin{Discussion}
353
354 The machine instructions should be in a format that is easily understood,
355 such as the symbolic format of the assembler. The relative offsets are
356 needed in numeric format, to check any alignment restrictions that the
357 architecture might impose.
358
359 @end{Discussion}
360
361 Where each data object is stored during its lifetime;
362 @begin{Discussion}
363
364 This requirement implies that if the optimizer assigns a variable to a
365 register, this needs to be evident.
366
367 @end{Discussion}
368
369 Correspondence with the source program, including an identification of the
370 code produced per declaration and per statement.
371 @begin{Discussion}
372
373 This correspondence will be quite complex when extensive optimization is
374 performed. In particular, address calculation to access some data structures
375 could be moved from the actual access. However, when all the machine code
376 arising from a statement or declaration is in one basic block, this must be
377 indicated by the implementation.
378
379 @end{Discussion}
380 @end{inneritemize}
381
382 An identification of each construct for which the implementation detects
383 the possibility of erroneous execution;
384 @begin{Discussion}
385
386 This requirement is quite vague. In general, it is hard for compilers to detect
387 erroneous execution and therefore the requirement will be rarely invoked. However,
388 if the pragma Suppress is used and the compiler can show that a predefined
389 exception will be raised, then such an identification would be useful.
390
391 @end{Discussion}
392
393 @Trailing@;For each subprogram, block, task,
394 or other construct implemented by
395 reserving and subsequently freeing an area on a run-time stack,
396 an identification
397 of the length of the fixed-size portion of the area and an indication
398 of whether the non-fixed size portion is reserved on the stack
399 or in a dynamically-managed storage region.
400 @begin{Discussion}
401 This requirement is vital for those requiring to show that the storage
402 available to a program is sufficient. This is crucial in those cases in
403 which the internal checks for stack overflow are suppressed (perhaps by
404 @key[pragma] Restrictions(No_Exceptions)).
405 @end{Discussion}
406 @end{itemize}
407
408 @Leading@;The implementation shall provide the following
409 information for any partition to which the
410 pragma applies:
411 @begin{Itemize}
412 An object code listing of the entire partition, including
413 initialization and finalization code as well as
414 run-time
415 system components, and with an identification of those instructions and
416 data that will be relocated at load time;
417 @begin{Discussion}
418 The object code listing should enable a validator to estimate
419 upper bounds for the time taken by critical parts of a program.
420 Similarly, by an analysis of the entire partition, it should be possible
421 to ensure that the storage requirements are suitably bounded,
422 assuming that the partition was written in an appropriate
423 manner.@end{discussion}
424
425 A description of the run-time model relevant to the partition.
426 @begin{Discussion}
427 For example,
428 a description of the storage model is vital,
429 since the Ada language does not explicitly define such a model.
430 @end{Discussion}
431 @end{itemize}
432 @end{ImplReq}
433
434 @Chgnote{The following paragraph is missing a number in the original version.
435 To give it a number in the new version, it is marked as an insertion.}
436 @ChgRef{Version=[0],Kind=[Added]}
437 @Chg{New=[],Old=[@Noparanum@;]}The implementation shall provide control- and data-flow
438 information, both within each compilation unit and across
439 the compilation units of the partition.
440 @begin{Discussion}
441
442 This requirement is quite vague, since it is unclear what control and data
443 flow information the compiler has produced. It is really a plea not to throw
444 away information that could be useful to the validator. Note that the data
445 flow information is relevant to the detection of @lquotes@;possibly uninitialized@rquotes@;
446 objects referred to above.
447
448 @end{Discussion}
449 @begin{ImplAdvice}
450 The implementation should provide the above
451 information in both a human-readable
452 and machine-readable form,
453 and should document the latter so as to ease further
454 processing by automated tools.
455 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
456 Text=[The information produced by @nt{pragma} Reviewable should be
457 provided in both a human-readable and machine-readable form, and the
458 latter form should be documented.]}]}
459
460 Object code listings should be provided both in a symbolic
461 format and also in an appropriate numeric format (such as
462 hexadecimal or octal).
463 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
464 Text=[Object code listings should be provided both in a symbolic
465 format and in a numeric format.]}]}
466 @begin{Reason}
467
468 This is to enable other tools to perform any analysis that the user
469 needed to aid validation.
470 The format should be in some agreed form.
471
472 @end{Reason}
473 @end{ImplAdvice}
474
475 @begin{Notes}
476 The order of elaboration of library units will be documented
477 even in the absence of @nt[pragma] Reviewable
478 (see @RefSecNum{Program Execution}).
479 @end{Notes}
480
481 @begin[discussion]
482 There might be some interactions between pragma Reviewable and compiler
483 optimizations. For example,
484 an implementation may disable some
485 optimizations when pragma Reviewable is in force
486 if it would be overly complicated to
487 provide
488 the detailed information to allow review of the optimized object code.
489 See also @nt<pragma> Optimize (@RefSecNum{Pragmas}).
490 @end[discussion]
491
492 @begin{DiffWord95}
493 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00209-01]}
494 @ChgAdded{Version=[2],Text=[The wording was clarified that pragma Reviewable
495 applies to each read of an object, as it makes no sense to talk about the
496 state of an object that will immediately be overwritten.]}
497 @end{DiffWord95}
498
499 @LabeledSubClause{Pragma Inspection_Point}
500 @begin{Intro}
501 An occurrence of a pragma Inspection_Point identifies a set of objects each of
502 whose values is to be
503 available at the point(s) during program execution corresponding to the
504 position of the pragma in the compilation unit.
505 The purpose of such a pragma is to facilitate code validation.
506 @begin{Discussion}
507
508 Inspection points are a high level equivalent of break points used by
509 debuggers.
510
511 @end{Discussion}
512 @end{Intro}
513
514 @begin{Syntax}
515 @begin{SyntaxText}
516 @Leading@Keepnext@;The form of a @nt{pragma} Inspection_Point is as follows:
517 @end{SyntaxText}
518
519 @PragmaSyn`@key{pragma} @prag(Inspection_Point)[(@SynI{object_}@Syn2{name} {, @SynI{object_}@Syn2{name}})];'
520 @end{Syntax}
521
522 @begin{Legality}
523 A pragma Inspection_Point is allowed wherever a
524 @nt[declarative_item]
525 or @nt[statement] is allowed.
526 Each @SynI{object_}name shall statically denote the declaration of an object.
527 @begin{Discussion}
528
529 The static denotation is required, since no dynamic evaluation of a name
530 is involved in this pragma.
531
532 @end{Discussion}
533 @end{Legality}
534
535 @begin{StaticSem}
536 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0093],ARef=[AI95-00207-01]}
537 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]}
538 @Defn{inspection point}
539 An @i{inspection point} is a point in the object code
540 corresponding to the occurrence of a pragma Inspection_@!Point in the
541 compilation unit.
542 @Defn{inspectable object}
543 An object is @i{inspectable} at an inspection point if the corresponding
544 pragma Inspection_Point either has an argument denoting that object,
545 or has no arguments@Chg{New=[ and the @Chg{Version=[2],New=[declaration
546 of the ],Old=[]}object is visible at the inspection point],Old=[]}.
547 @begin{ramification}
548 If a pragma Inspection_Point is in an in-lined subprogram, there
549 might be numerous inspection points in the object code corresponding to
550 the single occurrence of the pragma in the source; similar considerations
551 apply if such a pragma is in a generic, or in a loop that has
552 been @lquotes@;unrolled@rquotes@; by an optimizer.
553
554 @ChgRef{Version=[1],Kind=[Added],Ref=[8652/0093],ARef=[AI95-00207-01]}
555 @ChgAdded{Version=[1],Text=[The short form of the pragma is a convenient shorthand for
556 listing all objects which could be explicitly made inspectable by the long
557 form of the pragma; thus only visible objects are made inspectable by it.
558 Objects that are not visible at the point of the pragma are not made
559 inspectable by the short form pragma. This is necessary so that implementations
560 need not keep information about (or prevent optimizations on) a unit simply
561 because some other unit @i<might> contain a short form Inspection_Point
562 pragma.]}
563 @end{ramification}
564 @begin{Discussion}
565 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0093],ARef=[AI95-00207-01]}
566 If the short form of the pragma is used, then all@Chg{New=[ visible],Old=[]}
567 objects are inspectable.
568 This implies that @Chg{New=[global objects from other compilation units],
569 Old=[objects out of scope at the point of the pragma]} are inspectable. A good
570 interactive debugging system could provide information
571 similar to a post-mortem dump at such inspection points. The annex does
572 not require that any inspection facility is provided, merely that the
573 information is available to understand the state of the machine at those
574 points.
575 @end{Discussion}
576 @end{StaticSem}
577
578 @begin{RunTime}
579 Execution of a pragma Inspection_Point has no effect.
580 @begin{Discussion}
581
582 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
583 Although an inspection point has no (semantic) effect,
584 the removal or adding @Chg{Version=[2],New=[of ],Old=[]}a new point could
585 change the machine code generated by the compiler.
586
587 @end{Discussion}
588 @end{RunTime}
589
590 @begin{ImplReq}
591 Reaching an inspection point is an external interaction
592 with respect to the values
593 of the inspectable objects at that point
594 (see @RefSecNum{Conformity of an Implementation with the Standard}).
595 @begin{Ramification}
596 The compiler is inhibited from moving an assignment to
597 an inspectable variable past an inspection point for that variable.
598 On the other hand, the evaluation of an expression that might raise
599 an exception may be moved past an inspection point
600 (see @RefSecNum[Exceptions and Optimization]).@end{ramification}
601 @end{ImplReq}
602
603 @begin{DocReq}
604 For each inspection point,
605 the implementation shall
606 identify a mapping between each inspectable object and the machine resources
607 (such as memory locations or registers) from which the object's value
608 can be obtained.
609 @ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2],
610 Text=[Implementation-defined aspects of pragma Inspection_Point.]}]}
611 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
612 Text=[For each inspection point, a mapping between each inspectable object
613 and the machine resources where the object's value can be obtained shall
614 be provided.]}]}
615 @end{DocReq}
616
617 @begin{Notes}
618 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00209-01]}
619 The implementation is not allowed to perform @lquotes@;dead store elimination@rquotes@; on
620 the last assignment to a variable prior to a point where the
621 variable is inspectable.
622 Thus an inspection point has the effect of an
623 implicit @Chg{Version=[2],New=[read of],Old=[reference to]} each of its
624 inspectable objects.
625
626 Inspection points are useful in maintaining a correspondence between the
627 state of the program in source code terms, and the machine state during
628 the program's execution. Assertions about the values of program objects
629 can be tested in machine terms at inspection points. Object code between
630 inspection points can be processed by automated tools to
631 verify programs mechanically.
632 @begin{Discussion}
633
634 Although it is not a requirement of the annex, it would be useful if the
635 state of the stack and heap could be interrogated. This would allow users
636 to check that a program did not have a `storage leak'.
637
638 @end{Discussion}
639
640 The identification of the mapping from source program objects to machine
641 resources is allowed to be in the form of an
642 annotated object listing, in human-readable or tool-processable form.
643 @begin{Discussion}
644
645 In principle, it is easy to check an implementation for this pragma, since
646 one merely needs to check the content of objects against those values
647 known from the source listing. In practice, one needs a tool similar
648 to an interactive debugger to perform the check.
649
650 @end{Discussion}
651 @end{Notes}
652
653 @begin{DiffWord95}
654 @ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0093],ARef=[AI95-00207-01]}
655 @ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the definition of
656 the Inspection_Point pragma to apply to only variables visible at the point
657 of the pragma. Otherwise, the compiler would have to assume that some
658 other code somewhere could have a pragma Inspection_Point, preventing many
659 optimizations (such as unused object elimination).]}
660 @end{DiffWord95}
661
662
663 @LabeledRevisedClause{Version=[2],New=[High Integrity Restrictions],Old=[Safety and Security Restrictions]}
664 @begin{Intro}
665 This clause defines restrictions that can be used with pragma
666 Restrictions (see @RefSecNum(Pragma Restrictions)); these facilitate
667 the demonstration of program correctness by allowing
668 tailored versions of the run-time system.
669 @begin{Discussion}
670
671 Note that the restrictions are absolute. If a partition has 100 library
672 units and just one needs Unchecked_Conversion, then the pragma cannot be
673 used to ensure the other 99 units do not use Unchecked_Conversion. Note also
674 that these are restrictions on all Ada code within a partition, and
675 therefore it may not be evident from the specification of a package whether
676 a restriction can be imposed.
677
678 @end{Discussion}
679 @end{Intro}
680
681 @begin{StaticSem}
682 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00347-01],ARef=[AI95-00394-01]}
683 @ChgDeleted{Version=[2],Text=[The following restrictions,
684 the same as in @RefSecNum{Tasking Restrictions},
685 apply in this Annex:
686 No_Task_@!Hierarchy,
687 No_Abort_@!Statement,
688 No_Implicit_@!Heap_@!Allocation,
689 Max_@!Task_@!Entries is 0,
690 Max_@!Asynchronous_@!Select_@!Nesting is 0, and
691 Max_@!Tasks is 0.
692 @redundant[The last three restrictions are checked prior to program execution.]]}
693
694 @Trailing@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00394-01]}
695 The following @Chg{Version=[2],New=[@SynI{restriction_}@nt{identifier}s are
696 language defined:],Old=[additional restrictions apply in this Annex.]}
697
698 @leading@keepnext@b{Tasking-related restriction:}
699
700 @begin{Description}
701 @Trailing@;@Defn2{Term=[Restrictions],Sec=(No_Protected_Types)}No_Protected_Types @\There
702 are no declarations of protected types or protected objects.
703 @end{Description}
704
705 @leading@keepnext@b{Memory-management related restrictions:}
706
707 @begin{Description}
708 @Defn2{Term=[Restrictions],Sec=(No_Allocators)}No_Allocators @\There are no
709 occurrences of an @nt{allocator}.
710
711 @ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0042],ARef=[AI95-00130]}
712 @Defn2{Term=[Restrictions],Sec=(No_Local_Allocators)}No_Local_Allocators @\@nt{Allocator}s
713 are prohibited in subprograms, generic subprograms,
714 tasks, and entry bodies@Chg{New=[],Old=[; instantiations of generic packages
715 are also prohibited in these contexts]}.
716 @begin[Ramification]
717 Thus @nt{allocator}s are permitted only in expressions whose
718 evaluation can only be performed before the main subprogram is invoked.
719 @end[Ramification]
720 @begin[Reason]
721 @ChgRef{Version=[1],Kind=[Deleted],Ref=[8652/0042],ARef=[AI95-00130]}
722 @ChgNote{The associated rule has been deleted.}
723 @ChgDeleted{Version=[1],Text=[The reason for the prohibition against
724 instantiations of
725 generic packages is to avoid contract model violations.
726 An alternative would be to prohibit @nt{allocator}s from generic
727 packages, but it seems preferable to allow generality on the
728 defining side and then place the restrictions on the usage (instantiation),
729 rather than inhibiting what can be in the generic while
730 liberalizing where they can be instantiated.]}
731 @end[Reason]
732
733 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00394-01]}
734 @ChgDeleted{Version=[2],Text=[@Defn2{Term=[Restrictions],
735 Sec=(No_Unchecked_Deallocation)}No_Unchecked_Deallocation @\Semantic
736 dependence on Unchecked_Deallocation is not allowed.]}
737 @begin{Discussion}
738 @ChgRef{Version=[2],Kind=[Deleted]}
739 @ChgDeleted{Version=[2],Text=[This restriction would be useful in those
740 contexts in which heap storage is needed on program start-up, but need not be
741 increased subsequently. The danger of a dangling pointer can therefore be
742 avoided.]}
743 @end{Discussion}
744
745 @Trailing@;Immediate_Reclamation @\Except for storage occupied by objects created by
746 @nt{allocator}s and not deallocated via unchecked deallocation, any storage
747 reserved at run time for an object is immediately reclaimed when the
748 object no longer exists.
749 @Defn2{Term=[Restrictions],Sec=(Immediate_Reclamation)}
750 @begin{Discussion}
751 Immediate reclamation would apply to storage created by the compiler, such
752 as for a return value from a function whose size is not known at the
753 call site.
754 @end{Discussion}
755 @end{Description}
756
757 @leading@keepnext@b{Exception-related restriction:}
758
759 @begin{Description}
760 @Trailing@Defn2{Term=[Restrictions],Sec=(No_Exceptions)}No_Exceptions @\@nt{Raise_statement}s
761 and @nt{exception_handler}s are not allowed.
762 No language-defined run-time checks are generated;
763 however, a run-time check performed automatically by the hardware
764 is permitted.
765 @begin{Discussion}
766
767 This restriction mirrors a method of working that is quite common in the
768 safety area. The programmer is required to show that exceptions cannot be
769 raised. Then a simplified run-time system is used without exception
770 handling. However, some hardware checks may still be enforced. If the
771 software check would have failed, or if the hardware check actually fails,
772 then the execution of the program is unpredictable.
773 There are obvious dangers in this approach, but it is similar to
774 programming at the assembler level.
775
776 @end{Discussion}
777 @end{Description}
778
779 @leading@keepnext@b{Other restrictions:}
780
781 @begin{Description}
782 @Defn2{Term=[Restrictions],Sec=(No_Floating_Point)}No_Floating_Point @\Uses of predefined floating point types and
783 operations, and declarations of new floating point types, are
784 not allowed.
785 @begin{Discussion}
786
787 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
788 The intention is to avoid the use of floating point hardware at run time,
789 but this is expressed in
790 language terms. It is conceivable that floating point is used implicitly in
791 some contexts, say fixed point type conversions of high accuracy. However,
792 the @ImplReqTitle below make it clear that the restriction would apply
793 to the @lquotes@;run-time system@rquotes@; and hence not be allowed.
794 This @Chg{Version=[2],New=[restriction],Old=[parameter]} could be used to
795 inform a compiler that a variant of the architecture is being used which does
796 not have floating point instructions.
797
798 @end{Discussion}
799
800 @Defn2{Term=[Restrictions],Sec=(No_Fixed_Point)}No_Fixed_Point @\Uses of predefined fixed point types and
801 operations, and declarations of new fixed point types, are
802 not allowed.
803 @begin{Discussion}
804
805 This restriction would have the side-effect of prohibiting the
806 @nt{delay_relative_statement}.
807 As with the No_Floating_Point restriction, this might be used to
808 avoid any question of rounding errors. Unless an Ada run-time is written in
809 Ada, it seems hard to rule out implicit use of fixed point, since at the
810 machine level, fixed point is virtually the same as integer arithmetic.
811
812 @end{Discussion}
813
814 @ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00394-01]}
815 @ChgDeleted{Version=[2],Text=[@Defn2{Term=[Restrictions],
816 Sec=(No_Unchecked_Conversion)}No_Unchecked_Conversion @\Semantic dependence
817 on the predefined generic Unchecked_Conversion is not allowed.]}
818 @begin{Discussion}
819 @ChgRef{Version=[2],Kind=[Deleted]}
820 @ChgDeleted{Version=[2],Text=[Most critical applications would require
821 some restrictions or additional validation checks on uses of unchecked
822 conversion. If the application does not require the functionality, then
823 this restriction provides a means of ensuring the design requirement has
824 been satisfied. The same applies to several of the following restrictions.]}
825 @end{Discussion}
826
827 No_Access_Subprograms @\The declaration of access-to-subprogram types
828 is not allowed.
829 @Defn2{Term=[Restrictions],Sec=(No_Access_Subprograms)}
830 @begin{Discussion}@ChgNote{Moved from above}
831 @ChgRef{Version=[2],Kind=[Added]}
832 @ChgAdded{Version=[2],Text=[Most critical applications would require
833 some restrictions or additional validation checks on uses of
834 access-to-subprogram types. If the application does not require the
835 functionality, then this restriction provides a means of ensuring the design
836 requirement has been satisfied. The same applies to several of the following
837 restrictions, and to restriction No_Dependence => Ada.Unchecked_Conversion.]}
838 @end{Discussion}
839
840 @Defn2{Term=[Restrictions],Sec=(No_Unchecked_Access)}No_Unchecked_Access @\The @attr[Unchecked_Access] attribute
841 is not allowed.
842
843 @Defn2{Term=[Restrictions],Sec=(No_Dispatch)}No_Dispatch @\Occurrences of T'Class are not allowed, for any
844 (tagged)
845 subtype T.
846
847 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
848 @Defn2{Term=[Restrictions],Sec=(No_IO)}No_IO @\Semantic dependence on
849 any of the library units
850 Sequential_IO, Direct_IO, Text_IO, Wide_Text_IO, @Chg{Version=[2],
851 New=[Wide_Wide_Text_IO, ],Old=[]}or Stream_IO is not allowed.
852 @begin{Discussion}
853
854 Excluding the input-output facilities of an implementation may be needed
855 in those environments which cannot support the supplied functionality.
856 A program in such an environment is likely to require some low level
857 facilities or a call on a non-Ada feature.
858
859 @end{Discussion}
860
861 @Defn2{Term=[Restrictions],Sec=(No_Delay)}No_Delay @\@nt[Delay_Statement]s
862 and semantic dependence on package Calendar
863 are not allowed.
864 @begin[Ramification]
865 This implies that @nt[delay_alternative]s in a
866 @nt[select_statement] are prohibited.
867
868 The purpose of this restriction is to avoid the need for timing facilities
869 within the run-time system.
870
871 @end[ramification]
872
873 @Defn2{Term=[Restrictions],Sec=(No_Recursion)}No_Recursion @\As part of the execution of a subprogram, the same
874 subprogram is not invoked.
875
876 @Defn2{Term=[Restrictions],Sec=(No_Reentrancy)}No_Reentrancy @\During the execution of a subprogram by a task, no other
877 task invokes the same subprogram.
878
879 @end{description}
880 @end{StaticSem}
881
882 @begin{ImplReq}
883
884 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00394-01]}
885 @ChgAdded{Version=[2],Type=[Leading],Text=[An implementation of this Annex
886 shall support:]}
887 @begin{Itemize}
888 @ChgRef{Version=[2],Kind=[Added]}
889 @ChgAdded{Version=[2],Text=[the restrictions defined in this subclause; and]}
890
891 @ChgRef{Version=[2],Kind=[Added]}
892 @ChgAdded{Version=[2],Text=[the following restrictions defined in
893 @RefSecNum{Tasking Restrictions}: No_Task_Hierarchy,
894 No_Abort_Statement, No_Implicit_Heap_Allocation; and]}
895
896 @ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00347-01]}
897 @ChgAdded{Version=[2],Text=[the @key{pragma} Profile(Ravenscar); and]}
898 @begin{Discussion}
899 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00347-01]}
900 @ChgAdded{Version=[2],Text=[The reference to pragma Profile(Ravenscar) is
901 intended to show that properly restricted tasking is appropriate for use
902 in high integrity systems. The Ada 95
903 Annex seemed to suggest that tasking was inappropriate for such systems.]}
904 @end{Discussion}
905
906 @ChgRef{Version=[2],Kind=[Added]}
907 @ChgAdded{Version=[2],Type=[Leading],Text=[the following uses of
908 @SynI{restriction_parameter_}@nt{identifier}s defined in
909 @RefSecNum{Tasking Restrictions}@Redundant[, which are checked
910 prior to program execution]:]}
911 @begin{InnerItemize}
912 @ChgRef{Version=[2],Kind=[Added]}
913 @ChgAdded{Version=[2],Text=[Max_Task_Entries => 0,]}
914
915 @ChgRef{Version=[2],Kind=[Added]}
916 @ChgAdded{Version=[2],Text=[Max_Asynchronous_Select_Nesting => 0, and]}
917
918 @ChgRef{Version=[2],Kind=[Added]}
919 @ChgAdded{Version=[2],Text=[Max_Tasks => 0.]}
920 @end{InnerItemize}
921 @end{Itemize}
922
923 If an implementation supports @nt[pragma] Restrictions for a particular
924 argument, then except for the restrictions No_Unchecked_Deallocation,
925 No_Unchecked_Conversion, No_Access_Subprograms, and No_Unchecked_Access,
926 the associated restriction applies to the
927 run-time system.
928 @begin[reason]
929 Permission is granted for the run-time system to use the specified
930 otherwise-restricted features, since the use of these features may
931 simplify the run-time system by allowing more of it to be written
932 in Ada.
933 @end[reason]
934 @begin{Discussion}
935
936 The restrictions that are applied to the partition are also applied to the
937 run-time system. For example, if No_Floating_Point is specified,
938 then an implementation that uses floating point for implementing the delay
939 statement (say) would require that No_Floating_Point is
940 only used in conjunction with No_Delay. It is clearly important that
941 restrictions are effective so that Max_Tasks=0 does imply that tasking is
942 not used, even implicitly (for input-output, say).
943
944 An implementation of tasking could be produced based upon a run-time
945 system written in Ada in which the rendezvous was controlled by
946 protected types. In this case, No_Protected_Types could only be used in
947 conjunction with Max_Task_Entries=0. Other implementation dependencies
948 could be envisaged.
949
950 If the run-time system is not written in Ada, then the wording needs to be
951 applied in an appropriate fashion.
952
953 @end{Discussion}
954 @end{ImplReq}
955
956 @begin{DocReq}
957 If a pragma Restrictions(No_Exceptions) is specified, the implementation
958 shall document the effects of all constructs where language-defined checks are
959 still performed automatically (for example, an overflow check performed
960 by the processor).
961 @ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2],
962 Text=[Implementation-defined aspects of pragma Restrictions.]}]}
963 @ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[
964 If a pragma Restrictions(No_Exceptions) is specified, the effects of all
965 constructs where language-defined checks are still performed.]}]}
966 @begin{Discussion}
967
968 @ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
969 The documentation requirements here are quite difficult to satisfy. One
970 method is to review the object code generated and determine the checks that
971 are still present, either explicitly, or implicitly within the architecture.
972 As another example from that of overflow, consider the question of
973 @Chg{Version=[2],New=[dereferencing],Old=[deferencing]} a null pointer.
974 This could be undertaken by a memory access trap
975 when checks are performed. When checks are suppressed via the argument
976 No_Exceptions, it would not be necessary to have the memory access trap
977 mechanism enabled.
978
979 @end{Discussion}
980 @end{DocReq}
981
982 @begin{Erron}
983 @PDefn2{Term=(erroneous execution),Sec=(cause)}
984 Program execution is erroneous if pragma Restrictions(No_Exceptions)
985 has been specified and the conditions arise under which a generated
986 language-defined run-time check would fail.
987 @begin{Discussion}
988
989 The situation here is very similar to the application of pragma Suppress.
990 Since users are removing some of the protection the language
991 provides, they had better be careful!
992
993 @end{Discussion}
994
995 @PDefn2{Term=(erroneous execution),Sec=(cause)}
996 Program execution is erroneous if pragma Restrictions(No_Recursion)
997 has been specified and a subprogram is invoked as part of its
998 own execution,
999 or if pragma Restrictions(No_Reentrancy) has been specified and
1000 during the execution of a subprogram by a task, another task invokes
1001 the same subprogram.
1002 @begin{Discussion}
1003
1004 In practice, many implementations may not exploit the absence of recursion
1005 or need for reentrancy, in which case the program execution would be
1006 unaffected by the use of recursion or reentrancy, even though the program is
1007 still formally erroneous.
1008
1009 @end{Discussion}
1010 @end{Erron}
1011
1012 @ChgNote{I can't find any reason in the normative wording for this item;
1013 therefore I've removed it. The notes below (commented out anyway) refer only
1014 to a non-standard mode, which is irrelevant in the Standard.}
1015 @ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2],
1016 Text=[Any restrictions on pragma Restrictions.]}]}
1017
1018 @begin{Notes}
1019 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1020 @ChgAdded{Version=[2],Text=[Uses of @Syni{restriction_parameter_}@nt{identifier}
1021 No_Dependence defined in @RefSecNum{Language-Defined Restrictions}:
1022 No_Dependence => Ada.@!Unchecked_@!Deallocation and No_Dependence =>
1023 Ada.@!Unchecked_@!Conversion may be appropriate for high-integrity systems.
1024 Other uses of No_Dependence can also be appropriate for high-integrity
1025 systems.]}
1026 @begin{Discussion}
1027 @ChgRef{Version=[2],Kind=[AddedNormal]}
1028 @ChgAdded{Version=[2],Text=[The specific mention of these two uses
1029 is meant to replace the identifiers now banished to
1030 @RefSec{Dependence Restriction Identifiers}.]}
1031
1032 @ChgRef{Version=[2],Kind=[AddedNormal]}
1033 @ChgAdded{Version=[2],Text=[Restriction No_Dependence => Ada.Unchecked_Deallocation
1034 would be useful in those
1035 contexts in which heap storage is needed on program start-up, but need not be
1036 increased subsequently. The danger of a dangling pointer can therefore be
1037 avoided.]}@ChgNote{Moved down from above.}
1038 @end{Discussion}
1039
1040 @end{Notes}
1041
1042 @begin{comment}
1043 @begin{Notes}
1044 The standard mode for pragma Restrictions is that a
1045 compilation unit
1046 (or a partition if at link time) is illegal
1047 if it makes use of a feature identified in the pragma.
1048 However, an implementation is allowed to have a mode of operation
1049 where it issues a warning message versus rejecting the unit or partition,
1050 and where the run-time system supplied for the partition
1051 includes support for the identified feature.
1052
1053 An implementation need not independently support the restrictions
1054 identified above, but may instead require that if a particular
1055 restriction is identified in a @nt(pragma) Restrictions, then
1056 other restrictions (the exact set of which is implementation defined)
1057 need also to be identified.
1058
1059 In such a case, if the additional
1060 restrictions are not specified in a @nt(pragma) Restrictions, and
1061 a unit or partition uses such a feature, the implementation should
1062 @begin{itemize}
1063 issue a warning that the pragma is being ignored (that is, the
1064 full RTS is being used),
1065
1066 identify to the user the additional restrictions that need to be
1067 specified in the pragma in order to obtain the reduced RTS, and
1068 identify any constructs that would use any of the features so
1069 proscribed
1070 @end{itemize}
1071 @end{Notes}
1072 @end{comment}
1073
1074 @begin{Extend95}
1075 @ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0042],ARef=[AI95-00130-01]}
1076 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1077 No_Local_Allocators no longer prohibits generic instantiations.]}
1078 @end{Extend95}
1079
1080 @begin{DiffWord95}
1081 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
1082 @ChgAdded{Version=[2],Text=[Wide_Wide_Text_IO (which is new) is added to the
1083 No_IO restriction.]}
1084
1085 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00347-01]}
1086 @ChgAdded{Version=[2],Text=[The title of this clause was changed to match the
1087 change to the Annex title. Pragma Profile(Ravenscar) is part of this annex.]}
1088
1089 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1090 @ChgAdded{Version=[2],Text=[Restriction No_Dependence is used instead of
1091 special @i<restriction_>@nt<identifier>s. The old names are banished to
1092 Obsolescent Features (see @RefSecNum{Dependence Restriction Identifiers}).]}
1093
1094 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00394-01]}
1095 @ChgAdded{Version=[2],Text=[The bizarre wording @lquotes@;apply in this
1096 Annex@rquotes (which no one quite can explain the meaning of) is banished.]}
1097 @end{DiffWord95}
1098
1099 @LabeledAddedClause{Version=[2],Name=[Pragma Detect_Blocking]}
1100
1101 @begin{Intro}
1102 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1103 @ChgAdded{Version=[2],Text=[The following @nt{pragma} forces an implementation
1104 to detect potentially blocking operations within a protected operation.]}
1105 @end{Intro}
1106
1107 @begin{Syntax}
1108 @begin{SyntaxText}
1109 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1110 @ChgAdded{Version=[2],Type=[Leading],Keepnext=[T],Text=[The form of a
1111 @nt{pragma} Detect_Blocking is as follows:]}
1112 @end{SyntaxText}
1113 @ChgRef{Version=[2],Kind=[AddedNormal]}
1114 @ChgAdded{Version=[2],Text=[@AddedPragmaSyn`Version=[2],@key{pragma} @prag<Detect_Blocking>;']}
1115 @end{Syntax}
1116
1117 @begin{LinkTime}
1118 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1119 @ChgAdded{Version=[2],Text=[@PDefn2{Term=[configuration pragma], Sec=(Detect_Blocking)}
1120 @PDefn2{Term=[pragma, configuration], Sec=(Detect_Blocking)}
1121 A @nt{pragma} Detect_Blocking is a configuration
1122 pragma.]}
1123 @end{LinkTime}
1124
1125 @begin{RunTime}
1126 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1127 @ChgAdded{Version=[2],Text=[An implementation is required to detect a
1128 potentially blocking operation within a protected operation, and to raise
1129 Program_Error (see @RefSecNum{Protected Subprograms and Protected Actions}).]}
1130 @end{RunTime}
1131
1132 @begin{ImplPerm}
1133 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1134 @ChgAdded{Version=[2],Text=[An implementation is allowed to reject a
1135 @nt{compilation_unit} if a potentially blocking operation is present directly
1136 within an @nt{entry_body} or the body of a protected subprogram.]}
1137 @end{ImplPerm}
1138
1139 @begin{Notes}
1140 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1141 @ChgAdded{Version=[2],Text=[An operation that causes a task to be blocked
1142 within a foreign language domain is not defined to be potentially blocking,
1143 and need not be detected.]}
1144 @end{Notes}
1145
1146 @begin{Extend95}
1147 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00305-01]}
1148 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1149 Pragma Detect_Blocking is new.]}
1150 @end{Extend95}
1151
1152 @RMNewPage@Comment{For printed version of Ada 2007 RM}
1153 @LabeledAddedClause{Version=[2],Name=[Pragma Partition_Elaboration_Policy]}
1154
1155 @begin{Intro}
1156 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1157 @ChgAdded{Version=[2],Text=[This clause defines a @nt{pragma}
1158 for user control over elaboration policy.]}
1159 @end{Intro}
1160
1161 @begin{Syntax}
1162 @begin{SyntaxText}
1163 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1164 @ChgAdded{Version=[2],Type=[Leading],Keepnext=[T],Text=[The form of a
1165 @nt{pragma} Partition_Elaboration_Policy is as follows:]}
1166 @end{SyntaxText}
1167 @ChgRef{Version=[2],Kind=[AddedNormal]}
1168 @ChgAdded{Version=[2],Text=[@AddedPragmaSyn`Version=[2],@key{pragma} @prag<Partition_Elaboration_Policy> (@SynI<policy_>@Syn2<identifier>);']}
1169
1170 @begin{SyntaxText}
1171 @ChgRef{Version=[2],Kind=[AddedNormal]}
1172 @ChgAdded{Version=[2],Text=[The @SynI<policy_>@nt{identifier} shall be either
1173 Sequential, Concurrent or an implementation-defined identifier.]}
1174 @ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[Implementation-defined
1175 @SynI<policy_>@nt<identifier>s allowed in a @nt{pragma} Partition_Elaboration_Policy.],Old=[]}]}
1176 @end{SyntaxText}
1177 @end{Syntax}
1178
1179 @begin{LinkTime}
1180 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1181 @ChgAdded{Version=[2],Text=[@PDefn2{Term=[configuration pragma], Sec=(Partition_Elaboration_Policy)}
1182 @PDefn2{Term=[pragma, configuration], Sec=(Partition_Elaboration_Policy)}
1183 A @nt{pragma} Partition_Elaboration_Policy is a configuration pragma.
1184 It specifies the elaboration policy for a partition.
1185 At most one elaboration policy shall be specified for a partition.]}
1186
1187 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1188 @ChgAdded{Version=[2],Text=[If the Sequential policy is
1189 specified for a partition then pragma Restrictions (No_Task_Hierarchy) shall
1190 also be specified for the partition.]}
1191 @end{LinkTime}
1192
1193 @begin{RunTime}
1194 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1195 @ChgAdded{Version=[2],Text=[Notwithstanding what this International Standard
1196 says elsewhere, this @nt{pragma} allows partition elaboration rules concerning
1197 task activation and interrupt attachment to be changed. If the
1198 @SynI{policy_}@nt{identifier} is Concurrent, or if there is no pragma
1199 Partition_Elaboration_Policy defined for the partition, then the rules defined
1200 elsewhere in this Standard apply.]}
1201
1202 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1203 @ChgAdded{Version=[2],Type=[Leading],Text=[If the partition elaboration policy
1204 is Sequential, then task activation and interrupt attachment are performed in
1205 the following sequence of steps:]}
1206
1207 @begin{Itemize}
1208 @ChgRef{Version=[2],Kind=[AddedNormal]}
1209 @ChgAdded{Version=[2],Text=[The activation of all library-level tasks and the
1210 attachment of interrupt handlers are deferred until all library units are
1211 elaborated.]}
1212
1213 @ChgRef{Version=[2],Kind=[AddedNormal]}
1214 @ChgAdded{Version=[2],Text=[The interrupt handlers are attached by the
1215 environment task.]}
1216
1217 @ChgRef{Version=[2],Kind=[AddedNormal]}
1218 @ChgAdded{Version=[2],Text=[The environment task is suspended while the
1219 library-level tasks are activated.]}
1220
1221 @ChgRef{Version=[2],Kind=[AddedNormal]}
1222 @ChgAdded{Version=[2],Text=[The environment task executes the main subprogram
1223 (if any) concurrently with these executing tasks.]}
1224 @end{Itemize}
1225
1226 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1227 @ChgAdded{Version=[2],Text=[If several dynamic interrupt handler attachments for
1228 the same interrupt are deferred, then the most recent call of
1229 Attach_Handler or Exchange_Handler determines which handler is attached.]}
1230
1231 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1232 @ChgAdded{Version=[2],Text=[If any deferred task activation fails, Tasking_Error
1233 is raised at the beginning of the sequence of statements of the
1234 body of the environment task prior to calling the
1235 main subprogram.]}
1236
1237 @end{RunTime}
1238
1239 @begin{ImplAdvice}
1240 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1241 @ChgAdded{Version=[2],Text=[If the partition elaboration policy is Sequential
1242 and the Environment task becomes permanently blocked during elaboration then
1243 the partition is deadlocked and it is recommended that the partition be
1244 immediately terminated.]}
1245 @ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
1246 Text=[If the partition elaboration policy is Sequential
1247 and the Environment task becomes permanently blocked during elaboration then
1248 the partition should be immediately terminated.]}]}
1249
1250 @end{ImplAdvice}
1251
1252 @begin{ImplPerm}
1253 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01]}
1254 @ChgAdded{Version=[2],Text=[If the partition elaboration policy is Sequential
1255 and any task activation fails then an implementation may immediately terminate
1256 the active partition to mitigate the hazard posed by continuing to execute with
1257 a subset of the tasks being active.]}
1258 @end{ImplPerm}
1259
1260 @begin{Notes}
1261 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00421-01]}
1262 @ChgAdded{Version=[2],Text=[If any deferred task activation fails, the
1263 environment task is unable to handle the Tasking_Error exception and completes
1264 immediately. By contrast, if the partition elaboration policy is Concurrent,
1265 then this exception could be handled within a library unit.]}
1266 @end{Notes}
1267
1268
1269 @begin{Extend95}
1270 @ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00265-01],ARef=[AI95-00421-01]}
1271 @ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
1272 @nt{Pragma} Partition_Elaboration_Policy is new.]}
1273 @end{Extend95}
1274
1275
1276
1277