[Ada] Pragma Warning_As_Error works for style warnings
[gcc.git] / gcc / ada / gnat_rm.texi
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename gnat_rm.info
4 @documentencoding UTF-8
5 @ifinfo
6 @*Generated by Sphinx 1.4.6.@*
7 @end ifinfo
8 @settitle GNAT Reference Manual
9 @defindex ge
10 @paragraphindent 0
11 @exampleindent 4
12 @finalout
13 @dircategory GNU Ada Tools
14 @direntry
15 * gnat_rm: (gnat_rm.info). gnat_rm
16 @end direntry
17
18 @definfoenclose strong,`,'
19 @definfoenclose emph,`,'
20 @c %**end of header
21
22 @copying
23 @quotation
24 GNAT Reference Manual , Aug 01, 2019
25
26 AdaCore
27
28 Copyright @copyright{} 2008-2019, Free Software Foundation
29 @end quotation
30
31 @end copying
32
33 @titlepage
34 @title GNAT Reference Manual
35 @insertcopying
36 @end titlepage
37 @contents
38
39 @c %** start of user preamble
40
41 @c %** end of user preamble
42
43 @ifnottex
44 @node Top
45 @top GNAT Reference Manual
46 @insertcopying
47 @end ifnottex
48
49 @c %**start of body
50 @anchor{gnat_rm doc}@anchor{0}
51 @emph{GNAT, The GNU Ada Development Environment}
52
53
54 @include gcc-common.texi
55 GCC version @value{version-GCC}@*
56 AdaCore
57
58 Permission is granted to copy, distribute and/or modify this document
59 under the terms of the GNU Free Documentation License, Version 1.3 or
60 any later version published by the Free Software Foundation; with no
61 Invariant Sections, with the Front-Cover Texts being "GNAT Reference
62 Manual", and with no Back-Cover Texts. A copy of the license is
63 included in the section entitled @ref{1,,GNU Free Documentation License}.
64
65 @menu
66 * About This Guide::
67 * Implementation Defined Pragmas::
68 * Implementation Defined Aspects::
69 * Implementation Defined Attributes::
70 * Standard and Implementation Defined Restrictions::
71 * Implementation Advice::
72 * Implementation Defined Characteristics::
73 * Intrinsic Subprograms::
74 * Representation Clauses and Pragmas::
75 * Standard Library Routines::
76 * The Implementation of Standard I/O::
77 * The GNAT Library::
78 * Interfacing to Other Languages::
79 * Specialized Needs Annexes::
80 * Implementation of Specific Ada Features::
81 * Implementation of Ada 2012 Features::
82 * Obsolescent Features::
83 * Compatibility and Porting Guide::
84 * GNU Free Documentation License::
85 * Index::
86
87 @detailmenu
88 --- The Detailed Node Listing ---
89
90 About This Guide
91
92 * What This Reference Manual Contains::
93 * Conventions::
94 * Related Information::
95
96 Implementation Defined Pragmas
97
98 * Pragma Abort_Defer::
99 * Pragma Abstract_State::
100 * Pragma Acc_Parallel::
101 * Pragma Acc_Loop::
102 * Pragma Acc_Kernels::
103 * Pragma Acc_Data::
104 * Pragma Ada_83::
105 * Pragma Ada_95::
106 * Pragma Ada_05::
107 * Pragma Ada_2005::
108 * Pragma Ada_12::
109 * Pragma Ada_2012::
110 * Pragma Allow_Integer_Address::
111 * Pragma Annotate::
112 * Pragma Assert::
113 * Pragma Assert_And_Cut::
114 * Pragma Assertion_Policy::
115 * Pragma Assume::
116 * Pragma Assume_No_Invalid_Values::
117 * Pragma Async_Readers::
118 * Pragma Async_Writers::
119 * Pragma Attribute_Definition::
120 * Pragma C_Pass_By_Copy::
121 * Pragma Check::
122 * Pragma Check_Float_Overflow::
123 * Pragma Check_Name::
124 * Pragma Check_Policy::
125 * Pragma Comment::
126 * Pragma Common_Object::
127 * Pragma Compile_Time_Error::
128 * Pragma Compile_Time_Warning::
129 * Pragma Compiler_Unit::
130 * Pragma Compiler_Unit_Warning::
131 * Pragma Complete_Representation::
132 * Pragma Complex_Representation::
133 * Pragma Component_Alignment::
134 * Pragma Constant_After_Elaboration::
135 * Pragma Contract_Cases::
136 * Pragma Convention_Identifier::
137 * Pragma CPP_Class::
138 * Pragma CPP_Constructor::
139 * Pragma CPP_Virtual::
140 * Pragma CPP_Vtable::
141 * Pragma CPU::
142 * Pragma Deadline_Floor::
143 * Pragma Default_Initial_Condition::
144 * Pragma Debug::
145 * Pragma Debug_Policy::
146 * Pragma Default_Scalar_Storage_Order::
147 * Pragma Default_Storage_Pool::
148 * Pragma Depends::
149 * Pragma Detect_Blocking::
150 * Pragma Disable_Atomic_Synchronization::
151 * Pragma Dispatching_Domain::
152 * Pragma Effective_Reads::
153 * Pragma Effective_Writes::
154 * Pragma Elaboration_Checks::
155 * Pragma Eliminate::
156 * Pragma Enable_Atomic_Synchronization::
157 * Pragma Export_Function::
158 * Pragma Export_Object::
159 * Pragma Export_Procedure::
160 * Pragma Export_Value::
161 * Pragma Export_Valued_Procedure::
162 * Pragma Extend_System::
163 * Pragma Extensions_Allowed::
164 * Pragma Extensions_Visible::
165 * Pragma External::
166 * Pragma External_Name_Casing::
167 * Pragma Fast_Math::
168 * Pragma Favor_Top_Level::
169 * Pragma Finalize_Storage_Only::
170 * Pragma Float_Representation::
171 * Pragma Ghost::
172 * Pragma Global::
173 * Pragma Ident::
174 * Pragma Ignore_Pragma::
175 * Pragma Implementation_Defined::
176 * Pragma Implemented::
177 * Pragma Implicit_Packing::
178 * Pragma Import_Function::
179 * Pragma Import_Object::
180 * Pragma Import_Procedure::
181 * Pragma Import_Valued_Procedure::
182 * Pragma Independent::
183 * Pragma Independent_Components::
184 * Pragma Initial_Condition::
185 * Pragma Initialize_Scalars::
186 * Pragma Initializes::
187 * Pragma Inline_Always::
188 * Pragma Inline_Generic::
189 * Pragma Interface::
190 * Pragma Interface_Name::
191 * Pragma Interrupt_Handler::
192 * Pragma Interrupt_State::
193 * Pragma Invariant::
194 * Pragma Keep_Names::
195 * Pragma License::
196 * Pragma Link_With::
197 * Pragma Linker_Alias::
198 * Pragma Linker_Constructor::
199 * Pragma Linker_Destructor::
200 * Pragma Linker_Section::
201 * Pragma Lock_Free::
202 * Pragma Loop_Invariant::
203 * Pragma Loop_Optimize::
204 * Pragma Loop_Variant::
205 * Pragma Machine_Attribute::
206 * Pragma Main::
207 * Pragma Main_Storage::
208 * Pragma Max_Queue_Length::
209 * Pragma No_Body::
210 * Pragma No_Caching::
211 * Pragma No_Component_Reordering::
212 * Pragma No_Elaboration_Code_All::
213 * Pragma No_Heap_Finalization::
214 * Pragma No_Inline::
215 * Pragma No_Return::
216 * Pragma No_Run_Time::
217 * Pragma No_Strict_Aliasing::
218 * Pragma No_Tagged_Streams::
219 * Pragma Normalize_Scalars::
220 * Pragma Obsolescent::
221 * Pragma Optimize_Alignment::
222 * Pragma Ordered::
223 * Pragma Overflow_Mode::
224 * Pragma Overriding_Renamings::
225 * Pragma Partition_Elaboration_Policy::
226 * Pragma Part_Of::
227 * Pragma Passive::
228 * Pragma Persistent_BSS::
229 * Pragma Polling::
230 * Pragma Post::
231 * Pragma Postcondition::
232 * Pragma Post_Class::
233 * Pragma Rename_Pragma::
234 * Pragma Pre::
235 * Pragma Precondition::
236 * Pragma Predicate::
237 * Pragma Predicate_Failure::
238 * Pragma Preelaborable_Initialization::
239 * Pragma Prefix_Exception_Messages::
240 * Pragma Pre_Class::
241 * Pragma Priority_Specific_Dispatching::
242 * Pragma Profile::
243 * Pragma Profile_Warnings::
244 * Pragma Propagate_Exceptions::
245 * Pragma Provide_Shift_Operators::
246 * Pragma Psect_Object::
247 * Pragma Pure_Function::
248 * Pragma Rational::
249 * Pragma Ravenscar::
250 * Pragma Refined_Depends::
251 * Pragma Refined_Global::
252 * Pragma Refined_Post::
253 * Pragma Refined_State::
254 * Pragma Relative_Deadline::
255 * Pragma Remote_Access_Type::
256 * Pragma Restricted_Run_Time::
257 * Pragma Restriction_Warnings::
258 * Pragma Reviewable::
259 * Pragma Secondary_Stack_Size::
260 * Pragma Share_Generic::
261 * Pragma Shared::
262 * Pragma Short_Circuit_And_Or::
263 * Pragma Short_Descriptors::
264 * Pragma Simple_Storage_Pool_Type::
265 * Pragma Source_File_Name::
266 * Pragma Source_File_Name_Project::
267 * Pragma Source_Reference::
268 * Pragma SPARK_Mode::
269 * Pragma Static_Elaboration_Desired::
270 * Pragma Stream_Convert::
271 * Pragma Style_Checks::
272 * Pragma Subtitle::
273 * Pragma Suppress::
274 * Pragma Suppress_All::
275 * Pragma Suppress_Debug_Info::
276 * Pragma Suppress_Exception_Locations::
277 * Pragma Suppress_Initialization::
278 * Pragma Task_Name::
279 * Pragma Task_Storage::
280 * Pragma Test_Case::
281 * Pragma Thread_Local_Storage::
282 * Pragma Time_Slice::
283 * Pragma Title::
284 * Pragma Type_Invariant::
285 * Pragma Type_Invariant_Class::
286 * Pragma Unchecked_Union::
287 * Pragma Unevaluated_Use_Of_Old::
288 * Pragma Unimplemented_Unit::
289 * Pragma Universal_Aliasing::
290 * Pragma Universal_Data::
291 * Pragma Unmodified::
292 * Pragma Unreferenced::
293 * Pragma Unreferenced_Objects::
294 * Pragma Unreserve_All_Interrupts::
295 * Pragma Unsuppress::
296 * Pragma Use_VADS_Size::
297 * Pragma Unused::
298 * Pragma Validity_Checks::
299 * Pragma Volatile::
300 * Pragma Volatile_Full_Access::
301 * Pragma Volatile_Function::
302 * Pragma Warning_As_Error::
303 * Pragma Warnings::
304 * Pragma Weak_External::
305 * Pragma Wide_Character_Encoding::
306
307 Implementation Defined Aspects
308
309 * Aspect Abstract_State::
310 * Aspect Annotate::
311 * Aspect Async_Readers::
312 * Aspect Async_Writers::
313 * Aspect Constant_After_Elaboration::
314 * Aspect Contract_Cases::
315 * Aspect Depends::
316 * Aspect Default_Initial_Condition::
317 * Aspect Dimension::
318 * Aspect Dimension_System::
319 * Aspect Disable_Controlled::
320 * Aspect Effective_Reads::
321 * Aspect Effective_Writes::
322 * Aspect Extensions_Visible::
323 * Aspect Favor_Top_Level::
324 * Aspect Ghost::
325 * Aspect Global::
326 * Aspect Initial_Condition::
327 * Aspect Initializes::
328 * Aspect Inline_Always::
329 * Aspect Invariant::
330 * Aspect Invariant'Class::
331 * Aspect Iterable::
332 * Aspect Linker_Section::
333 * Aspect Lock_Free::
334 * Aspect Max_Queue_Length::
335 * Aspect No_Caching::
336 * Aspect No_Elaboration_Code_All::
337 * Aspect No_Inline::
338 * Aspect No_Tagged_Streams::
339 * Aspect Object_Size::
340 * Aspect Obsolescent::
341 * Aspect Part_Of::
342 * Aspect Persistent_BSS::
343 * Aspect Predicate::
344 * Aspect Pure_Function::
345 * Aspect Refined_Depends::
346 * Aspect Refined_Global::
347 * Aspect Refined_Post::
348 * Aspect Refined_State::
349 * Aspect Remote_Access_Type::
350 * Aspect Secondary_Stack_Size::
351 * Aspect Scalar_Storage_Order::
352 * Aspect Shared::
353 * Aspect Simple_Storage_Pool::
354 * Aspect Simple_Storage_Pool_Type::
355 * Aspect SPARK_Mode::
356 * Aspect Suppress_Debug_Info::
357 * Aspect Suppress_Initialization::
358 * Aspect Test_Case::
359 * Aspect Thread_Local_Storage::
360 * Aspect Universal_Aliasing::
361 * Aspect Universal_Data::
362 * Aspect Unmodified::
363 * Aspect Unreferenced::
364 * Aspect Unreferenced_Objects::
365 * Aspect Value_Size::
366 * Aspect Volatile_Full_Access::
367 * Aspect Volatile_Function::
368 * Aspect Warnings::
369
370 Implementation Defined Attributes
371
372 * Attribute Abort_Signal::
373 * Attribute Address_Size::
374 * Attribute Asm_Input::
375 * Attribute Asm_Output::
376 * Attribute Atomic_Always_Lock_Free::
377 * Attribute Bit::
378 * Attribute Bit_Position::
379 * Attribute Code_Address::
380 * Attribute Compiler_Version::
381 * Attribute Constrained::
382 * Attribute Default_Bit_Order::
383 * Attribute Default_Scalar_Storage_Order::
384 * Attribute Deref::
385 * Attribute Descriptor_Size::
386 * Attribute Elaborated::
387 * Attribute Elab_Body::
388 * Attribute Elab_Spec::
389 * Attribute Elab_Subp_Body::
390 * Attribute Emax::
391 * Attribute Enabled::
392 * Attribute Enum_Rep::
393 * Attribute Enum_Val::
394 * Attribute Epsilon::
395 * Attribute Fast_Math::
396 * Attribute Finalization_Size::
397 * Attribute Fixed_Value::
398 * Attribute From_Any::
399 * Attribute Has_Access_Values::
400 * Attribute Has_Discriminants::
401 * Attribute Img::
402 * Attribute Integer_Value::
403 * Attribute Invalid_Value::
404 * Attribute Iterable::
405 * Attribute Large::
406 * Attribute Library_Level::
407 * Attribute Lock_Free::
408 * Attribute Loop_Entry::
409 * Attribute Machine_Size::
410 * Attribute Mantissa::
411 * Attribute Maximum_Alignment::
412 * Attribute Mechanism_Code::
413 * Attribute Null_Parameter::
414 * Attribute Object_Size::
415 * Attribute Old::
416 * Attribute Passed_By_Reference::
417 * Attribute Pool_Address::
418 * Attribute Range_Length::
419 * Attribute Restriction_Set::
420 * Attribute Result::
421 * Attribute Safe_Emax::
422 * Attribute Safe_Large::
423 * Attribute Safe_Small::
424 * Attribute Scalar_Storage_Order::
425 * Attribute Simple_Storage_Pool::
426 * Attribute Small::
427 * Attribute Storage_Unit::
428 * Attribute Stub_Type::
429 * Attribute System_Allocator_Alignment::
430 * Attribute Target_Name::
431 * Attribute To_Address::
432 * Attribute To_Any::
433 * Attribute Type_Class::
434 * Attribute Type_Key::
435 * Attribute TypeCode::
436 * Attribute Unconstrained_Array::
437 * Attribute Universal_Literal_String::
438 * Attribute Unrestricted_Access::
439 * Attribute Update::
440 * Attribute Valid_Scalars::
441 * Attribute VADS_Size::
442 * Attribute Value_Size::
443 * Attribute Wchar_T_Size::
444 * Attribute Word_Size::
445
446 Standard and Implementation Defined Restrictions
447
448 * Partition-Wide Restrictions::
449 * Program Unit Level Restrictions::
450
451 Partition-Wide Restrictions
452
453 * Immediate_Reclamation::
454 * Max_Asynchronous_Select_Nesting::
455 * Max_Entry_Queue_Length::
456 * Max_Protected_Entries::
457 * Max_Select_Alternatives::
458 * Max_Storage_At_Blocking::
459 * Max_Task_Entries::
460 * Max_Tasks::
461 * No_Abort_Statements::
462 * No_Access_Parameter_Allocators::
463 * No_Access_Subprograms::
464 * No_Allocators::
465 * No_Anonymous_Allocators::
466 * No_Asynchronous_Control::
467 * No_Calendar::
468 * No_Coextensions::
469 * No_Default_Initialization::
470 * No_Delay::
471 * No_Dependence::
472 * No_Direct_Boolean_Operators::
473 * No_Dispatch::
474 * No_Dispatching_Calls::
475 * No_Dynamic_Attachment::
476 * No_Dynamic_Priorities::
477 * No_Entry_Calls_In_Elaboration_Code::
478 * No_Enumeration_Maps::
479 * No_Exception_Handlers::
480 * No_Exception_Propagation::
481 * No_Exception_Registration::
482 * No_Exceptions::
483 * No_Finalization::
484 * No_Fixed_Point::
485 * No_Floating_Point::
486 * No_Implicit_Conditionals::
487 * No_Implicit_Dynamic_Code::
488 * No_Implicit_Heap_Allocations::
489 * No_Implicit_Protected_Object_Allocations::
490 * No_Implicit_Task_Allocations::
491 * No_Initialize_Scalars::
492 * No_IO::
493 * No_Local_Allocators::
494 * No_Local_Protected_Objects::
495 * No_Local_Timing_Events::
496 * No_Long_Long_Integers::
497 * No_Multiple_Elaboration::
498 * No_Nested_Finalization::
499 * No_Protected_Type_Allocators::
500 * No_Protected_Types::
501 * No_Recursion::
502 * No_Reentrancy::
503 * No_Relative_Delay::
504 * No_Requeue_Statements::
505 * No_Secondary_Stack::
506 * No_Select_Statements::
507 * No_Specific_Termination_Handlers::
508 * No_Specification_of_Aspect::
509 * No_Standard_Allocators_After_Elaboration::
510 * No_Standard_Storage_Pools::
511 * No_Stream_Optimizations::
512 * No_Streams::
513 * No_Task_Allocators::
514 * No_Task_At_Interrupt_Priority::
515 * No_Task_Attributes_Package::
516 * No_Task_Hierarchy::
517 * No_Task_Termination::
518 * No_Tasking::
519 * No_Terminate_Alternatives::
520 * No_Unchecked_Access::
521 * No_Unchecked_Conversion::
522 * No_Unchecked_Deallocation::
523 * No_Use_Of_Entity::
524 * Pure_Barriers::
525 * Simple_Barriers::
526 * Static_Priorities::
527 * Static_Storage_Size::
528
529 Program Unit Level Restrictions
530
531 * No_Elaboration_Code::
532 * No_Dynamic_Sized_Objects::
533 * No_Entry_Queue::
534 * No_Implementation_Aspect_Specifications::
535 * No_Implementation_Attributes::
536 * No_Implementation_Identifiers::
537 * No_Implementation_Pragmas::
538 * No_Implementation_Restrictions::
539 * No_Implementation_Units::
540 * No_Implicit_Aliasing::
541 * No_Implicit_Loops::
542 * No_Obsolescent_Features::
543 * No_Wide_Characters::
544 * Static_Dispatch_Tables::
545 * SPARK_05::
546
547 Implementation Advice
548
549 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection.
550 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units.
551 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors.
552 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas.
553 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas.
554 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets.
555 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types.
556 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types.
557 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values.
558 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types.
559 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays.
560 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small.
561 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation.
562 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information.
563 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks.
564 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses.
565 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types.
566 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses.
567 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses.
568 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses.
569 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses.
570 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses.
571 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses.
572 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses.
573 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes.
574 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering.
575 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private.
576 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations.
577 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion.
578 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage.
579 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation.
580 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes.
581 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types.
582 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling.
583 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling.
584 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation.
585 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate.
586 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export.
587 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces.
588 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C.
589 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL.
590 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran.
591 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations.
592 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations.
593 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support.
594 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers.
595 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts.
596 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements.
597 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names.
598 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes.
599 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies.
600 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies.
601 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort.
602 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions.
603 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time.
604 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem.
605 * RM F(7); COBOL Support: RM F 7 COBOL Support.
606 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support.
607 * RM G; Numerics: RM G Numerics.
608 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types.
609 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions.
610 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements.
611 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy.
612 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy.
613
614 Intrinsic Subprograms
615
616 * Intrinsic Operators::
617 * Compilation_ISO_Date::
618 * Compilation_Date::
619 * Compilation_Time::
620 * Enclosing_Entity::
621 * Exception_Information::
622 * Exception_Message::
623 * Exception_Name::
624 * File::
625 * Line::
626 * Shifts and Rotates::
627 * Source_Location::
628
629 Representation Clauses and Pragmas
630
631 * Alignment Clauses::
632 * Size Clauses::
633 * Storage_Size Clauses::
634 * Size of Variant Record Objects::
635 * Biased Representation::
636 * Value_Size and Object_Size Clauses::
637 * Component_Size Clauses::
638 * Bit_Order Clauses::
639 * Effect of Bit_Order on Byte Ordering::
640 * Pragma Pack for Arrays::
641 * Pragma Pack for Records::
642 * Record Representation Clauses::
643 * Handling of Records with Holes::
644 * Enumeration Clauses::
645 * Address Clauses::
646 * Use of Address Clauses for Memory-Mapped I/O::
647 * Effect of Convention on Representation::
648 * Conventions and Anonymous Access Types::
649 * Determining the Representations chosen by GNAT::
650
651 The Implementation of Standard I/O
652
653 * Standard I/O Packages::
654 * FORM Strings::
655 * Direct_IO::
656 * Sequential_IO::
657 * Text_IO::
658 * Wide_Text_IO::
659 * Wide_Wide_Text_IO::
660 * Stream_IO::
661 * Text Translation::
662 * Shared Files::
663 * Filenames encoding::
664 * File content encoding::
665 * Open Modes::
666 * Operations on C Streams::
667 * Interfacing to C Streams::
668
669 Text_IO
670
671 * Stream Pointer Positioning::
672 * Reading and Writing Non-Regular Files::
673 * Get_Immediate::
674 * Treating Text_IO Files as Streams::
675 * Text_IO Extensions::
676 * Text_IO Facilities for Unbounded Strings::
677
678 Wide_Text_IO
679
680 * Stream Pointer Positioning: Stream Pointer Positioning<2>.
681 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>.
682
683 Wide_Wide_Text_IO
684
685 * Stream Pointer Positioning: Stream Pointer Positioning<3>.
686 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>.
687
688 The GNAT Library
689
690 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads.
691 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads.
692 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads.
693 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads.
694 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads.
695 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads.
696 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads.
697 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads.
698 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads.
699 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads.
700 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads.
701 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads.
702 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads.
703 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads.
704 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads.
705 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads.
706 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads.
707 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads.
708 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads.
709 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads.
710 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads.
711 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads.
712 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads.
713 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads.
714 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads.
715 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
716 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
717 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
718 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
719 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
720 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
721 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads.
722 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads.
723 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads.
724 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads.
725 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads.
726 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads.
727 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads.
728 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads.
729 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads.
730 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads.
731 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads.
732 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads.
733 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads.
734 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads.
735 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads.
736 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads.
737 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads.
738 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads.
739 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads.
740 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads.
741 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads.
742 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads.
743 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads.
744 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads.
745 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads.
746 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads.
747 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads.
748 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads.
749 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads.
750 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads.
751 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads.
752 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads.
753 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads.
754 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads.
755 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads.
756 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads.
757 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads.
758 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads.
759 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads.
760 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads.
761 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads.
762 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads.
763 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads.
764 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads.
765 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads.
766 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads.
767 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads.
768 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads.
769 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads.
770 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads.
771 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads.
772 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads.
773 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads.
774 * GNAT.IO (g-io.ads): GNAT IO g-io ads.
775 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads.
776 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads.
777 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads.
778 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads.
779 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads.
780 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads.
781 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads.
782 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads.
783 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads.
784 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads.
785 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads.
786 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads.
787 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads.
788 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads.
789 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads.
790 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads.
791 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads.
792 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads.
793 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads.
794 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads.
795 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads.
796 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads.
797 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads.
798 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads.
799 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads.
800 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads.
801 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads.
802 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads.
803 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads.
804 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads.
805 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads.
806 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads.
807 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads.
808 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads.
809 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads.
810 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads.
811 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads.
812 * GNAT.Table (g-table.ads): GNAT Table g-table ads.
813 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads.
814 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads.
815 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads.
816 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads.
817 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads.
818 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads.
819 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads.
820 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads.
821 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads.
822 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads.
823 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads.
824 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads.
825 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads.
826 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads.
827 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads.
828 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads.
829 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads.
830 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads.
831 * System.Assertions (s-assert.ads): System Assertions s-assert ads.
832 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads.
833 * System.Memory (s-memory.ads): System Memory s-memory ads.
834 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads.
835 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads.
836 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads.
837 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads.
838 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads.
839 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads.
840 * System.Rident (s-rident.ads): System Rident s-rident ads.
841 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads.
842 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads.
843 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads.
844 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads.
845
846 Interfacing to Other Languages
847
848 * Interfacing to C::
849 * Interfacing to C++::
850 * Interfacing to COBOL::
851 * Interfacing to Fortran::
852 * Interfacing to non-GNAT Ada code::
853
854 Implementation of Specific Ada Features
855
856 * Machine Code Insertions::
857 * GNAT Implementation of Tasking::
858 * GNAT Implementation of Shared Passive Packages::
859 * Code Generation for Array Aggregates::
860 * The Size of Discriminated Records with Default Discriminants::
861 * Strict Conformance to the Ada Reference Manual::
862
863 GNAT Implementation of Tasking
864
865 * Mapping Ada Tasks onto the Underlying Kernel Threads::
866 * Ensuring Compliance with the Real-Time Annex::
867 * Support for Locking Policies::
868
869 Code Generation for Array Aggregates
870
871 * Static constant aggregates with static bounds::
872 * Constant aggregates with unconstrained nominal types::
873 * Aggregates with static bounds::
874 * Aggregates with nonstatic bounds::
875 * Aggregates in assignment statements::
876
877 Obsolescent Features
878
879 * pragma No_Run_Time::
880 * pragma Ravenscar::
881 * pragma Restricted_Run_Time::
882 * pragma Task_Info::
883 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads.
884
885 Compatibility and Porting Guide
886
887 * Writing Portable Fixed-Point Declarations::
888 * Compatibility with Ada 83::
889 * Compatibility between Ada 95 and Ada 2005::
890 * Implementation-dependent characteristics::
891 * Compatibility with Other Ada Systems::
892 * Representation Clauses::
893 * Compatibility with HP Ada 83::
894
895 Compatibility with Ada 83
896
897 * Legal Ada 83 programs that are illegal in Ada 95::
898 * More deterministic semantics::
899 * Changed semantics::
900 * Other language compatibility issues::
901
902 Implementation-dependent characteristics
903
904 * Implementation-defined pragmas::
905 * Implementation-defined attributes::
906 * Libraries::
907 * Elaboration order::
908 * Target-specific aspects::
909
910 @end detailmenu
911 @end menu
912
913 @node About This Guide,Implementation Defined Pragmas,Top,Top
914 @anchor{gnat_rm/about_this_guide about-this-guide}@anchor{2}@anchor{gnat_rm/about_this_guide doc}@anchor{3}@anchor{gnat_rm/about_this_guide gnat-reference-manual}@anchor{4}@anchor{gnat_rm/about_this_guide id1}@anchor{5}
915 @chapter About This Guide
916
917
918
919 This manual contains useful information in writing programs using the
920 GNAT compiler. It includes information on implementation dependent
921 characteristics of GNAT, including all the information required by
922 Annex M of the Ada language standard.
923
924 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
925 invoked in Ada 83 compatibility mode.
926 By default, GNAT assumes Ada 2012,
927 but you can override with a compiler switch
928 to explicitly specify the language version.
929 (Please refer to the @emph{GNAT User's Guide} for details on these switches.)
930 Throughout this manual, references to 'Ada' without a year suffix
931 apply to all the Ada versions of the language.
932
933 Ada is designed to be highly portable.
934 In general, a program will have the same effect even when compiled by
935 different compilers on different platforms.
936 However, since Ada is designed to be used in a
937 wide variety of applications, it also contains a number of system
938 dependent features to be used in interfacing to the external world.
939
940 @geindex Implementation-dependent features
941
942 @geindex Portability
943
944 Note: Any program that makes use of implementation-dependent features
945 may be non-portable. You should follow good programming practice and
946 isolate and clearly document any sections of your program that make use
947 of these features in a non-portable manner.
948
949 @menu
950 * What This Reference Manual Contains::
951 * Conventions::
952 * Related Information::
953
954 @end menu
955
956 @node What This Reference Manual Contains,Conventions,,About This Guide
957 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
958 @section What This Reference Manual Contains
959
960
961 This reference manual contains the following chapters:
962
963
964 @itemize *
965
966 @item
967 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
968 pragmas, which can be used to extend and enhance the functionality of the
969 compiler.
970
971 @item
972 @ref{8,,Implementation Defined Attributes}, lists GNAT
973 implementation-dependent attributes, which can be used to extend and
974 enhance the functionality of the compiler.
975
976 @item
977 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
978 implementation-dependent restrictions, which can be used to extend and
979 enhance the functionality of the compiler.
980
981 @item
982 @ref{a,,Implementation Advice}, provides information on generally
983 desirable behavior which are not requirements that all compilers must
984 follow since it cannot be provided on all systems, or which may be
985 undesirable on some systems.
986
987 @item
988 @ref{b,,Implementation Defined Characteristics}, provides a guide to
989 minimizing implementation dependent features.
990
991 @item
992 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
993 implemented by GNAT, and how they can be imported into user
994 application programs.
995
996 @item
997 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
998 way that GNAT represents data, and in particular the exact set
999 of representation clauses and pragmas that is accepted.
1000
1001 @item
1002 @ref{e,,Standard Library Routines}, provides a listing of packages and a
1003 brief description of the functionality that is provided by Ada's
1004 extensive set of standard library routines as implemented by GNAT.
1005
1006 @item
1007 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
1008 implementation of the input-output facilities.
1009
1010 @item
1011 @ref{10,,The GNAT Library}, is a catalog of packages that complement
1012 the Ada predefined library.
1013
1014 @item
1015 @ref{11,,Interfacing to Other Languages}, describes how programs
1016 written in Ada using GNAT can be interfaced to other programming
1017 languages.
1018
1019 @item
1020 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
1021 of the specialized needs annexes.
1022
1023 @item
1024 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1025 to GNAT's implementation of machine code insertions, tasking, and several
1026 other features.
1027
1028 @item
1029 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1030 GNAT implementation of the Ada 2012 language standard.
1031
1032 @item
1033 @ref{15,,Obsolescent Features} documents implementation dependent features,
1034 including pragmas and attributes, which are considered obsolescent, since
1035 there are other preferred ways of achieving the same results. These
1036 obsolescent forms are retained for backwards compatibility.
1037
1038 @item
1039 @ref{16,,Compatibility and Porting Guide} presents some guidelines for
1040 developing portable Ada code, describes the compatibility issues that
1041 may arise between GNAT and other Ada compilation systems (including those
1042 for Ada 83), and shows how GNAT can expedite porting applications
1043 developed in other Ada environments.
1044
1045 @item
1046 @ref{1,,GNU Free Documentation License} contains the license for this document.
1047 @end itemize
1048
1049 @geindex Ada 95 Language Reference Manual
1050
1051 @geindex Ada 2005 Language Reference Manual
1052
1053 This reference manual assumes a basic familiarity with the Ada 95 language, as
1054 described in the
1055 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1056 It does not require knowledge of the new features introduced by Ada 2005 or
1057 Ada 2012.
1058 All three reference manuals are included in the GNAT documentation
1059 package.
1060
1061 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1062 @anchor{gnat_rm/about_this_guide conventions}@anchor{17}
1063 @section Conventions
1064
1065
1066 @geindex Conventions
1067 @geindex typographical
1068
1069 @geindex Typographical conventions
1070
1071 Following are examples of the typographical and graphic conventions used
1072 in this guide:
1073
1074
1075 @itemize *
1076
1077 @item
1078 @code{Functions}, @code{utility program names}, @code{standard names},
1079 and @code{classes}.
1080
1081 @item
1082 @code{Option flags}
1083
1084 @item
1085 @code{File names}
1086
1087 @item
1088 @code{Variables}
1089
1090 @item
1091 @emph{Emphasis}
1092
1093 @item
1094 [optional information or parameters]
1095
1096 @item
1097 Examples are described by text
1098
1099 @example
1100 and then shown this way.
1101 @end example
1102
1103 @item
1104 Commands that are entered by the user are shown as preceded by a prompt string
1105 comprising the @code{$} character followed by a space.
1106 @end itemize
1107
1108 @node Related Information,,Conventions,About This Guide
1109 @anchor{gnat_rm/about_this_guide related-information}@anchor{18}
1110 @section Related Information
1111
1112
1113 See the following documents for further information on GNAT:
1114
1115
1116 @itemize *
1117
1118 @item
1119 @cite{GNAT User's Guide for Native Platforms},
1120 which provides information on how to use the
1121 GNAT development environment.
1122
1123 @item
1124 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1125
1126 @item
1127 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1128 of the Ada 95 standard. The annotations describe
1129 detailed aspects of the design decision, and in particular contain useful
1130 sections on Ada 83 compatibility.
1131
1132 @item
1133 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1134
1135 @item
1136 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1137 of the Ada 2005 standard. The annotations describe
1138 detailed aspects of the design decision.
1139
1140 @item
1141 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1142
1143 @item
1144 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1145 which contains specific information on compatibility between GNAT and
1146 DEC Ada 83 systems.
1147
1148 @item
1149 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1150 describes in detail the pragmas and attributes provided by the DEC Ada 83
1151 compiler system.
1152 @end itemize
1153
1154 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1155 @anchor{gnat_rm/implementation_defined_pragmas implementation-defined-pragmas}@anchor{7}@anchor{gnat_rm/implementation_defined_pragmas doc}@anchor{19}@anchor{gnat_rm/implementation_defined_pragmas id1}@anchor{1a}
1156 @chapter Implementation Defined Pragmas
1157
1158
1159 Ada defines a set of pragmas that can be used to supply additional
1160 information to the compiler. These language defined pragmas are
1161 implemented in GNAT and work as described in the Ada Reference Manual.
1162
1163 In addition, Ada allows implementations to define additional pragmas
1164 whose meaning is defined by the implementation. GNAT provides a number
1165 of these implementation-defined pragmas, which can be used to extend
1166 and enhance the functionality of the compiler. This section of the GNAT
1167 Reference Manual describes these additional pragmas.
1168
1169 Note that any program using these pragmas might not be portable to other
1170 compilers (although GNAT implements this set of pragmas on all
1171 platforms). Therefore if portability to other compilers is an important
1172 consideration, the use of these pragmas should be minimized.
1173
1174 @menu
1175 * Pragma Abort_Defer::
1176 * Pragma Abstract_State::
1177 * Pragma Acc_Parallel::
1178 * Pragma Acc_Loop::
1179 * Pragma Acc_Kernels::
1180 * Pragma Acc_Data::
1181 * Pragma Ada_83::
1182 * Pragma Ada_95::
1183 * Pragma Ada_05::
1184 * Pragma Ada_2005::
1185 * Pragma Ada_12::
1186 * Pragma Ada_2012::
1187 * Pragma Allow_Integer_Address::
1188 * Pragma Annotate::
1189 * Pragma Assert::
1190 * Pragma Assert_And_Cut::
1191 * Pragma Assertion_Policy::
1192 * Pragma Assume::
1193 * Pragma Assume_No_Invalid_Values::
1194 * Pragma Async_Readers::
1195 * Pragma Async_Writers::
1196 * Pragma Attribute_Definition::
1197 * Pragma C_Pass_By_Copy::
1198 * Pragma Check::
1199 * Pragma Check_Float_Overflow::
1200 * Pragma Check_Name::
1201 * Pragma Check_Policy::
1202 * Pragma Comment::
1203 * Pragma Common_Object::
1204 * Pragma Compile_Time_Error::
1205 * Pragma Compile_Time_Warning::
1206 * Pragma Compiler_Unit::
1207 * Pragma Compiler_Unit_Warning::
1208 * Pragma Complete_Representation::
1209 * Pragma Complex_Representation::
1210 * Pragma Component_Alignment::
1211 * Pragma Constant_After_Elaboration::
1212 * Pragma Contract_Cases::
1213 * Pragma Convention_Identifier::
1214 * Pragma CPP_Class::
1215 * Pragma CPP_Constructor::
1216 * Pragma CPP_Virtual::
1217 * Pragma CPP_Vtable::
1218 * Pragma CPU::
1219 * Pragma Deadline_Floor::
1220 * Pragma Default_Initial_Condition::
1221 * Pragma Debug::
1222 * Pragma Debug_Policy::
1223 * Pragma Default_Scalar_Storage_Order::
1224 * Pragma Default_Storage_Pool::
1225 * Pragma Depends::
1226 * Pragma Detect_Blocking::
1227 * Pragma Disable_Atomic_Synchronization::
1228 * Pragma Dispatching_Domain::
1229 * Pragma Effective_Reads::
1230 * Pragma Effective_Writes::
1231 * Pragma Elaboration_Checks::
1232 * Pragma Eliminate::
1233 * Pragma Enable_Atomic_Synchronization::
1234 * Pragma Export_Function::
1235 * Pragma Export_Object::
1236 * Pragma Export_Procedure::
1237 * Pragma Export_Value::
1238 * Pragma Export_Valued_Procedure::
1239 * Pragma Extend_System::
1240 * Pragma Extensions_Allowed::
1241 * Pragma Extensions_Visible::
1242 * Pragma External::
1243 * Pragma External_Name_Casing::
1244 * Pragma Fast_Math::
1245 * Pragma Favor_Top_Level::
1246 * Pragma Finalize_Storage_Only::
1247 * Pragma Float_Representation::
1248 * Pragma Ghost::
1249 * Pragma Global::
1250 * Pragma Ident::
1251 * Pragma Ignore_Pragma::
1252 * Pragma Implementation_Defined::
1253 * Pragma Implemented::
1254 * Pragma Implicit_Packing::
1255 * Pragma Import_Function::
1256 * Pragma Import_Object::
1257 * Pragma Import_Procedure::
1258 * Pragma Import_Valued_Procedure::
1259 * Pragma Independent::
1260 * Pragma Independent_Components::
1261 * Pragma Initial_Condition::
1262 * Pragma Initialize_Scalars::
1263 * Pragma Initializes::
1264 * Pragma Inline_Always::
1265 * Pragma Inline_Generic::
1266 * Pragma Interface::
1267 * Pragma Interface_Name::
1268 * Pragma Interrupt_Handler::
1269 * Pragma Interrupt_State::
1270 * Pragma Invariant::
1271 * Pragma Keep_Names::
1272 * Pragma License::
1273 * Pragma Link_With::
1274 * Pragma Linker_Alias::
1275 * Pragma Linker_Constructor::
1276 * Pragma Linker_Destructor::
1277 * Pragma Linker_Section::
1278 * Pragma Lock_Free::
1279 * Pragma Loop_Invariant::
1280 * Pragma Loop_Optimize::
1281 * Pragma Loop_Variant::
1282 * Pragma Machine_Attribute::
1283 * Pragma Main::
1284 * Pragma Main_Storage::
1285 * Pragma Max_Queue_Length::
1286 * Pragma No_Body::
1287 * Pragma No_Caching::
1288 * Pragma No_Component_Reordering::
1289 * Pragma No_Elaboration_Code_All::
1290 * Pragma No_Heap_Finalization::
1291 * Pragma No_Inline::
1292 * Pragma No_Return::
1293 * Pragma No_Run_Time::
1294 * Pragma No_Strict_Aliasing::
1295 * Pragma No_Tagged_Streams::
1296 * Pragma Normalize_Scalars::
1297 * Pragma Obsolescent::
1298 * Pragma Optimize_Alignment::
1299 * Pragma Ordered::
1300 * Pragma Overflow_Mode::
1301 * Pragma Overriding_Renamings::
1302 * Pragma Partition_Elaboration_Policy::
1303 * Pragma Part_Of::
1304 * Pragma Passive::
1305 * Pragma Persistent_BSS::
1306 * Pragma Polling::
1307 * Pragma Post::
1308 * Pragma Postcondition::
1309 * Pragma Post_Class::
1310 * Pragma Rename_Pragma::
1311 * Pragma Pre::
1312 * Pragma Precondition::
1313 * Pragma Predicate::
1314 * Pragma Predicate_Failure::
1315 * Pragma Preelaborable_Initialization::
1316 * Pragma Prefix_Exception_Messages::
1317 * Pragma Pre_Class::
1318 * Pragma Priority_Specific_Dispatching::
1319 * Pragma Profile::
1320 * Pragma Profile_Warnings::
1321 * Pragma Propagate_Exceptions::
1322 * Pragma Provide_Shift_Operators::
1323 * Pragma Psect_Object::
1324 * Pragma Pure_Function::
1325 * Pragma Rational::
1326 * Pragma Ravenscar::
1327 * Pragma Refined_Depends::
1328 * Pragma Refined_Global::
1329 * Pragma Refined_Post::
1330 * Pragma Refined_State::
1331 * Pragma Relative_Deadline::
1332 * Pragma Remote_Access_Type::
1333 * Pragma Restricted_Run_Time::
1334 * Pragma Restriction_Warnings::
1335 * Pragma Reviewable::
1336 * Pragma Secondary_Stack_Size::
1337 * Pragma Share_Generic::
1338 * Pragma Shared::
1339 * Pragma Short_Circuit_And_Or::
1340 * Pragma Short_Descriptors::
1341 * Pragma Simple_Storage_Pool_Type::
1342 * Pragma Source_File_Name::
1343 * Pragma Source_File_Name_Project::
1344 * Pragma Source_Reference::
1345 * Pragma SPARK_Mode::
1346 * Pragma Static_Elaboration_Desired::
1347 * Pragma Stream_Convert::
1348 * Pragma Style_Checks::
1349 * Pragma Subtitle::
1350 * Pragma Suppress::
1351 * Pragma Suppress_All::
1352 * Pragma Suppress_Debug_Info::
1353 * Pragma Suppress_Exception_Locations::
1354 * Pragma Suppress_Initialization::
1355 * Pragma Task_Name::
1356 * Pragma Task_Storage::
1357 * Pragma Test_Case::
1358 * Pragma Thread_Local_Storage::
1359 * Pragma Time_Slice::
1360 * Pragma Title::
1361 * Pragma Type_Invariant::
1362 * Pragma Type_Invariant_Class::
1363 * Pragma Unchecked_Union::
1364 * Pragma Unevaluated_Use_Of_Old::
1365 * Pragma Unimplemented_Unit::
1366 * Pragma Universal_Aliasing::
1367 * Pragma Universal_Data::
1368 * Pragma Unmodified::
1369 * Pragma Unreferenced::
1370 * Pragma Unreferenced_Objects::
1371 * Pragma Unreserve_All_Interrupts::
1372 * Pragma Unsuppress::
1373 * Pragma Use_VADS_Size::
1374 * Pragma Unused::
1375 * Pragma Validity_Checks::
1376 * Pragma Volatile::
1377 * Pragma Volatile_Full_Access::
1378 * Pragma Volatile_Function::
1379 * Pragma Warning_As_Error::
1380 * Pragma Warnings::
1381 * Pragma Weak_External::
1382 * Pragma Wide_Character_Encoding::
1383
1384 @end menu
1385
1386 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1387 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1b}
1388 @section Pragma Abort_Defer
1389
1390
1391 @geindex Deferring aborts
1392
1393 Syntax:
1394
1395 @example
1396 pragma Abort_Defer;
1397 @end example
1398
1399 This pragma must appear at the start of the statement sequence of a
1400 handled sequence of statements (right after the @code{begin}). It has
1401 the effect of deferring aborts for the sequence of statements (but not
1402 for the declarations or handlers, if any, associated with this statement
1403 sequence).
1404
1405 @node Pragma Abstract_State,Pragma Acc_Parallel,Pragma Abort_Defer,Implementation Defined Pragmas
1406 @anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1c}@anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}
1407 @section Pragma Abstract_State
1408
1409
1410 Syntax:
1411
1412 @example
1413 pragma Abstract_State (ABSTRACT_STATE_LIST);
1414
1415 ABSTRACT_STATE_LIST ::=
1416 null
1417 | STATE_NAME_WITH_OPTIONS
1418 | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1419
1420 STATE_NAME_WITH_OPTIONS ::=
1421 STATE_NAME
1422 | (STATE_NAME with OPTION_LIST)
1423
1424 OPTION_LIST ::= OPTION @{, OPTION@}
1425
1426 OPTION ::=
1427 SIMPLE_OPTION
1428 | NAME_VALUE_OPTION
1429
1430 SIMPLE_OPTION ::= Ghost | Synchronous
1431
1432 NAME_VALUE_OPTION ::=
1433 Part_Of => ABSTRACT_STATE
1434 | External [=> EXTERNAL_PROPERTY_LIST]
1435
1436 EXTERNAL_PROPERTY_LIST ::=
1437 EXTERNAL_PROPERTY
1438 | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
1439
1440 EXTERNAL_PROPERTY ::=
1441 Async_Readers [=> boolean_EXPRESSION]
1442 | Async_Writers [=> boolean_EXPRESSION]
1443 | Effective_Reads [=> boolean_EXPRESSION]
1444 | Effective_Writes [=> boolean_EXPRESSION]
1445 others => boolean_EXPRESSION
1446
1447 STATE_NAME ::= defining_identifier
1448
1449 ABSTRACT_STATE ::= name
1450 @end example
1451
1452 For the semantics of this pragma, see the entry for aspect @code{Abstract_State} in
1453 the SPARK 2014 Reference Manual, section 7.1.4.
1454
1455 @node Pragma Acc_Parallel,Pragma Acc_Loop,Pragma Abstract_State,Implementation Defined Pragmas
1456 @anchor{gnat_rm/implementation_defined_pragmas pragma-acc-parallel}@anchor{1e}
1457 @section Pragma Acc_Parallel
1458
1459
1460 Syntax:
1461
1462 @example
1463 pragma Acc_Parallel [( ACC_PARALLEL_CLAUSE [, ACC_PARALLEL_CLAUSE... ])];
1464
1465 ACC_PARALLEL_CLAUSE ::=
1466 Acc_If => boolean_EXPRESSION
1467 | Acc_Private => IDENTIFIERS
1468 | Async => integer_EXPRESSION
1469 | Copy => IDENTIFIERS
1470 | Copy_In => IDENTIFIERS
1471 | Copy_Out => IDENTIFIERS
1472 | Create => IDENTIFIERS
1473 | Default => None
1474 | Device_Ptr => IDENTIFIERS
1475 | First_Private => IDENTIFIERS
1476 | Num_Gangs => integer_EXPRESSION
1477 | Num_Workers => integer_EXPRESSION
1478 | Present => IDENTIFIERS
1479 | Reduction => (REDUCTION_RECORD)
1480 | Vector_Length => integer_EXPRESSION
1481 | Wait => INTEGERS
1482
1483 REDUCTION_RECORD ::=
1484 "+" => IDENTIFIERS
1485 | "*" => IDENTIFIERS
1486 | "min" => IDENTIFIERS
1487 | "max" => IDENTIFIERS
1488 | "or" => IDENTIFIERS
1489 | "and" => IDENTIFIERS
1490
1491 IDENTIFIERS ::=
1492 | IDENTIFIER
1493 | (IDENTIFIER, IDENTIFIERS)
1494
1495 INTEGERS ::=
1496 | integer_EXPRESSION
1497 | (integer_EXPRESSION, INTEGERS)
1498 @end example
1499
1500 Requires the @code{-fopenacc} flag.
1501
1502 Equivalent to the @code{parallel} directive of the OpenAcc standard. This pragma
1503 should be placed in loops. It offloads the content of the loop to an
1504 accelerator device.
1505
1506 For more information about the effect of the clauses, see the OpenAcc
1507 specification.
1508
1509 @node Pragma Acc_Loop,Pragma Acc_Kernels,Pragma Acc_Parallel,Implementation Defined Pragmas
1510 @anchor{gnat_rm/implementation_defined_pragmas pragma-acc-loop}@anchor{1f}
1511 @section Pragma Acc_Loop
1512
1513
1514 Syntax:
1515
1516 @example
1517 pragma Acc_Loop [( ACC_LOOP_CLAUSE [, ACC_LOOP_CLAUSE... ])];
1518
1519 ACC_LOOP_CLAUSE ::=
1520 Auto
1521 | Collapse => INTEGER_LITERAL
1522 | Gang [=> GANG_ARG]
1523 | Independent
1524 | Private => IDENTIFIERS
1525 | Reduction => (REDUCTION_RECORD)
1526 | Seq
1527 | Tile => SIZE_EXPRESSION
1528 | Vector [=> integer_EXPRESSION]
1529 | Worker [=> integer_EXPRESSION]
1530
1531 GANG_ARG ::=
1532 integer_EXPRESSION
1533 | Static => SIZE_EXPRESSION
1534
1535 SIZE_EXPRESSION ::=
1536 *
1537 | integer_EXPRESSION
1538 @end example
1539
1540 Requires the @code{-fopenacc} flag.
1541
1542 Equivalent to the @code{loop} directive of the OpenAcc standard. This pragma
1543 should be placed in for loops after the "Acc_Parallel" pragma. It tells the
1544 compiler how to parallelize the loop.
1545
1546 For more information about the effect of the clauses, see the OpenAcc
1547 specification.
1548
1549 @node Pragma Acc_Kernels,Pragma Acc_Data,Pragma Acc_Loop,Implementation Defined Pragmas
1550 @anchor{gnat_rm/implementation_defined_pragmas pragma-acc-kernels}@anchor{20}
1551 @section Pragma Acc_Kernels
1552
1553
1554 Syntax:
1555
1556 @example
1557 pragma Acc_Kernels [( ACC_KERNELS_CLAUSE [, ACC_KERNELS_CLAUSE...])];
1558
1559 ACC_KERNELS_CLAUSE ::=
1560 Acc_If => boolean_EXPRESSION
1561 | Async => integer_EXPRESSION
1562 | Copy => IDENTIFIERS
1563 | Copy_In => IDENTIFIERS
1564 | Copy_Out => IDENTIFIERS
1565 | Create => IDENTIFIERS
1566 | Default => None
1567 | Device_Ptr => IDENTIFIERS
1568 | Num_Gangs => integer_EXPRESSION
1569 | Num_Workers => integer_EXPRESSION
1570 | Present => IDENTIFIERS
1571 | Vector_Length => integer_EXPRESSION
1572 | Wait => INTEGERS
1573
1574 IDENTIFIERS ::=
1575 | IDENTIFIER
1576 | (IDENTIFIER, IDENTIFIERS)
1577
1578 INTEGERS ::=
1579 | integer_EXPRESSION
1580 | (integer_EXPRESSION, INTEGERS)
1581 @end example
1582
1583 Requires the @code{-fopenacc} flag.
1584
1585 Equivalent to the kernels directive of the OpenAcc standard. This pragma should
1586 be placed in loops.
1587
1588 For more information about the effect of the clauses, see the OpenAcc
1589 specification.
1590
1591 @node Pragma Acc_Data,Pragma Ada_83,Pragma Acc_Kernels,Implementation Defined Pragmas
1592 @anchor{gnat_rm/implementation_defined_pragmas pragma-acc-data}@anchor{21}
1593 @section Pragma Acc_Data
1594
1595
1596 Syntax:
1597
1598 @example
1599 pragma Acc_Data ([ ACC_DATA_CLAUSE [, ACC_DATA_CLAUSE...]]);
1600
1601 ACC_DATA_CLAUSE ::=
1602 Copy => IDENTIFIERS
1603 | Copy_In => IDENTIFIERS
1604 | Copy_Out => IDENTIFIERS
1605 | Create => IDENTIFIERS
1606 | Device_Ptr => IDENTIFIERS
1607 | Present => IDENTIFIERS
1608 @end example
1609
1610 Requires the @code{-fopenacc} flag.
1611
1612 Equivalent to the @code{data} directive of the OpenAcc standard. This pragma
1613 should be placed in loops.
1614
1615 For more information about the effect of the clauses, see the OpenAcc
1616 specification.
1617
1618 @node Pragma Ada_83,Pragma Ada_95,Pragma Acc_Data,Implementation Defined Pragmas
1619 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{22}
1620 @section Pragma Ada_83
1621
1622
1623 Syntax:
1624
1625 @example
1626 pragma Ada_83;
1627 @end example
1628
1629 A configuration pragma that establishes Ada 83 mode for the unit to
1630 which it applies, regardless of the mode set by the command line
1631 switches. In Ada 83 mode, GNAT attempts to be as compatible with
1632 the syntax and semantics of Ada 83, as defined in the original Ada
1633 83 Reference Manual as possible. In particular, the keywords added by Ada 95
1634 and Ada 2005 are not recognized, optional package bodies are allowed,
1635 and generics may name types with unknown discriminants without using
1636 the @code{(<>)} notation. In addition, some but not all of the additional
1637 restrictions of Ada 83 are enforced.
1638
1639 Ada 83 mode is intended for two purposes. Firstly, it allows existing
1640 Ada 83 code to be compiled and adapted to GNAT with less effort.
1641 Secondly, it aids in keeping code backwards compatible with Ada 83.
1642 However, there is no guarantee that code that is processed correctly
1643 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1644 83 compiler, since GNAT does not enforce all the additional checks
1645 required by Ada 83.
1646
1647 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1648 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{23}
1649 @section Pragma Ada_95
1650
1651
1652 Syntax:
1653
1654 @example
1655 pragma Ada_95;
1656 @end example
1657
1658 A configuration pragma that establishes Ada 95 mode for the unit to which
1659 it applies, regardless of the mode set by the command line switches.
1660 This mode is set automatically for the @code{Ada} and @code{System}
1661 packages and their children, so you need not specify it in these
1662 contexts. This pragma is useful when writing a reusable component that
1663 itself uses Ada 95 features, but which is intended to be usable from
1664 either Ada 83 or Ada 95 programs.
1665
1666 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1667 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{24}
1668 @section Pragma Ada_05
1669
1670
1671 Syntax:
1672
1673 @example
1674 pragma Ada_05;
1675 pragma Ada_05 (local_NAME);
1676 @end example
1677
1678 A configuration pragma that establishes Ada 2005 mode for the unit to which
1679 it applies, regardless of the mode set by the command line switches.
1680 This pragma is useful when writing a reusable component that
1681 itself uses Ada 2005 features, but which is intended to be usable from
1682 either Ada 83 or Ada 95 programs.
1683
1684 The one argument form (which is not a configuration pragma)
1685 is used for managing the transition from
1686 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1687 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1688 mode will generate a warning. In addition, in Ada_83 or Ada_95
1689 mode, a preference rule is established which does not choose
1690 such an entity unless it is unambiguously specified. This avoids
1691 extra subprograms marked this way from generating ambiguities in
1692 otherwise legal pre-Ada_2005 programs. The one argument form is
1693 intended for exclusive use in the GNAT run-time library.
1694
1695 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1696 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{25}
1697 @section Pragma Ada_2005
1698
1699
1700 Syntax:
1701
1702 @example
1703 pragma Ada_2005;
1704 @end example
1705
1706 This configuration pragma is a synonym for pragma Ada_05 and has the
1707 same syntax and effect.
1708
1709 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1710 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{26}
1711 @section Pragma Ada_12
1712
1713
1714 Syntax:
1715
1716 @example
1717 pragma Ada_12;
1718 pragma Ada_12 (local_NAME);
1719 @end example
1720
1721 A configuration pragma that establishes Ada 2012 mode for the unit to which
1722 it applies, regardless of the mode set by the command line switches.
1723 This mode is set automatically for the @code{Ada} and @code{System}
1724 packages and their children, so you need not specify it in these
1725 contexts. This pragma is useful when writing a reusable component that
1726 itself uses Ada 2012 features, but which is intended to be usable from
1727 Ada 83, Ada 95, or Ada 2005 programs.
1728
1729 The one argument form, which is not a configuration pragma,
1730 is used for managing the transition from Ada
1731 2005 to Ada 2012 in the run-time library. If an entity is marked
1732 as Ada_2012 only, then referencing the entity in any pre-Ada_2012
1733 mode will generate a warning. In addition, in any pre-Ada_2012
1734 mode, a preference rule is established which does not choose
1735 such an entity unless it is unambiguously specified. This avoids
1736 extra subprograms marked this way from generating ambiguities in
1737 otherwise legal pre-Ada_2012 programs. The one argument form is
1738 intended for exclusive use in the GNAT run-time library.
1739
1740 @node Pragma Ada_2012,Pragma Allow_Integer_Address,Pragma Ada_12,Implementation Defined Pragmas
1741 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{27}
1742 @section Pragma Ada_2012
1743
1744
1745 Syntax:
1746
1747 @example
1748 pragma Ada_2012;
1749 @end example
1750
1751 This configuration pragma is a synonym for pragma Ada_12 and has the
1752 same syntax and effect.
1753
1754 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Ada_2012,Implementation Defined Pragmas
1755 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{28}
1756 @section Pragma Allow_Integer_Address
1757
1758
1759 Syntax:
1760
1761 @example
1762 pragma Allow_Integer_Address;
1763 @end example
1764
1765 In almost all versions of GNAT, @code{System.Address} is a private
1766 type in accordance with the implementation advice in the RM. This
1767 means that integer values,
1768 in particular integer literals, are not allowed as address values.
1769 If the configuration pragma
1770 @code{Allow_Integer_Address} is given, then integer expressions may
1771 be used anywhere a value of type @code{System.Address} is required.
1772 The effect is to introduce an implicit unchecked conversion from the
1773 integer value to type @code{System.Address}. The reverse case of using
1774 an address where an integer type is required is handled analogously.
1775 The following example compiles without errors:
1776
1777 @example
1778 pragma Allow_Integer_Address;
1779 with System; use System;
1780 package AddrAsInt is
1781 X : Integer;
1782 Y : Integer;
1783 for X'Address use 16#1240#;
1784 for Y use at 16#3230#;
1785 m : Address := 16#4000#;
1786 n : constant Address := 4000;
1787 p : constant Address := Address (X + Y);
1788 v : Integer := y'Address;
1789 w : constant Integer := Integer (Y'Address);
1790 type R is new integer;
1791 RR : R := 1000;
1792 Z : Integer;
1793 for Z'Address use RR;
1794 end AddrAsInt;
1795 @end example
1796
1797 Note that pragma @code{Allow_Integer_Address} is ignored if @code{System.Address}
1798 is not a private type. In implementations of @code{GNAT} where
1799 System.Address is a visible integer type,
1800 this pragma serves no purpose but is ignored
1801 rather than rejected to allow common sets of sources to be used
1802 in the two situations.
1803
1804 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1805 @anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{29}@anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{2a}
1806 @section Pragma Annotate
1807
1808
1809 Syntax:
1810
1811 @example
1812 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1813
1814 ARG ::= NAME | EXPRESSION
1815 @end example
1816
1817 This pragma is used to annotate programs. IDENTIFIER identifies
1818 the type of annotation. GNAT verifies that it is an identifier, but does
1819 not otherwise analyze it. The second optional identifier is also left
1820 unanalyzed, and by convention is used to control the action of the tool to
1821 which the annotation is addressed. The remaining ARG arguments
1822 can be either string literals or more generally expressions.
1823 String literals are assumed to be either of type
1824 @code{Standard.String} or else @code{Wide_String} or @code{Wide_Wide_String}
1825 depending on the character literals they contain.
1826 All other kinds of arguments are analyzed as expressions, and must be
1827 unambiguous. The last argument if present must have the identifier
1828 @code{Entity} and GNAT verifies that a local name is given.
1829
1830 The analyzed pragma is retained in the tree, but not otherwise processed
1831 by any part of the GNAT compiler, except to generate corresponding note
1832 lines in the generated ALI file. For the format of these note lines, see
1833 the compiler source file lib-writ.ads. This pragma is intended for use by
1834 external tools, including ASIS. The use of pragma Annotate does not
1835 affect the compilation process in any way. This pragma may be used as
1836 a configuration pragma.
1837
1838 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1839 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{2b}
1840 @section Pragma Assert
1841
1842
1843 Syntax:
1844
1845 @example
1846 pragma Assert (
1847 boolean_EXPRESSION
1848 [, string_EXPRESSION]);
1849 @end example
1850
1851 The effect of this pragma depends on whether the corresponding command
1852 line switch is set to activate assertions. The pragma expands into code
1853 equivalent to the following:
1854
1855 @example
1856 if assertions-enabled then
1857 if not boolean_EXPRESSION then
1858 System.Assertions.Raise_Assert_Failure
1859 (string_EXPRESSION);
1860 end if;
1861 end if;
1862 @end example
1863
1864 The string argument, if given, is the message that will be associated
1865 with the exception occurrence if the exception is raised. If no second
1866 argument is given, the default message is @code{file}:@code{nnn},
1867 where @code{file} is the name of the source file containing the assert,
1868 and @code{nnn} is the line number of the assert.
1869
1870 Note that, as with the @code{if} statement to which it is equivalent, the
1871 type of the expression is either @code{Standard.Boolean}, or any type derived
1872 from this standard type.
1873
1874 Assert checks can be either checked or ignored. By default they are ignored.
1875 They will be checked if either the command line switch @emph{-gnata} is
1876 used, or if an @code{Assertion_Policy} or @code{Check_Policy} pragma is used
1877 to enable @code{Assert_Checks}.
1878
1879 If assertions are ignored, then there
1880 is no run-time effect (and in particular, any side effects from the
1881 expression will not occur at run time). (The expression is still
1882 analyzed at compile time, and may cause types to be frozen if they are
1883 mentioned here for the first time).
1884
1885 If assertions are checked, then the given expression is tested, and if
1886 it is @code{False} then @code{System.Assertions.Raise_Assert_Failure} is called
1887 which results in the raising of @code{Assert_Failure} with the given message.
1888
1889 You should generally avoid side effects in the expression arguments of
1890 this pragma, because these side effects will turn on and off with the
1891 setting of the assertions mode, resulting in assertions that have an
1892 effect on the program. However, the expressions are analyzed for
1893 semantic correctness whether or not assertions are enabled, so turning
1894 assertions on and off cannot affect the legality of a program.
1895
1896 Note that the implementation defined policy @code{DISABLE}, given in a
1897 pragma @code{Assertion_Policy}, can be used to suppress this semantic analysis.
1898
1899 Note: this is a standard language-defined pragma in versions
1900 of Ada from 2005 on. In GNAT, it is implemented in all versions
1901 of Ada, and the DISABLE policy is an implementation-defined
1902 addition.
1903
1904 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1905 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{2c}
1906 @section Pragma Assert_And_Cut
1907
1908
1909 Syntax:
1910
1911 @example
1912 pragma Assert_And_Cut (
1913 boolean_EXPRESSION
1914 [, string_EXPRESSION]);
1915 @end example
1916
1917 The effect of this pragma is identical to that of pragma @code{Assert},
1918 except that in an @code{Assertion_Policy} pragma, the identifier
1919 @code{Assert_And_Cut} is used to control whether it is ignored or checked
1920 (or disabled).
1921
1922 The intention is that this be used within a subprogram when the
1923 given test expresion sums up all the work done so far in the
1924 subprogram, so that the rest of the subprogram can be verified
1925 (informally or formally) using only the entry preconditions,
1926 and the expression in this pragma. This allows dividing up
1927 a subprogram into sections for the purposes of testing or
1928 formal verification. The pragma also serves as useful
1929 documentation.
1930
1931 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1932 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{2d}
1933 @section Pragma Assertion_Policy
1934
1935
1936 Syntax:
1937
1938 @example
1939 pragma Assertion_Policy (CHECK | DISABLE | IGNORE | SUPPRESSIBLE);
1940
1941 pragma Assertion_Policy (
1942 ASSERTION_KIND => POLICY_IDENTIFIER
1943 @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1944
1945 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1946
1947 RM_ASSERTION_KIND ::= Assert |
1948 Static_Predicate |
1949 Dynamic_Predicate |
1950 Pre |
1951 Pre'Class |
1952 Post |
1953 Post'Class |
1954 Type_Invariant |
1955 Type_Invariant'Class
1956
1957 ID_ASSERTION_KIND ::= Assertions |
1958 Assert_And_Cut |
1959 Assume |
1960 Contract_Cases |
1961 Debug |
1962 Ghost |
1963 Invariant |
1964 Invariant'Class |
1965 Loop_Invariant |
1966 Loop_Variant |
1967 Postcondition |
1968 Precondition |
1969 Predicate |
1970 Refined_Post |
1971 Statement_Assertions
1972
1973 POLICY_IDENTIFIER ::= Check | Disable | Ignore | Suppressible
1974 @end example
1975
1976 This is a standard Ada 2012 pragma that is available as an
1977 implementation-defined pragma in earlier versions of Ada.
1978 The assertion kinds @code{RM_ASSERTION_KIND} are those defined in
1979 the Ada standard. The assertion kinds @code{ID_ASSERTION_KIND}
1980 are implementation defined additions recognized by the GNAT compiler.
1981
1982 The pragma applies in both cases to pragmas and aspects with matching
1983 names, e.g. @code{Pre} applies to the Pre aspect, and @code{Precondition}
1984 applies to both the @code{Precondition} pragma
1985 and the aspect @code{Precondition}. Note that the identifiers for
1986 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
1987 Pre_Class and Post_Class), since these pragmas are intended to be
1988 identical to the corresponding aspects).
1989
1990 If the policy is @code{CHECK}, then assertions are enabled, i.e.
1991 the corresponding pragma or aspect is activated.
1992 If the policy is @code{IGNORE}, then assertions are ignored, i.e.
1993 the corresponding pragma or aspect is deactivated.
1994 This pragma overrides the effect of the @emph{-gnata} switch on the
1995 command line.
1996 If the policy is @code{SUPPRESSIBLE}, then assertions are enabled by default,
1997 however, if the @emph{-gnatp} switch is specified all assertions are ignored.
1998
1999 The implementation defined policy @code{DISABLE} is like
2000 @code{IGNORE} except that it completely disables semantic
2001 checking of the corresponding pragma or aspect. This is
2002 useful when the pragma or aspect argument references subprograms
2003 in a with'ed package which is replaced by a dummy package
2004 for the final build.
2005
2006 The implementation defined assertion kind @code{Assertions} applies to all
2007 assertion kinds. The form with no assertion kind given implies this
2008 choice, so it applies to all assertion kinds (RM defined, and
2009 implementation defined).
2010
2011 The implementation defined assertion kind @code{Statement_Assertions}
2012 applies to @code{Assert}, @code{Assert_And_Cut},
2013 @code{Assume}, @code{Loop_Invariant}, and @code{Loop_Variant}.
2014
2015 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
2016 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2e}
2017 @section Pragma Assume
2018
2019
2020 Syntax:
2021
2022 @example
2023 pragma Assume (
2024 boolean_EXPRESSION
2025 [, string_EXPRESSION]);
2026 @end example
2027
2028 The effect of this pragma is identical to that of pragma @code{Assert},
2029 except that in an @code{Assertion_Policy} pragma, the identifier
2030 @code{Assume} is used to control whether it is ignored or checked
2031 (or disabled).
2032
2033 The intention is that this be used for assumptions about the
2034 external environment. So you cannot expect to verify formally
2035 or informally that the condition is met, this must be
2036 established by examining things outside the program itself.
2037 For example, we may have code that depends on the size of
2038 @code{Long_Long_Integer} being at least 64. So we could write:
2039
2040 @example
2041 pragma Assume (Long_Long_Integer'Size >= 64);
2042 @end example
2043
2044 This assumption cannot be proved from the program itself,
2045 but it acts as a useful run-time check that the assumption
2046 is met, and documents the need to ensure that it is met by
2047 reference to information outside the program.
2048
2049 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
2050 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{2f}
2051 @section Pragma Assume_No_Invalid_Values
2052
2053
2054 @geindex Invalid representations
2055
2056 @geindex Invalid values
2057
2058 Syntax:
2059
2060 @example
2061 pragma Assume_No_Invalid_Values (On | Off);
2062 @end example
2063
2064 This is a configuration pragma that controls the assumptions made by the
2065 compiler about the occurrence of invalid representations (invalid values)
2066 in the code.
2067
2068 The default behavior (corresponding to an Off argument for this pragma), is
2069 to assume that values may in general be invalid unless the compiler can
2070 prove they are valid. Consider the following example:
2071
2072 @example
2073 V1 : Integer range 1 .. 10;
2074 V2 : Integer range 11 .. 20;
2075 ...
2076 for J in V2 .. V1 loop
2077 ...
2078 end loop;
2079 @end example
2080
2081 if V1 and V2 have valid values, then the loop is known at compile
2082 time not to execute since the lower bound must be greater than the
2083 upper bound. However in default mode, no such assumption is made,
2084 and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
2085 is given, the compiler will assume that any occurrence of a variable
2086 other than in an explicit @code{'Valid} test always has a valid
2087 value, and the loop above will be optimized away.
2088
2089 The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
2090 you know your code is free of uninitialized variables and other
2091 possible sources of invalid representations, and may result in
2092 more efficient code. A program that accesses an invalid representation
2093 with this pragma in effect is erroneous, so no guarantees can be made
2094 about its behavior.
2095
2096 It is peculiar though permissible to use this pragma in conjunction
2097 with validity checking (-gnatVa). In such cases, accessing invalid
2098 values will generally give an exception, though formally the program
2099 is erroneous so there are no guarantees that this will always be the
2100 case, and it is recommended that these two options not be used together.
2101
2102 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
2103 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{30}@anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{31}
2104 @section Pragma Async_Readers
2105
2106
2107 Syntax:
2108
2109 @example
2110 pragma Async_Readers [ (boolean_EXPRESSION) ];
2111 @end example
2112
2113 For the semantics of this pragma, see the entry for aspect @code{Async_Readers} in
2114 the SPARK 2014 Reference Manual, section 7.1.2.
2115
2116 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
2117 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{32}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{33}
2118 @section Pragma Async_Writers
2119
2120
2121 Syntax:
2122
2123 @example
2124 pragma Async_Writers [ (boolean_EXPRESSION) ];
2125 @end example
2126
2127 For the semantics of this pragma, see the entry for aspect @code{Async_Writers} in
2128 the SPARK 2014 Reference Manual, section 7.1.2.
2129
2130 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
2131 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{34}
2132 @section Pragma Attribute_Definition
2133
2134
2135 Syntax:
2136
2137 @example
2138 pragma Attribute_Definition
2139 ([Attribute =>] ATTRIBUTE_DESIGNATOR,
2140 [Entity =>] LOCAL_NAME,
2141 [Expression =>] EXPRESSION | NAME);
2142 @end example
2143
2144 If @code{Attribute} is a known attribute name, this pragma is equivalent to
2145 the attribute definition clause:
2146
2147 @example
2148 for Entity'Attribute use Expression;
2149 @end example
2150
2151 If @code{Attribute} is not a recognized attribute name, the pragma is
2152 ignored, and a warning is emitted. This allows source
2153 code to be written that takes advantage of some new attribute, while remaining
2154 compilable with earlier compilers.
2155
2156 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
2157 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{35}
2158 @section Pragma C_Pass_By_Copy
2159
2160
2161 @geindex Passing by copy
2162
2163 Syntax:
2164
2165 @example
2166 pragma C_Pass_By_Copy
2167 ([Max_Size =>] static_integer_EXPRESSION);
2168 @end example
2169
2170 Normally the default mechanism for passing C convention records to C
2171 convention subprograms is to pass them by reference, as suggested by RM
2172 B.3(69). Use the configuration pragma @code{C_Pass_By_Copy} to change
2173 this default, by requiring that record formal parameters be passed by
2174 copy if all of the following conditions are met:
2175
2176
2177 @itemize *
2178
2179 @item
2180 The size of the record type does not exceed the value specified for
2181 @code{Max_Size}.
2182
2183 @item
2184 The record type has @code{Convention C}.
2185
2186 @item
2187 The formal parameter has this record type, and the subprogram has a
2188 foreign (non-Ada) convention.
2189 @end itemize
2190
2191 If these conditions are met the argument is passed by copy; i.e., in a
2192 manner consistent with what C expects if the corresponding formal in the
2193 C prototype is a struct (rather than a pointer to a struct).
2194
2195 You can also pass records by copy by specifying the convention
2196 @code{C_Pass_By_Copy} for the record type, or by using the extended
2197 @code{Import} and @code{Export} pragmas, which allow specification of
2198 passing mechanisms on a parameter by parameter basis.
2199
2200 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2201 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{36}
2202 @section Pragma Check
2203
2204
2205 @geindex Assertions
2206
2207 @geindex Named assertions
2208
2209 Syntax:
2210
2211 @example
2212 pragma Check (
2213 [Name =>] CHECK_KIND,
2214 [Check =>] Boolean_EXPRESSION
2215 [, [Message =>] string_EXPRESSION] );
2216
2217 CHECK_KIND ::= IDENTIFIER |
2218 Pre'Class |
2219 Post'Class |
2220 Type_Invariant'Class |
2221 Invariant'Class
2222 @end example
2223
2224 This pragma is similar to the predefined pragma @code{Assert} except that an
2225 extra identifier argument is present. In conjunction with pragma
2226 @code{Check_Policy}, this can be used to define groups of assertions that can
2227 be independently controlled. The identifier @code{Assertion} is special, it
2228 refers to the normal set of pragma @code{Assert} statements.
2229
2230 Checks introduced by this pragma are normally deactivated by default. They can
2231 be activated either by the command line option @emph{-gnata}, which turns on
2232 all checks, or individually controlled using pragma @code{Check_Policy}.
2233
2234 The identifiers @code{Assertions} and @code{Statement_Assertions} are not
2235 permitted as check kinds, since this would cause confusion with the use
2236 of these identifiers in @code{Assertion_Policy} and @code{Check_Policy}
2237 pragmas, where they are used to refer to sets of assertions.
2238
2239 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2240 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{37}
2241 @section Pragma Check_Float_Overflow
2242
2243
2244 @geindex Floating-point overflow
2245
2246 Syntax:
2247
2248 @example
2249 pragma Check_Float_Overflow;
2250 @end example
2251
2252 In Ada, the predefined floating-point types (@code{Short_Float},
2253 @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
2254 defined to be @emph{unconstrained}. This means that even though each
2255 has a well-defined base range, an operation that delivers a result
2256 outside this base range is not required to raise an exception.
2257 This implementation permission accommodates the notion
2258 of infinities in IEEE floating-point, and corresponds to the
2259 efficient execution mode on most machines. GNAT will not raise
2260 overflow exceptions on these machines; instead it will generate
2261 infinities and NaN's as defined in the IEEE standard.
2262
2263 Generating infinities, although efficient, is not always desirable.
2264 Often the preferable approach is to check for overflow, even at the
2265 (perhaps considerable) expense of run-time performance.
2266 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
2267 range constraints -- and indeed such a subtype
2268 can have the same base range as its base type. For example:
2269
2270 @example
2271 subtype My_Float is Float range Float'Range;
2272 @end example
2273
2274 Here @code{My_Float} has the same range as
2275 @code{Float} but is constrained, so operations on
2276 @code{My_Float} values will be checked for overflow
2277 against this range.
2278
2279 This style will achieve the desired goal, but
2280 it is often more convenient to be able to simply use
2281 the standard predefined floating-point types as long
2282 as overflow checking could be guaranteed.
2283 The @code{Check_Float_Overflow}
2284 configuration pragma achieves this effect. If a unit is compiled
2285 subject to this configuration pragma, then all operations
2286 on predefined floating-point types including operations on
2287 base types of these floating-point types will be treated as
2288 though those types were constrained, and overflow checks
2289 will be generated. The @code{Constraint_Error}
2290 exception is raised if the result is out of range.
2291
2292 This mode can also be set by use of the compiler
2293 switch @emph{-gnateF}.
2294
2295 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2296 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{38}
2297 @section Pragma Check_Name
2298
2299
2300 @geindex Defining check names
2301
2302 @geindex Check names
2303 @geindex defining
2304
2305 Syntax:
2306
2307 @example
2308 pragma Check_Name (check_name_IDENTIFIER);
2309 @end example
2310
2311 This is a configuration pragma that defines a new implementation
2312 defined check name (unless IDENTIFIER matches one of the predefined
2313 check names, in which case the pragma has no effect). Check names
2314 are global to a partition, so if two or more configuration pragmas
2315 are present in a partition mentioning the same name, only one new
2316 check name is introduced.
2317
2318 An implementation defined check name introduced with this pragma may
2319 be used in only three contexts: @code{pragma Suppress},
2320 @code{pragma Unsuppress},
2321 and as the prefix of a @code{Check_Name'Enabled} attribute reference. For
2322 any of these three cases, the check name must be visible. A check
2323 name is visible if it is in the configuration pragmas applying to
2324 the current unit, or if it appears at the start of any unit that
2325 is part of the dependency set of the current unit (e.g., units that
2326 are mentioned in @code{with} clauses).
2327
2328 Check names introduced by this pragma are subject to control by compiler
2329 switches (in particular -gnatp) in the usual manner.
2330
2331 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2332 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{39}
2333 @section Pragma Check_Policy
2334
2335
2336 @geindex Controlling assertions
2337
2338 @geindex Assertions
2339 @geindex control
2340
2341 @geindex Check pragma control
2342
2343 @geindex Named assertions
2344
2345 Syntax:
2346
2347 @example
2348 pragma Check_Policy
2349 ([Name =>] CHECK_KIND,
2350 [Policy =>] POLICY_IDENTIFIER);
2351
2352 pragma Check_Policy (
2353 CHECK_KIND => POLICY_IDENTIFIER
2354 @{, CHECK_KIND => POLICY_IDENTIFIER@});
2355
2356 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2357
2358 CHECK_KIND ::= IDENTIFIER |
2359 Pre'Class |
2360 Post'Class |
2361 Type_Invariant'Class |
2362 Invariant'Class
2363
2364 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2365 avoids confusion between the two possible syntax forms for this pragma.
2366
2367 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2368 @end example
2369
2370 This pragma is used to set the checking policy for assertions (specified
2371 by aspects or pragmas), the @code{Debug} pragma, or additional checks
2372 to be checked using the @code{Check} pragma. It may appear either as
2373 a configuration pragma, or within a declarative part of package. In the
2374 latter case, it applies from the point where it appears to the end of
2375 the declarative region (like pragma @code{Suppress}).
2376
2377 The @code{Check_Policy} pragma is similar to the
2378 predefined @code{Assertion_Policy} pragma,
2379 and if the check kind corresponds to one of the assertion kinds that
2380 are allowed by @code{Assertion_Policy}, then the effect is identical.
2381
2382 If the first argument is Debug, then the policy applies to Debug pragmas,
2383 disabling their effect if the policy is @code{OFF}, @code{DISABLE}, or
2384 @code{IGNORE}, and allowing them to execute with normal semantics if
2385 the policy is @code{ON} or @code{CHECK}. In addition if the policy is
2386 @code{DISABLE}, then the procedure call in @code{Debug} pragmas will
2387 be totally ignored and not analyzed semantically.
2388
2389 Finally the first argument may be some other identifier than the above
2390 possibilities, in which case it controls a set of named assertions
2391 that can be checked using pragma @code{Check}. For example, if the pragma:
2392
2393 @example
2394 pragma Check_Policy (Critical_Error, OFF);
2395 @end example
2396
2397 is given, then subsequent @code{Check} pragmas whose first argument is also
2398 @code{Critical_Error} will be disabled.
2399
2400 The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
2401 to turn on corresponding checks. The default for a set of checks for which no
2402 @code{Check_Policy} is given is @code{OFF} unless the compiler switch
2403 @emph{-gnata} is given, which turns on all checks by default.
2404
2405 The check policy settings @code{CHECK} and @code{IGNORE} are recognized
2406 as synonyms for @code{ON} and @code{OFF}. These synonyms are provided for
2407 compatibility with the standard @code{Assertion_Policy} pragma. The check
2408 policy setting @code{DISABLE} causes the second argument of a corresponding
2409 @code{Check} pragma to be completely ignored and not analyzed.
2410
2411 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2412 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{3a}
2413 @section Pragma Comment
2414
2415
2416 Syntax:
2417
2418 @example
2419 pragma Comment (static_string_EXPRESSION);
2420 @end example
2421
2422 This is almost identical in effect to pragma @code{Ident}. It allows the
2423 placement of a comment into the object file and hence into the
2424 executable file if the operating system permits such usage. The
2425 difference is that @code{Comment}, unlike @code{Ident}, has
2426 no limitations on placement of the pragma (it can be placed
2427 anywhere in the main source unit), and if more than one pragma
2428 is used, all comments are retained.
2429
2430 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2431 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{3b}
2432 @section Pragma Common_Object
2433
2434
2435 Syntax:
2436
2437 @example
2438 pragma Common_Object (
2439 [Internal =>] LOCAL_NAME
2440 [, [External =>] EXTERNAL_SYMBOL]
2441 [, [Size =>] EXTERNAL_SYMBOL] );
2442
2443 EXTERNAL_SYMBOL ::=
2444 IDENTIFIER
2445 | static_string_EXPRESSION
2446 @end example
2447
2448 This pragma enables the shared use of variables stored in overlaid
2449 linker areas corresponding to the use of @code{COMMON}
2450 in Fortran. The single
2451 object @code{LOCAL_NAME} is assigned to the area designated by
2452 the @code{External} argument.
2453 You may define a record to correspond to a series
2454 of fields. The @code{Size} argument
2455 is syntax checked in GNAT, but otherwise ignored.
2456
2457 @code{Common_Object} is not supported on all platforms. If no
2458 support is available, then the code generator will issue a message
2459 indicating that the necessary attribute for implementation of this
2460 pragma is not available.
2461
2462 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2463 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{3c}
2464 @section Pragma Compile_Time_Error
2465
2466
2467 Syntax:
2468
2469 @example
2470 pragma Compile_Time_Error
2471 (boolean_EXPRESSION, static_string_EXPRESSION);
2472 @end example
2473
2474 This pragma can be used to generate additional compile time
2475 error messages. It
2476 is particularly useful in generics, where errors can be issued for
2477 specific problematic instantiations. The first parameter is a boolean
2478 expression. The pragma is effective only if the value of this expression
2479 is known at compile time, and has the value True. The set of expressions
2480 whose values are known at compile time includes all static boolean
2481 expressions, and also other values which the compiler can determine
2482 at compile time (e.g., the size of a record type set by an explicit
2483 size representation clause, or the value of a variable which was
2484 initialized to a constant and is known not to have been modified).
2485 If these conditions are met, an error message is generated using
2486 the value given as the second argument. This string value may contain
2487 embedded ASCII.LF characters to break the message into multiple lines.
2488
2489 @node Pragma Compile_Time_Warning,Pragma Compiler_Unit,Pragma Compile_Time_Error,Implementation Defined Pragmas
2490 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{3d}
2491 @section Pragma Compile_Time_Warning
2492
2493
2494 Syntax:
2495
2496 @example
2497 pragma Compile_Time_Warning
2498 (boolean_EXPRESSION, static_string_EXPRESSION);
2499 @end example
2500
2501 Same as pragma Compile_Time_Error, except a warning is issued instead
2502 of an error message. Note that if this pragma is used in a package that
2503 is with'ed by a client, the client will get the warning even though it
2504 is issued by a with'ed package (normally warnings in with'ed units are
2505 suppressed, but this is a special exception to that rule).
2506
2507 One typical use is within a generic where compile time known characteristics
2508 of formal parameters are tested, and warnings given appropriately. Another use
2509 with a first parameter of True is to warn a client about use of a package,
2510 for example that it is not fully implemented.
2511
2512 @node Pragma Compiler_Unit,Pragma Compiler_Unit_Warning,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2513 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit}@anchor{3e}
2514 @section Pragma Compiler_Unit
2515
2516
2517 Syntax:
2518
2519 @example
2520 pragma Compiler_Unit;
2521 @end example
2522
2523 This pragma is obsolete. It is equivalent to Compiler_Unit_Warning. It is
2524 retained so that old versions of the GNAT run-time that use this pragma can
2525 be compiled with newer versions of the compiler.
2526
2527 @node Pragma Compiler_Unit_Warning,Pragma Complete_Representation,Pragma Compiler_Unit,Implementation Defined Pragmas
2528 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit-warning}@anchor{3f}
2529 @section Pragma Compiler_Unit_Warning
2530
2531
2532 Syntax:
2533
2534 @example
2535 pragma Compiler_Unit_Warning;
2536 @end example
2537
2538 This pragma is intended only for internal use in the GNAT run-time library.
2539 It indicates that the unit is used as part of the compiler build. The effect
2540 is to generate warnings for the use of constructs (for example, conditional
2541 expressions) that would cause trouble when bootstrapping using an older
2542 version of GNAT. For the exact list of restrictions, see the compiler sources
2543 and references to Check_Compiler_Unit.
2544
2545 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compiler_Unit_Warning,Implementation Defined Pragmas
2546 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{40}
2547 @section Pragma Complete_Representation
2548
2549
2550 Syntax:
2551
2552 @example
2553 pragma Complete_Representation;
2554 @end example
2555
2556 This pragma must appear immediately within a record representation
2557 clause. Typical placements are before the first component clause
2558 or after the last component clause. The effect is to give an error
2559 message if any component is missing a component clause. This pragma
2560 may be used to ensure that a record representation clause is
2561 complete, and that this invariant is maintained if fields are
2562 added to the record in the future.
2563
2564 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2565 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{41}
2566 @section Pragma Complex_Representation
2567
2568
2569 Syntax:
2570
2571 @example
2572 pragma Complex_Representation
2573 ([Entity =>] LOCAL_NAME);
2574 @end example
2575
2576 The @code{Entity} argument must be the name of a record type which has
2577 two fields of the same floating-point type. The effect of this pragma is
2578 to force gcc to use the special internal complex representation form for
2579 this record, which may be more efficient. Note that this may result in
2580 the code for this type not conforming to standard ABI (application
2581 binary interface) requirements for the handling of record types. For
2582 example, in some environments, there is a requirement for passing
2583 records by pointer, and the use of this pragma may result in passing
2584 this type in floating-point registers.
2585
2586 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2587 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{42}
2588 @section Pragma Component_Alignment
2589
2590
2591 @geindex Alignments of components
2592
2593 @geindex Pragma Component_Alignment
2594
2595 Syntax:
2596
2597 @example
2598 pragma Component_Alignment (
2599 [Form =>] ALIGNMENT_CHOICE
2600 [, [Name =>] type_LOCAL_NAME]);
2601
2602 ALIGNMENT_CHOICE ::=
2603 Component_Size
2604 | Component_Size_4
2605 | Storage_Unit
2606 | Default
2607 @end example
2608
2609 Specifies the alignment of components in array or record types.
2610 The meaning of the @code{Form} argument is as follows:
2611
2612 @quotation
2613
2614 @geindex Component_Size (in pragma Component_Alignment)
2615 @end quotation
2616
2617
2618 @table @asis
2619
2620 @item @emph{Component_Size}
2621
2622 Aligns scalar components and subcomponents of the array or record type
2623 on boundaries appropriate to their inherent size (naturally
2624 aligned). For example, 1-byte components are aligned on byte boundaries,
2625 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2626 integer components are aligned on 4-byte boundaries and so on. These
2627 alignment rules correspond to the normal rules for C compilers on all
2628 machines except the VAX.
2629
2630 @geindex Component_Size_4 (in pragma Component_Alignment)
2631
2632 @item @emph{Component_Size_4}
2633
2634 Naturally aligns components with a size of four or fewer
2635 bytes. Components that are larger than 4 bytes are placed on the next
2636 4-byte boundary.
2637
2638 @geindex Storage_Unit (in pragma Component_Alignment)
2639
2640 @item @emph{Storage_Unit}
2641
2642 Specifies that array or record components are byte aligned, i.e.,
2643 aligned on boundaries determined by the value of the constant
2644 @code{System.Storage_Unit}.
2645
2646 @geindex Default (in pragma Component_Alignment)
2647
2648 @item @emph{Default}
2649
2650 Specifies that array or record components are aligned on default
2651 boundaries, appropriate to the underlying hardware or operating system or
2652 both. The @code{Default} choice is the same as @code{Component_Size} (natural
2653 alignment).
2654 @end table
2655
2656 If the @code{Name} parameter is present, @code{type_LOCAL_NAME} must
2657 refer to a local record or array type, and the specified alignment
2658 choice applies to the specified type. The use of
2659 @code{Component_Alignment} together with a pragma @code{Pack} causes the
2660 @code{Component_Alignment} pragma to be ignored. The use of
2661 @code{Component_Alignment} together with a record representation clause
2662 is only effective for fields not specified by the representation clause.
2663
2664 If the @code{Name} parameter is absent, the pragma can be used as either
2665 a configuration pragma, in which case it applies to one or more units in
2666 accordance with the normal rules for configuration pragmas, or it can be
2667 used within a declarative part, in which case it applies to types that
2668 are declared within this declarative part, or within any nested scope
2669 within this declarative part. In either case it specifies the alignment
2670 to be applied to any record or array type which has otherwise standard
2671 representation.
2672
2673 If the alignment for a record or array type is not specified (using
2674 pragma @code{Pack}, pragma @code{Component_Alignment}, or a record rep
2675 clause), the GNAT uses the default alignment as described previously.
2676
2677 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2678 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{43}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{44}
2679 @section Pragma Constant_After_Elaboration
2680
2681
2682 Syntax:
2683
2684 @example
2685 pragma Constant_After_Elaboration [ (boolean_EXPRESSION) ];
2686 @end example
2687
2688 For the semantics of this pragma, see the entry for aspect
2689 @code{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2690
2691 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2692 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{45}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{46}
2693 @section Pragma Contract_Cases
2694
2695
2696 @geindex Contract cases
2697
2698 Syntax:
2699
2700 @example
2701 pragma Contract_Cases ((CONTRACT_CASE @{, CONTRACT_CASE));
2702
2703 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2704
2705 CASE_GUARD ::= boolean_EXPRESSION | others
2706
2707 CONSEQUENCE ::= boolean_EXPRESSION
2708 @end example
2709
2710 The @code{Contract_Cases} pragma allows defining fine-grain specifications
2711 that can complement or replace the contract given by a precondition and a
2712 postcondition. Additionally, the @code{Contract_Cases} pragma can be used
2713 by testing and formal verification tools. The compiler checks its validity and,
2714 depending on the assertion policy at the point of declaration of the pragma,
2715 it may insert a check in the executable. For code generation, the contract
2716 cases
2717
2718 @example
2719 pragma Contract_Cases (
2720 Cond1 => Pred1,
2721 Cond2 => Pred2);
2722 @end example
2723
2724 are equivalent to
2725
2726 @example
2727 C1 : constant Boolean := Cond1; -- evaluated at subprogram entry
2728 C2 : constant Boolean := Cond2; -- evaluated at subprogram entry
2729 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2730 pragma Postcondition (if C1 then Pred1);
2731 pragma Postcondition (if C2 then Pred2);
2732 @end example
2733
2734 The precondition ensures that one and only one of the case guards is
2735 satisfied on entry to the subprogram.
2736 The postcondition ensures that for the case guard that was True on entry,
2737 the corrresponding consequence is True on exit. Other consequence expressions
2738 are not evaluated.
2739
2740 A precondition @code{P} and postcondition @code{Q} can also be
2741 expressed as contract cases:
2742
2743 @example
2744 pragma Contract_Cases (P => Q);
2745 @end example
2746
2747 The placement and visibility rules for @code{Contract_Cases} pragmas are
2748 identical to those described for preconditions and postconditions.
2749
2750 The compiler checks that boolean expressions given in case guards and
2751 consequences are valid, where the rules for case guards are the same as
2752 the rule for an expression in @code{Precondition} and the rules for
2753 consequences are the same as the rule for an expression in
2754 @code{Postcondition}. In particular, attributes @code{'Old} and
2755 @code{'Result} can only be used within consequence expressions.
2756 The case guard for the last contract case may be @code{others}, to denote
2757 any case not captured by the previous cases. The
2758 following is an example of use within a package spec:
2759
2760 @example
2761 package Math_Functions is
2762 ...
2763 function Sqrt (Arg : Float) return Float;
2764 pragma Contract_Cases (((Arg in 0.0 .. 99.0) => Sqrt'Result < 10.0,
2765 Arg >= 100.0 => Sqrt'Result >= 10.0,
2766 others => Sqrt'Result = 0.0));
2767 ...
2768 end Math_Functions;
2769 @end example
2770
2771 The meaning of contract cases is that only one case should apply at each
2772 call, as determined by the corresponding case guard evaluating to True,
2773 and that the consequence for this case should hold when the subprogram
2774 returns.
2775
2776 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2777 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{47}
2778 @section Pragma Convention_Identifier
2779
2780
2781 @geindex Conventions
2782 @geindex synonyms
2783
2784 Syntax:
2785
2786 @example
2787 pragma Convention_Identifier (
2788 [Name =>] IDENTIFIER,
2789 [Convention =>] convention_IDENTIFIER);
2790 @end example
2791
2792 This pragma provides a mechanism for supplying synonyms for existing
2793 convention identifiers. The @code{Name} identifier can subsequently
2794 be used as a synonym for the given convention in other pragmas (including
2795 for example pragma @code{Import} or another @code{Convention_Identifier}
2796 pragma). As an example of the use of this, suppose you had legacy code
2797 which used Fortran77 as the identifier for Fortran. Then the pragma:
2798
2799 @example
2800 pragma Convention_Identifier (Fortran77, Fortran);
2801 @end example
2802
2803 would allow the use of the convention identifier @code{Fortran77} in
2804 subsequent code, avoiding the need to modify the sources. As another
2805 example, you could use this to parameterize convention requirements
2806 according to systems. Suppose you needed to use @code{Stdcall} on
2807 windows systems, and @code{C} on some other system, then you could
2808 define a convention identifier @code{Library} and use a single
2809 @code{Convention_Identifier} pragma to specify which convention
2810 would be used system-wide.
2811
2812 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2813 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{48}
2814 @section Pragma CPP_Class
2815
2816
2817 @geindex Interfacing with C++
2818
2819 Syntax:
2820
2821 @example
2822 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2823 @end example
2824
2825 The argument denotes an entity in the current declarative region that is
2826 declared as a record type. It indicates that the type corresponds to an
2827 externally declared C++ class type, and is to be laid out the same way
2828 that C++ would lay out the type. If the C++ class has virtual primitives
2829 then the record must be declared as a tagged record type.
2830
2831 Types for which @code{CPP_Class} is specified do not have assignment or
2832 equality operators defined (such operations can be imported or declared
2833 as subprograms as required). Initialization is allowed only by constructor
2834 functions (see pragma @code{CPP_Constructor}). Such types are implicitly
2835 limited if not explicitly declared as limited or derived from a limited
2836 type, and an error is issued in that case.
2837
2838 See @ref{49,,Interfacing to C++} for related information.
2839
2840 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
2841 for backward compatibility but its functionality is available
2842 using pragma @code{Import} with @code{Convention} = @code{CPP}.
2843
2844 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2845 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{4a}
2846 @section Pragma CPP_Constructor
2847
2848
2849 @geindex Interfacing with C++
2850
2851 Syntax:
2852
2853 @example
2854 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2855 [, [External_Name =>] static_string_EXPRESSION ]
2856 [, [Link_Name =>] static_string_EXPRESSION ]);
2857 @end example
2858
2859 This pragma identifies an imported function (imported in the usual way
2860 with pragma @code{Import}) as corresponding to a C++ constructor. If
2861 @code{External_Name} and @code{Link_Name} are not specified then the
2862 @code{Entity} argument is a name that must have been previously mentioned
2863 in a pragma @code{Import} with @code{Convention} = @code{CPP}. Such name
2864 must be of one of the following forms:
2865
2866
2867 @itemize *
2868
2869 @item
2870 @strong{function} @code{Fname} @strong{return} T`
2871
2872 @item
2873 @strong{function} @code{Fname} @strong{return} T'Class
2874
2875 @item
2876 @strong{function} @code{Fname} (...) @strong{return} T`
2877
2878 @item
2879 @strong{function} @code{Fname} (...) @strong{return} T'Class
2880 @end itemize
2881
2882 where @code{T} is a limited record type imported from C++ with pragma
2883 @code{Import} and @code{Convention} = @code{CPP}.
2884
2885 The first two forms import the default constructor, used when an object
2886 of type @code{T} is created on the Ada side with no explicit constructor.
2887 The latter two forms cover all the non-default constructors of the type.
2888 See the GNAT User's Guide for details.
2889
2890 If no constructors are imported, it is impossible to create any objects
2891 on the Ada side and the type is implicitly declared abstract.
2892
2893 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
2894 using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
2895 GCC switch).
2896 See @ref{49,,Interfacing to C++} for more related information.
2897
2898 Note: The use of functions returning class-wide types for constructors is
2899 currently obsolete. They are supported for backward compatibility. The
2900 use of functions returning the type T leave the Ada sources more clear
2901 because the imported C++ constructors always return an object of type T;
2902 that is, they never return an object whose type is a descendant of type T.
2903
2904 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2905 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{4b}
2906 @section Pragma CPP_Virtual
2907
2908
2909 @geindex Interfacing to C++
2910
2911 This pragma is now obsolete and, other than generating a warning if warnings
2912 on obsolescent features are enabled, is completely ignored.
2913 It is retained for compatibility
2914 purposes. It used to be required to ensure compoatibility with C++, but
2915 is no longer required for that purpose because GNAT generates
2916 the same object layout as the G++ compiler by default.
2917
2918 See @ref{49,,Interfacing to C++} for related information.
2919
2920 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2921 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{4c}
2922 @section Pragma CPP_Vtable
2923
2924
2925 @geindex Interfacing with C++
2926
2927 This pragma is now obsolete and, other than generating a warning if warnings
2928 on obsolescent features are enabled, is completely ignored.
2929 It used to be required to ensure compatibility with C++, but
2930 is no longer required for that purpose because GNAT generates
2931 the same object layout as the G++ compiler by default.
2932
2933 See @ref{49,,Interfacing to C++} for related information.
2934
2935 @node Pragma CPU,Pragma Deadline_Floor,Pragma CPP_Vtable,Implementation Defined Pragmas
2936 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{4d}
2937 @section Pragma CPU
2938
2939
2940 Syntax:
2941
2942 @example
2943 pragma CPU (EXPRESSION);
2944 @end example
2945
2946 This pragma is standard in Ada 2012, but is available in all earlier
2947 versions of Ada as an implementation-defined pragma.
2948 See Ada 2012 Reference Manual for details.
2949
2950 @node Pragma Deadline_Floor,Pragma Default_Initial_Condition,Pragma CPU,Implementation Defined Pragmas
2951 @anchor{gnat_rm/implementation_defined_pragmas pragma-deadline-floor}@anchor{4e}
2952 @section Pragma Deadline_Floor
2953
2954
2955 Syntax:
2956
2957 @example
2958 pragma Deadline_Floor (time_span_EXPRESSION);
2959 @end example
2960
2961 This pragma applies only to protected types and specifies the floor
2962 deadline inherited by a task when the task enters a protected object.
2963 It is effective only when the EDF scheduling policy is used.
2964
2965 @node Pragma Default_Initial_Condition,Pragma Debug,Pragma Deadline_Floor,Implementation Defined Pragmas
2966 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{4f}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{50}
2967 @section Pragma Default_Initial_Condition
2968
2969
2970 Syntax:
2971
2972 @example
2973 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2974 @end example
2975
2976 For the semantics of this pragma, see the entry for aspect
2977 @code{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2978
2979 @node Pragma Debug,Pragma Debug_Policy,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2980 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{51}
2981 @section Pragma Debug
2982
2983
2984 Syntax:
2985
2986 @example
2987 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2988
2989 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2990 PROCEDURE_NAME
2991 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2992 @end example
2993
2994 The procedure call argument has the syntactic form of an expression, meeting
2995 the syntactic requirements for pragmas.
2996
2997 If debug pragmas are not enabled or if the condition is present and evaluates
2998 to False, this pragma has no effect. If debug pragmas are enabled, the
2999 semantics of the pragma is exactly equivalent to the procedure call statement
3000 corresponding to the argument with a terminating semicolon. Pragmas are
3001 permitted in sequences of declarations, so you can use pragma @code{Debug} to
3002 intersperse calls to debug procedures in the middle of declarations. Debug
3003 pragmas can be enabled either by use of the command line switch @emph{-gnata}
3004 or by use of the pragma @code{Check_Policy} with a first argument of
3005 @code{Debug}.
3006
3007 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
3008 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{52}
3009 @section Pragma Debug_Policy
3010
3011
3012 Syntax:
3013
3014 @example
3015 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
3016 @end example
3017
3018 This pragma is equivalent to a corresponding @code{Check_Policy} pragma
3019 with a first argument of @code{Debug}. It is retained for historical
3020 compatibility reasons.
3021
3022 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
3023 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{53}
3024 @section Pragma Default_Scalar_Storage_Order
3025
3026
3027 @geindex Default_Scalar_Storage_Order
3028
3029 @geindex Scalar_Storage_Order
3030
3031 Syntax:
3032
3033 @example
3034 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
3035 @end example
3036
3037 Normally if no explicit @code{Scalar_Storage_Order} is given for a record
3038 type or array type, then the scalar storage order defaults to the ordinary
3039 default for the target. But this default may be overridden using this pragma.
3040 The pragma may appear as a configuration pragma, or locally within a package
3041 spec or declarative part. In the latter case, it applies to all subsequent
3042 types declared within that package spec or declarative part.
3043
3044 The following example shows the use of this pragma:
3045
3046 @example
3047 pragma Default_Scalar_Storage_Order (High_Order_First);
3048 with System; use System;
3049 package DSSO1 is
3050 type H1 is record
3051 a : Integer;
3052 end record;
3053
3054 type L2 is record
3055 a : Integer;
3056 end record;
3057 for L2'Scalar_Storage_Order use Low_Order_First;
3058
3059 type L2a is new L2;
3060
3061 package Inner is
3062 type H3 is record
3063 a : Integer;
3064 end record;
3065
3066 pragma Default_Scalar_Storage_Order (Low_Order_First);
3067
3068 type L4 is record
3069 a : Integer;
3070 end record;
3071 end Inner;
3072
3073 type H4a is new Inner.L4;
3074
3075 type H5 is record
3076 a : Integer;
3077 end record;
3078 end DSSO1;
3079 @end example
3080
3081 In this example record types with names starting with @emph{L} have @cite{Low_Order_First} scalar
3082 storage order, and record types with names starting with @emph{H} have @code{High_Order_First}.
3083 Note that in the case of @code{H4a}, the order is not inherited
3084 from the parent type. Only an explicitly set @code{Scalar_Storage_Order}
3085 gets inherited on type derivation.
3086
3087 If this pragma is used as a configuration pragma which appears within a
3088 configuration pragma file (as opposed to appearing explicitly at the start
3089 of a single unit), then the binder will require that all units in a partition
3090 be compiled in a similar manner, other than run-time units, which are not
3091 affected by this pragma. Note that the use of this form is discouraged because
3092 it may significantly degrade the run-time performance of the software, instead
3093 the default scalar storage order ought to be changed only on a local basis.
3094
3095 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
3096 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{54}
3097 @section Pragma Default_Storage_Pool
3098
3099
3100 @geindex Default_Storage_Pool
3101
3102 Syntax:
3103
3104 @example
3105 pragma Default_Storage_Pool (storage_pool_NAME | null);
3106 @end example
3107
3108 This pragma is standard in Ada 2012, but is available in all earlier
3109 versions of Ada as an implementation-defined pragma.
3110 See Ada 2012 Reference Manual for details.
3111
3112 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
3113 @anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{55}@anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{56}
3114 @section Pragma Depends
3115
3116
3117 Syntax:
3118
3119 @example
3120 pragma Depends (DEPENDENCY_RELATION);
3121
3122 DEPENDENCY_RELATION ::=
3123 null
3124 | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
3125
3126 DEPENDENCY_CLAUSE ::=
3127 OUTPUT_LIST =>[+] INPUT_LIST
3128 | NULL_DEPENDENCY_CLAUSE
3129
3130 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
3131
3132 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
3133
3134 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
3135
3136 OUTPUT ::= NAME | FUNCTION_RESULT
3137 INPUT ::= NAME
3138
3139 where FUNCTION_RESULT is a function Result attribute_reference
3140 @end example
3141
3142 For the semantics of this pragma, see the entry for aspect @code{Depends} in the
3143 SPARK 2014 Reference Manual, section 6.1.5.
3144
3145 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
3146 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{57}
3147 @section Pragma Detect_Blocking
3148
3149
3150 Syntax:
3151
3152 @example
3153 pragma Detect_Blocking;
3154 @end example
3155
3156 This is a standard pragma in Ada 2005, that is available in all earlier
3157 versions of Ada as an implementation-defined pragma.
3158
3159 This is a configuration pragma that forces the detection of potentially
3160 blocking operations within a protected operation, and to raise Program_Error
3161 if that happens.
3162
3163 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
3164 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{58}
3165 @section Pragma Disable_Atomic_Synchronization
3166
3167
3168 @geindex Atomic Synchronization
3169
3170 Syntax:
3171
3172 @example
3173 pragma Disable_Atomic_Synchronization [(Entity)];
3174 @end example
3175
3176 Ada requires that accesses (reads or writes) of an atomic variable be
3177 regarded as synchronization points in the case of multiple tasks.
3178 Particularly in the case of multi-processors this may require special
3179 handling, e.g. the generation of memory barriers. This capability may
3180 be turned off using this pragma in cases where it is known not to be
3181 required.
3182
3183 The placement and scope rules for this pragma are the same as those
3184 for @code{pragma Suppress}. In particular it can be used as a
3185 configuration pragma, or in a declaration sequence where it applies
3186 till the end of the scope. If an @code{Entity} argument is present,
3187 the action applies only to that entity.
3188
3189 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
3190 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{59}
3191 @section Pragma Dispatching_Domain
3192
3193
3194 Syntax:
3195
3196 @example
3197 pragma Dispatching_Domain (EXPRESSION);
3198 @end example
3199
3200 This pragma is standard in Ada 2012, but is available in all earlier
3201 versions of Ada as an implementation-defined pragma.
3202 See Ada 2012 Reference Manual for details.
3203
3204 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
3205 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{5a}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{5b}
3206 @section Pragma Effective_Reads
3207
3208
3209 Syntax:
3210
3211 @example
3212 pragma Effective_Reads [ (boolean_EXPRESSION) ];
3213 @end example
3214
3215 For the semantics of this pragma, see the entry for aspect @code{Effective_Reads} in
3216 the SPARK 2014 Reference Manual, section 7.1.2.
3217
3218 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3219 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{5c}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{5d}
3220 @section Pragma Effective_Writes
3221
3222
3223 Syntax:
3224
3225 @example
3226 pragma Effective_Writes [ (boolean_EXPRESSION) ];
3227 @end example
3228
3229 For the semantics of this pragma, see the entry for aspect @code{Effective_Writes}
3230 in the SPARK 2014 Reference Manual, section 7.1.2.
3231
3232 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3233 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{5e}
3234 @section Pragma Elaboration_Checks
3235
3236
3237 @geindex Elaboration control
3238
3239 Syntax:
3240
3241 @example
3242 pragma Elaboration_Checks (Dynamic | Static);
3243 @end example
3244
3245 This is a configuration pragma which specifies the elaboration model to be
3246 used during compilation. For more information on the elaboration models of
3247 GNAT, consult the chapter on elaboration order handling in the @emph{GNAT User's
3248 Guide}.
3249
3250 The pragma may appear in the following contexts:
3251
3252
3253 @itemize *
3254
3255 @item
3256 Configuration pragmas file
3257
3258 @item
3259 Prior to the context clauses of a compilation unit's initial declaration
3260 @end itemize
3261
3262 Any other placement of the pragma will result in a warning and the effects of
3263 the offending pragma will be ignored.
3264
3265 If the pragma argument is @code{Dynamic}, then the dynamic elaboration model is in
3266 effect. If the pragma argument is @code{Static}, then the static elaboration model
3267 is in effect.
3268
3269 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3270 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{5f}
3271 @section Pragma Eliminate
3272
3273
3274 @geindex Elimination of unused subprograms
3275
3276 Syntax:
3277
3278 @example
3279 pragma Eliminate (
3280 [ Unit_Name => ] IDENTIFIER | SELECTED_COMPONENT ,
3281 [ Entity => ] IDENTIFIER |
3282 SELECTED_COMPONENT |
3283 STRING_LITERAL
3284 [, Source_Location => SOURCE_TRACE ] );
3285
3286 SOURCE_TRACE ::= STRING_LITERAL
3287 @end example
3288
3289 This pragma indicates that the given entity is not used in the program to be
3290 compiled and built, thus allowing the compiler to
3291 eliminate the code or data associated with the named entity. Any reference to
3292 an eliminated entity causes a compile-time or link-time error.
3293
3294 The pragma has the following semantics, where @code{U} is the unit specified by
3295 the @code{Unit_Name} argument and @code{E} is the entity specified by the @code{Entity}
3296 argument:
3297
3298
3299 @itemize *
3300
3301 @item
3302 @code{E} must be a subprogram that is explicitly declared either:
3303
3304 o Within @code{U}, or
3305
3306 o Within a generic package that is instantiated in @code{U}, or
3307
3308 o As an instance of generic subprogram instantiated in @code{U}.
3309
3310 Otherwise the pragma is ignored.
3311
3312 @item
3313 If @code{E} is overloaded within @code{U} then, in the absence of a
3314 @code{Source_Location} argument, all overloadings are eliminated.
3315
3316 @item
3317 If @code{E} is overloaded within @code{U} and only some overloadings
3318 are to be eliminated, then each overloading to be eliminated
3319 must be specified in a corresponding pragma @code{Eliminate}
3320 with a @code{Source_Location} argument identifying the line where the
3321 declaration appears, as described below.
3322
3323 @item
3324 If @code{E} is declared as the result of a generic instantiation, then
3325 a @code{Source_Location} argument is needed, as described below
3326 @end itemize
3327
3328 Pragma @code{Eliminate} allows a program to be compiled in a system-independent
3329 manner, so that unused entities are eliminated but without
3330 needing to modify the source text. Normally the required set of
3331 @code{Eliminate} pragmas is constructed automatically using the @code{gnatelim} tool.
3332
3333 Any source file change that removes, splits, or
3334 adds lines may make the set of @code{Eliminate} pragmas invalid because their
3335 @code{Source_Location} argument values may get out of date.
3336
3337 Pragma @code{Eliminate} may be used where the referenced entity is a dispatching
3338 operation. In this case all the subprograms to which the given operation can
3339 dispatch are considered to be unused (are never called as a result of a direct
3340 or a dispatching call).
3341
3342 The string literal given for the source location specifies the line number
3343 of the declaration of the entity, using the following syntax for @code{SOURCE_TRACE}:
3344
3345 @example
3346 SOURCE_TRACE ::= SOURCE_REFERENCE [ LBRACKET SOURCE_TRACE RBRACKET ]
3347
3348 LBRACKET ::= '['
3349 RBRACKET ::= ']'
3350
3351 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3352
3353 LINE_NUMBER ::= DIGIT @{DIGIT@}
3354 @end example
3355
3356 Spaces around the colon in a @code{SOURCE_REFERENCE} are optional.
3357
3358 The source trace that is given as the @code{Source_Location} must obey the
3359 following rules (or else the pragma is ignored), where @code{U} is
3360 the unit @code{U} specified by the @code{Unit_Name} argument and @code{E} is the
3361 subprogram specified by the @code{Entity} argument:
3362
3363
3364 @itemize *
3365
3366 @item
3367 @code{FILE_NAME} is the short name (with no directory
3368 information) of the Ada source file for @code{U}, using the required syntax
3369 for the underlying file system (e.g. case is significant if the underlying
3370 operating system is case sensitive).
3371 If @code{U} is a package and @code{E} is a subprogram declared in the package
3372 specification and its full declaration appears in the package body,
3373 then the relevant source file is the one for the package specification;
3374 analogously if @code{U} is a generic package.
3375
3376 @item
3377 If @code{E} is not declared in a generic instantiation (this includes
3378 generic subprogram instances), the source trace includes only one source
3379 line reference. @code{LINE_NUMBER} gives the line number of the occurrence
3380 of the declaration of @code{E} within the source file (as a decimal literal
3381 without an exponent or point).
3382
3383 @item
3384 If @code{E} is declared by a generic instantiation, its source trace
3385 (from left to right) starts with the source location of the
3386 declaration of @code{E} in the generic unit and ends with the source
3387 location of the instantiation, given in square brackets. This approach is
3388 applied recursively with nested instantiations: the rightmost (nested
3389 most deeply in square brackets) element of the source trace is the location
3390 of the outermost instantiation, and the leftmost element (that is, outside
3391 of any square brackets) is the location of the declaration of @code{E} in
3392 the generic unit.
3393 @end itemize
3394
3395 Examples:
3396
3397 @quotation
3398
3399 @example
3400 pragma Eliminate (Pkg0, Proc);
3401 -- Eliminate (all overloadings of) Proc in Pkg0
3402
3403 pragma Eliminate (Pkg1, Proc,
3404 Source_Location => "pkg1.ads:8");
3405 -- Eliminate overloading of Proc at line 8 in pkg1.ads
3406
3407 -- Assume the following file contents:
3408 -- gen_pkg.ads
3409 -- 1: generic
3410 -- 2: type T is private;
3411 -- 3: package Gen_Pkg is
3412 -- 4: procedure Proc(N : T);
3413 -- ... ...
3414 -- ... end Gen_Pkg;
3415 --
3416 -- q.adb
3417 -- 1: with Gen_Pkg;
3418 -- 2: procedure Q is
3419 -- 3: package Inst_Pkg is new Gen_Pkg(Integer);
3420 -- ... -- No calls on Inst_Pkg.Proc
3421 -- ... end Q;
3422
3423 -- The following pragma eliminates Inst_Pkg.Proc from Q
3424 pragma Eliminate (Q, Proc,
3425 Source_Location => "gen_pkg.ads:4[q.adb:3]");
3426 @end example
3427 @end quotation
3428
3429 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3430 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{60}
3431 @section Pragma Enable_Atomic_Synchronization
3432
3433
3434 @geindex Atomic Synchronization
3435
3436 Syntax:
3437
3438 @example
3439 pragma Enable_Atomic_Synchronization [(Entity)];
3440 @end example
3441
3442 Ada requires that accesses (reads or writes) of an atomic variable be
3443 regarded as synchronization points in the case of multiple tasks.
3444 Particularly in the case of multi-processors this may require special
3445 handling, e.g. the generation of memory barriers. This synchronization
3446 is performed by default, but can be turned off using
3447 @code{pragma Disable_Atomic_Synchronization}. The
3448 @code{Enable_Atomic_Synchronization} pragma can be used to turn
3449 it back on.
3450
3451 The placement and scope rules for this pragma are the same as those
3452 for @code{pragma Unsuppress}. In particular it can be used as a
3453 configuration pragma, or in a declaration sequence where it applies
3454 till the end of the scope. If an @code{Entity} argument is present,
3455 the action applies only to that entity.
3456
3457 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3458 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{61}
3459 @section Pragma Export_Function
3460
3461
3462 @geindex Argument passing mechanisms
3463
3464 Syntax:
3465
3466 @example
3467 pragma Export_Function (
3468 [Internal =>] LOCAL_NAME
3469 [, [External =>] EXTERNAL_SYMBOL]
3470 [, [Parameter_Types =>] PARAMETER_TYPES]
3471 [, [Result_Type =>] result_SUBTYPE_MARK]
3472 [, [Mechanism =>] MECHANISM]
3473 [, [Result_Mechanism =>] MECHANISM_NAME]);
3474
3475 EXTERNAL_SYMBOL ::=
3476 IDENTIFIER
3477 | static_string_EXPRESSION
3478 | ""
3479
3480 PARAMETER_TYPES ::=
3481 null
3482 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3483
3484 TYPE_DESIGNATOR ::=
3485 subtype_NAME
3486 | subtype_Name ' Access
3487
3488 MECHANISM ::=
3489 MECHANISM_NAME
3490 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3491
3492 MECHANISM_ASSOCIATION ::=
3493 [formal_parameter_NAME =>] MECHANISM_NAME
3494
3495 MECHANISM_NAME ::= Value | Reference
3496 @end example
3497
3498 Use this pragma to make a function externally callable and optionally
3499 provide information on mechanisms to be used for passing parameter and
3500 result values. We recommend, for the purposes of improving portability,
3501 this pragma always be used in conjunction with a separate pragma
3502 @code{Export}, which must precede the pragma @code{Export_Function}.
3503 GNAT does not require a separate pragma @code{Export}, but if none is
3504 present, @code{Convention Ada} is assumed, which is usually
3505 not what is wanted, so it is usually appropriate to use this
3506 pragma in conjunction with a @code{Export} or @code{Convention}
3507 pragma that specifies the desired foreign convention.
3508 Pragma @code{Export_Function}
3509 (and @code{Export}, if present) must appear in the same declarative
3510 region as the function to which they apply.
3511
3512 The @code{internal_name} must uniquely designate the function to which the
3513 pragma applies. If more than one function name exists of this name in
3514 the declarative part you must use the @code{Parameter_Types} and
3515 @code{Result_Type} parameters to achieve the required
3516 unique designation. The @cite{subtype_mark}s in these parameters must
3517 exactly match the subtypes in the corresponding function specification,
3518 using positional notation to match parameters with subtype marks.
3519 The form with an @code{'Access} attribute can be used to match an
3520 anonymous access parameter.
3521
3522 @geindex Suppressing external name
3523
3524 Special treatment is given if the EXTERNAL is an explicit null
3525 string or a static string expressions that evaluates to the null
3526 string. In this case, no external name is generated. This form
3527 still allows the specification of parameter mechanisms.
3528
3529 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3530 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{62}
3531 @section Pragma Export_Object
3532
3533
3534 Syntax:
3535
3536 @example
3537 pragma Export_Object
3538 [Internal =>] LOCAL_NAME
3539 [, [External =>] EXTERNAL_SYMBOL]
3540 [, [Size =>] EXTERNAL_SYMBOL]
3541
3542 EXTERNAL_SYMBOL ::=
3543 IDENTIFIER
3544 | static_string_EXPRESSION
3545 @end example
3546
3547 This pragma designates an object as exported, and apart from the
3548 extended rules for external symbols, is identical in effect to the use of
3549 the normal @code{Export} pragma applied to an object. You may use a
3550 separate Export pragma (and you probably should from the point of view
3551 of portability), but it is not required. @code{Size} is syntax checked,
3552 but otherwise ignored by GNAT.
3553
3554 @node Pragma Export_Procedure,Pragma Export_Value,Pragma Export_Object,Implementation Defined Pragmas
3555 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{63}
3556 @section Pragma Export_Procedure
3557
3558
3559 Syntax:
3560
3561 @example
3562 pragma Export_Procedure (
3563 [Internal =>] LOCAL_NAME
3564 [, [External =>] EXTERNAL_SYMBOL]
3565 [, [Parameter_Types =>] PARAMETER_TYPES]
3566 [, [Mechanism =>] MECHANISM]);
3567
3568 EXTERNAL_SYMBOL ::=
3569 IDENTIFIER
3570 | static_string_EXPRESSION
3571 | ""
3572
3573 PARAMETER_TYPES ::=
3574 null
3575 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3576
3577 TYPE_DESIGNATOR ::=
3578 subtype_NAME
3579 | subtype_Name ' Access
3580
3581 MECHANISM ::=
3582 MECHANISM_NAME
3583 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3584
3585 MECHANISM_ASSOCIATION ::=
3586 [formal_parameter_NAME =>] MECHANISM_NAME
3587
3588 MECHANISM_NAME ::= Value | Reference
3589 @end example
3590
3591 This pragma is identical to @code{Export_Function} except that it
3592 applies to a procedure rather than a function and the parameters
3593 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
3594 GNAT does not require a separate pragma @code{Export}, but if none is
3595 present, @code{Convention Ada} is assumed, which is usually
3596 not what is wanted, so it is usually appropriate to use this
3597 pragma in conjunction with a @code{Export} or @code{Convention}
3598 pragma that specifies the desired foreign convention.
3599
3600 @geindex Suppressing external name
3601
3602 Special treatment is given if the EXTERNAL is an explicit null
3603 string or a static string expressions that evaluates to the null
3604 string. In this case, no external name is generated. This form
3605 still allows the specification of parameter mechanisms.
3606
3607 @node Pragma Export_Value,Pragma Export_Valued_Procedure,Pragma Export_Procedure,Implementation Defined Pragmas
3608 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-value}@anchor{64}
3609 @section Pragma Export_Value
3610
3611
3612 Syntax:
3613
3614 @example
3615 pragma Export_Value (
3616 [Value =>] static_integer_EXPRESSION,
3617 [Link_Name =>] static_string_EXPRESSION);
3618 @end example
3619
3620 This pragma serves to export a static integer value for external use.
3621 The first argument specifies the value to be exported. The Link_Name
3622 argument specifies the symbolic name to be associated with the integer
3623 value. This pragma is useful for defining a named static value in Ada
3624 that can be referenced in assembly language units to be linked with
3625 the application. This pragma is currently supported only for the
3626 AAMP target and is ignored for other targets.
3627
3628 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Value,Implementation Defined Pragmas
3629 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{65}
3630 @section Pragma Export_Valued_Procedure
3631
3632
3633 Syntax:
3634
3635 @example
3636 pragma Export_Valued_Procedure (
3637 [Internal =>] LOCAL_NAME
3638 [, [External =>] EXTERNAL_SYMBOL]
3639 [, [Parameter_Types =>] PARAMETER_TYPES]
3640 [, [Mechanism =>] MECHANISM]);
3641
3642 EXTERNAL_SYMBOL ::=
3643 IDENTIFIER
3644 | static_string_EXPRESSION
3645 | ""
3646
3647 PARAMETER_TYPES ::=
3648 null
3649 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3650
3651 TYPE_DESIGNATOR ::=
3652 subtype_NAME
3653 | subtype_Name ' Access
3654
3655 MECHANISM ::=
3656 MECHANISM_NAME
3657 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3658
3659 MECHANISM_ASSOCIATION ::=
3660 [formal_parameter_NAME =>] MECHANISM_NAME
3661
3662 MECHANISM_NAME ::= Value | Reference
3663 @end example
3664
3665 This pragma is identical to @code{Export_Procedure} except that the
3666 first parameter of @code{LOCAL_NAME}, which must be present, must be of
3667 mode @code{out}, and externally the subprogram is treated as a function
3668 with this parameter as the result of the function. GNAT provides for
3669 this capability to allow the use of @code{out} and @code{in out}
3670 parameters in interfacing to external functions (which are not permitted
3671 in Ada functions).
3672 GNAT does not require a separate pragma @code{Export}, but if none is
3673 present, @code{Convention Ada} is assumed, which is almost certainly
3674 not what is wanted since the whole point of this pragma is to interface
3675 with foreign language functions, so it is usually appropriate to use this
3676 pragma in conjunction with a @code{Export} or @code{Convention}
3677 pragma that specifies the desired foreign convention.
3678
3679 @geindex Suppressing external name
3680
3681 Special treatment is given if the EXTERNAL is an explicit null
3682 string or a static string expressions that evaluates to the null
3683 string. In this case, no external name is generated. This form
3684 still allows the specification of parameter mechanisms.
3685
3686 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3687 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{66}
3688 @section Pragma Extend_System
3689
3690
3691 @geindex System
3692 @geindex extending
3693
3694 @geindex DEC Ada 83
3695
3696 Syntax:
3697
3698 @example
3699 pragma Extend_System ([Name =>] IDENTIFIER);
3700 @end example
3701
3702 This pragma is used to provide backwards compatibility with other
3703 implementations that extend the facilities of package @code{System}. In
3704 GNAT, @code{System} contains only the definitions that are present in
3705 the Ada RM. However, other implementations, notably the DEC Ada 83
3706 implementation, provide many extensions to package @code{System}.
3707
3708 For each such implementation accommodated by this pragma, GNAT provides a
3709 package @code{Aux_@emph{xxx}}, e.g., @code{Aux_DEC} for the DEC Ada 83
3710 implementation, which provides the required additional definitions. You
3711 can use this package in two ways. You can @code{with} it in the normal
3712 way and access entities either by selection or using a @code{use}
3713 clause. In this case no special processing is required.
3714
3715 However, if existing code contains references such as
3716 @code{System.@emph{xxx}} where @emph{xxx} is an entity in the extended
3717 definitions provided in package @code{System}, you may use this pragma
3718 to extend visibility in @code{System} in a non-standard way that
3719 provides greater compatibility with the existing code. Pragma
3720 @code{Extend_System} is a configuration pragma whose single argument is
3721 the name of the package containing the extended definition
3722 (e.g., @code{Aux_DEC} for the DEC Ada case). A unit compiled under
3723 control of this pragma will be processed using special visibility
3724 processing that looks in package @code{System.Aux_@emph{xxx}} where
3725 @code{Aux_@emph{xxx}} is the pragma argument for any entity referenced in
3726 package @code{System}, but not found in package @code{System}.
3727
3728 You can use this pragma either to access a predefined @code{System}
3729 extension supplied with the compiler, for example @code{Aux_DEC} or
3730 you can construct your own extension unit following the above
3731 definition. Note that such a package is a child of @code{System}
3732 and thus is considered part of the implementation.
3733 To compile it you will have to use the @emph{-gnatg} switch
3734 for compiling System units, as explained in the
3735 GNAT User's Guide.
3736
3737 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3738 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{67}
3739 @section Pragma Extensions_Allowed
3740
3741
3742 @geindex Ada Extensions
3743
3744 @geindex GNAT Extensions
3745
3746 Syntax:
3747
3748 @example
3749 pragma Extensions_Allowed (On | Off);
3750 @end example
3751
3752 This configuration pragma enables or disables the implementation
3753 extension mode (the use of Off as a parameter cancels the effect
3754 of the @emph{-gnatX} command switch).
3755
3756 In extension mode, the latest version of the Ada language is
3757 implemented (currently Ada 2012), and in addition a small number
3758 of GNAT specific extensions are recognized as follows:
3759
3760
3761 @table @asis
3762
3763 @item @emph{Constrained attribute for generic objects}
3764
3765 The @code{Constrained} attribute is permitted for objects of
3766 generic types. The result indicates if the corresponding actual
3767 is constrained.
3768 @end table
3769
3770 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3771 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{68}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{69}
3772 @section Pragma Extensions_Visible
3773
3774
3775 Syntax:
3776
3777 @example
3778 pragma Extensions_Visible [ (boolean_EXPRESSION) ];
3779 @end example
3780
3781 For the semantics of this pragma, see the entry for aspect @code{Extensions_Visible}
3782 in the SPARK 2014 Reference Manual, section 6.1.7.
3783
3784 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3785 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{6a}
3786 @section Pragma External
3787
3788
3789 Syntax:
3790
3791 @example
3792 pragma External (
3793 [ Convention =>] convention_IDENTIFIER,
3794 [ Entity =>] LOCAL_NAME
3795 [, [External_Name =>] static_string_EXPRESSION ]
3796 [, [Link_Name =>] static_string_EXPRESSION ]);
3797 @end example
3798
3799 This pragma is identical in syntax and semantics to pragma
3800 @code{Export} as defined in the Ada Reference Manual. It is
3801 provided for compatibility with some Ada 83 compilers that
3802 used this pragma for exactly the same purposes as pragma
3803 @code{Export} before the latter was standardized.
3804
3805 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3806 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{6b}
3807 @section Pragma External_Name_Casing
3808
3809
3810 @geindex Dec Ada 83 casing compatibility
3811
3812 @geindex External Names
3813 @geindex casing
3814
3815 @geindex Casing of External names
3816
3817 Syntax:
3818
3819 @example
3820 pragma External_Name_Casing (
3821 Uppercase | Lowercase
3822 [, Uppercase | Lowercase | As_Is]);
3823 @end example
3824
3825 This pragma provides control over the casing of external names associated
3826 with Import and Export pragmas. There are two cases to consider:
3827
3828
3829 @itemize *
3830
3831 @item
3832 Implicit external names
3833
3834 Implicit external names are derived from identifiers. The most common case
3835 arises when a standard Ada Import or Export pragma is used with only two
3836 arguments, as in:
3837
3838 @example
3839 pragma Import (C, C_Routine);
3840 @end example
3841
3842 Since Ada is a case-insensitive language, the spelling of the identifier in
3843 the Ada source program does not provide any information on the desired
3844 casing of the external name, and so a convention is needed. In GNAT the
3845 default treatment is that such names are converted to all lower case
3846 letters. This corresponds to the normal C style in many environments.
3847 The first argument of pragma @code{External_Name_Casing} can be used to
3848 control this treatment. If @code{Uppercase} is specified, then the name
3849 will be forced to all uppercase letters. If @code{Lowercase} is specified,
3850 then the normal default of all lower case letters will be used.
3851
3852 This same implicit treatment is also used in the case of extended DEC Ada 83
3853 compatible Import and Export pragmas where an external name is explicitly
3854 specified using an identifier rather than a string.
3855
3856 @item
3857 Explicit external names
3858
3859 Explicit external names are given as string literals. The most common case
3860 arises when a standard Ada Import or Export pragma is used with three
3861 arguments, as in:
3862
3863 @example
3864 pragma Import (C, C_Routine, "C_routine");
3865 @end example
3866
3867 In this case, the string literal normally provides the exact casing required
3868 for the external name. The second argument of pragma
3869 @code{External_Name_Casing} may be used to modify this behavior.
3870 If @code{Uppercase} is specified, then the name
3871 will be forced to all uppercase letters. If @code{Lowercase} is specified,
3872 then the name will be forced to all lowercase letters. A specification of
3873 @code{As_Is} provides the normal default behavior in which the casing is
3874 taken from the string provided.
3875 @end itemize
3876
3877 This pragma may appear anywhere that a pragma is valid. In particular, it
3878 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3879 case it applies to all subsequent compilations, or it can be used as a program
3880 unit pragma, in which case it only applies to the current unit, or it can
3881 be used more locally to control individual Import/Export pragmas.
3882
3883 It was primarily intended for use with OpenVMS systems, where many
3884 compilers convert all symbols to upper case by default. For interfacing to
3885 such compilers (e.g., the DEC C compiler), it may be convenient to use
3886 the pragma:
3887
3888 @example
3889 pragma External_Name_Casing (Uppercase, Uppercase);
3890 @end example
3891
3892 to enforce the upper casing of all external symbols.
3893
3894 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3895 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{6c}
3896 @section Pragma Fast_Math
3897
3898
3899 Syntax:
3900
3901 @example
3902 pragma Fast_Math;
3903 @end example
3904
3905 This is a configuration pragma which activates a mode in which speed is
3906 considered more important for floating-point operations than absolutely
3907 accurate adherence to the requirements of the standard. Currently the
3908 following operations are affected:
3909
3910
3911 @table @asis
3912
3913 @item @emph{Complex Multiplication}
3914
3915 The normal simple formula for complex multiplication can result in intermediate
3916 overflows for numbers near the end of the range. The Ada standard requires that
3917 this situation be detected and corrected by scaling, but in Fast_Math mode such
3918 cases will simply result in overflow. Note that to take advantage of this you
3919 must instantiate your own version of @code{Ada.Numerics.Generic_Complex_Types}
3920 under control of the pragma, rather than use the preinstantiated versions.
3921 @end table
3922
3923 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3924 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{6d}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{6e}
3925 @section Pragma Favor_Top_Level
3926
3927
3928 Syntax:
3929
3930 @example
3931 pragma Favor_Top_Level (type_NAME);
3932 @end example
3933
3934 The argument of pragma @code{Favor_Top_Level} must be a named access-to-subprogram
3935 type. This pragma is an efficiency hint to the compiler, regarding the use of
3936 @code{'Access} or @code{'Unrestricted_Access} on nested (non-library-level) subprograms.
3937 The pragma means that nested subprograms are not used with this type, or are
3938 rare, so that the generated code should be efficient in the top-level case.
3939 When this pragma is used, dynamically generated trampolines may be used on some
3940 targets for nested subprograms. See restriction @code{No_Implicit_Dynamic_Code}.
3941
3942 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3943 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{6f}
3944 @section Pragma Finalize_Storage_Only
3945
3946
3947 Syntax:
3948
3949 @example
3950 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3951 @end example
3952
3953 The argument of pragma @code{Finalize_Storage_Only} must denote a local type which
3954 is derived from @code{Ada.Finalization.Controlled} or @code{Limited_Controlled}. The
3955 pragma suppresses the call to @code{Finalize} for declared library-level objects
3956 of the argument type. This is mostly useful for types where finalization is
3957 only used to deal with storage reclamation since in most environments it is
3958 not necessary to reclaim memory just before terminating execution, hence the
3959 name. Note that this pragma does not suppress Finalize calls for library-level
3960 heap-allocated objects (see pragma @code{No_Heap_Finalization}).
3961
3962 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3963 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{70}
3964 @section Pragma Float_Representation
3965
3966
3967 Syntax:
3968
3969 @example
3970 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3971
3972 FLOAT_REP ::= VAX_Float | IEEE_Float
3973 @end example
3974
3975 In the one argument form, this pragma is a configuration pragma which
3976 allows control over the internal representation chosen for the predefined
3977 floating point types declared in the packages @code{Standard} and
3978 @code{System}. This pragma is only provided for compatibility and has no effect.
3979
3980 The two argument form specifies the representation to be used for
3981 the specified floating-point type. The argument must
3982 be @code{IEEE_Float} to specify the use of IEEE format, as follows:
3983
3984
3985 @itemize *
3986
3987 @item
3988 For a digits value of 6, 32-bit IEEE short format will be used.
3989
3990 @item
3991 For a digits value of 15, 64-bit IEEE long format will be used.
3992
3993 @item
3994 No other value of digits is permitted.
3995 @end itemize
3996
3997 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
3998 @anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{71}@anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{72}
3999 @section Pragma Ghost
4000
4001
4002 Syntax:
4003
4004 @example
4005 pragma Ghost [ (boolean_EXPRESSION) ];
4006 @end example
4007
4008 For the semantics of this pragma, see the entry for aspect @code{Ghost} in the SPARK
4009 2014 Reference Manual, section 6.9.
4010
4011 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
4012 @anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{73}@anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{74}
4013 @section Pragma Global
4014
4015
4016 Syntax:
4017
4018 @example
4019 pragma Global (GLOBAL_SPECIFICATION);
4020
4021 GLOBAL_SPECIFICATION ::=
4022 null
4023 | (GLOBAL_LIST)
4024 | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
4025
4026 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
4027
4028 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
4029 GLOBAL_LIST ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
4030 GLOBAL_ITEM ::= NAME
4031 @end example
4032
4033 For the semantics of this pragma, see the entry for aspect @code{Global} in the
4034 SPARK 2014 Reference Manual, section 6.1.4.
4035
4036 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
4037 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{75}
4038 @section Pragma Ident
4039
4040
4041 Syntax:
4042
4043 @example
4044 pragma Ident (static_string_EXPRESSION);
4045 @end example
4046
4047 This pragma is identical in effect to pragma @code{Comment}. It is provided
4048 for compatibility with other Ada compilers providing this pragma.
4049
4050 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
4051 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{76}
4052 @section Pragma Ignore_Pragma
4053
4054
4055 Syntax:
4056
4057 @example
4058 pragma Ignore_Pragma (pragma_IDENTIFIER);
4059 @end example
4060
4061 This is a configuration pragma
4062 that takes a single argument that is a simple identifier. Any subsequent
4063 use of a pragma whose pragma identifier matches this argument will be
4064 silently ignored. This may be useful when legacy code or code intended
4065 for compilation with some other compiler contains pragmas that match the
4066 name, but not the exact implementation, of a GNAT pragma. The use of this
4067 pragma allows such pragmas to be ignored, which may be useful in CodePeer
4068 mode, or during porting of legacy code.
4069
4070 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
4071 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{77}
4072 @section Pragma Implementation_Defined
4073
4074
4075 Syntax:
4076
4077 @example
4078 pragma Implementation_Defined (local_NAME);
4079 @end example
4080
4081 This pragma marks a previously declared entity as implementation-defined.
4082 For an overloaded entity, applies to the most recent homonym.
4083
4084 @example
4085 pragma Implementation_Defined;
4086 @end example
4087
4088 The form with no arguments appears anywhere within a scope, most
4089 typically a package spec, and indicates that all entities that are
4090 defined within the package spec are Implementation_Defined.
4091
4092 This pragma is used within the GNAT runtime library to identify
4093 implementation-defined entities introduced in language-defined units,
4094 for the purpose of implementing the No_Implementation_Identifiers
4095 restriction.
4096
4097 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
4098 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{78}
4099 @section Pragma Implemented
4100
4101
4102 Syntax:
4103
4104 @example
4105 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
4106
4107 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
4108 @end example
4109
4110 This is an Ada 2012 representation pragma which applies to protected, task
4111 and synchronized interface primitives. The use of pragma Implemented provides
4112 a way to impose a static requirement on the overriding operation by adhering
4113 to one of the three implementation kinds: entry, protected procedure or any of
4114 the above. This pragma is available in all earlier versions of Ada as an
4115 implementation-defined pragma.
4116
4117 @example
4118 type Synch_Iface is synchronized interface;
4119 procedure Prim_Op (Obj : in out Iface) is abstract;
4120 pragma Implemented (Prim_Op, By_Protected_Procedure);
4121
4122 protected type Prot_1 is new Synch_Iface with
4123 procedure Prim_Op; -- Legal
4124 end Prot_1;
4125
4126 protected type Prot_2 is new Synch_Iface with
4127 entry Prim_Op; -- Illegal
4128 end Prot_2;
4129
4130 task type Task_Typ is new Synch_Iface with
4131 entry Prim_Op; -- Illegal
4132 end Task_Typ;
4133 @end example
4134
4135 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
4136 Implemented determines the runtime behavior of the requeue. Implementation kind
4137 By_Entry guarantees that the action of requeueing will proceed from an entry to
4138 another entry. Implementation kind By_Protected_Procedure transforms the
4139 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
4140 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
4141 the target's overriding subprogram kind.
4142
4143 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
4144 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{79}
4145 @section Pragma Implicit_Packing
4146
4147
4148 @geindex Rational Profile
4149
4150 Syntax:
4151
4152 @example
4153 pragma Implicit_Packing;
4154 @end example
4155
4156 This is a configuration pragma that requests implicit packing for packed
4157 arrays for which a size clause is given but no explicit pragma Pack or
4158 specification of Component_Size is present. It also applies to records
4159 where no record representation clause is present. Consider this example:
4160
4161 @example
4162 type R is array (0 .. 7) of Boolean;
4163 for R'Size use 8;
4164 @end example
4165
4166 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
4167 does not change the layout of a composite object. So the Size clause in the
4168 above example is normally rejected, since the default layout of the array uses
4169 8-bit components, and thus the array requires a minimum of 64 bits.
4170
4171 If this declaration is compiled in a region of code covered by an occurrence
4172 of the configuration pragma Implicit_Packing, then the Size clause in this
4173 and similar examples will cause implicit packing and thus be accepted. For
4174 this implicit packing to occur, the type in question must be an array of small
4175 components whose size is known at compile time, and the Size clause must
4176 specify the exact size that corresponds to the number of elements in the array
4177 multiplied by the size in bits of the component type (both single and
4178 multi-dimensioned arrays can be controlled with this pragma).
4179
4180 @geindex Array packing
4181
4182 Similarly, the following example shows the use in the record case
4183
4184 @example
4185 type r is record
4186 a, b, c, d, e, f, g, h : boolean;
4187 chr : character;
4188 end record;
4189 for r'size use 16;
4190 @end example
4191
4192 Without a pragma Pack, each Boolean field requires 8 bits, so the
4193 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
4194 sufficient. The use of pragma Implicit_Packing allows this record
4195 declaration to compile without an explicit pragma Pack.
4196
4197 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
4198 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{7a}
4199 @section Pragma Import_Function
4200
4201
4202 Syntax:
4203
4204 @example
4205 pragma Import_Function (
4206 [Internal =>] LOCAL_NAME,
4207 [, [External =>] EXTERNAL_SYMBOL]
4208 [, [Parameter_Types =>] PARAMETER_TYPES]
4209 [, [Result_Type =>] SUBTYPE_MARK]
4210 [, [Mechanism =>] MECHANISM]
4211 [, [Result_Mechanism =>] MECHANISM_NAME]);
4212
4213 EXTERNAL_SYMBOL ::=
4214 IDENTIFIER
4215 | static_string_EXPRESSION
4216
4217 PARAMETER_TYPES ::=
4218 null
4219 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4220
4221 TYPE_DESIGNATOR ::=
4222 subtype_NAME
4223 | subtype_Name ' Access
4224
4225 MECHANISM ::=
4226 MECHANISM_NAME
4227 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4228
4229 MECHANISM_ASSOCIATION ::=
4230 [formal_parameter_NAME =>] MECHANISM_NAME
4231
4232 MECHANISM_NAME ::=
4233 Value
4234 | Reference
4235 @end example
4236
4237 This pragma is used in conjunction with a pragma @code{Import} to
4238 specify additional information for an imported function. The pragma
4239 @code{Import} (or equivalent pragma @code{Interface}) must precede the
4240 @code{Import_Function} pragma and both must appear in the same
4241 declarative part as the function specification.
4242
4243 The @code{Internal} argument must uniquely designate
4244 the function to which the
4245 pragma applies. If more than one function name exists of this name in
4246 the declarative part you must use the @code{Parameter_Types} and
4247 @code{Result_Type} parameters to achieve the required unique
4248 designation. Subtype marks in these parameters must exactly match the
4249 subtypes in the corresponding function specification, using positional
4250 notation to match parameters with subtype marks.
4251 The form with an @code{'Access} attribute can be used to match an
4252 anonymous access parameter.
4253
4254 You may optionally use the @code{Mechanism} and @code{Result_Mechanism}
4255 parameters to specify passing mechanisms for the
4256 parameters and result. If you specify a single mechanism name, it
4257 applies to all parameters. Otherwise you may specify a mechanism on a
4258 parameter by parameter basis using either positional or named
4259 notation. If the mechanism is not specified, the default mechanism
4260 is used.
4261
4262 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
4263 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{7b}
4264 @section Pragma Import_Object
4265
4266
4267 Syntax:
4268
4269 @example
4270 pragma Import_Object
4271 [Internal =>] LOCAL_NAME
4272 [, [External =>] EXTERNAL_SYMBOL]
4273 [, [Size =>] EXTERNAL_SYMBOL]);
4274
4275 EXTERNAL_SYMBOL ::=
4276 IDENTIFIER
4277 | static_string_EXPRESSION
4278 @end example
4279
4280 This pragma designates an object as imported, and apart from the
4281 extended rules for external symbols, is identical in effect to the use of
4282 the normal @code{Import} pragma applied to an object. Unlike the
4283 subprogram case, you need not use a separate @code{Import} pragma,
4284 although you may do so (and probably should do so from a portability
4285 point of view). @code{size} is syntax checked, but otherwise ignored by
4286 GNAT.
4287
4288 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
4289 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{7c}
4290 @section Pragma Import_Procedure
4291
4292
4293 Syntax:
4294
4295 @example
4296 pragma Import_Procedure (
4297 [Internal =>] LOCAL_NAME
4298 [, [External =>] EXTERNAL_SYMBOL]
4299 [, [Parameter_Types =>] PARAMETER_TYPES]
4300 [, [Mechanism =>] MECHANISM]);
4301
4302 EXTERNAL_SYMBOL ::=
4303 IDENTIFIER
4304 | static_string_EXPRESSION
4305
4306 PARAMETER_TYPES ::=
4307 null
4308 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4309
4310 TYPE_DESIGNATOR ::=
4311 subtype_NAME
4312 | subtype_Name ' Access
4313
4314 MECHANISM ::=
4315 MECHANISM_NAME
4316 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4317
4318 MECHANISM_ASSOCIATION ::=
4319 [formal_parameter_NAME =>] MECHANISM_NAME
4320
4321 MECHANISM_NAME ::= Value | Reference
4322 @end example
4323
4324 This pragma is identical to @code{Import_Function} except that it
4325 applies to a procedure rather than a function and the parameters
4326 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
4327
4328 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4329 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{7d}
4330 @section Pragma Import_Valued_Procedure
4331
4332
4333 Syntax:
4334
4335 @example
4336 pragma Import_Valued_Procedure (
4337 [Internal =>] LOCAL_NAME
4338 [, [External =>] EXTERNAL_SYMBOL]
4339 [, [Parameter_Types =>] PARAMETER_TYPES]
4340 [, [Mechanism =>] MECHANISM]);
4341
4342 EXTERNAL_SYMBOL ::=
4343 IDENTIFIER
4344 | static_string_EXPRESSION
4345
4346 PARAMETER_TYPES ::=
4347 null
4348 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4349
4350 TYPE_DESIGNATOR ::=
4351 subtype_NAME
4352 | subtype_Name ' Access
4353
4354 MECHANISM ::=
4355 MECHANISM_NAME
4356 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4357
4358 MECHANISM_ASSOCIATION ::=
4359 [formal_parameter_NAME =>] MECHANISM_NAME
4360
4361 MECHANISM_NAME ::= Value | Reference
4362 @end example
4363
4364 This pragma is identical to @code{Import_Procedure} except that the
4365 first parameter of @code{LOCAL_NAME}, which must be present, must be of
4366 mode @code{out}, and externally the subprogram is treated as a function
4367 with this parameter as the result of the function. The purpose of this
4368 capability is to allow the use of @code{out} and @code{in out}
4369 parameters in interfacing to external functions (which are not permitted
4370 in Ada functions). You may optionally use the @code{Mechanism}
4371 parameters to specify passing mechanisms for the parameters.
4372 If you specify a single mechanism name, it applies to all parameters.
4373 Otherwise you may specify a mechanism on a parameter by parameter
4374 basis using either positional or named notation. If the mechanism is not
4375 specified, the default mechanism is used.
4376
4377 Note that it is important to use this pragma in conjunction with a separate
4378 pragma Import that specifies the desired convention, since otherwise the
4379 default convention is Ada, which is almost certainly not what is required.
4380
4381 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4382 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{7e}
4383 @section Pragma Independent
4384
4385
4386 Syntax:
4387
4388 @example
4389 pragma Independent (Local_NAME);
4390 @end example
4391
4392 This pragma is standard in Ada 2012 mode (which also provides an aspect
4393 of the same name). It is also available as an implementation-defined
4394 pragma in all earlier versions. It specifies that the
4395 designated object or all objects of the designated type must be
4396 independently addressable. This means that separate tasks can safely
4397 manipulate such objects. For example, if two components of a record are
4398 independent, then two separate tasks may access these two components.
4399 This may place
4400 constraints on the representation of the object (for instance prohibiting
4401 tight packing).
4402
4403 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4404 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{7f}
4405 @section Pragma Independent_Components
4406
4407
4408 Syntax:
4409
4410 @example
4411 pragma Independent_Components (Local_NAME);
4412 @end example
4413
4414 This pragma is standard in Ada 2012 mode (which also provides an aspect
4415 of the same name). It is also available as an implementation-defined
4416 pragma in all earlier versions. It specifies that the components of the
4417 designated object, or the components of each object of the designated
4418 type, must be
4419 independently addressable. This means that separate tasks can safely
4420 manipulate separate components in the composite object. This may place
4421 constraints on the representation of the object (for instance prohibiting
4422 tight packing).
4423
4424 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4425 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{80}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{81}
4426 @section Pragma Initial_Condition
4427
4428
4429 Syntax:
4430
4431 @example
4432 pragma Initial_Condition (boolean_EXPRESSION);
4433 @end example
4434
4435 For the semantics of this pragma, see the entry for aspect @code{Initial_Condition}
4436 in the SPARK 2014 Reference Manual, section 7.1.6.
4437
4438 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4439 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{82}
4440 @section Pragma Initialize_Scalars
4441
4442
4443 @geindex debugging with Initialize_Scalars
4444
4445 Syntax:
4446
4447 @example
4448 pragma Initialize_Scalars
4449 [ ( TYPE_VALUE_PAIR @{, TYPE_VALUE_PAIR@} ) ];
4450
4451 TYPE_VALUE_PAIR ::=
4452 SCALAR_TYPE => static_EXPRESSION
4453
4454 SCALAR_TYPE :=
4455 Short_Float
4456 | Float
4457 | Long_Float
4458 | Long_Long_Flat
4459 | Signed_8
4460 | Signed_16
4461 | Signed_32
4462 | Signed_64
4463 | Unsigned_8
4464 | Unsigned_16
4465 | Unsigned_32
4466 | Unsigned_64
4467 @end example
4468
4469 This pragma is similar to @code{Normalize_Scalars} conceptually but has two
4470 important differences.
4471
4472 First, there is no requirement for the pragma to be used uniformly in all units
4473 of a partition. In particular, it is fine to use this just for some or all of
4474 the application units of a partition, without needing to recompile the run-time
4475 library. In the case where some units are compiled with the pragma, and some
4476 without, then a declaration of a variable where the type is defined in package
4477 Standard or is locally declared will always be subject to initialization, as
4478 will any declaration of a scalar variable. For composite variables, whether the
4479 variable is initialized may also depend on whether the package in which the
4480 type of the variable is declared is compiled with the pragma.
4481
4482 The other important difference is that the programmer can control the value
4483 used for initializing scalar objects. This effect can be achieved in several
4484 different ways:
4485
4486
4487 @itemize *
4488
4489 @item
4490 At compile time, the programmer can specify the invalid value for a
4491 particular family of scalar types using the optional arguments of the pragma.
4492
4493 The compile-time approach is intended to optimize the generated code for the
4494 pragma, by possibly using fast operations such as @code{memset}.
4495
4496 @item
4497 At bind time, the programmer has several options:
4498
4499
4500 @itemize *
4501
4502 @item
4503 Initialization with invalid values (similar to Normalize_Scalars, though
4504 for Initialize_Scalars it is not always possible to determine the invalid
4505 values in complex cases like signed component fields with nonstandard
4506 sizes).
4507
4508 @item
4509 Initialization with high values.
4510
4511 @item
4512 Initialization with low values.
4513
4514 @item
4515 Initialization with a specific bit pattern.
4516 @end itemize
4517
4518 See the GNAT User's Guide for binder options for specifying these cases.
4519
4520 The bind-time approach is intended to provide fast turnaround for testing
4521 with different values, without having to recompile the program.
4522
4523 @item
4524 At execution time, the programmer can speify the invalid values using an
4525 environment variable. See the GNAT User's Guide for details.
4526
4527 The execution-time approach is intended to provide fast turnaround for
4528 testing with different values, without having to recompile and rebind the
4529 program.
4530 @end itemize
4531
4532 Note that pragma @code{Initialize_Scalars} is particularly useful in conjunction
4533 with the enhanced validity checking that is now provided in GNAT, which checks
4534 for invalid values under more conditions. Using this feature (see description
4535 of the @emph{-gnatV} flag in the GNAT User's Guide) in conjunction with pragma
4536 @code{Initialize_Scalars} provides a powerful new tool to assist in the detection
4537 of problems caused by uninitialized variables.
4538
4539 Note: the use of @code{Initialize_Scalars} has a fairly extensive effect on the
4540 generated code. This may cause your code to be substantially larger. It may
4541 also cause an increase in the amount of stack required, so it is probably a
4542 good idea to turn on stack checking (see description of stack checking in the
4543 GNAT User's Guide) when using this pragma.
4544
4545 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4546 @anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{83}@anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{84}
4547 @section Pragma Initializes
4548
4549
4550 Syntax:
4551
4552 @example
4553 pragma Initializes (INITIALIZATION_LIST);
4554
4555 INITIALIZATION_LIST ::=
4556 null
4557 | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4558
4559 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4560
4561 INPUT_LIST ::=
4562 null
4563 | INPUT
4564 | (INPUT @{, INPUT@})
4565
4566 INPUT ::= name
4567 @end example
4568
4569 For the semantics of this pragma, see the entry for aspect @code{Initializes} in the
4570 SPARK 2014 Reference Manual, section 7.1.5.
4571
4572 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4573 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{85}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{86}
4574 @section Pragma Inline_Always
4575
4576
4577 Syntax:
4578
4579 @example
4580 pragma Inline_Always (NAME [, NAME]);
4581 @end example
4582
4583 Similar to pragma @code{Inline} except that inlining is unconditional.
4584 Inline_Always instructs the compiler to inline every direct call to the
4585 subprogram or else to emit a compilation error, independently of any
4586 option, in particular @emph{-gnatn} or @emph{-gnatN} or the optimization level.
4587 It is an error to take the address or access of @code{NAME}. It is also an error to
4588 apply this pragma to a primitive operation of a tagged type. Thanks to such
4589 restrictions, the compiler is allowed to remove the out-of-line body of @code{NAME}.
4590
4591 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4592 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{87}
4593 @section Pragma Inline_Generic
4594
4595
4596 Syntax:
4597
4598 @example
4599 pragma Inline_Generic (GNAME @{, GNAME@});
4600
4601 GNAME ::= generic_unit_NAME | generic_instance_NAME
4602 @end example
4603
4604 This pragma is provided for compatibility with Dec Ada 83. It has
4605 no effect in GNAT (which always inlines generics), other
4606 than to check that the given names are all names of generic units or
4607 generic instances.
4608
4609 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4610 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{88}
4611 @section Pragma Interface
4612
4613
4614 Syntax:
4615
4616 @example
4617 pragma Interface (
4618 [Convention =>] convention_identifier,
4619 [Entity =>] local_NAME
4620 [, [External_Name =>] static_string_expression]
4621 [, [Link_Name =>] static_string_expression]);
4622 @end example
4623
4624 This pragma is identical in syntax and semantics to
4625 the standard Ada pragma @code{Import}. It is provided for compatibility
4626 with Ada 83. The definition is upwards compatible both with pragma
4627 @code{Interface} as defined in the Ada 83 Reference Manual, and also
4628 with some extended implementations of this pragma in certain Ada 83
4629 implementations. The only difference between pragma @code{Interface}
4630 and pragma @code{Import} is that there is special circuitry to allow
4631 both pragmas to appear for the same subprogram entity (normally it
4632 is illegal to have multiple @code{Import} pragmas. This is useful in
4633 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4634 Ada 83 compilers.
4635
4636 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4637 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{89}
4638 @section Pragma Interface_Name
4639
4640
4641 Syntax:
4642
4643 @example
4644 pragma Interface_Name (
4645 [Entity =>] LOCAL_NAME
4646 [, [External_Name =>] static_string_EXPRESSION]
4647 [, [Link_Name =>] static_string_EXPRESSION]);
4648 @end example
4649
4650 This pragma provides an alternative way of specifying the interface name
4651 for an interfaced subprogram, and is provided for compatibility with Ada
4652 83 compilers that use the pragma for this purpose. You must provide at
4653 least one of @code{External_Name} or @code{Link_Name}.
4654
4655 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4656 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{8a}
4657 @section Pragma Interrupt_Handler
4658
4659
4660 Syntax:
4661
4662 @example
4663 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4664 @end example
4665
4666 This program unit pragma is supported for parameterless protected procedures
4667 as described in Annex C of the Ada Reference Manual. On the AAMP target
4668 the pragma can also be specified for nonprotected parameterless procedures
4669 that are declared at the library level (which includes procedures
4670 declared at the top level of a library package). In the case of AAMP,
4671 when this pragma is applied to a nonprotected procedure, the instruction
4672 @code{IERET} is generated for returns from the procedure, enabling
4673 maskable interrupts, in place of the normal return instruction.
4674
4675 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4676 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{8b}
4677 @section Pragma Interrupt_State
4678
4679
4680 Syntax:
4681
4682 @example
4683 pragma Interrupt_State
4684 ([Name =>] value,
4685 [State =>] SYSTEM | RUNTIME | USER);
4686 @end example
4687
4688 Normally certain interrupts are reserved to the implementation. Any attempt
4689 to attach an interrupt causes Program_Error to be raised, as described in
4690 RM C.3.2(22). A typical example is the @code{SIGINT} interrupt used in
4691 many systems for an @code{Ctrl-C} interrupt. Normally this interrupt is
4692 reserved to the implementation, so that @code{Ctrl-C} can be used to
4693 interrupt execution. Additionally, signals such as @code{SIGSEGV},
4694 @code{SIGABRT}, @code{SIGFPE} and @code{SIGILL} are often mapped to specific
4695 Ada exceptions, or used to implement run-time functions such as the
4696 @code{abort} statement and stack overflow checking.
4697
4698 Pragma @code{Interrupt_State} provides a general mechanism for overriding
4699 such uses of interrupts. It subsumes the functionality of pragma
4700 @code{Unreserve_All_Interrupts}. Pragma @code{Interrupt_State} is not
4701 available on Windows or VMS. On all other platforms than VxWorks,
4702 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4703 and may be used to mark interrupts required by the board support package
4704 as reserved.
4705
4706 Interrupts can be in one of three states:
4707
4708
4709 @itemize *
4710
4711 @item
4712 System
4713
4714 The interrupt is reserved (no Ada handler can be installed), and the
4715 Ada run-time may not install a handler. As a result you are guaranteed
4716 standard system default action if this interrupt is raised. This also allows
4717 installing a low level handler via C APIs such as sigaction(), outside
4718 of Ada control.
4719
4720 @item
4721 Runtime
4722
4723 The interrupt is reserved (no Ada handler can be installed). The run time
4724 is allowed to install a handler for internal control purposes, but is
4725 not required to do so.
4726
4727 @item
4728 User
4729
4730 The interrupt is unreserved. The user may install an Ada handler via
4731 Ada.Interrupts and pragma Interrupt_Handler or Attach_Handler to provide
4732 some other action.
4733 @end itemize
4734
4735 These states are the allowed values of the @code{State} parameter of the
4736 pragma. The @code{Name} parameter is a value of the type
4737 @code{Ada.Interrupts.Interrupt_ID}. Typically, it is a name declared in
4738 @code{Ada.Interrupts.Names}.
4739
4740 This is a configuration pragma, and the binder will check that there
4741 are no inconsistencies between different units in a partition in how a
4742 given interrupt is specified. It may appear anywhere a pragma is legal.
4743
4744 The effect is to move the interrupt to the specified state.
4745
4746 By declaring interrupts to be SYSTEM, you guarantee the standard system
4747 action, such as a core dump.
4748
4749 By declaring interrupts to be USER, you guarantee that you can install
4750 a handler.
4751
4752 Note that certain signals on many operating systems cannot be caught and
4753 handled by applications. In such cases, the pragma is ignored. See the
4754 operating system documentation, or the value of the array @code{Reserved}
4755 declared in the spec of package @code{System.OS_Interface}.
4756
4757 Overriding the default state of signals used by the Ada runtime may interfere
4758 with an application's runtime behavior in the cases of the synchronous signals,
4759 and in the case of the signal used to implement the @code{abort} statement.
4760
4761 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupt_State,Implementation Defined Pragmas
4762 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{8c}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{8d}
4763 @section Pragma Invariant
4764
4765
4766 Syntax:
4767
4768 @example
4769 pragma Invariant
4770 ([Entity =>] private_type_LOCAL_NAME,
4771 [Check =>] EXPRESSION
4772 [,[Message =>] String_Expression]);
4773 @end example
4774
4775 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4776 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4777 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4778 requires the use of the aspect syntax, which is not available except in 2012
4779 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4780 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4781 note that the aspect Invariant is a synonym in GNAT for the aspect
4782 Type_Invariant, but there is no pragma Type_Invariant.
4783
4784 The pragma must appear within the visible part of the package specification,
4785 after the type to which its Entity argument appears. As with the Invariant
4786 aspect, the Check expression is not analyzed until the end of the visible
4787 part of the package, so it may contain forward references. The Message
4788 argument, if present, provides the exception message used if the invariant
4789 is violated. If no Message parameter is provided, a default message that
4790 identifies the line on which the pragma appears is used.
4791
4792 It is permissible to have multiple Invariants for the same type entity, in
4793 which case they are and'ed together. It is permissible to use this pragma
4794 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4795 invariant pragma for the same entity.
4796
4797 For further details on the use of this pragma, see the Ada 2012 documentation
4798 of the Type_Invariant aspect.
4799
4800 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4801 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{8e}
4802 @section Pragma Keep_Names
4803
4804
4805 Syntax:
4806
4807 @example
4808 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4809 @end example
4810
4811 The @code{LOCAL_NAME} argument
4812 must refer to an enumeration first subtype
4813 in the current declarative part. The effect is to retain the enumeration
4814 literal names for use by @code{Image} and @code{Value} even if a global
4815 @code{Discard_Names} pragma applies. This is useful when you want to
4816 generally suppress enumeration literal names and for example you therefore
4817 use a @code{Discard_Names} pragma in the @code{gnat.adc} file, but you
4818 want to retain the names for specific enumeration types.
4819
4820 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4821 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{8f}
4822 @section Pragma License
4823
4824
4825 @geindex License checking
4826
4827 Syntax:
4828
4829 @example
4830 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4831 @end example
4832
4833 This pragma is provided to allow automated checking for appropriate license
4834 conditions with respect to the standard and modified GPL. A pragma
4835 @code{License}, which is a configuration pragma that typically appears at
4836 the start of a source file or in a separate @code{gnat.adc} file, specifies
4837 the licensing conditions of a unit as follows:
4838
4839
4840 @itemize *
4841
4842 @item
4843 Unrestricted
4844 This is used for a unit that can be freely used with no license restrictions.
4845 Examples of such units are public domain units, and units from the Ada
4846 Reference Manual.
4847
4848 @item
4849 GPL
4850 This is used for a unit that is licensed under the unmodified GPL, and which
4851 therefore cannot be @code{with}ed by a restricted unit.
4852
4853 @item
4854 Modified_GPL
4855 This is used for a unit licensed under the GNAT modified GPL that includes
4856 a special exception paragraph that specifically permits the inclusion of
4857 the unit in programs without requiring the entire program to be released
4858 under the GPL.
4859
4860 @item
4861 Restricted
4862 This is used for a unit that is restricted in that it is not permitted to
4863 depend on units that are licensed under the GPL. Typical examples are
4864 proprietary code that is to be released under more restrictive license
4865 conditions. Note that restricted units are permitted to @code{with} units
4866 which are licensed under the modified GPL (this is the whole point of the
4867 modified GPL).
4868 @end itemize
4869
4870 Normally a unit with no @code{License} pragma is considered to have an
4871 unknown license, and no checking is done. However, standard GNAT headers
4872 are recognized, and license information is derived from them as follows.
4873
4874 A GNAT license header starts with a line containing 78 hyphens. The following
4875 comment text is searched for the appearance of any of the following strings.
4876
4877 If the string 'GNU General Public License' is found, then the unit is assumed
4878 to have GPL license, unless the string 'As a special exception' follows, in
4879 which case the license is assumed to be modified GPL.
4880
4881 If one of the strings
4882 'This specification is adapted from the Ada Semantic Interface' or
4883 'This specification is derived from the Ada Reference Manual' is found
4884 then the unit is assumed to be unrestricted.
4885
4886 These default actions means that a program with a restricted license pragma
4887 will automatically get warnings if a GPL unit is inappropriately
4888 @code{with}ed. For example, the program:
4889
4890 @example
4891 with Sem_Ch3;
4892 with GNAT.Sockets;
4893 procedure Secret_Stuff is
4894 ...
4895 end Secret_Stuff
4896 @end example
4897
4898 if compiled with pragma @code{License} (@code{Restricted}) in a
4899 @code{gnat.adc} file will generate the warning:
4900
4901 @example
4902 1. with Sem_Ch3;
4903 |
4904 >>> license of withed unit "Sem_Ch3" is incompatible
4905
4906 2. with GNAT.Sockets;
4907 3. procedure Secret_Stuff is
4908 @end example
4909
4910 Here we get a warning on @code{Sem_Ch3} since it is part of the GNAT
4911 compiler and is licensed under the
4912 GPL, but no warning for @code{GNAT.Sockets} which is part of the GNAT
4913 run time, and is therefore licensed under the modified GPL.
4914
4915 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4916 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{90}
4917 @section Pragma Link_With
4918
4919
4920 Syntax:
4921
4922 @example
4923 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4924 @end example
4925
4926 This pragma is provided for compatibility with certain Ada 83 compilers.
4927 It has exactly the same effect as pragma @code{Linker_Options} except
4928 that spaces occurring within one of the string expressions are treated
4929 as separators. For example, in the following case:
4930
4931 @example
4932 pragma Link_With ("-labc -ldef");
4933 @end example
4934
4935 results in passing the strings @code{-labc} and @code{-ldef} as two
4936 separate arguments to the linker. In addition pragma Link_With allows
4937 multiple arguments, with the same effect as successive pragmas.
4938
4939 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4940 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{91}
4941 @section Pragma Linker_Alias
4942
4943
4944 Syntax:
4945
4946 @example
4947 pragma Linker_Alias (
4948 [Entity =>] LOCAL_NAME,
4949 [Target =>] static_string_EXPRESSION);
4950 @end example
4951
4952 @code{LOCAL_NAME} must refer to an object that is declared at the library
4953 level. This pragma establishes the given entity as a linker alias for the
4954 given target. It is equivalent to @code{__attribute__((alias))} in GNU C
4955 and causes @code{LOCAL_NAME} to be emitted as an alias for the symbol
4956 @code{static_string_EXPRESSION} in the object file, that is to say no space
4957 is reserved for @code{LOCAL_NAME} by the assembler and it will be resolved
4958 to the same address as @code{static_string_EXPRESSION} by the linker.
4959
4960 The actual linker name for the target must be used (e.g., the fully
4961 encoded name with qualification in Ada, or the mangled name in C++),
4962 or it must be declared using the C convention with @code{pragma Import}
4963 or @code{pragma Export}.
4964
4965 Not all target machines support this pragma. On some of them it is accepted
4966 only if @code{pragma Weak_External} has been applied to @code{LOCAL_NAME}.
4967
4968 @example
4969 -- Example of the use of pragma Linker_Alias
4970
4971 package p is
4972 i : Integer := 1;
4973 pragma Export (C, i);
4974
4975 new_name_for_i : Integer;
4976 pragma Linker_Alias (new_name_for_i, "i");
4977 end p;
4978 @end example
4979
4980 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4981 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{92}
4982 @section Pragma Linker_Constructor
4983
4984
4985 Syntax:
4986
4987 @example
4988 pragma Linker_Constructor (procedure_LOCAL_NAME);
4989 @end example
4990
4991 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4992 is declared at the library level. A procedure to which this pragma is
4993 applied will be treated as an initialization routine by the linker.
4994 It is equivalent to @code{__attribute__((constructor))} in GNU C and
4995 causes @code{procedure_LOCAL_NAME} to be invoked before the entry point
4996 of the executable is called (or immediately after the shared library is
4997 loaded if the procedure is linked in a shared library), in particular
4998 before the Ada run-time environment is set up.
4999
5000 Because of these specific contexts, the set of operations such a procedure
5001 can perform is very limited and the type of objects it can manipulate is
5002 essentially restricted to the elementary types. In particular, it must only
5003 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
5004
5005 This pragma is used by GNAT to implement auto-initialization of shared Stand
5006 Alone Libraries, which provides a related capability without the restrictions
5007 listed above. Where possible, the use of Stand Alone Libraries is preferable
5008 to the use of this pragma.
5009
5010 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
5011 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{93}
5012 @section Pragma Linker_Destructor
5013
5014
5015 Syntax:
5016
5017 @example
5018 pragma Linker_Destructor (procedure_LOCAL_NAME);
5019 @end example
5020
5021 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
5022 is declared at the library level. A procedure to which this pragma is
5023 applied will be treated as a finalization routine by the linker.
5024 It is equivalent to @code{__attribute__((destructor))} in GNU C and
5025 causes @code{procedure_LOCAL_NAME} to be invoked after the entry point
5026 of the executable has exited (or immediately before the shared library
5027 is unloaded if the procedure is linked in a shared library), in particular
5028 after the Ada run-time environment is shut down.
5029
5030 See @code{pragma Linker_Constructor} for the set of restrictions that apply
5031 because of these specific contexts.
5032
5033 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
5034 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{94}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{95}
5035 @section Pragma Linker_Section
5036
5037
5038 Syntax:
5039
5040 @example
5041 pragma Linker_Section (
5042 [Entity =>] LOCAL_NAME,
5043 [Section =>] static_string_EXPRESSION);
5044 @end example
5045
5046 @code{LOCAL_NAME} must refer to an object, type, or subprogram that is
5047 declared at the library level. This pragma specifies the name of the
5048 linker section for the given entity. It is equivalent to
5049 @code{__attribute__((section))} in GNU C and causes @code{LOCAL_NAME} to
5050 be placed in the @code{static_string_EXPRESSION} section of the
5051 executable (assuming the linker doesn't rename the section).
5052 GNAT also provides an implementation defined aspect of the same name.
5053
5054 In the case of specifying this aspect for a type, the effect is to
5055 specify the corresponding section for all library-level objects of
5056 the type that do not have an explicit linker section set. Note that
5057 this only applies to whole objects, not to components of composite objects.
5058
5059 In the case of a subprogram, the linker section applies to all previously
5060 declared matching overloaded subprograms in the current declarative part
5061 which do not already have a linker section assigned. The linker section
5062 aspect is useful in this case for specifying different linker sections
5063 for different elements of such an overloaded set.
5064
5065 Note that an empty string specifies that no linker section is specified.
5066 This is not quite the same as omitting the pragma or aspect, since it
5067 can be used to specify that one element of an overloaded set of subprograms
5068 has the default linker section, or that one object of a type for which a
5069 linker section is specified should has the default linker section.
5070
5071 The compiler normally places library-level entities in standard sections
5072 depending on the class: procedures and functions generally go in the
5073 @code{.text} section, initialized variables in the @code{.data} section
5074 and uninitialized variables in the @code{.bss} section.
5075
5076 Other, special sections may exist on given target machines to map special
5077 hardware, for example I/O ports or flash memory. This pragma is a means to
5078 defer the final layout of the executable to the linker, thus fully working
5079 at the symbolic level with the compiler.
5080
5081 Some file formats do not support arbitrary sections so not all target
5082 machines support this pragma. The use of this pragma may cause a program
5083 execution to be erroneous if it is used to place an entity into an
5084 inappropriate section (e.g., a modified variable into the @code{.text}
5085 section). See also @code{pragma Persistent_BSS}.
5086
5087 @example
5088 -- Example of the use of pragma Linker_Section
5089
5090 package IO_Card is
5091 Port_A : Integer;
5092 pragma Volatile (Port_A);
5093 pragma Linker_Section (Port_A, ".bss.port_a");
5094
5095 Port_B : Integer;
5096 pragma Volatile (Port_B);
5097 pragma Linker_Section (Port_B, ".bss.port_b");
5098
5099 type Port_Type is new Integer with Linker_Section => ".bss";
5100 PA : Port_Type with Linker_Section => ".bss.PA";
5101 PB : Port_Type; -- ends up in linker section ".bss"
5102
5103 procedure Q with Linker_Section => "Qsection";
5104 end IO_Card;
5105 @end example
5106
5107 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
5108 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{96}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{97}
5109 @section Pragma Lock_Free
5110
5111
5112 Syntax:
5113 This pragma may be specified for protected types or objects. It specifies that
5114 the implementation of protected operations must be implemented without locks.
5115 Compilation fails if the compiler cannot generate lock-free code for the
5116 operations.
5117
5118 The current conditions required to support this pragma are:
5119
5120
5121 @itemize *
5122
5123 @item
5124 Protected type declarations may not contain entries
5125
5126 @item
5127 Protected subprogram declarations may not have nonelementary parameters
5128 @end itemize
5129
5130 In addition, each protected subprogram body must satisfy:
5131
5132
5133 @itemize *
5134
5135 @item
5136 May reference only one protected component
5137
5138 @item
5139 May not reference nonconstant entities outside the protected subprogram
5140 scope.
5141
5142 @item
5143 May not contain address representation items, allocators, or quantified
5144 expressions.
5145
5146 @item
5147 May not contain delay, goto, loop, or procedure-call statements.
5148
5149 @item
5150 May not contain exported and imported entities
5151
5152 @item
5153 May not dereferenced access values
5154
5155 @item
5156 Function calls and attribute references must be static
5157 @end itemize
5158
5159 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
5160 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{98}
5161 @section Pragma Loop_Invariant
5162
5163
5164 Syntax:
5165
5166 @example
5167 pragma Loop_Invariant ( boolean_EXPRESSION );
5168 @end example
5169
5170 The effect of this pragma is similar to that of pragma @code{Assert},
5171 except that in an @code{Assertion_Policy} pragma, the identifier
5172 @code{Loop_Invariant} is used to control whether it is ignored or checked
5173 (or disabled).
5174
5175 @code{Loop_Invariant} can only appear as one of the items in the sequence
5176 of statements of a loop body, or nested inside block statements that
5177 appear in the sequence of statements of a loop body.
5178 The intention is that it be used to
5179 represent a "loop invariant" assertion, i.e. something that is true each
5180 time through the loop, and which can be used to show that the loop is
5181 achieving its purpose.
5182
5183 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5184 apply to the same loop should be grouped in the same sequence of
5185 statements.
5186
5187 To aid in writing such invariants, the special attribute @code{Loop_Entry}
5188 may be used to refer to the value of an expression on entry to the loop. This
5189 attribute can only be used within the expression of a @code{Loop_Invariant}
5190 pragma. For full details, see documentation of attribute @code{Loop_Entry}.
5191
5192 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
5193 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{99}
5194 @section Pragma Loop_Optimize
5195
5196
5197 Syntax:
5198
5199 @example
5200 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
5201
5202 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
5203 @end example
5204
5205 This pragma must appear immediately within a loop statement. It allows the
5206 programmer to specify optimization hints for the enclosing loop. The hints
5207 are not mutually exclusive and can be freely mixed, but not all combinations
5208 will yield a sensible outcome.
5209
5210 There are five supported optimization hints for a loop:
5211
5212
5213 @itemize *
5214
5215 @item
5216 Ivdep
5217
5218 The programmer asserts that there are no loop-carried dependencies
5219 which would prevent consecutive iterations of the loop from being
5220 executed simultaneously.
5221
5222 @item
5223 No_Unroll
5224
5225 The loop must not be unrolled. This is a strong hint: the compiler will not
5226 unroll a loop marked with this hint.
5227
5228 @item
5229 Unroll
5230
5231 The loop should be unrolled. This is a weak hint: the compiler will try to
5232 apply unrolling to this loop preferably to other optimizations, notably
5233 vectorization, but there is no guarantee that the loop will be unrolled.
5234
5235 @item
5236 No_Vector
5237
5238 The loop must not be vectorized. This is a strong hint: the compiler will not
5239 vectorize a loop marked with this hint.
5240
5241 @item
5242 Vector
5243
5244 The loop should be vectorized. This is a weak hint: the compiler will try to
5245 apply vectorization to this loop preferably to other optimizations, notably
5246 unrolling, but there is no guarantee that the loop will be vectorized.
5247 @end itemize
5248
5249 These hints do not remove the need to pass the appropriate switches to the
5250 compiler in order to enable the relevant optimizations, that is to say
5251 @emph{-funroll-loops} for unrolling and @emph{-ftree-vectorize} for
5252 vectorization.
5253
5254 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
5255 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{9a}
5256 @section Pragma Loop_Variant
5257
5258
5259 Syntax:
5260
5261 @example
5262 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
5263 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
5264 CHANGE_DIRECTION ::= Increases | Decreases
5265 @end example
5266
5267 @code{Loop_Variant} can only appear as one of the items in the sequence
5268 of statements of a loop body, or nested inside block statements that
5269 appear in the sequence of statements of a loop body.
5270 It allows the specification of quantities which must always
5271 decrease or increase in successive iterations of the loop. In its simplest
5272 form, just one expression is specified, whose value must increase or decrease
5273 on each iteration of the loop.
5274
5275 In a more complex form, multiple arguments can be given which are intepreted
5276 in a nesting lexicographic manner. For example:
5277
5278 @example
5279 pragma Loop_Variant (Increases => X, Decreases => Y);
5280 @end example
5281
5282 specifies that each time through the loop either X increases, or X stays
5283 the same and Y decreases. A @code{Loop_Variant} pragma ensures that the
5284 loop is making progress. It can be useful in helping to show informally
5285 or prove formally that the loop always terminates.
5286
5287 @code{Loop_Variant} is an assertion whose effect can be controlled using
5288 an @code{Assertion_Policy} with a check name of @code{Loop_Variant}. The
5289 policy can be @code{Check} to enable the loop variant check, @code{Ignore}
5290 to ignore the check (in which case the pragma has no effect on the program),
5291 or @code{Disable} in which case the pragma is not even checked for correct
5292 syntax.
5293
5294 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5295 apply to the same loop should be grouped in the same sequence of
5296 statements.
5297
5298 The @code{Loop_Entry} attribute may be used within the expressions of the
5299 @code{Loop_Variant} pragma to refer to values on entry to the loop.
5300
5301 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
5302 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{9b}
5303 @section Pragma Machine_Attribute
5304
5305
5306 Syntax:
5307
5308 @example
5309 pragma Machine_Attribute (
5310 [Entity =>] LOCAL_NAME,
5311 [Attribute_Name =>] static_string_EXPRESSION
5312 [, [Info =>] static_EXPRESSION @{, static_EXPRESSION@}] );
5313 @end example
5314
5315 Machine-dependent attributes can be specified for types and/or
5316 declarations. This pragma is semantically equivalent to
5317 @code{__attribute__((@emph{attribute_name}))} (if @code{info} is not
5318 specified) or @code{__attribute__((@emph{attribute_name(info})))}
5319 or @code{__attribute__((@emph{attribute_name(info,...})))} in GNU C,
5320 where @emph{attribute_name} is recognized by the compiler middle-end
5321 or the @code{TARGET_ATTRIBUTE_TABLE} machine specific macro. Note
5322 that a string literal for the optional parameter @code{info} or the
5323 following ones is transformed by default into an identifier,
5324 which may make this pragma unusable for some attributes.
5325 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
5326
5327 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
5328 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{9c}
5329 @section Pragma Main
5330
5331
5332 Syntax:
5333
5334 @example
5335 pragma Main
5336 (MAIN_OPTION [, MAIN_OPTION]);
5337
5338 MAIN_OPTION ::=
5339 [Stack_Size =>] static_integer_EXPRESSION
5340 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
5341 | [Time_Slicing_Enabled =>] static_boolean_EXPRESSION
5342 @end example
5343
5344 This pragma is provided for compatibility with OpenVMS VAX Systems. It has
5345 no effect in GNAT, other than being syntax checked.
5346
5347 @node Pragma Main_Storage,Pragma Max_Queue_Length,Pragma Main,Implementation Defined Pragmas
5348 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{9d}
5349 @section Pragma Main_Storage
5350
5351
5352 Syntax:
5353
5354 @example
5355 pragma Main_Storage
5356 (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
5357
5358 MAIN_STORAGE_OPTION ::=
5359 [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
5360 | [TOP_GUARD =>] static_SIMPLE_EXPRESSION
5361 @end example
5362
5363 This pragma is provided for compatibility with OpenVMS VAX Systems. It has
5364 no effect in GNAT, other than being syntax checked.
5365
5366 @node Pragma Max_Queue_Length,Pragma No_Body,Pragma Main_Storage,Implementation Defined Pragmas
5367 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{9e}@anchor{gnat_rm/implementation_defined_pragmas pragma-max-queue-length}@anchor{9f}
5368 @section Pragma Max_Queue_Length
5369
5370
5371 Syntax:
5372
5373 @example
5374 pragma Max_Entry_Queue (static_integer_EXPRESSION);
5375 @end example
5376
5377 This pragma is used to specify the maximum callers per entry queue for
5378 individual protected entries and entry families. It accepts a single
5379 positive integer as a parameter and must appear after the declaration
5380 of an entry.
5381
5382 @node Pragma No_Body,Pragma No_Caching,Pragma Max_Queue_Length,Implementation Defined Pragmas
5383 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{a0}
5384 @section Pragma No_Body
5385
5386
5387 Syntax:
5388
5389 @example
5390 pragma No_Body;
5391 @end example
5392
5393 There are a number of cases in which a package spec does not require a body,
5394 and in fact a body is not permitted. GNAT will not permit the spec to be
5395 compiled if there is a body around. The pragma No_Body allows you to provide
5396 a body file, even in a case where no body is allowed. The body file must
5397 contain only comments and a single No_Body pragma. This is recognized by
5398 the compiler as indicating that no body is logically present.
5399
5400 This is particularly useful during maintenance when a package is modified in
5401 such a way that a body needed before is no longer needed. The provision of a
5402 dummy body with a No_Body pragma ensures that there is no interference from
5403 earlier versions of the package body.
5404
5405 @node Pragma No_Caching,Pragma No_Component_Reordering,Pragma No_Body,Implementation Defined Pragmas
5406 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-caching}@anchor{a1}@anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{a2}
5407 @section Pragma No_Caching
5408
5409
5410 Syntax:
5411
5412 @example
5413 pragma No_Caching [ (boolean_EXPRESSION) ];
5414 @end example
5415
5416 For the semantics of this pragma, see the entry for aspect @code{No_Caching} in
5417 the SPARK 2014 Reference Manual, section 7.1.2.
5418
5419 @node Pragma No_Component_Reordering,Pragma No_Elaboration_Code_All,Pragma No_Caching,Implementation Defined Pragmas
5420 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-component-reordering}@anchor{a3}
5421 @section Pragma No_Component_Reordering
5422
5423
5424 Syntax:
5425
5426 @example
5427 pragma No_Component_Reordering [([Entity =>] type_LOCAL_NAME)];
5428 @end example
5429
5430 @code{type_LOCAL_NAME} must refer to a record type declaration in the current
5431 declarative part. The effect is to preclude any reordering of components
5432 for the layout of the record, i.e. the record is laid out by the compiler
5433 in the order in which the components are declared textually. The form with
5434 no argument is a configuration pragma which applies to all record types
5435 declared in units to which the pragma applies and there is a requirement
5436 that this pragma be used consistently within a partition.
5437
5438 @node Pragma No_Elaboration_Code_All,Pragma No_Heap_Finalization,Pragma No_Component_Reordering,Implementation Defined Pragmas
5439 @anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a4}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{a5}
5440 @section Pragma No_Elaboration_Code_All
5441
5442
5443 Syntax:
5444
5445 @example
5446 pragma No_Elaboration_Code_All [(program_unit_NAME)];
5447 @end example
5448
5449 This is a program unit pragma (there is also an equivalent aspect of the
5450 same name) that establishes the restriction @code{No_Elaboration_Code} for
5451 the current unit and any extended main source units (body and subunits).
5452 It also has the effect of enforcing a transitive application of this
5453 aspect, so that if any unit is implicitly or explicitly with'ed by the
5454 current unit, it must also have the No_Elaboration_Code_All aspect set.
5455 It may be applied to package or subprogram specs or their generic versions.
5456
5457 @node Pragma No_Heap_Finalization,Pragma No_Inline,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5458 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-heap-finalization}@anchor{a6}
5459 @section Pragma No_Heap_Finalization
5460
5461
5462 Syntax:
5463
5464 @example
5465 pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ];
5466 @end example
5467
5468 Pragma @code{No_Heap_Finalization} may be used as a configuration pragma or as a
5469 type-specific pragma.
5470
5471 In its configuration form, the pragma must appear within a configuration file
5472 such as gnat.adc, without an argument. The pragma suppresses the call to
5473 @code{Finalize} for heap-allocated objects created through library-level named
5474 access-to-object types in cases where the designated type requires finalization
5475 actions.
5476
5477 In its type-specific form, the argument of the pragma must denote a
5478 library-level named access-to-object type. The pragma suppresses the call to
5479 @code{Finalize} for heap-allocated objects created through the specific access type
5480 in cases where the designated type requires finalization actions.
5481
5482 It is still possible to finalize such heap-allocated objects by explicitly
5483 deallocating them.
5484
5485 A library-level named access-to-object type declared within a generic unit will
5486 lose its @code{No_Heap_Finalization} pragma when the corresponding instance does not
5487 appear at the library level.
5488
5489 @node Pragma No_Inline,Pragma No_Return,Pragma No_Heap_Finalization,Implementation Defined Pragmas
5490 @anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{a7}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{a8}
5491 @section Pragma No_Inline
5492
5493
5494 Syntax:
5495
5496 @example
5497 pragma No_Inline (NAME @{, NAME@});
5498 @end example
5499
5500 This pragma suppresses inlining for the callable entity or the instances of
5501 the generic subprogram designated by @code{NAME}, including inlining that
5502 results from the use of pragma @code{Inline}. This pragma is always active,
5503 in particular it is not subject to the use of option @emph{-gnatn} or
5504 @emph{-gnatN}. It is illegal to specify both pragma @code{No_Inline} and
5505 pragma @code{Inline_Always} for the same @code{NAME}.
5506
5507 @node Pragma No_Return,Pragma No_Run_Time,Pragma No_Inline,Implementation Defined Pragmas
5508 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{a9}
5509 @section Pragma No_Return
5510
5511
5512 Syntax:
5513
5514 @example
5515 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5516 @end example
5517
5518 Each @code{procedure_LOCAL_NAME} argument must refer to one or more procedure
5519 declarations in the current declarative part. A procedure to which this
5520 pragma is applied may not contain any explicit @code{return} statements.
5521 In addition, if the procedure contains any implicit returns from falling
5522 off the end of a statement sequence, then execution of that implicit
5523 return will cause Program_Error to be raised.
5524
5525 One use of this pragma is to identify procedures whose only purpose is to raise
5526 an exception. Another use of this pragma is to suppress incorrect warnings
5527 about missing returns in functions, where the last statement of a function
5528 statement sequence is a call to such a procedure.
5529
5530 Note that in Ada 2005 mode, this pragma is part of the language. It is
5531 available in all earlier versions of Ada as an implementation-defined
5532 pragma.
5533
5534 @node Pragma No_Run_Time,Pragma No_Strict_Aliasing,Pragma No_Return,Implementation Defined Pragmas
5535 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-run-time}@anchor{aa}
5536 @section Pragma No_Run_Time
5537
5538
5539 Syntax:
5540
5541 @example
5542 pragma No_Run_Time;
5543 @end example
5544
5545 This is an obsolete configuration pragma that historically was used to
5546 set up a runtime library with no object code. It is now used only for
5547 internal testing. The pragma has been superseded by the reconfigurable
5548 runtime capability of GNAT.
5549
5550 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Run_Time,Implementation Defined Pragmas
5551 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{ab}
5552 @section Pragma No_Strict_Aliasing
5553
5554
5555 Syntax:
5556
5557 @example
5558 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5559 @end example
5560
5561 @code{type_LOCAL_NAME} must refer to an access type
5562 declaration in the current declarative part. The effect is to inhibit
5563 strict aliasing optimization for the given type. The form with no
5564 arguments is a configuration pragma which applies to all access types
5565 declared in units to which the pragma applies. For a detailed
5566 description of the strict aliasing optimization, and the situations
5567 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5568 in the @cite{GNAT User's Guide}.
5569
5570 This pragma currently has no effects on access to unconstrained array types.
5571
5572 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5573 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{ac}@anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{ad}
5574 @section Pragma No_Tagged_Streams
5575
5576
5577 Syntax:
5578
5579 @example
5580 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5581 @end example
5582
5583 Normally when a tagged type is introduced using a full type declaration,
5584 part of the processing includes generating stream access routines to be
5585 used by stream attributes referencing the type (or one of its subtypes
5586 or derived types). This can involve the generation of significant amounts
5587 of code which is wasted space if stream routines are not needed for the
5588 type in question.
5589
5590 The @code{No_Tagged_Streams} pragma causes the generation of these stream
5591 routines to be skipped, and any attempt to use stream operations on
5592 types subject to this pragma will be statically rejected as illegal.
5593
5594 There are two forms of the pragma. The form with no arguments must appear
5595 in a declarative sequence or in the declarations of a package spec. This
5596 pragma affects all subsequent root tagged types declared in the declaration
5597 sequence, and specifies that no stream routines be generated. The form with
5598 an argument (for which there is also a corresponding aspect) specifies a
5599 single root tagged type for which stream routines are not to be generated.
5600
5601 Once the pragma has been given for a particular root tagged type, all subtypes
5602 and derived types of this type inherit the pragma automatically, so the effect
5603 applies to a complete hierarchy (this is necessary to deal with the class-wide
5604 dispatching versions of the stream routines).
5605
5606 When pragmas @code{Discard_Names} and @code{No_Tagged_Streams} are simultaneously
5607 applied to a tagged type its Expanded_Name and External_Tag are initialized
5608 with empty strings. This is useful to avoid exposing entity names at binary
5609 level but has a negative impact on the debuggability of tagged types.
5610
5611 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5612 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{ae}
5613 @section Pragma Normalize_Scalars
5614
5615
5616 Syntax:
5617
5618 @example
5619 pragma Normalize_Scalars;
5620 @end example
5621
5622 This is a language defined pragma which is fully implemented in GNAT. The
5623 effect is to cause all scalar objects that are not otherwise initialized
5624 to be initialized. The initial values are implementation dependent and
5625 are as follows:
5626
5627
5628 @table @asis
5629
5630 @item @emph{Standard.Character}
5631
5632 Objects whose root type is Standard.Character are initialized to
5633 Character'Last unless the subtype range excludes NUL (in which case
5634 NUL is used). This choice will always generate an invalid value if
5635 one exists.
5636
5637 @item @emph{Standard.Wide_Character}
5638
5639 Objects whose root type is Standard.Wide_Character are initialized to
5640 Wide_Character'Last unless the subtype range excludes NUL (in which case
5641 NUL is used). This choice will always generate an invalid value if
5642 one exists.
5643
5644 @item @emph{Standard.Wide_Wide_Character}
5645
5646 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5647 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5648 which case NUL is used). This choice will always generate an invalid value if
5649 one exists.
5650
5651 @item @emph{Integer types}
5652
5653 Objects of an integer type are treated differently depending on whether
5654 negative values are present in the subtype. If no negative values are
5655 present, then all one bits is used as the initial value except in the
5656 special case where zero is excluded from the subtype, in which case
5657 all zero bits are used. This choice will always generate an invalid
5658 value if one exists.
5659
5660 For subtypes with negative values present, the largest negative number
5661 is used, except in the unusual case where this largest negative number
5662 is in the subtype, and the largest positive number is not, in which case
5663 the largest positive value is used. This choice will always generate
5664 an invalid value if one exists.
5665
5666 @item @emph{Floating-Point Types}
5667
5668 Objects of all floating-point types are initialized to all 1-bits. For
5669 standard IEEE format, this corresponds to a NaN (not a number) which is
5670 indeed an invalid value.
5671
5672 @item @emph{Fixed-Point Types}
5673
5674 Objects of all fixed-point types are treated as described above for integers,
5675 with the rules applying to the underlying integer value used to represent
5676 the fixed-point value.
5677
5678 @item @emph{Modular types}
5679
5680 Objects of a modular type are initialized to all one bits, except in
5681 the special case where zero is excluded from the subtype, in which
5682 case all zero bits are used. This choice will always generate an
5683 invalid value if one exists.
5684
5685 @item @emph{Enumeration types}
5686
5687 Objects of an enumeration type are initialized to all one-bits, i.e., to
5688 the value @code{2 ** typ'Size - 1} unless the subtype excludes the literal
5689 whose Pos value is zero, in which case a code of zero is used. This choice
5690 will always generate an invalid value if one exists.
5691 @end table
5692
5693 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5694 @anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{af}@anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{b0}
5695 @section Pragma Obsolescent
5696
5697
5698 Syntax:
5699
5700 @example
5701 pragma Obsolescent;
5702
5703 pragma Obsolescent (
5704 [Message =>] static_string_EXPRESSION
5705 [,[Version =>] Ada_05]]);
5706
5707 pragma Obsolescent (
5708 [Entity =>] NAME
5709 [,[Message =>] static_string_EXPRESSION
5710 [,[Version =>] Ada_05]] );
5711 @end example
5712
5713 This pragma can occur immediately following a declaration of an entity,
5714 including the case of a record component. If no Entity argument is present,
5715 then this declaration is the one to which the pragma applies. If an Entity
5716 parameter is present, it must either match the name of the entity in this
5717 declaration, or alternatively, the pragma can immediately follow an enumeration
5718 type declaration, where the Entity argument names one of the enumeration
5719 literals.
5720
5721 This pragma is used to indicate that the named entity
5722 is considered obsolescent and should not be used. Typically this is
5723 used when an API must be modified by eventually removing or modifying
5724 existing subprograms or other entities. The pragma can be used at an
5725 intermediate stage when the entity is still present, but will be
5726 removed later.
5727
5728 The effect of this pragma is to output a warning message on a reference to
5729 an entity thus marked that the subprogram is obsolescent if the appropriate
5730 warning option in the compiler is activated. If the @code{Message} parameter is
5731 present, then a second warning message is given containing this text. In
5732 addition, a reference to the entity is considered to be a violation of pragma
5733 @code{Restrictions (No_Obsolescent_Features)}.
5734
5735 This pragma can also be used as a program unit pragma for a package,
5736 in which case the entity name is the name of the package, and the
5737 pragma indicates that the entire package is considered
5738 obsolescent. In this case a client @code{with}ing such a package
5739 violates the restriction, and the @code{with} clause is
5740 flagged with warnings if the warning option is set.
5741
5742 If the @code{Version} parameter is present (which must be exactly
5743 the identifier @code{Ada_05}, no other argument is allowed), then the
5744 indication of obsolescence applies only when compiling in Ada 2005
5745 mode. This is primarily intended for dealing with the situations
5746 in the predefined library where subprograms or packages
5747 have become defined as obsolescent in Ada 2005
5748 (e.g., in @code{Ada.Characters.Handling}), but may be used anywhere.
5749
5750 The following examples show typical uses of this pragma:
5751
5752 @example
5753 package p is
5754 pragma Obsolescent (p, Message => "use pp instead of p");
5755 end p;
5756
5757 package q is
5758 procedure q2;
5759 pragma Obsolescent ("use q2new instead");
5760
5761 type R is new integer;
5762 pragma Obsolescent
5763 (Entity => R,
5764 Message => "use RR in Ada 2005",
5765 Version => Ada_05);
5766
5767 type M is record
5768 F1 : Integer;
5769 F2 : Integer;
5770 pragma Obsolescent;
5771 F3 : Integer;
5772 end record;
5773
5774 type E is (a, bc, 'd', quack);
5775 pragma Obsolescent (Entity => bc)
5776 pragma Obsolescent (Entity => 'd')
5777
5778 function "+"
5779 (a, b : character) return character;
5780 pragma Obsolescent (Entity => "+");
5781 end;
5782 @end example
5783
5784 Note that, as for all pragmas, if you use a pragma argument identifier,
5785 then all subsequent parameters must also use a pragma argument identifier.
5786 So if you specify @code{Entity =>} for the @code{Entity} argument, and a @code{Message}
5787 argument is present, it must be preceded by @code{Message =>}.
5788
5789 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5790 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{b1}
5791 @section Pragma Optimize_Alignment
5792
5793
5794 @geindex Alignment
5795 @geindex default settings
5796
5797 Syntax:
5798
5799 @example
5800 pragma Optimize_Alignment (TIME | SPACE | OFF);
5801 @end example
5802
5803 This is a configuration pragma which affects the choice of default alignments
5804 for types and objects where no alignment is explicitly specified. There is a
5805 time/space trade-off in the selection of these values. Large alignments result
5806 in more efficient code, at the expense of larger data space, since sizes have
5807 to be increased to match these alignments. Smaller alignments save space, but
5808 the access code is slower. The normal choice of default alignments for types
5809 and individual alignment promotions for objects (which is what you get if you
5810 do not use this pragma, or if you use an argument of OFF), tries to balance
5811 these two requirements.
5812
5813 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5814 First any packed record is given an alignment of 1. Second, if a size is given
5815 for the type, then the alignment is chosen to avoid increasing this size. For
5816 example, consider:
5817
5818 @example
5819 type R is record
5820 X : Integer;
5821 Y : Character;
5822 end record;
5823
5824 for R'Size use 5*8;
5825 @end example
5826
5827 In the default mode, this type gets an alignment of 4, so that access to the
5828 Integer field X are efficient. But this means that objects of the type end up
5829 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5830 allowed to be bigger than the size of the type, but it can waste space if for
5831 example fields of type R appear in an enclosing record. If the above type is
5832 compiled in @code{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5833
5834 However, there is one case in which SPACE is ignored. If a variable length
5835 record (that is a discriminated record with a component which is an array
5836 whose length depends on a discriminant), has a pragma Pack, then it is not
5837 in general possible to set the alignment of such a record to one, so the
5838 pragma is ignored in this case (with a warning).
5839
5840 Specifying SPACE also disables alignment promotions for standalone objects,
5841 which occur when the compiler increases the alignment of a specific object
5842 without changing the alignment of its type.
5843
5844 Specifying SPACE also disables component reordering in unpacked record types,
5845 which can result in larger sizes in order to meet alignment requirements.
5846
5847 Specifying TIME causes larger default alignments to be chosen in the case of
5848 small types with sizes that are not a power of 2. For example, consider:
5849
5850 @example
5851 type R is record
5852 A : Character;
5853 B : Character;
5854 C : Boolean;
5855 end record;
5856
5857 pragma Pack (R);
5858 for R'Size use 17;
5859 @end example
5860
5861 The default alignment for this record is normally 1, but if this type is
5862 compiled in @code{Optimize_Alignment (Time)} mode, then the alignment is set
5863 to 4, which wastes space for objects of the type, since they are now 4 bytes
5864 long, but results in more efficient access when the whole record is referenced.
5865
5866 As noted above, this is a configuration pragma, and there is a requirement
5867 that all units in a partition be compiled with a consistent setting of the
5868 optimization setting. This would normally be achieved by use of a configuration
5869 pragma file containing the appropriate setting. The exception to this rule is
5870 that units with an explicit configuration pragma in the same file as the source
5871 unit are excluded from the consistency check, as are all predefined units. The
5872 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5873 pragma appears at the start of the file.
5874
5875 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5876 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{b2}
5877 @section Pragma Ordered
5878
5879
5880 Syntax:
5881
5882 @example
5883 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5884 @end example
5885
5886 Most enumeration types are from a conceptual point of view unordered.
5887 For example, consider:
5888
5889 @example
5890 type Color is (Red, Blue, Green, Yellow);
5891 @end example
5892
5893 By Ada semantics @code{Blue > Red} and @code{Green > Blue},
5894 but really these relations make no sense; the enumeration type merely
5895 specifies a set of possible colors, and the order is unimportant.
5896
5897 For unordered enumeration types, it is generally a good idea if
5898 clients avoid comparisons (other than equality or inequality) and
5899 explicit ranges. (A @emph{client} is a unit where the type is referenced,
5900 other than the unit where the type is declared, its body, and its subunits.)
5901 For example, if code buried in some client says:
5902
5903 @example
5904 if Current_Color < Yellow then ...
5905 if Current_Color in Blue .. Green then ...
5906 @end example
5907
5908 then the client code is relying on the order, which is undesirable.
5909 It makes the code hard to read and creates maintenance difficulties if
5910 entries have to be added to the enumeration type. Instead,
5911 the code in the client should list the possibilities, or an
5912 appropriate subtype should be declared in the unit that declares
5913 the original enumeration type. E.g., the following subtype could
5914 be declared along with the type @code{Color}:
5915
5916 @example
5917 subtype RBG is Color range Red .. Green;
5918 @end example
5919
5920 and then the client could write:
5921
5922 @example
5923 if Current_Color in RBG then ...
5924 if Current_Color = Blue or Current_Color = Green then ...
5925 @end example
5926
5927 However, some enumeration types are legitimately ordered from a conceptual
5928 point of view. For example, if you declare:
5929
5930 @example
5931 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5932 @end example
5933
5934 then the ordering imposed by the language is reasonable, and
5935 clients can depend on it, writing for example:
5936
5937 @example
5938 if D in Mon .. Fri then ...
5939 if D < Wed then ...
5940 @end example
5941
5942 The pragma @emph{Ordered} is provided to mark enumeration types that
5943 are conceptually ordered, alerting the reader that clients may depend
5944 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5945 rather than one to mark them as unordered, since in our experience,
5946 the great majority of enumeration types are conceptually unordered.
5947
5948 The types @code{Boolean}, @code{Character}, @code{Wide_Character},
5949 and @code{Wide_Wide_Character}
5950 are considered to be ordered types, so each is declared with a
5951 pragma @code{Ordered} in package @code{Standard}.
5952
5953 Normally pragma @code{Ordered} serves only as documentation and a guide for
5954 coding standards, but GNAT provides a warning switch @emph{-gnatw.u} that
5955 requests warnings for inappropriate uses (comparisons and explicit
5956 subranges) for unordered types. If this switch is used, then any
5957 enumeration type not marked with pragma @code{Ordered} will be considered
5958 as unordered, and will generate warnings for inappropriate uses.
5959
5960 Note that generic types are not considered ordered or unordered (since the
5961 template can be instantiated for both cases), so we never generate warnings
5962 for the case of generic enumerated types.
5963
5964 For additional information please refer to the description of the
5965 @emph{-gnatw.u} switch in the GNAT User's Guide.
5966
5967 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5968 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{b3}
5969 @section Pragma Overflow_Mode
5970
5971
5972 Syntax:
5973
5974 @example
5975 pragma Overflow_Mode
5976 ( [General =>] MODE
5977 [,[Assertions =>] MODE]);
5978
5979 MODE ::= STRICT | MINIMIZED | ELIMINATED
5980 @end example
5981
5982 This pragma sets the current overflow mode to the given setting. For details
5983 of the meaning of these modes, please refer to the
5984 'Overflow Check Handling in GNAT' appendix in the
5985 GNAT User's Guide. If only the @code{General} parameter is present,
5986 the given mode applies to all expressions. If both parameters are present,
5987 the @code{General} mode applies to expressions outside assertions, and
5988 the @code{Eliminated} mode applies to expressions within assertions.
5989
5990 The case of the @code{MODE} parameter is ignored,
5991 so @code{MINIMIZED}, @code{Minimized} and
5992 @code{minimized} all have the same effect.
5993
5994 The @code{Overflow_Mode} pragma has the same scoping and placement
5995 rules as pragma @code{Suppress}, so it can occur either as a
5996 configuration pragma, specifying a default for the whole
5997 program, or in a declarative scope, where it applies to the
5998 remaining declarations and statements in that scope.
5999
6000 The pragma @code{Suppress (Overflow_Check)} suppresses
6001 overflow checking, but does not affect the overflow mode.
6002
6003 The pragma @code{Unsuppress (Overflow_Check)} unsuppresses (enables)
6004 overflow checking, but does not affect the overflow mode.
6005
6006 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
6007 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{b4}
6008 @section Pragma Overriding_Renamings
6009
6010
6011 @geindex Rational profile
6012
6013 @geindex Rational compatibility
6014
6015 Syntax:
6016
6017 @example
6018 pragma Overriding_Renamings;
6019 @end example
6020
6021 This is a GNAT configuration pragma to simplify porting
6022 legacy code accepted by the Rational
6023 Ada compiler. In the presence of this pragma, a renaming declaration that
6024 renames an inherited operation declared in the same scope is legal if selected
6025 notation is used as in:
6026
6027 @example
6028 pragma Overriding_Renamings;
6029 ...
6030 package R is
6031 function F (..);
6032 ...
6033 function F (..) renames R.F;
6034 end R;
6035 @end example
6036
6037 even though
6038 RM 8.3 (15) stipulates that an overridden operation is not visible within the
6039 declaration of the overriding operation.
6040
6041 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
6042 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{b5}
6043 @section Pragma Partition_Elaboration_Policy
6044
6045
6046 Syntax:
6047
6048 @example
6049 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
6050
6051 POLICY_IDENTIFIER ::= Concurrent | Sequential
6052 @end example
6053
6054 This pragma is standard in Ada 2005, but is available in all earlier
6055 versions of Ada as an implementation-defined pragma.
6056 See Ada 2012 Reference Manual for details.
6057
6058 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
6059 @anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{b6}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{b7}
6060 @section Pragma Part_Of
6061
6062
6063 Syntax:
6064
6065 @example
6066 pragma Part_Of (ABSTRACT_STATE);
6067
6068 ABSTRACT_STATE ::= NAME
6069 @end example
6070
6071 For the semantics of this pragma, see the entry for aspect @code{Part_Of} in the
6072 SPARK 2014 Reference Manual, section 7.2.6.
6073
6074 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
6075 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{b8}
6076 @section Pragma Passive
6077
6078
6079 Syntax:
6080
6081 @example
6082 pragma Passive [(Semaphore | No)];
6083 @end example
6084
6085 Syntax checked, but otherwise ignored by GNAT. This is recognized for
6086 compatibility with DEC Ada 83 implementations, where it is used within a
6087 task definition to request that a task be made passive. If the argument
6088 @code{Semaphore} is present, or the argument is omitted, then DEC Ada 83
6089 treats the pragma as an assertion that the containing task is passive
6090 and that optimization of context switch with this task is permitted and
6091 desired. If the argument @code{No} is present, the task must not be
6092 optimized. GNAT does not attempt to optimize any tasks in this manner
6093 (since protected objects are available in place of passive tasks).
6094
6095 For more information on the subject of passive tasks, see the section
6096 'Passive Task Optimization' in the GNAT Users Guide.
6097
6098 @node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
6099 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{b9}@anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{ba}
6100 @section Pragma Persistent_BSS
6101
6102
6103 Syntax:
6104
6105 @example
6106 pragma Persistent_BSS [(LOCAL_NAME)]
6107 @end example
6108
6109 This pragma allows selected objects to be placed in the @code{.persistent_bss}
6110 section. On some targets the linker and loader provide for special
6111 treatment of this section, allowing a program to be reloaded without
6112 affecting the contents of this data (hence the name persistent).
6113
6114 There are two forms of usage. If an argument is given, it must be the
6115 local name of a library-level object, with no explicit initialization
6116 and whose type is potentially persistent. If no argument is given, then
6117 the pragma is a configuration pragma, and applies to all library-level
6118 objects with no explicit initialization of potentially persistent types.
6119
6120 A potentially persistent type is a scalar type, or an untagged,
6121 non-discriminated record, all of whose components have no explicit
6122 initialization and are themselves of a potentially persistent type,
6123 or an array, all of whose constraints are static, and whose component
6124 type is potentially persistent.
6125
6126 If this pragma is used on a target where this feature is not supported,
6127 then the pragma will be ignored. See also @code{pragma Linker_Section}.
6128
6129 @node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
6130 @anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{bb}
6131 @section Pragma Polling
6132
6133
6134 Syntax:
6135
6136 @example
6137 pragma Polling (ON | OFF);
6138 @end example
6139
6140 This pragma controls the generation of polling code. This is normally off.
6141 If @code{pragma Polling (ON)} is used then periodic calls are generated to
6142 the routine @code{Ada.Exceptions.Poll}. This routine is a separate unit in the
6143 runtime library, and can be found in file @code{a-excpol.adb}.
6144
6145 Pragma @code{Polling} can appear as a configuration pragma (for example it
6146 can be placed in the @code{gnat.adc} file) to enable polling globally, or it
6147 can be used in the statement or declaration sequence to control polling
6148 more locally.
6149
6150 A call to the polling routine is generated at the start of every loop and
6151 at the start of every subprogram call. This guarantees that the @code{Poll}
6152 routine is called frequently, and places an upper bound (determined by
6153 the complexity of the code) on the period between two @code{Poll} calls.
6154
6155 The primary purpose of the polling interface is to enable asynchronous
6156 aborts on targets that cannot otherwise support it (for example Windows
6157 NT), but it may be used for any other purpose requiring periodic polling.
6158 The standard version is null, and can be replaced by a user program. This
6159 will require re-compilation of the @code{Ada.Exceptions} package that can
6160 be found in files @code{a-except.ads} and @code{a-except.adb}.
6161
6162 A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
6163 distribution) is used to enable the asynchronous abort capability on
6164 targets that do not normally support the capability. The version of
6165 @code{Poll} in this file makes a call to the appropriate runtime routine
6166 to test for an abort condition.
6167
6168 Note that polling can also be enabled by use of the @emph{-gnatP} switch.
6169 See the section on switches for gcc in the @cite{GNAT User's Guide}.
6170
6171 @node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
6172 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{bc}
6173 @section Pragma Post
6174
6175
6176 @geindex Post
6177
6178 @geindex Checks
6179 @geindex postconditions
6180
6181 Syntax:
6182
6183 @example
6184 pragma Post (Boolean_Expression);
6185 @end example
6186
6187 The @code{Post} pragma is intended to be an exact replacement for
6188 the language-defined
6189 @code{Post} aspect, and shares its restrictions and semantics.
6190 It must appear either immediately following the corresponding
6191 subprogram declaration (only other pragmas may intervene), or
6192 if there is no separate subprogram declaration, then it can
6193 appear at the start of the declarations in a subprogram body
6194 (preceded only by other pragmas).
6195
6196 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
6197 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{bd}
6198 @section Pragma Postcondition
6199
6200
6201 @geindex Postcondition
6202
6203 @geindex Checks
6204 @geindex postconditions
6205
6206 Syntax:
6207
6208 @example
6209 pragma Postcondition (
6210 [Check =>] Boolean_Expression
6211 [,[Message =>] String_Expression]);
6212 @end example
6213
6214 The @code{Postcondition} pragma allows specification of automatic
6215 postcondition checks for subprograms. These checks are similar to
6216 assertions, but are automatically inserted just prior to the return
6217 statements of the subprogram with which they are associated (including
6218 implicit returns at the end of procedure bodies and associated
6219 exception handlers).
6220
6221 In addition, the boolean expression which is the condition which
6222 must be true may contain references to function'Result in the case
6223 of a function to refer to the returned value.
6224
6225 @code{Postcondition} pragmas may appear either immediately following the
6226 (separate) declaration of a subprogram, or at the start of the
6227 declarations of a subprogram body. Only other pragmas may intervene
6228 (that is appear between the subprogram declaration and its
6229 postconditions, or appear before the postcondition in the
6230 declaration sequence in a subprogram body). In the case of a
6231 postcondition appearing after a subprogram declaration, the
6232 formal arguments of the subprogram are visible, and can be
6233 referenced in the postcondition expressions.
6234
6235 The postconditions are collected and automatically tested just
6236 before any return (implicit or explicit) in the subprogram body.
6237 A postcondition is only recognized if postconditions are active
6238 at the time the pragma is encountered. The compiler switch @emph{gnata}
6239 turns on all postconditions by default, and pragma @code{Check_Policy}
6240 with an identifier of @code{Postcondition} can also be used to
6241 control whether postconditions are active.
6242
6243 The general approach is that postconditions are placed in the spec
6244 if they represent functional aspects which make sense to the client.
6245 For example we might have:
6246
6247 @example
6248 function Direction return Integer;
6249 pragma Postcondition
6250 (Direction'Result = +1
6251 or else
6252 Direction'Result = -1);
6253 @end example
6254
6255 which serves to document that the result must be +1 or -1, and
6256 will test that this is the case at run time if postcondition
6257 checking is active.
6258
6259 Postconditions within the subprogram body can be used to
6260 check that some internal aspect of the implementation,
6261 not visible to the client, is operating as expected.
6262 For instance if a square root routine keeps an internal
6263 counter of the number of times it is called, then we
6264 might have the following postcondition:
6265
6266 @example
6267 Sqrt_Calls : Natural := 0;
6268
6269 function Sqrt (Arg : Float) return Float is
6270 pragma Postcondition
6271 (Sqrt_Calls = Sqrt_Calls'Old + 1);
6272 ...
6273 end Sqrt
6274 @end example
6275
6276 As this example, shows, the use of the @code{Old} attribute
6277 is often useful in postconditions to refer to the state on
6278 entry to the subprogram.
6279
6280 Note that postconditions are only checked on normal returns
6281 from the subprogram. If an abnormal return results from
6282 raising an exception, then the postconditions are not checked.
6283
6284 If a postcondition fails, then the exception
6285 @code{System.Assertions.Assert_Failure} is raised. If
6286 a message argument was supplied, then the given string
6287 will be used as the exception message. If no message
6288 argument was supplied, then the default message has
6289 the form "Postcondition failed at file_name:line". The
6290 exception is raised in the context of the subprogram
6291 body, so it is possible to catch postcondition failures
6292 within the subprogram body itself.
6293
6294 Within a package spec, normal visibility rules
6295 in Ada would prevent forward references within a
6296 postcondition pragma to functions defined later in
6297 the same package. This would introduce undesirable
6298 ordering constraints. To avoid this problem, all
6299 postcondition pragmas are analyzed at the end of
6300 the package spec, allowing forward references.
6301
6302 The following example shows that this even allows
6303 mutually recursive postconditions as in:
6304
6305 @example
6306 package Parity_Functions is
6307 function Odd (X : Natural) return Boolean;
6308 pragma Postcondition
6309 (Odd'Result =
6310 (x = 1
6311 or else
6312 (x /= 0 and then Even (X - 1))));
6313
6314 function Even (X : Natural) return Boolean;
6315 pragma Postcondition
6316 (Even'Result =
6317 (x = 0
6318 or else
6319 (x /= 1 and then Odd (X - 1))));
6320
6321 end Parity_Functions;
6322 @end example
6323
6324 There are no restrictions on the complexity or form of
6325 conditions used within @code{Postcondition} pragmas.
6326 The following example shows that it is even possible
6327 to verify performance behavior.
6328
6329 @example
6330 package Sort is
6331
6332 Performance : constant Float;
6333 -- Performance constant set by implementation
6334 -- to match target architecture behavior.
6335
6336 procedure Treesort (Arg : String);
6337 -- Sorts characters of argument using N*logN sort
6338 pragma Postcondition
6339 (Float (Clock - Clock'Old) <=
6340 Float (Arg'Length) *
6341 log (Float (Arg'Length)) *
6342 Performance);
6343 end Sort;
6344 @end example
6345
6346 Note: postcondition pragmas associated with subprograms that are
6347 marked as Inline_Always, or those marked as Inline with front-end
6348 inlining (-gnatN option set) are accepted and legality-checked
6349 by the compiler, but are ignored at run-time even if postcondition
6350 checking is enabled.
6351
6352 Note that pragma @code{Postcondition} differs from the language-defined
6353 @code{Post} aspect (and corresponding @code{Post} pragma) in allowing
6354 multiple occurrences, allowing occurences in the body even if there
6355 is a separate spec, and allowing a second string parameter, and the
6356 use of the pragma identifier @code{Check}. Historically, pragma
6357 @code{Postcondition} was implemented prior to the development of
6358 Ada 2012, and has been retained in its original form for
6359 compatibility purposes.
6360
6361 @node Pragma Post_Class,Pragma Rename_Pragma,Pragma Postcondition,Implementation Defined Pragmas
6362 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{be}
6363 @section Pragma Post_Class
6364
6365
6366 @geindex Post
6367
6368 @geindex Checks
6369 @geindex postconditions
6370
6371 Syntax:
6372
6373 @example
6374 pragma Post_Class (Boolean_Expression);
6375 @end example
6376
6377 The @code{Post_Class} pragma is intended to be an exact replacement for
6378 the language-defined
6379 @code{Post'Class} aspect, and shares its restrictions and semantics.
6380 It must appear either immediately following the corresponding
6381 subprogram declaration (only other pragmas may intervene), or
6382 if there is no separate subprogram declaration, then it can
6383 appear at the start of the declarations in a subprogram body
6384 (preceded only by other pragmas).
6385
6386 Note: This pragma is called @code{Post_Class} rather than
6387 @code{Post'Class} because the latter would not be strictly
6388 conforming to the allowed syntax for pragmas. The motivation
6389 for provinding pragmas equivalent to the aspects is to allow a program
6390 to be written using the pragmas, and then compiled if necessary
6391 using an Ada compiler that does not recognize the pragmas or
6392 aspects, but is prepared to ignore the pragmas. The assertion
6393 policy that controls this pragma is @code{Post'Class}, not
6394 @code{Post_Class}.
6395
6396 @node Pragma Rename_Pragma,Pragma Pre,Pragma Post_Class,Implementation Defined Pragmas
6397 @anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{bf}
6398 @section Pragma Rename_Pragma
6399
6400
6401 @geindex Pragmas
6402 @geindex synonyms
6403
6404 Syntax:
6405
6406 @example
6407 pragma Rename_Pragma (
6408 [New_Name =>] IDENTIFIER,
6409 [Renamed =>] pragma_IDENTIFIER);
6410 @end example
6411
6412 This pragma provides a mechanism for supplying new names for existing
6413 pragmas. The @code{New_Name} identifier can subsequently be used as a synonym for
6414 the Renamed pragma. For example, suppose you have code that was originally
6415 developed on a compiler that supports Inline_Only as an implementation defined
6416 pragma. And suppose the semantics of pragma Inline_Only are identical to (or at
6417 least very similar to) the GNAT implementation defined pragma
6418 Inline_Always. You could globally replace Inline_Only with Inline_Always.
6419
6420 However, to avoid that source modification, you could instead add a
6421 configuration pragma:
6422
6423 @example
6424 pragma Rename_Pragma (
6425 New_Name => Inline_Only,
6426 Renamed => Inline_Always);
6427 @end example
6428
6429 Then GNAT will treat "pragma Inline_Only ..." as if you had written
6430 "pragma Inline_Always ...".
6431
6432 Pragma Inline_Only will not necessarily mean the same thing as the other Ada
6433 compiler; it's up to you to make sure the semantics are close enough.
6434
6435 @node Pragma Pre,Pragma Precondition,Pragma Rename_Pragma,Implementation Defined Pragmas
6436 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{c0}
6437 @section Pragma Pre
6438
6439
6440 @geindex Pre
6441
6442 @geindex Checks
6443 @geindex preconditions
6444
6445 Syntax:
6446
6447 @example
6448 pragma Pre (Boolean_Expression);
6449 @end example
6450
6451 The @code{Pre} pragma is intended to be an exact replacement for
6452 the language-defined
6453 @code{Pre} aspect, and shares its restrictions and semantics.
6454 It must appear either immediately following the corresponding
6455 subprogram declaration (only other pragmas may intervene), or
6456 if there is no separate subprogram declaration, then it can
6457 appear at the start of the declarations in a subprogram body
6458 (preceded only by other pragmas).
6459
6460 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
6461 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{c1}
6462 @section Pragma Precondition
6463
6464
6465 @geindex Preconditions
6466
6467 @geindex Checks
6468 @geindex preconditions
6469
6470 Syntax:
6471
6472 @example
6473 pragma Precondition (
6474 [Check =>] Boolean_Expression
6475 [,[Message =>] String_Expression]);
6476 @end example
6477
6478 The @code{Precondition} pragma is similar to @code{Postcondition}
6479 except that the corresponding checks take place immediately upon
6480 entry to the subprogram, and if a precondition fails, the exception
6481 is raised in the context of the caller, and the attribute 'Result
6482 cannot be used within the precondition expression.
6483
6484 Otherwise, the placement and visibility rules are identical to those
6485 described for postconditions. The following is an example of use
6486 within a package spec:
6487
6488 @example
6489 package Math_Functions is
6490 ...
6491 function Sqrt (Arg : Float) return Float;
6492 pragma Precondition (Arg >= 0.0)
6493 ...
6494 end Math_Functions;
6495 @end example
6496
6497 @code{Precondition} pragmas may appear either immediately following the
6498 (separate) declaration of a subprogram, or at the start of the
6499 declarations of a subprogram body. Only other pragmas may intervene
6500 (that is appear between the subprogram declaration and its
6501 postconditions, or appear before the postcondition in the
6502 declaration sequence in a subprogram body).
6503
6504 Note: precondition pragmas associated with subprograms that are
6505 marked as Inline_Always, or those marked as Inline with front-end
6506 inlining (-gnatN option set) are accepted and legality-checked
6507 by the compiler, but are ignored at run-time even if precondition
6508 checking is enabled.
6509
6510 Note that pragma @code{Precondition} differs from the language-defined
6511 @code{Pre} aspect (and corresponding @code{Pre} pragma) in allowing
6512 multiple occurrences, allowing occurences in the body even if there
6513 is a separate spec, and allowing a second string parameter, and the
6514 use of the pragma identifier @code{Check}. Historically, pragma
6515 @code{Precondition} was implemented prior to the development of
6516 Ada 2012, and has been retained in its original form for
6517 compatibility purposes.
6518
6519 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
6520 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{c2}@anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{c3}
6521 @section Pragma Predicate
6522
6523
6524 Syntax:
6525
6526 @example
6527 pragma Predicate
6528 ([Entity =>] type_LOCAL_NAME,
6529 [Check =>] EXPRESSION);
6530 @end example
6531
6532 This pragma (available in all versions of Ada in GNAT) encompasses both
6533 the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
6534 Ada 2012. A predicate is regarded as static if it has an allowed form
6535 for @code{Static_Predicate} and is otherwise treated as a
6536 @code{Dynamic_Predicate}. Otherwise, predicates specified by this
6537 pragma behave exactly as described in the Ada 2012 reference manual.
6538 For example, if we have
6539
6540 @example
6541 type R is range 1 .. 10;
6542 subtype S is R;
6543 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6544 subtype Q is R
6545 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6546 @end example
6547
6548 the effect is identical to the following Ada 2012 code:
6549
6550 @example
6551 type R is range 1 .. 10;
6552 subtype S is R with
6553 Static_Predicate => S not in 4 .. 6;
6554 subtype Q is R with
6555 Dynamic_Predicate => F(Q) or G(Q);
6556 @end example
6557
6558 Note that there are no pragmas @code{Dynamic_Predicate}
6559 or @code{Static_Predicate}. That is
6560 because these pragmas would affect legality and semantics of
6561 the program and thus do not have a neutral effect if ignored.
6562 The motivation behind providing pragmas equivalent to
6563 corresponding aspects is to allow a program to be written
6564 using the pragmas, and then compiled with a compiler that
6565 will ignore the pragmas. That doesn't work in the case of
6566 static and dynamic predicates, since if the corresponding
6567 pragmas are ignored, then the behavior of the program is
6568 fundamentally changed (for example a membership test
6569 @code{A in B} would not take into account a predicate
6570 defined for subtype B). When following this approach, the
6571 use of predicates should be avoided.
6572
6573 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6574 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{c4}
6575 @section Pragma Predicate_Failure
6576
6577
6578 Syntax:
6579
6580 @example
6581 pragma Predicate_Failure
6582 ([Entity =>] type_LOCAL_NAME,
6583 [Message =>] String_Expression);
6584 @end example
6585
6586 The @code{Predicate_Failure} pragma is intended to be an exact replacement for
6587 the language-defined
6588 @code{Predicate_Failure} aspect, and shares its restrictions and semantics.
6589
6590 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6591 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{c5}
6592 @section Pragma Preelaborable_Initialization
6593
6594
6595 Syntax:
6596
6597 @example
6598 pragma Preelaborable_Initialization (DIRECT_NAME);
6599 @end example
6600
6601 This pragma is standard in Ada 2005, but is available in all earlier
6602 versions of Ada as an implementation-defined pragma.
6603 See Ada 2012 Reference Manual for details.
6604
6605 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6606 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c6}
6607 @section Pragma Prefix_Exception_Messages
6608
6609
6610 @geindex Prefix_Exception_Messages
6611
6612 @geindex exception
6613
6614 @geindex Exception_Message
6615
6616 Syntax:
6617
6618 @example
6619 pragma Prefix_Exception_Messages;
6620 @end example
6621
6622 This is an implementation-defined configuration pragma that affects the
6623 behavior of raise statements with a message given as a static string
6624 constant (typically a string literal). In such cases, the string will
6625 be automatically prefixed by the name of the enclosing entity (giving
6626 the package and subprogram containing the raise statement). This helps
6627 to identify where messages are coming from, and this mode is automatic
6628 for the run-time library.
6629
6630 The pragma has no effect if the message is computed with an expression other
6631 than a static string constant, since the assumption in this case is that
6632 the program computes exactly the string it wants. If you still want the
6633 prefixing in this case, you can always call
6634 @code{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6635
6636 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6637 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c7}
6638 @section Pragma Pre_Class
6639
6640
6641 @geindex Pre_Class
6642
6643 @geindex Checks
6644 @geindex preconditions
6645
6646 Syntax:
6647
6648 @example
6649 pragma Pre_Class (Boolean_Expression);
6650 @end example
6651
6652 The @code{Pre_Class} pragma is intended to be an exact replacement for
6653 the language-defined
6654 @code{Pre'Class} aspect, and shares its restrictions and semantics.
6655 It must appear either immediately following the corresponding
6656 subprogram declaration (only other pragmas may intervene), or
6657 if there is no separate subprogram declaration, then it can
6658 appear at the start of the declarations in a subprogram body
6659 (preceded only by other pragmas).
6660
6661 Note: This pragma is called @code{Pre_Class} rather than
6662 @code{Pre'Class} because the latter would not be strictly
6663 conforming to the allowed syntax for pragmas. The motivation
6664 for providing pragmas equivalent to the aspects is to allow a program
6665 to be written using the pragmas, and then compiled if necessary
6666 using an Ada compiler that does not recognize the pragmas or
6667 aspects, but is prepared to ignore the pragmas. The assertion
6668 policy that controls this pragma is @code{Pre'Class}, not
6669 @code{Pre_Class}.
6670
6671 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6672 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c8}
6673 @section Pragma Priority_Specific_Dispatching
6674
6675
6676 Syntax:
6677
6678 @example
6679 pragma Priority_Specific_Dispatching (
6680 POLICY_IDENTIFIER,
6681 first_priority_EXPRESSION,
6682 last_priority_EXPRESSION)
6683
6684 POLICY_IDENTIFIER ::=
6685 EDF_Across_Priorities |
6686 FIFO_Within_Priorities |
6687 Non_Preemptive_Within_Priorities |
6688 Round_Robin_Within_Priorities
6689 @end example
6690
6691 This pragma is standard in Ada 2005, but is available in all earlier
6692 versions of Ada as an implementation-defined pragma.
6693 See Ada 2012 Reference Manual for details.
6694
6695 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6696 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c9}
6697 @section Pragma Profile
6698
6699
6700 Syntax:
6701
6702 @example
6703 pragma Profile (Ravenscar | Restricted | Rational |
6704 GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
6705 @end example
6706
6707 This pragma is standard in Ada 2005, but is available in all earlier
6708 versions of Ada as an implementation-defined pragma. This is a
6709 configuration pragma that establishes a set of configuration pragmas
6710 that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
6711 The other possibilities (@code{Restricted}, @code{Rational},
6712 @code{GNAT_Extended_Ravenscar}, @code{GNAT_Ravenscar_EDF})
6713 are implementation-defined. The set of configuration pragmas
6714 is defined in the following sections.
6715
6716
6717 @itemize *
6718
6719 @item
6720 Pragma Profile (Ravenscar)
6721
6722 The @code{Ravenscar} profile is standard in Ada 2005,
6723 but is available in all earlier
6724 versions of Ada as an implementation-defined pragma. This profile
6725 establishes the following set of configuration pragmas:
6726
6727
6728 @itemize *
6729
6730 @item
6731 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6732
6733 [RM D.2.2] Tasks are dispatched following a preemptive
6734 priority-ordered scheduling policy.
6735
6736 @item
6737 @code{Locking_Policy (Ceiling_Locking)}
6738
6739 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6740 the ceiling priority of the corresponding protected object.
6741
6742 @item
6743 @code{Detect_Blocking}
6744
6745 This pragma forces the detection of potentially blocking operations within a
6746 protected operation, and to raise Program_Error if that happens.
6747 @end itemize
6748
6749 plus the following set of restrictions:
6750
6751
6752 @itemize *
6753
6754 @item
6755 @code{Max_Entry_Queue_Length => 1}
6756
6757 No task can be queued on a protected entry.
6758
6759 @item
6760 @code{Max_Protected_Entries => 1}
6761
6762 @item
6763 @code{Max_Task_Entries => 0}
6764
6765 No rendezvous statements are allowed.
6766
6767 @item
6768 @code{No_Abort_Statements}
6769
6770 @item
6771 @code{No_Dynamic_Attachment}
6772
6773 @item
6774 @code{No_Dynamic_Priorities}
6775
6776 @item
6777 @code{No_Implicit_Heap_Allocations}
6778
6779 @item
6780 @code{No_Local_Protected_Objects}
6781
6782 @item
6783 @code{No_Local_Timing_Events}
6784
6785 @item
6786 @code{No_Protected_Type_Allocators}
6787
6788 @item
6789 @code{No_Relative_Delay}
6790
6791 @item
6792 @code{No_Requeue_Statements}
6793
6794 @item
6795 @code{No_Select_Statements}
6796
6797 @item
6798 @code{No_Specific_Termination_Handlers}
6799
6800 @item
6801 @code{No_Task_Allocators}
6802
6803 @item
6804 @code{No_Task_Hierarchy}
6805
6806 @item
6807 @code{No_Task_Termination}
6808
6809 @item
6810 @code{Simple_Barriers}
6811 @end itemize
6812
6813 The Ravenscar profile also includes the following restrictions that specify
6814 that there are no semantic dependences on the corresponding predefined
6815 packages:
6816
6817
6818 @itemize *
6819
6820 @item
6821 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6822
6823 @item
6824 @code{No_Dependence => Ada.Calendar}
6825
6826 @item
6827 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6828
6829 @item
6830 @code{No_Dependence => Ada.Execution_Time.Timers}
6831
6832 @item
6833 @code{No_Dependence => Ada.Task_Attributes}
6834
6835 @item
6836 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6837 @end itemize
6838
6839 This set of configuration pragmas and restrictions correspond to the
6840 definition of the 'Ravenscar Profile' for limited tasking, devised and
6841 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6842 A description is also available at
6843 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6844
6845 The original definition of the profile was revised at subsequent IRTAW
6846 meetings. It has been included in the ISO
6847 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6848 and was made part of the Ada 2005 standard.
6849 The formal definition given by
6850 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6851 AI-305) available at
6852 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6853 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6854
6855 The above set is a superset of the restrictions provided by pragma
6856 @code{Profile (Restricted)}, it includes six additional restrictions
6857 (@code{Simple_Barriers}, @code{No_Select_Statements},
6858 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6859 @code{No_Relative_Delay} and @code{No_Task_Termination}). This means
6860 that pragma @code{Profile (Ravenscar)}, like the pragma
6861 @code{Profile (Restricted)},
6862 automatically causes the use of a simplified,
6863 more efficient version of the tasking run-time library.
6864
6865 @item
6866 Pragma Profile (GNAT_Extended_Ravenscar)
6867
6868 This profile corresponds to a GNAT specific extension of the
6869 Ravenscar profile. The profile may change in the future although
6870 only in a compatible way: some restrictions may be removed or
6871 relaxed. It is defined as a variation of the Ravenscar profile.
6872
6873 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6874 by @code{No_Implicit_Task_Allocations} and
6875 @code{No_Implicit_Protected_Object_Allocations}.
6876
6877 The @code{Simple_Barriers} restriction has been replaced by
6878 @code{Pure_Barriers}.
6879
6880 The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
6881 @code{No_Relative_Delay} restrictions have been removed.
6882
6883 @item
6884 Pragma Profile (GNAT_Ravenscar_EDF)
6885
6886 This profile corresponds to the Ravenscar profile but using
6887 EDF_Across_Priority as the Task_Scheduling_Policy.
6888
6889 @item
6890 Pragma Profile (Restricted)
6891
6892 This profile corresponds to the GNAT restricted run time. It
6893 establishes the following set of restrictions:
6894
6895
6896 @itemize *
6897
6898 @item
6899 @code{No_Abort_Statements}
6900
6901 @item
6902 @code{No_Entry_Queue}
6903
6904 @item
6905 @code{No_Task_Hierarchy}
6906
6907 @item
6908 @code{No_Task_Allocators}
6909
6910 @item
6911 @code{No_Dynamic_Priorities}
6912
6913 @item
6914 @code{No_Terminate_Alternatives}
6915
6916 @item
6917 @code{No_Dynamic_Attachment}
6918
6919 @item
6920 @code{No_Protected_Type_Allocators}
6921
6922 @item
6923 @code{No_Local_Protected_Objects}
6924
6925 @item
6926 @code{No_Requeue_Statements}
6927
6928 @item
6929 @code{No_Task_Attributes_Package}
6930
6931 @item
6932 @code{Max_Asynchronous_Select_Nesting = 0}
6933
6934 @item
6935 @code{Max_Task_Entries = 0}
6936
6937 @item
6938 @code{Max_Protected_Entries = 1}
6939
6940 @item
6941 @code{Max_Select_Alternatives = 0}
6942 @end itemize
6943
6944 This set of restrictions causes the automatic selection of a simplified
6945 version of the run time that provides improved performance for the
6946 limited set of tasking functionality permitted by this set of restrictions.
6947
6948 @item
6949 Pragma Profile (Rational)
6950
6951 The Rational profile is intended to facilitate porting legacy code that
6952 compiles with the Rational APEX compiler, even when the code includes non-
6953 conforming Ada constructs. The profile enables the following three pragmas:
6954
6955
6956 @itemize *
6957
6958 @item
6959 @code{pragma Implicit_Packing}
6960
6961 @item
6962 @code{pragma Overriding_Renamings}
6963
6964 @item
6965 @code{pragma Use_VADS_Size}
6966 @end itemize
6967 @end itemize
6968
6969 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6970 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{ca}
6971 @section Pragma Profile_Warnings
6972
6973
6974 Syntax:
6975
6976 @example
6977 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6978 @end example
6979
6980 This is an implementation-defined pragma that is similar in
6981 effect to @code{pragma Profile} except that instead of
6982 generating @code{Restrictions} pragmas, it generates
6983 @code{Restriction_Warnings} pragmas. The result is that
6984 violations of the profile generate warning messages instead
6985 of error messages.
6986
6987 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6988 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{cb}
6989 @section Pragma Propagate_Exceptions
6990
6991
6992 @geindex Interfacing to C++
6993
6994 Syntax:
6995
6996 @example
6997 pragma Propagate_Exceptions;
6998 @end example
6999
7000 This pragma is now obsolete and, other than generating a warning if warnings
7001 on obsolescent features are enabled, is ignored.
7002 It is retained for compatibility
7003 purposes. It used to be used in connection with optimization of
7004 a now-obsolete mechanism for implementation of exceptions.
7005
7006 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
7007 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{cc}
7008 @section Pragma Provide_Shift_Operators
7009
7010
7011 @geindex Shift operators
7012
7013 Syntax:
7014
7015 @example
7016 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
7017 @end example
7018
7019 This pragma can be applied to a first subtype local name that specifies
7020 either an unsigned or signed type. It has the effect of providing the
7021 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
7022 Rotate_Left and Rotate_Right) for the given type. It is similar to
7023 including the function declarations for these five operators, together
7024 with the pragma Import (Intrinsic, ...) statements.
7025
7026 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
7027 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{cd}
7028 @section Pragma Psect_Object
7029
7030
7031 Syntax:
7032
7033 @example
7034 pragma Psect_Object (
7035 [Internal =>] LOCAL_NAME,
7036 [, [External =>] EXTERNAL_SYMBOL]
7037 [, [Size =>] EXTERNAL_SYMBOL]);
7038
7039 EXTERNAL_SYMBOL ::=
7040 IDENTIFIER
7041 | static_string_EXPRESSION
7042 @end example
7043
7044 This pragma is identical in effect to pragma @code{Common_Object}.
7045
7046 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
7047 @anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{ce}@anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{cf}
7048 @section Pragma Pure_Function
7049
7050
7051 Syntax:
7052
7053 @example
7054 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
7055 @end example
7056
7057 This pragma appears in the same declarative part as a function
7058 declaration (or a set of function declarations if more than one
7059 overloaded declaration exists, in which case the pragma applies
7060 to all entities). It specifies that the function @code{Entity} is
7061 to be considered pure for the purposes of code generation. This means
7062 that the compiler can assume that there are no side effects, and
7063 in particular that two calls with identical arguments produce the
7064 same result. It also means that the function can be used in an
7065 address clause.
7066
7067 Note that, quite deliberately, there are no static checks to try
7068 to ensure that this promise is met, so @code{Pure_Function} can be used
7069 with functions that are conceptually pure, even if they do modify
7070 global variables. For example, a square root function that is
7071 instrumented to count the number of times it is called is still
7072 conceptually pure, and can still be optimized, even though it
7073 modifies a global variable (the count). Memo functions are another
7074 example (where a table of previous calls is kept and consulted to
7075 avoid re-computation).
7076
7077 Note also that the normal rules excluding optimization of subprograms
7078 in pure units (when parameter types are descended from System.Address,
7079 or when the full view of a parameter type is limited), do not apply
7080 for the Pure_Function case. If you explicitly specify Pure_Function,
7081 the compiler may optimize away calls with identical arguments, and
7082 if that results in unexpected behavior, the proper action is not to
7083 use the pragma for subprograms that are not (conceptually) pure.
7084
7085 Note: Most functions in a @code{Pure} package are automatically pure, and
7086 there is no need to use pragma @code{Pure_Function} for such functions. One
7087 exception is any function that has at least one formal of type
7088 @code{System.Address} or a type derived from it. Such functions are not
7089 considered pure by default, since the compiler assumes that the
7090 @code{Address} parameter may be functioning as a pointer and that the
7091 referenced data may change even if the address value does not.
7092 Similarly, imported functions are not considered to be pure by default,
7093 since there is no way of checking that they are in fact pure. The use
7094 of pragma @code{Pure_Function} for such a function will override these default
7095 assumption, and cause the compiler to treat a designated subprogram as pure
7096 in these cases.
7097
7098 Note: If pragma @code{Pure_Function} is applied to a renamed function, it
7099 applies to the underlying renamed function. This can be used to
7100 disambiguate cases of overloading where some but not all functions
7101 in a set of overloaded functions are to be designated as pure.
7102
7103 If pragma @code{Pure_Function} is applied to a library-level function, the
7104 function is also considered pure from an optimization point of view, but the
7105 unit is not a Pure unit in the categorization sense. So for example, a function
7106 thus marked is free to @code{with} non-pure units.
7107
7108 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
7109 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{d0}
7110 @section Pragma Rational
7111
7112
7113 Syntax:
7114
7115 @example
7116 pragma Rational;
7117 @end example
7118
7119 This pragma is considered obsolescent, but is retained for
7120 compatibility purposes. It is equivalent to:
7121
7122 @example
7123 pragma Profile (Rational);
7124 @end example
7125
7126 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
7127 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{d1}
7128 @section Pragma Ravenscar
7129
7130
7131 Syntax:
7132
7133 @example
7134 pragma Ravenscar;
7135 @end example
7136
7137 This pragma is considered obsolescent, but is retained for
7138 compatibility purposes. It is equivalent to:
7139
7140 @example
7141 pragma Profile (Ravenscar);
7142 @end example
7143
7144 which is the preferred method of setting the @code{Ravenscar} profile.
7145
7146 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
7147 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{d2}@anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{d3}
7148 @section Pragma Refined_Depends
7149
7150
7151 Syntax:
7152
7153 @example
7154 pragma Refined_Depends (DEPENDENCY_RELATION);
7155
7156 DEPENDENCY_RELATION ::=
7157 null
7158 | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
7159
7160 DEPENDENCY_CLAUSE ::=
7161 OUTPUT_LIST =>[+] INPUT_LIST
7162 | NULL_DEPENDENCY_CLAUSE
7163
7164 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
7165
7166 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
7167
7168 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
7169
7170 OUTPUT ::= NAME | FUNCTION_RESULT
7171 INPUT ::= NAME
7172
7173 where FUNCTION_RESULT is a function Result attribute_reference
7174 @end example
7175
7176 For the semantics of this pragma, see the entry for aspect @code{Refined_Depends} in
7177 the SPARK 2014 Reference Manual, section 6.1.5.
7178
7179 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
7180 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{d4}@anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{d5}
7181 @section Pragma Refined_Global
7182
7183
7184 Syntax:
7185
7186 @example
7187 pragma Refined_Global (GLOBAL_SPECIFICATION);
7188
7189 GLOBAL_SPECIFICATION ::=
7190 null
7191 | (GLOBAL_LIST)
7192 | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
7193
7194 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
7195
7196 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
7197 GLOBAL_LIST ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
7198 GLOBAL_ITEM ::= NAME
7199 @end example
7200
7201 For the semantics of this pragma, see the entry for aspect @code{Refined_Global} in
7202 the SPARK 2014 Reference Manual, section 6.1.4.
7203
7204 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
7205 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d6}@anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d7}
7206 @section Pragma Refined_Post
7207
7208
7209 Syntax:
7210
7211 @example
7212 pragma Refined_Post (boolean_EXPRESSION);
7213 @end example
7214
7215 For the semantics of this pragma, see the entry for aspect @code{Refined_Post} in
7216 the SPARK 2014 Reference Manual, section 7.2.7.
7217
7218 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
7219 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{d8}@anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d9}
7220 @section Pragma Refined_State
7221
7222
7223 Syntax:
7224
7225 @example
7226 pragma Refined_State (REFINEMENT_LIST);
7227
7228 REFINEMENT_LIST ::=
7229 (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
7230
7231 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
7232
7233 CONSTITUENT_LIST ::=
7234 null
7235 | CONSTITUENT
7236 | (CONSTITUENT @{, CONSTITUENT@})
7237
7238 CONSTITUENT ::= object_NAME | state_NAME
7239 @end example
7240
7241 For the semantics of this pragma, see the entry for aspect @code{Refined_State} in
7242 the SPARK 2014 Reference Manual, section 7.2.2.
7243
7244 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
7245 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{da}
7246 @section Pragma Relative_Deadline
7247
7248
7249 Syntax:
7250
7251 @example
7252 pragma Relative_Deadline (time_span_EXPRESSION);
7253 @end example
7254
7255 This pragma is standard in Ada 2005, but is available in all earlier
7256 versions of Ada as an implementation-defined pragma.
7257 See Ada 2012 Reference Manual for details.
7258
7259 @node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
7260 @anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{db}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{dc}
7261 @section Pragma Remote_Access_Type
7262
7263
7264 Syntax:
7265
7266 @example
7267 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
7268 @end example
7269
7270 This pragma appears in the formal part of a generic declaration.
7271 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
7272 the use of a remote access to class-wide type as actual for a formal
7273 access type.
7274
7275 When this pragma applies to a formal access type @code{Entity}, that
7276 type is treated as a remote access to class-wide type in the generic.
7277 It must be a formal general access type, and its designated type must
7278 be the class-wide type of a formal tagged limited private type from the
7279 same generic declaration.
7280
7281 In the generic unit, the formal type is subject to all restrictions
7282 pertaining to remote access to class-wide types. At instantiation, the
7283 actual type must be a remote access to class-wide type.
7284
7285 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
7286 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{dd}
7287 @section Pragma Restricted_Run_Time
7288
7289
7290 Syntax:
7291
7292 @example
7293 pragma Restricted_Run_Time;
7294 @end example
7295
7296 This pragma is considered obsolescent, but is retained for
7297 compatibility purposes. It is equivalent to:
7298
7299 @example
7300 pragma Profile (Restricted);
7301 @end example
7302
7303 which is the preferred method of setting the restricted run time
7304 profile.
7305
7306 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
7307 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{de}
7308 @section Pragma Restriction_Warnings
7309
7310
7311 Syntax:
7312
7313 @example
7314 pragma Restriction_Warnings
7315 (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
7316 @end example
7317
7318 This pragma allows a series of restriction identifiers to be
7319 specified (the list of allowed identifiers is the same as for
7320 pragma @code{Restrictions}). For each of these identifiers
7321 the compiler checks for violations of the restriction, but
7322 generates a warning message rather than an error message
7323 if the restriction is violated.
7324
7325 One use of this is in situations where you want to know
7326 about violations of a restriction, but you want to ignore some of
7327 these violations. Consider this example, where you want to set
7328 Ada_95 mode and enable style checks, but you want to know about
7329 any other use of implementation pragmas:
7330
7331 @example
7332 pragma Restriction_Warnings (No_Implementation_Pragmas);
7333 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
7334 pragma Ada_95;
7335 pragma Style_Checks ("2bfhkM160");
7336 pragma Warnings (On, "violation of No_Implementation_Pragmas");
7337 @end example
7338
7339 By including the above lines in a configuration pragmas file,
7340 the Ada_95 and Style_Checks pragmas are accepted without
7341 generating a warning, but any other use of implementation
7342 defined pragmas will cause a warning to be generated.
7343
7344 @node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
7345 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{df}
7346 @section Pragma Reviewable
7347
7348
7349 Syntax:
7350
7351 @example
7352 pragma Reviewable;
7353 @end example
7354
7355 This pragma is an RM-defined standard pragma, but has no effect on the
7356 program being compiled, or on the code generated for the program.
7357
7358 To obtain the required output specified in RM H.3.1, the compiler must be
7359 run with various special switches as follows:
7360
7361
7362 @itemize *
7363
7364 @item
7365 @emph{Where compiler-generated run-time checks remain}
7366
7367 The switch @emph{-gnatGL}
7368 may be used to list the expanded code in pseudo-Ada form.
7369 Runtime checks show up in the listing either as explicit
7370 checks or operators marked with @{@} to indicate a check is present.
7371
7372 @item
7373 @emph{An identification of known exceptions at compile time}
7374
7375 If the program is compiled with @emph{-gnatwa},
7376 the compiler warning messages will indicate all cases where the compiler
7377 detects that an exception is certain to occur at run time.
7378
7379 @item
7380 @emph{Possible reads of uninitialized variables}
7381
7382 The compiler warns of many such cases, but its output is incomplete.
7383 @end itemize
7384
7385
7386 A supplemental static analysis tool
7387 may be used to obtain a comprehensive list of all
7388 possible points at which uninitialized data may be read.
7389
7390
7391 @itemize *
7392
7393 @item
7394 @emph{Where run-time support routines are implicitly invoked}
7395
7396 In the output from @emph{-gnatGL},
7397 run-time calls are explicitly listed as calls to the relevant
7398 run-time routine.
7399
7400 @item
7401 @emph{Object code listing}
7402
7403 This may be obtained either by using the @emph{-S} switch,
7404 or the objdump utility.
7405
7406 @item
7407 @emph{Constructs known to be erroneous at compile time}
7408
7409 These are identified by warnings issued by the compiler (use @emph{-gnatwa}).
7410
7411 @item
7412 @emph{Stack usage information}
7413
7414 Static stack usage data (maximum per-subprogram) can be obtained via the
7415 @emph{-fstack-usage} switch to the compiler.
7416 Dynamic stack usage data (per task) can be obtained via the @emph{-u} switch
7417 to gnatbind
7418 @end itemize
7419
7420
7421
7422 @itemize *
7423
7424 @item
7425 @emph{Object code listing of entire partition}
7426
7427 This can be obtained by compiling the partition with @emph{-S},
7428 or by applying objdump
7429 to all the object files that are part of the partition.
7430
7431 @item
7432 @emph{A description of the run-time model}
7433
7434 The full sources of the run-time are available, and the documentation of
7435 these routines describes how these run-time routines interface to the
7436 underlying operating system facilities.
7437
7438 @item
7439 @emph{Control and data-flow information}
7440 @end itemize
7441
7442
7443 A supplemental static analysis tool
7444 may be used to obtain complete control and data-flow information, as well as
7445 comprehensive messages identifying possible problems based on this
7446 information.
7447
7448 @node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
7449 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{e0}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{e1}
7450 @section Pragma Secondary_Stack_Size
7451
7452
7453 Syntax:
7454
7455 @example
7456 pragma Secondary_Stack_Size (integer_EXPRESSION);
7457 @end example
7458
7459 This pragma appears within the task definition of a single task declaration
7460 or a task type declaration (like pragma @code{Storage_Size}) and applies to all
7461 task objects of that type. The argument specifies the size of the secondary
7462 stack to be used by these task objects, and must be of an integer type. The
7463 secondary stack is used to handle functions that return a variable-sized
7464 result, for example a function returning an unconstrained String.
7465
7466 Note this pragma only applies to targets using fixed secondary stacks, like
7467 VxWorks 653 and bare board targets, where a fixed block for the
7468 secondary stack is allocated from the primary stack of the task. By default,
7469 these targets assign a percentage of the primary stack for the secondary stack,
7470 as defined by @code{System.Parameter.Sec_Stack_Percentage}. With this pragma,
7471 an @code{integer_EXPRESSION} of bytes is assigned from the primary stack instead.
7472
7473 For most targets, the pragma does not apply as the secondary stack grows on
7474 demand: allocated as a chain of blocks in the heap. The default size of these
7475 blocks can be modified via the @code{-D} binder option as described in
7476 @cite{GNAT User's Guide}.
7477
7478 Note that no check is made to see if the secondary stack can fit inside the
7479 primary stack.
7480
7481 Note the pragma cannot appear when the restriction @code{No_Secondary_Stack}
7482 is in effect.
7483
7484 @node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
7485 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{e2}
7486 @section Pragma Share_Generic
7487
7488
7489 Syntax:
7490
7491 @example
7492 pragma Share_Generic (GNAME @{, GNAME@});
7493
7494 GNAME ::= generic_unit_NAME | generic_instance_NAME
7495 @end example
7496
7497 This pragma is provided for compatibility with Dec Ada 83. It has
7498 no effect in GNAT (which does not implement shared generics), other
7499 than to check that the given names are all names of generic units or
7500 generic instances.
7501
7502 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
7503 @anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{e3}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{e4}
7504 @section Pragma Shared
7505
7506
7507 This pragma is provided for compatibility with Ada 83. The syntax and
7508 semantics are identical to pragma Atomic.
7509
7510 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
7511 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{e5}
7512 @section Pragma Short_Circuit_And_Or
7513
7514
7515 Syntax:
7516
7517 @example
7518 pragma Short_Circuit_And_Or;
7519 @end example
7520
7521 This configuration pragma causes any occurrence of the AND operator applied to
7522 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
7523 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
7524 may be useful in the context of certification protocols requiring the use of
7525 short-circuited logical operators. If this configuration pragma occurs locally
7526 within the file being compiled, it applies only to the file being compiled.
7527 There is no requirement that all units in a partition use this option.
7528
7529 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
7530 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e6}
7531 @section Pragma Short_Descriptors
7532
7533
7534 Syntax:
7535
7536 @example
7537 pragma Short_Descriptors
7538 @end example
7539
7540 This pragma is provided for compatibility with other Ada implementations. It
7541 is recognized but ignored by all current versions of GNAT.
7542
7543 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
7544 @anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{e7}@anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e8}
7545 @section Pragma Simple_Storage_Pool_Type
7546
7547
7548 @geindex Storage pool
7549 @geindex simple
7550
7551 @geindex Simple storage pool
7552
7553 Syntax:
7554
7555 @example
7556 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
7557 @end example
7558
7559 A type can be established as a 'simple storage pool type' by applying
7560 the representation pragma @code{Simple_Storage_Pool_Type} to the type.
7561 A type named in the pragma must be a library-level immutably limited record
7562 type or limited tagged type declared immediately within a package declaration.
7563 The type can also be a limited private type whose full type is allowed as
7564 a simple storage pool type.
7565
7566 For a simple storage pool type @code{SSP}, nonabstract primitive subprograms
7567 @code{Allocate}, @code{Deallocate}, and @code{Storage_Size} can be declared that
7568 are subtype conformant with the following subprogram declarations:
7569
7570 @example
7571 procedure Allocate
7572 (Pool : in out SSP;
7573 Storage_Address : out System.Address;
7574 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7575 Alignment : System.Storage_Elements.Storage_Count);
7576
7577 procedure Deallocate
7578 (Pool : in out SSP;
7579 Storage_Address : System.Address;
7580 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7581 Alignment : System.Storage_Elements.Storage_Count);
7582
7583 function Storage_Size (Pool : SSP)
7584 return System.Storage_Elements.Storage_Count;
7585 @end example
7586
7587 Procedure @code{Allocate} must be declared, whereas @code{Deallocate} and
7588 @code{Storage_Size} are optional. If @code{Deallocate} is not declared, then
7589 applying an unchecked deallocation has no effect other than to set its actual
7590 parameter to null. If @code{Storage_Size} is not declared, then the
7591 @code{Storage_Size} attribute applied to an access type associated with
7592 a pool object of type SSP returns zero. Additional operations can be declared
7593 for a simple storage pool type (such as for supporting a mark/release
7594 storage-management discipline).
7595
7596 An object of a simple storage pool type can be associated with an access
7597 type by specifying the attribute
7598 @ref{e9,,Simple_Storage_Pool}. For example:
7599
7600 @example
7601 My_Pool : My_Simple_Storage_Pool_Type;
7602
7603 type Acc is access My_Data_Type;
7604
7605 for Acc'Simple_Storage_Pool use My_Pool;
7606 @end example
7607
7608 See attribute @ref{e9,,Simple_Storage_Pool}
7609 for further details.
7610
7611 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7612 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{ea}@anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{eb}
7613 @section Pragma Source_File_Name
7614
7615
7616 Syntax:
7617
7618 @example
7619 pragma Source_File_Name (
7620 [Unit_Name =>] unit_NAME,
7621 Spec_File_Name => STRING_LITERAL,
7622 [Index => INTEGER_LITERAL]);
7623
7624 pragma Source_File_Name (
7625 [Unit_Name =>] unit_NAME,
7626 Body_File_Name => STRING_LITERAL,
7627 [Index => INTEGER_LITERAL]);
7628 @end example
7629
7630 Use this to override the normal naming convention. It is a configuration
7631 pragma, and so has the usual applicability of configuration pragmas
7632 (i.e., it applies to either an entire partition, or to all units in a
7633 compilation, or to a single unit, depending on how it is used.
7634 @code{unit_name} is mapped to @code{file_name_literal}. The identifier for
7635 the second argument is required, and indicates whether this is the file
7636 name for the spec or for the body.
7637
7638 The optional Index argument should be used when a file contains multiple
7639 units, and when you do not want to use @code{gnatchop} to separate then
7640 into multiple files (which is the recommended procedure to limit the
7641 number of recompilations that are needed when some sources change).
7642 For instance, if the source file @code{source.ada} contains
7643
7644 @example
7645 package B is
7646 ...
7647 end B;
7648
7649 with B;
7650 procedure A is
7651 begin
7652 ..
7653 end A;
7654 @end example
7655
7656 you could use the following configuration pragmas:
7657
7658 @example
7659 pragma Source_File_Name
7660 (B, Spec_File_Name => "source.ada", Index => 1);
7661 pragma Source_File_Name
7662 (A, Body_File_Name => "source.ada", Index => 2);
7663 @end example
7664
7665 Note that the @code{gnatname} utility can also be used to generate those
7666 configuration pragmas.
7667
7668 Another form of the @code{Source_File_Name} pragma allows
7669 the specification of patterns defining alternative file naming schemes
7670 to apply to all files.
7671
7672 @example
7673 pragma Source_File_Name
7674 ( [Spec_File_Name =>] STRING_LITERAL
7675 [,[Casing =>] CASING_SPEC]
7676 [,[Dot_Replacement =>] STRING_LITERAL]);
7677
7678 pragma Source_File_Name
7679 ( [Body_File_Name =>] STRING_LITERAL
7680 [,[Casing =>] CASING_SPEC]
7681 [,[Dot_Replacement =>] STRING_LITERAL]);
7682
7683 pragma Source_File_Name
7684 ( [Subunit_File_Name =>] STRING_LITERAL
7685 [,[Casing =>] CASING_SPEC]
7686 [,[Dot_Replacement =>] STRING_LITERAL]);
7687
7688 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7689 @end example
7690
7691 The first argument is a pattern that contains a single asterisk indicating
7692 the point at which the unit name is to be inserted in the pattern string
7693 to form the file name. The second argument is optional. If present it
7694 specifies the casing of the unit name in the resulting file name string.
7695 The default is lower case. Finally the third argument allows for systematic
7696 replacement of any dots in the unit name by the specified string literal.
7697
7698 Note that Source_File_Name pragmas should not be used if you are using
7699 project files. The reason for this rule is that the project manager is not
7700 aware of these pragmas, and so other tools that use the projet file would not
7701 be aware of the intended naming conventions. If you are using project files,
7702 file naming is controlled by Source_File_Name_Project pragmas, which are
7703 usually supplied automatically by the project manager. A pragma
7704 Source_File_Name cannot appear after a @ref{ec,,Pragma Source_File_Name_Project}.
7705
7706 For more details on the use of the @code{Source_File_Name} pragma, see the
7707 sections on @code{Using Other File Names} and @cite{Alternative File Naming Schemes' in the :title:`GNAT User's Guide}.
7708
7709 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7710 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{ec}@anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{ed}
7711 @section Pragma Source_File_Name_Project
7712
7713
7714 This pragma has the same syntax and semantics as pragma Source_File_Name.
7715 It is only allowed as a stand-alone configuration pragma.
7716 It cannot appear after a @ref{ea,,Pragma Source_File_Name}, and
7717 most importantly, once pragma Source_File_Name_Project appears,
7718 no further Source_File_Name pragmas are allowed.
7719
7720 The intention is that Source_File_Name_Project pragmas are always
7721 generated by the Project Manager in a manner consistent with the naming
7722 specified in a project file, and when naming is controlled in this manner,
7723 it is not permissible to attempt to modify this naming scheme using
7724 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7725 known to the project manager).
7726
7727 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7728 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{ee}
7729 @section Pragma Source_Reference
7730
7731
7732 Syntax:
7733
7734 @example
7735 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7736 @end example
7737
7738 This pragma must appear as the first line of a source file.
7739 @code{integer_literal} is the logical line number of the line following
7740 the pragma line (for use in error messages and debugging
7741 information). @code{string_literal} is a static string constant that
7742 specifies the file name to be used in error messages and debugging
7743 information. This is most notably used for the output of @code{gnatchop}
7744 with the @emph{-r} switch, to make sure that the original unchopped
7745 source file is the one referred to.
7746
7747 The second argument must be a string literal, it cannot be a static
7748 string expression other than a string literal. This is because its value
7749 is needed for error messages issued by all phases of the compiler.
7750
7751 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7752 @anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{ef}@anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{f0}
7753 @section Pragma SPARK_Mode
7754
7755
7756 Syntax:
7757
7758 @example
7759 pragma SPARK_Mode [(On | Off)] ;
7760 @end example
7761
7762 In general a program can have some parts that are in SPARK 2014 (and
7763 follow all the rules in the SPARK Reference Manual), and some parts
7764 that are full Ada 2012.
7765
7766 The SPARK_Mode pragma is used to identify which parts are in SPARK
7767 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7768 be used in the following places:
7769
7770
7771 @itemize *
7772
7773 @item
7774 As a configuration pragma, in which case it sets the default mode for
7775 all units compiled with this pragma.
7776
7777 @item
7778 Immediately following a library-level subprogram spec
7779
7780 @item
7781 Immediately within a library-level package body
7782
7783 @item
7784 Immediately following the @code{private} keyword of a library-level
7785 package spec
7786
7787 @item
7788 Immediately following the @code{begin} keyword of a library-level
7789 package body
7790
7791 @item
7792 Immediately within a library-level subprogram body
7793 @end itemize
7794
7795 Normally a subprogram or package spec/body inherits the current mode
7796 that is active at the point it is declared. But this can be overridden
7797 by pragma within the spec or body as above.
7798
7799 The basic consistency rule is that you can't turn SPARK_Mode back
7800 @code{On}, once you have explicitly (with a pragma) turned if
7801 @code{Off}. So the following rules apply:
7802
7803 If a subprogram spec has SPARK_Mode @code{Off}, then the body must
7804 also have SPARK_Mode @code{Off}.
7805
7806 For a package, we have four parts:
7807
7808
7809 @itemize *
7810
7811 @item
7812 the package public declarations
7813
7814 @item
7815 the package private part
7816
7817 @item
7818 the body of the package
7819
7820 @item
7821 the elaboration code after @code{begin}
7822 @end itemize
7823
7824 For a package, the rule is that if you explicitly turn SPARK_Mode
7825 @code{Off} for any part, then all the following parts must have
7826 SPARK_Mode @code{Off}. Note that this may require repeating a pragma
7827 SPARK_Mode (@code{Off}) in the body. For example, if we have a
7828 configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
7829 default everywhere, and one particular package spec has pragma
7830 SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
7831 the package body.
7832
7833 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7834 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{f1}
7835 @section Pragma Static_Elaboration_Desired
7836
7837
7838 Syntax:
7839
7840 @example
7841 pragma Static_Elaboration_Desired;
7842 @end example
7843
7844 This pragma is used to indicate that the compiler should attempt to initialize
7845 statically the objects declared in the library unit to which the pragma applies,
7846 when these objects are initialized (explicitly or implicitly) by an aggregate.
7847 In the absence of this pragma, aggregates in object declarations are expanded
7848 into assignments and loops, even when the aggregate components are static
7849 constants. When the aggregate is present the compiler builds a static expression
7850 that requires no run-time code, so that the initialized object can be placed in
7851 read-only data space. If the components are not static, or the aggregate has
7852 more that 100 components, the compiler emits a warning that the pragma cannot
7853 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7854 construction of larger aggregates with static components that include an others
7855 choice.)
7856
7857 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7858 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{f2}
7859 @section Pragma Stream_Convert
7860
7861
7862 Syntax:
7863
7864 @example
7865 pragma Stream_Convert (
7866 [Entity =>] type_LOCAL_NAME,
7867 [Read =>] function_NAME,
7868 [Write =>] function_NAME);
7869 @end example
7870
7871 This pragma provides an efficient way of providing user-defined stream
7872 attributes. Not only is it simpler to use than specifying the attributes
7873 directly, but more importantly, it allows the specification to be made in such
7874 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7875 needed (i.e. unless the stream attributes are actually used); the use of
7876 the Stream_Convert pragma adds no overhead at all, unless the stream
7877 attributes are actually used on the designated type.
7878
7879 The first argument specifies the type for which stream functions are
7880 provided. The second parameter provides a function used to read values
7881 of this type. It must name a function whose argument type may be any
7882 subtype, and whose returned type must be the type given as the first
7883 argument to the pragma.
7884
7885 The meaning of the @code{Read} parameter is that if a stream attribute directly
7886 or indirectly specifies reading of the type given as the first parameter,
7887 then a value of the type given as the argument to the Read function is
7888 read from the stream, and then the Read function is used to convert this
7889 to the required target type.
7890
7891 Similarly the @code{Write} parameter specifies how to treat write attributes
7892 that directly or indirectly apply to the type given as the first parameter.
7893 It must have an input parameter of the type specified by the first parameter,
7894 and the return type must be the same as the input type of the Read function.
7895 The effect is to first call the Write function to convert to the given stream
7896 type, and then write the result type to the stream.
7897
7898 The Read and Write functions must not be overloaded subprograms. If necessary
7899 renamings can be supplied to meet this requirement.
7900 The usage of this attribute is best illustrated by a simple example, taken
7901 from the GNAT implementation of package Ada.Strings.Unbounded:
7902
7903 @example
7904 function To_Unbounded (S : String) return Unbounded_String
7905 renames To_Unbounded_String;
7906
7907 pragma Stream_Convert
7908 (Unbounded_String, To_Unbounded, To_String);
7909 @end example
7910
7911 The specifications of the referenced functions, as given in the Ada
7912 Reference Manual are:
7913
7914 @example
7915 function To_Unbounded_String (Source : String)
7916 return Unbounded_String;
7917
7918 function To_String (Source : Unbounded_String)
7919 return String;
7920 @end example
7921
7922 The effect is that if the value of an unbounded string is written to a stream,
7923 then the representation of the item in the stream is in the same format that
7924 would be used for @code{Standard.String'Output}, and this same representation
7925 is expected when a value of this type is read from the stream. Note that the
7926 value written always includes the bounds, even for Unbounded_String'Write,
7927 since Unbounded_String is not an array type.
7928
7929 Note that the @code{Stream_Convert} pragma is not effective in the case of
7930 a derived type of a non-limited tagged type. If such a type is specified then
7931 the pragma is silently ignored, and the default implementation of the stream
7932 attributes is used instead.
7933
7934 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7935 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{f3}
7936 @section Pragma Style_Checks
7937
7938
7939 Syntax:
7940
7941 @example
7942 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7943 On | Off [, LOCAL_NAME]);
7944 @end example
7945
7946 This pragma is used in conjunction with compiler switches to control the
7947 built in style checking provided by GNAT. The compiler switches, if set,
7948 provide an initial setting for the switches, and this pragma may be used
7949 to modify these settings, or the settings may be provided entirely by
7950 the use of the pragma. This pragma can be used anywhere that a pragma
7951 is legal, including use as a configuration pragma (including use in
7952 the @code{gnat.adc} file).
7953
7954 The form with a string literal specifies which style options are to be
7955 activated. These are additive, so they apply in addition to any previously
7956 set style check options. The codes for the options are the same as those
7957 used in the @emph{-gnaty} switch to @emph{gcc} or @emph{gnatmake}.
7958 For example the following two methods can be used to enable
7959 layout checking:
7960
7961
7962 @itemize *
7963
7964 @item
7965 @example
7966 pragma Style_Checks ("l");
7967 @end example
7968
7969 @item
7970 @example
7971 gcc -c -gnatyl ...
7972 @end example
7973 @end itemize
7974
7975 The form @code{ALL_CHECKS} activates all standard checks (its use is equivalent
7976 to the use of the @code{gnaty} switch with no options.
7977 See the @cite{GNAT User's Guide} for details.)
7978
7979 Note: the behavior is slightly different in GNAT mode (@code{-gnatg} used).
7980 In this case, @code{ALL_CHECKS} implies the standard set of GNAT mode style check
7981 options (i.e. equivalent to @code{-gnatyg}).
7982
7983 The forms with @code{Off} and @code{On}
7984 can be used to temporarily disable style checks
7985 as shown in the following example:
7986
7987 @example
7988 pragma Style_Checks ("k"); -- requires keywords in lower case
7989 pragma Style_Checks (Off); -- turn off style checks
7990 NULL; -- this will not generate an error message
7991 pragma Style_Checks (On); -- turn style checks back on
7992 NULL; -- this will generate an error message
7993 @end example
7994
7995 Finally the two argument form is allowed only if the first argument is
7996 @code{On} or @code{Off}. The effect is to turn of semantic style checks
7997 for the specified entity, as shown in the following example:
7998
7999 @example
8000 pragma Style_Checks ("r"); -- require consistency of identifier casing
8001 Arg : Integer;
8002 Rf1 : Integer := ARG; -- incorrect, wrong case
8003 pragma Style_Checks (Off, Arg);
8004 Rf2 : Integer := ARG; -- OK, no error
8005 @end example
8006
8007 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
8008 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{f4}
8009 @section Pragma Subtitle
8010
8011
8012 Syntax:
8013
8014 @example
8015 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
8016 @end example
8017
8018 This pragma is recognized for compatibility with other Ada compilers
8019 but is ignored by GNAT.
8020
8021 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
8022 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{f5}
8023 @section Pragma Suppress
8024
8025
8026 Syntax:
8027
8028 @example
8029 pragma Suppress (Identifier [, [On =>] Name]);
8030 @end example
8031
8032 This is a standard pragma, and supports all the check names required in
8033 the RM. It is included here because GNAT recognizes some additional check
8034 names that are implementation defined (as permitted by the RM):
8035
8036
8037 @itemize *
8038
8039 @item
8040 @code{Alignment_Check} can be used to suppress alignment checks
8041 on addresses used in address clauses. Such checks can also be suppressed
8042 by suppressing range checks, but the specific use of @code{Alignment_Check}
8043 allows suppression of alignment checks without suppressing other range checks.
8044 Note that @code{Alignment_Check} is suppressed by default on machines (such as
8045 the x86) with non-strict alignment.
8046
8047 @item
8048 @code{Atomic_Synchronization} can be used to suppress the special memory
8049 synchronization instructions that are normally generated for access to
8050 @code{Atomic} variables to ensure correct synchronization between tasks
8051 that use such variables for synchronization purposes.
8052
8053 @item
8054 @code{Duplicated_Tag_Check} Can be used to suppress the check that is generated
8055 for a duplicated tag value when a tagged type is declared.
8056
8057 @item
8058 @code{Container_Checks} Can be used to suppress all checks within Ada.Containers
8059 and instances of its children, including Tampering_Check.
8060
8061 @item
8062 @code{Tampering_Check} Can be used to suppress tampering check in the containers.
8063
8064 @item
8065 @code{Predicate_Check} can be used to control whether predicate checks are
8066 active. It is applicable only to predicates for which the policy is
8067 @code{Check}. Unlike @code{Assertion_Policy}, which determines if a given
8068 predicate is ignored or checked for the whole program, the use of
8069 @code{Suppress} and @code{Unsuppress} with this check name allows a given
8070 predicate to be turned on and off at specific points in the program.
8071
8072 @item
8073 @code{Validity_Check} can be used specifically to control validity checks.
8074 If @code{Suppress} is used to suppress validity checks, then no validity
8075 checks are performed, including those specified by the appropriate compiler
8076 switch or the @code{Validity_Checks} pragma.
8077
8078 @item
8079 Additional check names previously introduced by use of the @code{Check_Name}
8080 pragma are also allowed.
8081 @end itemize
8082
8083 Note that pragma Suppress gives the compiler permission to omit
8084 checks, but does not require the compiler to omit checks. The compiler
8085 will generate checks if they are essentially free, even when they are
8086 suppressed. In particular, if the compiler can prove that a certain
8087 check will necessarily fail, it will generate code to do an
8088 unconditional 'raise', even if checks are suppressed. The compiler
8089 warns in this case.
8090
8091 Of course, run-time checks are omitted whenever the compiler can prove
8092 that they will not fail, whether or not checks are suppressed.
8093
8094 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
8095 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{f6}
8096 @section Pragma Suppress_All
8097
8098
8099 Syntax:
8100
8101 @example
8102 pragma Suppress_All;
8103 @end example
8104
8105 This pragma can appear anywhere within a unit.
8106 The effect is to apply @code{Suppress (All_Checks)} to the unit
8107 in which it appears. This pragma is implemented for compatibility with DEC
8108 Ada 83 usage where it appears at the end of a unit, and for compatibility
8109 with Rational Ada, where it appears as a program unit pragma.
8110 The use of the standard Ada pragma @code{Suppress (All_Checks)}
8111 as a normal configuration pragma is the preferred usage in GNAT.
8112
8113 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
8114 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{f7}@anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f8}
8115 @section Pragma Suppress_Debug_Info
8116
8117
8118 Syntax:
8119
8120 @example
8121 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
8122 @end example
8123
8124 This pragma can be used to suppress generation of debug information
8125 for the specified entity. It is intended primarily for use in debugging
8126 the debugger, and navigating around debugger problems.
8127
8128 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
8129 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f9}
8130 @section Pragma Suppress_Exception_Locations
8131
8132
8133 Syntax:
8134
8135 @example
8136 pragma Suppress_Exception_Locations;
8137 @end example
8138
8139 In normal mode, a raise statement for an exception by default generates
8140 an exception message giving the file name and line number for the location
8141 of the raise. This is useful for debugging and logging purposes, but this
8142 entails extra space for the strings for the messages. The configuration
8143 pragma @code{Suppress_Exception_Locations} can be used to suppress the
8144 generation of these strings, with the result that space is saved, but the
8145 exception message for such raises is null. This configuration pragma may
8146 appear in a global configuration pragma file, or in a specific unit as
8147 usual. It is not required that this pragma be used consistently within
8148 a partition, so it is fine to have some units within a partition compiled
8149 with this pragma and others compiled in normal mode without it.
8150
8151 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
8152 @anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{fa}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{fb}
8153 @section Pragma Suppress_Initialization
8154
8155
8156 @geindex Suppressing initialization
8157
8158 @geindex Initialization
8159 @geindex suppression of
8160
8161 Syntax:
8162
8163 @example
8164 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
8165 @end example
8166
8167 Here variable_or_subtype_Name is the name introduced by a type declaration
8168 or subtype declaration or the name of a variable introduced by an
8169 object declaration.
8170
8171 In the case of a type or subtype
8172 this pragma suppresses any implicit or explicit initialization
8173 for all variables of the given type or subtype,
8174 including initialization resulting from the use of pragmas
8175 Normalize_Scalars or Initialize_Scalars.
8176
8177 This is considered a representation item, so it cannot be given after
8178 the type is frozen. It applies to all subsequent object declarations,
8179 and also any allocator that creates objects of the type.
8180
8181 If the pragma is given for the first subtype, then it is considered
8182 to apply to the base type and all its subtypes. If the pragma is given
8183 for other than a first subtype, then it applies only to the given subtype.
8184 The pragma may not be given after the type is frozen.
8185
8186 Note that this includes eliminating initialization of discriminants
8187 for discriminated types, and tags for tagged types. In these cases,
8188 you will have to use some non-portable mechanism (e.g. address
8189 overlays or unchecked conversion) to achieve required initialization
8190 of these fields before accessing any object of the corresponding type.
8191
8192 For the variable case, implicit initialization for the named variable
8193 is suppressed, just as though its subtype had been given in a pragma
8194 Suppress_Initialization, as described above.
8195
8196 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
8197 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{fc}
8198 @section Pragma Task_Name
8199
8200
8201 Syntax
8202
8203 @example
8204 pragma Task_Name (string_EXPRESSION);
8205 @end example
8206
8207 This pragma appears within a task definition (like pragma
8208 @code{Priority}) and applies to the task in which it appears. The
8209 argument must be of type String, and provides a name to be used for
8210 the task instance when the task is created. Note that this expression
8211 is not required to be static, and in particular, it can contain
8212 references to task discriminants. This facility can be used to
8213 provide different names for different tasks as they are created,
8214 as illustrated in the example below.
8215
8216 The task name is recorded internally in the run-time structures
8217 and is accessible to tools like the debugger. In addition the
8218 routine @code{Ada.Task_Identification.Image} will return this
8219 string, with a unique task address appended.
8220
8221 @example
8222 -- Example of the use of pragma Task_Name
8223
8224 with Ada.Task_Identification;
8225 use Ada.Task_Identification;
8226 with Text_IO; use Text_IO;
8227 procedure t3 is
8228
8229 type Astring is access String;
8230
8231 task type Task_Typ (Name : access String) is
8232 pragma Task_Name (Name.all);
8233 end Task_Typ;
8234
8235 task body Task_Typ is
8236 Nam : constant String := Image (Current_Task);
8237 begin
8238 Put_Line ("-->" & Nam (1 .. 14) & "<--");
8239 end Task_Typ;
8240
8241 type Ptr_Task is access Task_Typ;
8242 Task_Var : Ptr_Task;
8243
8244 begin
8245 Task_Var :=
8246 new Task_Typ (new String'("This is task 1"));
8247 Task_Var :=
8248 new Task_Typ (new String'("This is task 2"));
8249 end;
8250 @end example
8251
8252 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
8253 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{fd}
8254 @section Pragma Task_Storage
8255
8256
8257 Syntax:
8258
8259 @example
8260 pragma Task_Storage (
8261 [Task_Type =>] LOCAL_NAME,
8262 [Top_Guard =>] static_integer_EXPRESSION);
8263 @end example
8264
8265 This pragma specifies the length of the guard area for tasks. The guard
8266 area is an additional storage area allocated to a task. A value of zero
8267 means that either no guard area is created or a minimal guard area is
8268 created, depending on the target. This pragma can appear anywhere a
8269 @code{Storage_Size} attribute definition clause is allowed for a task
8270 type.
8271
8272 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
8273 @anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{fe}@anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{ff}
8274 @section Pragma Test_Case
8275
8276
8277 @geindex Test cases
8278
8279 Syntax:
8280
8281 @example
8282 pragma Test_Case (
8283 [Name =>] static_string_Expression
8284 ,[Mode =>] (Nominal | Robustness)
8285 [, Requires => Boolean_Expression]
8286 [, Ensures => Boolean_Expression]);
8287 @end example
8288
8289 The @code{Test_Case} pragma allows defining fine-grain specifications
8290 for use by testing tools.
8291 The compiler checks the validity of the @code{Test_Case} pragma, but its
8292 presence does not lead to any modification of the code generated by the
8293 compiler.
8294
8295 @code{Test_Case} pragmas may only appear immediately following the
8296 (separate) declaration of a subprogram in a package declaration, inside
8297 a package spec unit. Only other pragmas may intervene (that is appear
8298 between the subprogram declaration and a test case).
8299
8300 The compiler checks that boolean expressions given in @code{Requires} and
8301 @code{Ensures} are valid, where the rules for @code{Requires} are the
8302 same as the rule for an expression in @code{Precondition} and the rules
8303 for @code{Ensures} are the same as the rule for an expression in
8304 @code{Postcondition}. In particular, attributes @code{'Old} and
8305 @code{'Result} can only be used within the @code{Ensures}
8306 expression. The following is an example of use within a package spec:
8307
8308 @example
8309 package Math_Functions is
8310 ...
8311 function Sqrt (Arg : Float) return Float;
8312 pragma Test_Case (Name => "Test 1",
8313 Mode => Nominal,
8314 Requires => Arg < 10000,
8315 Ensures => Sqrt'Result < 10);
8316 ...
8317 end Math_Functions;
8318 @end example
8319
8320 The meaning of a test case is that there is at least one context where
8321 @code{Requires} holds such that, if the associated subprogram is executed in
8322 that context, then @code{Ensures} holds when the subprogram returns.
8323 Mode @code{Nominal} indicates that the input context should also satisfy the
8324 precondition of the subprogram, and the output context should also satisfy its
8325 postcondition. Mode @code{Robustness} indicates that the precondition and
8326 postcondition of the subprogram should be ignored for this test case.
8327
8328 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
8329 @anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{100}@anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{101}
8330 @section Pragma Thread_Local_Storage
8331
8332
8333 @geindex Task specific storage
8334
8335 @geindex TLS (Thread Local Storage)
8336
8337 @geindex Task_Attributes
8338
8339 Syntax:
8340
8341 @example
8342 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
8343 @end example
8344
8345 This pragma specifies that the specified entity, which must be
8346 a variable declared in a library-level package, is to be marked as
8347 "Thread Local Storage" (@code{TLS}). On systems supporting this (which
8348 include Windows, Solaris, GNU/Linux, and VxWorks 6), this causes each
8349 thread (and hence each Ada task) to see a distinct copy of the variable.
8350
8351 The variable must not have default initialization, and if there is
8352 an explicit initialization, it must be either @code{null} for an
8353 access variable, a static expression for a scalar variable, or a fully
8354 static aggregate for a composite type, that is to say, an aggregate all
8355 of whose components are static, and which does not include packed or
8356 discriminated components.
8357
8358 This provides a low-level mechanism similar to that provided by
8359 the @code{Ada.Task_Attributes} package, but much more efficient
8360 and is also useful in writing interface code that will interact
8361 with foreign threads.
8362
8363 If this pragma is used on a system where @code{TLS} is not supported,
8364 then an error message will be generated and the program will be rejected.
8365
8366 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
8367 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{102}
8368 @section Pragma Time_Slice
8369
8370
8371 Syntax:
8372
8373 @example
8374 pragma Time_Slice (static_duration_EXPRESSION);
8375 @end example
8376
8377 For implementations of GNAT on operating systems where it is possible
8378 to supply a time slice value, this pragma may be used for this purpose.
8379 It is ignored if it is used in a system that does not allow this control,
8380 or if it appears in other than the main program unit.
8381
8382 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
8383 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{103}
8384 @section Pragma Title
8385
8386
8387 Syntax:
8388
8389 @example
8390 pragma Title (TITLING_OPTION [, TITLING OPTION]);
8391
8392 TITLING_OPTION ::=
8393 [Title =>] STRING_LITERAL,
8394 | [Subtitle =>] STRING_LITERAL
8395 @end example
8396
8397 Syntax checked but otherwise ignored by GNAT. This is a listing control
8398 pragma used in DEC Ada 83 implementations to provide a title and/or
8399 subtitle for the program listing. The program listing generated by GNAT
8400 does not have titles or subtitles.
8401
8402 Unlike other pragmas, the full flexibility of named notation is allowed
8403 for this pragma, i.e., the parameters may be given in any order if named
8404 notation is used, and named and positional notation can be mixed
8405 following the normal rules for procedure calls in Ada.
8406
8407 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
8408 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{104}
8409 @section Pragma Type_Invariant
8410
8411
8412 Syntax:
8413
8414 @example
8415 pragma Type_Invariant
8416 ([Entity =>] type_LOCAL_NAME,
8417 [Check =>] EXPRESSION);
8418 @end example
8419
8420 The @code{Type_Invariant} pragma is intended to be an exact
8421 replacement for the language-defined @code{Type_Invariant}
8422 aspect, and shares its restrictions and semantics. It differs
8423 from the language defined @code{Invariant} pragma in that it
8424 does not permit a string parameter, and it is
8425 controlled by the assertion identifier @code{Type_Invariant}
8426 rather than @code{Invariant}.
8427
8428 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
8429 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{105}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{106}
8430 @section Pragma Type_Invariant_Class
8431
8432
8433 Syntax:
8434
8435 @example
8436 pragma Type_Invariant_Class
8437 ([Entity =>] type_LOCAL_NAME,
8438 [Check =>] EXPRESSION);
8439 @end example
8440
8441 The @code{Type_Invariant_Class} pragma is intended to be an exact
8442 replacement for the language-defined @code{Type_Invariant'Class}
8443 aspect, and shares its restrictions and semantics.
8444
8445 Note: This pragma is called @code{Type_Invariant_Class} rather than
8446 @code{Type_Invariant'Class} because the latter would not be strictly
8447 conforming to the allowed syntax for pragmas. The motivation
8448 for providing pragmas equivalent to the aspects is to allow a program
8449 to be written using the pragmas, and then compiled if necessary
8450 using an Ada compiler that does not recognize the pragmas or
8451 aspects, but is prepared to ignore the pragmas. The assertion
8452 policy that controls this pragma is @code{Type_Invariant'Class},
8453 not @code{Type_Invariant_Class}.
8454
8455 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
8456 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{107}
8457 @section Pragma Unchecked_Union
8458
8459
8460 @geindex Unions in C
8461
8462 Syntax:
8463
8464 @example
8465 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
8466 @end example
8467
8468 This pragma is used to specify a representation of a record type that is
8469 equivalent to a C union. It was introduced as a GNAT implementation defined
8470 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
8471 pragma, making it language defined, and GNAT fully implements this extended
8472 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
8473 details, consult the Ada 2012 Reference Manual, section B.3.3.
8474
8475 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
8476 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{108}
8477 @section Pragma Unevaluated_Use_Of_Old
8478
8479
8480 @geindex Attribute Old
8481
8482 @geindex Attribute Loop_Entry
8483
8484 @geindex Unevaluated_Use_Of_Old
8485
8486 Syntax:
8487
8488 @example
8489 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
8490 @end example
8491
8492 This pragma controls the processing of attributes Old and Loop_Entry.
8493 If either of these attributes is used in a potentially unevaluated
8494 expression (e.g. the then or else parts of an if expression), then
8495 normally this usage is considered illegal if the prefix of the attribute
8496 is other than an entity name. The language requires this
8497 behavior for Old, and GNAT copies the same rule for Loop_Entry.
8498
8499 The reason for this rule is that otherwise, we can have a situation
8500 where we save the Old value, and this results in an exception, even
8501 though we might not evaluate the attribute. Consider this example:
8502
8503 @example
8504 package UnevalOld is
8505 K : Character;
8506 procedure U (A : String; C : Boolean) -- ERROR
8507 with Post => (if C then A(1)'Old = K else True);
8508 end;
8509 @end example
8510
8511 If procedure U is called with a string with a lower bound of 2, and
8512 C false, then an exception would be raised trying to evaluate A(1)
8513 on entry even though the value would not be actually used.
8514
8515 Although the rule guarantees against this possibility, it is sometimes
8516 too restrictive. For example if we know that the string has a lower
8517 bound of 1, then we will never raise an exception.
8518 The pragma @code{Unevaluated_Use_Of_Old} can be
8519 used to modify this behavior. If the argument is @code{Error} then an
8520 error is given (this is the default RM behavior). If the argument is
8521 @code{Warn} then the usage is allowed as legal but with a warning
8522 that an exception might be raised. If the argument is @code{Allow}
8523 then the usage is allowed as legal without generating a warning.
8524
8525 This pragma may appear as a configuration pragma, or in a declarative
8526 part or package specification. In the latter case it applies to
8527 uses up to the end of the corresponding statement sequence or
8528 sequence of package declarations.
8529
8530 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
8531 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{109}
8532 @section Pragma Unimplemented_Unit
8533
8534
8535 Syntax:
8536
8537 @example
8538 pragma Unimplemented_Unit;
8539 @end example
8540
8541 If this pragma occurs in a unit that is processed by the compiler, GNAT
8542 aborts with the message @code{xxx not implemented}, where
8543 @code{xxx} is the name of the current compilation unit. This pragma is
8544 intended to allow the compiler to handle unimplemented library units in
8545 a clean manner.
8546
8547 The abort only happens if code is being generated. Thus you can use
8548 specs of unimplemented packages in syntax or semantic checking mode.
8549
8550 @node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
8551 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{10a}@anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{10b}
8552 @section Pragma Universal_Aliasing
8553
8554
8555 Syntax:
8556
8557 @example
8558 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
8559 @end example
8560
8561 @code{type_LOCAL_NAME} must refer to a type declaration in the current
8562 declarative part. The effect is to inhibit strict type-based aliasing
8563 optimization for the given type. In other words, the effect is as though
8564 access types designating this type were subject to pragma No_Strict_Aliasing.
8565 For a detailed description of the strict aliasing optimization, and the
8566 situations in which it must be suppressed, see the section on
8567 @code{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
8568
8569 @node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
8570 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{10c}@anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{10d}
8571 @section Pragma Universal_Data
8572
8573
8574 Syntax:
8575
8576 @example
8577 pragma Universal_Data [(library_unit_Name)];
8578 @end example
8579
8580 This pragma is supported only for the AAMP target and is ignored for
8581 other targets. The pragma specifies that all library-level objects
8582 (Counter 0 data) associated with the library unit are to be accessed
8583 and updated using universal addressing (24-bit addresses for AAMP5)
8584 rather than the default of 16-bit Data Environment (DENV) addressing.
8585 Use of this pragma will generally result in less efficient code for
8586 references to global data associated with the library unit, but
8587 allows such data to be located anywhere in memory. This pragma is
8588 a library unit pragma, but can also be used as a configuration pragma
8589 (including use in the @code{gnat.adc} file). The functionality
8590 of this pragma is also available by applying the -univ switch on the
8591 compilations of units where universal addressing of the data is desired.
8592
8593 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
8594 @anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10e}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{10f}
8595 @section Pragma Unmodified
8596
8597
8598 @geindex Warnings
8599 @geindex unmodified
8600
8601 Syntax:
8602
8603 @example
8604 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8605 @end example
8606
8607 This pragma signals that the assignable entities (variables,
8608 @code{out} parameters, @code{in out} parameters) whose names are listed are
8609 deliberately not assigned in the current source unit. This
8610 suppresses warnings about the
8611 entities being referenced but not assigned, and in addition a warning will be
8612 generated if one of these entities is in fact assigned in the
8613 same unit as the pragma (or in the corresponding body, or one
8614 of its subunits).
8615
8616 This is particularly useful for clearly signaling that a particular
8617 parameter is not modified, even though the spec suggests that it might
8618 be.
8619
8620 For the variable case, warnings are never given for unreferenced variables
8621 whose name contains one of the substrings
8622 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8623 are typically to be used in cases where such warnings are expected.
8624 Thus it is never necessary to use @code{pragma Unmodified} for such
8625 variables, though it is harmless to do so.
8626
8627 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8628 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{110}@anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{111}
8629 @section Pragma Unreferenced
8630
8631
8632 @geindex Warnings
8633 @geindex unreferenced
8634
8635 Syntax:
8636
8637 @example
8638 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8639 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8640 @end example
8641
8642 This pragma signals that the entities whose names are listed are
8643 deliberately not referenced in the current source unit after the
8644 occurrence of the pragma. This
8645 suppresses warnings about the
8646 entities being unreferenced, and in addition a warning will be
8647 generated if one of these entities is in fact subsequently referenced in the
8648 same unit as the pragma (or in the corresponding body, or one
8649 of its subunits).
8650
8651 This is particularly useful for clearly signaling that a particular
8652 parameter is not referenced in some particular subprogram implementation
8653 and that this is deliberate. It can also be useful in the case of
8654 objects declared only for their initialization or finalization side
8655 effects.
8656
8657 If @code{LOCAL_NAME} identifies more than one matching homonym in the
8658 current scope, then the entity most recently declared is the one to which
8659 the pragma applies. Note that in the case of accept formals, the pragma
8660 Unreferenced may appear immediately after the keyword @code{do} which
8661 allows the indication of whether or not accept formals are referenced
8662 or not to be given individually for each accept statement.
8663
8664 The left hand side of an assignment does not count as a reference for the
8665 purpose of this pragma. Thus it is fine to assign to an entity for which
8666 pragma Unreferenced is given.
8667
8668 Note that if a warning is desired for all calls to a given subprogram,
8669 regardless of whether they occur in the same unit as the subprogram
8670 declaration, then this pragma should not be used (calls from another
8671 unit would not be flagged); pragma Obsolescent can be used instead
8672 for this purpose, see @ref{af,,Pragma Obsolescent}.
8673
8674 The second form of pragma @code{Unreferenced} is used within a context
8675 clause. In this case the arguments must be unit names of units previously
8676 mentioned in @code{with} clauses (similar to the usage of pragma
8677 @code{Elaborate_All}. The effect is to suppress warnings about unreferenced
8678 units and unreferenced entities within these units.
8679
8680 For the variable case, warnings are never given for unreferenced variables
8681 whose name contains one of the substrings
8682 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8683 are typically to be used in cases where such warnings are expected.
8684 Thus it is never necessary to use @code{pragma Unreferenced} for such
8685 variables, though it is harmless to do so.
8686
8687 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8688 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{112}@anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{113}
8689 @section Pragma Unreferenced_Objects
8690
8691
8692 @geindex Warnings
8693 @geindex unreferenced
8694
8695 Syntax:
8696
8697 @example
8698 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8699 @end example
8700
8701 This pragma signals that for the types or subtypes whose names are
8702 listed, objects which are declared with one of these types or subtypes may
8703 not be referenced, and if no references appear, no warnings are given.
8704
8705 This is particularly useful for objects which are declared solely for their
8706 initialization and finalization effect. Such variables are sometimes referred
8707 to as RAII variables (Resource Acquisition Is Initialization). Using this
8708 pragma on the relevant type (most typically a limited controlled type), the
8709 compiler will automatically suppress unwanted warnings about these variables
8710 not being referenced.
8711
8712 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8713 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{114}
8714 @section Pragma Unreserve_All_Interrupts
8715
8716
8717 Syntax:
8718
8719 @example
8720 pragma Unreserve_All_Interrupts;
8721 @end example
8722
8723 Normally certain interrupts are reserved to the implementation. Any attempt
8724 to attach an interrupt causes Program_Error to be raised, as described in
8725 RM C.3.2(22). A typical example is the @code{SIGINT} interrupt used in
8726 many systems for a @code{Ctrl-C} interrupt. Normally this interrupt is
8727 reserved to the implementation, so that @code{Ctrl-C} can be used to
8728 interrupt execution.
8729
8730 If the pragma @code{Unreserve_All_Interrupts} appears anywhere in any unit in
8731 a program, then all such interrupts are unreserved. This allows the
8732 program to handle these interrupts, but disables their standard
8733 functions. For example, if this pragma is used, then pressing
8734 @code{Ctrl-C} will not automatically interrupt execution. However,
8735 a program can then handle the @code{SIGINT} interrupt as it chooses.
8736
8737 For a full list of the interrupts handled in a specific implementation,
8738 see the source code for the spec of @code{Ada.Interrupts.Names} in
8739 file @code{a-intnam.ads}. This is a target dependent file that contains the
8740 list of interrupts recognized for a given target. The documentation in
8741 this file also specifies what interrupts are affected by the use of
8742 the @code{Unreserve_All_Interrupts} pragma.
8743
8744 For a more general facility for controlling what interrupts can be
8745 handled, see pragma @code{Interrupt_State}, which subsumes the functionality
8746 of the @code{Unreserve_All_Interrupts} pragma.
8747
8748 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8749 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{115}
8750 @section Pragma Unsuppress
8751
8752
8753 Syntax:
8754
8755 @example
8756 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8757 @end example
8758
8759 This pragma undoes the effect of a previous pragma @code{Suppress}. If
8760 there is no corresponding pragma @code{Suppress} in effect, it has no
8761 effect. The range of the effect is the same as for pragma
8762 @code{Suppress}. The meaning of the arguments is identical to that used
8763 in pragma @code{Suppress}.
8764
8765 One important application is to ensure that checks are on in cases where
8766 code depends on the checks for its correct functioning, so that the code
8767 will compile correctly even if the compiler switches are set to suppress
8768 checks. For example, in a program that depends on external names of tagged
8769 types and wants to ensure that the duplicated tag check occurs even if all
8770 run-time checks are suppressed by a compiler switch, the following
8771 configuration pragma will ensure this test is not suppressed:
8772
8773 @example
8774 pragma Unsuppress (Duplicated_Tag_Check);
8775 @end example
8776
8777 This pragma is standard in Ada 2005. It is available in all earlier versions
8778 of Ada as an implementation-defined pragma.
8779
8780 Note that in addition to the checks defined in the Ada RM, GNAT recogizes a
8781 number of implementation-defined check names. See the description of pragma
8782 @code{Suppress} for full details.
8783
8784 @node Pragma Use_VADS_Size,Pragma Unused,Pragma Unsuppress,Implementation Defined Pragmas
8785 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{116}
8786 @section Pragma Use_VADS_Size
8787
8788
8789 @geindex Size
8790 @geindex VADS compatibility
8791
8792 @geindex Rational profile
8793
8794 Syntax:
8795
8796 @example
8797 pragma Use_VADS_Size;
8798 @end example
8799
8800 This is a configuration pragma. In a unit to which it applies, any use
8801 of the 'Size attribute is automatically interpreted as a use of the
8802 'VADS_Size attribute. Note that this may result in incorrect semantic
8803 processing of valid Ada 95 or Ada 2005 programs. This is intended to aid in
8804 the handling of existing code which depends on the interpretation of Size
8805 as implemented in the VADS compiler. See description of the VADS_Size
8806 attribute for further details.
8807
8808 @node Pragma Unused,Pragma Validity_Checks,Pragma Use_VADS_Size,Implementation Defined Pragmas
8809 @anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{117}@anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{118}
8810 @section Pragma Unused
8811
8812
8813 @geindex Warnings
8814 @geindex unused
8815
8816 Syntax:
8817
8818 @example
8819 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8820 @end example
8821
8822 This pragma signals that the assignable entities (variables,
8823 @code{out} parameters, and @code{in out} parameters) whose names are listed
8824 deliberately do not get assigned or referenced in the current source unit
8825 after the occurrence of the pragma in the current source unit. This
8826 suppresses warnings about the entities that are unreferenced and/or not
8827 assigned, and, in addition, a warning will be generated if one of these
8828 entities gets assigned or subsequently referenced in the same unit as the
8829 pragma (in the corresponding body or one of its subunits).
8830
8831 This is particularly useful for clearly signaling that a particular
8832 parameter is not modified or referenced, even though the spec suggests
8833 that it might be.
8834
8835 For the variable case, warnings are never given for unreferenced
8836 variables whose name contains one of the substrings
8837 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8838 are typically to be used in cases where such warnings are expected.
8839 Thus it is never necessary to use @code{pragma Unmodified} for such
8840 variables, though it is harmless to do so.
8841
8842 @node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
8843 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{119}
8844 @section Pragma Validity_Checks
8845
8846
8847 Syntax:
8848
8849 @example
8850 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8851 @end example
8852
8853 This pragma is used in conjunction with compiler switches to control the
8854 built-in validity checking provided by GNAT. The compiler switches, if set
8855 provide an initial setting for the switches, and this pragma may be used
8856 to modify these settings, or the settings may be provided entirely by
8857 the use of the pragma. This pragma can be used anywhere that a pragma
8858 is legal, including use as a configuration pragma (including use in
8859 the @code{gnat.adc} file).
8860
8861 The form with a string literal specifies which validity options are to be
8862 activated. The validity checks are first set to include only the default
8863 reference manual settings, and then a string of letters in the string
8864 specifies the exact set of options required. The form of this string
8865 is exactly as described for the @emph{-gnatVx} compiler switch (see the
8866 GNAT User's Guide for details). For example the following two
8867 methods can be used to enable validity checking for mode @code{in} and
8868 @code{in out} subprogram parameters:
8869
8870
8871 @itemize *
8872
8873 @item
8874 @example
8875 pragma Validity_Checks ("im");
8876 @end example
8877
8878 @item
8879 @example
8880 $ gcc -c -gnatVim ...
8881 @end example
8882 @end itemize
8883
8884 The form ALL_CHECKS activates all standard checks (its use is equivalent
8885 to the use of the @code{gnatVa} switch).
8886
8887 The forms with @code{Off} and @code{On} can be used to temporarily disable
8888 validity checks as shown in the following example:
8889
8890 @example
8891 pragma Validity_Checks ("c"); -- validity checks for copies
8892 pragma Validity_Checks (Off); -- turn off validity checks
8893 A := B; -- B will not be validity checked
8894 pragma Validity_Checks (On); -- turn validity checks back on
8895 A := C; -- C will be validity checked
8896 @end example
8897
8898 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8899 @anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{11a}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{11b}
8900 @section Pragma Volatile
8901
8902
8903 Syntax:
8904
8905 @example
8906 pragma Volatile (LOCAL_NAME);
8907 @end example
8908
8909 This pragma is defined by the Ada Reference Manual, and the GNAT
8910 implementation is fully conformant with this definition. The reason it
8911 is mentioned in this section is that a pragma of the same name was supplied
8912 in some Ada 83 compilers, including DEC Ada 83. The Ada 95 / Ada 2005
8913 implementation of pragma Volatile is upwards compatible with the
8914 implementation in DEC Ada 83.
8915
8916 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8917 @anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{11c}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{11d}
8918 @section Pragma Volatile_Full_Access
8919
8920
8921 Syntax:
8922
8923 @example
8924 pragma Volatile_Full_Access (LOCAL_NAME);
8925 @end example
8926
8927 This is similar in effect to pragma Volatile, except that any reference to the
8928 object is guaranteed to be done only with instructions that read or write all
8929 the bits of the object. Furthermore, if the object is of a composite type,
8930 then any reference to a component of the object is guaranteed to read and/or
8931 write all the bits of the object.
8932
8933 The intention is that this be suitable for use with memory-mapped I/O devices
8934 on some machines. Note that there are two important respects in which this is
8935 different from @code{pragma Atomic}. First a reference to a @code{Volatile_Full_Access}
8936 object is not a sequential action in the RM 9.10 sense and, therefore, does
8937 not create a synchronization point. Second, in the case of @code{pragma Atomic},
8938 there is no guarantee that all the bits will be accessed if the reference
8939 is not to the whole object; the compiler is allowed (and generally will)
8940 access only part of the object in this case.
8941
8942 It is not permissible to specify @code{Atomic} and @code{Volatile_Full_Access} for
8943 the same object.
8944
8945 It is not permissible to specify @code{Volatile_Full_Access} for a composite
8946 (record or array) type or object that has at least one @code{Aliased} component.
8947
8948 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8949 @anchor{gnat_rm/implementation_defined_pragmas id56}@anchor{11e}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{11f}
8950 @section Pragma Volatile_Function
8951
8952
8953 Syntax:
8954
8955 @example
8956 pragma Volatile_Function [ (boolean_EXPRESSION) ];
8957 @end example
8958
8959 For the semantics of this pragma, see the entry for aspect @code{Volatile_Function}
8960 in the SPARK 2014 Reference Manual, section 7.1.2.
8961
8962 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
8963 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{120}
8964 @section Pragma Warning_As_Error
8965
8966
8967 Syntax:
8968
8969 @example
8970 pragma Warning_As_Error (static_string_EXPRESSION);
8971 @end example
8972
8973 This configuration pragma allows the programmer to specify a set
8974 of warnings that will be treated as errors. Any warning that
8975 matches the pattern given by the pragma argument will be treated
8976 as an error. This gives more precise control than -gnatwe,
8977 which treats warnings as errors.
8978
8979 This pragma can apply to regular warnings (messages enabled by -gnatw)
8980 and to style warnings (messages that start with "(style)",
8981 enabled by -gnaty).
8982
8983 The pattern may contain asterisks, which match zero or more characters
8984 in the message. For example, you can use @code{pragma Warning_As_Error
8985 ("bits of*unused")} to treat the warning message @code{warning: 960 bits of
8986 "a" unused} as an error. All characters other than asterisk are treated
8987 as literal characters in the match. The match is case insensitive; for
8988 example XYZ matches xyz.
8989
8990 Note that the pattern matches if it occurs anywhere within the warning
8991 message string (it is not necessary to put an asterisk at the start and
8992 the end of the message, since this is implied).
8993
8994 Another possibility for the static_string_EXPRESSION which works whether
8995 or not error tags are enabled (@emph{-gnatw.d}) is to use the
8996 @emph{-gnatw} tag string, enclosed in brackets,
8997 as shown in the example below, to treat a class of warnings as errors.
8998
8999 The above use of patterns to match the message applies only to warning
9000 messages generated by the front end. This pragma can also be applied to
9001 warnings provided by the back end and mentioned in @ref{121,,Pragma Warnings}.
9002 By using a single full @emph{-Wxxx} switch in the pragma, such warnings
9003 can also be treated as errors.
9004
9005 The pragma can appear either in a global configuration pragma file
9006 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
9007 configuration pragma file containing:
9008
9009 @example
9010 pragma Warning_As_Error ("[-gnatwj]");
9011 @end example
9012
9013 which will treat all obsolescent feature warnings as errors, the
9014 following program compiles as shown (compile options here are
9015 @emph{-gnatwa.d -gnatl -gnatj55}).
9016
9017 @example
9018 1. pragma Warning_As_Error ("*never assigned*");
9019 2. function Warnerr return String is
9020 3. X : Integer;
9021 |
9022 >>> error: variable "X" is never read and
9023 never assigned [-gnatwv] [warning-as-error]
9024
9025 4. Y : Integer;
9026 |
9027 >>> warning: variable "Y" is assigned but
9028 never read [-gnatwu]
9029
9030 5. begin
9031 6. Y := 0;
9032 7. return %ABC%;
9033 |
9034 >>> error: use of "%" is an obsolescent
9035 feature (RM J.2(4)), use """ instead
9036 [-gnatwj] [warning-as-error]
9037
9038 8. end;
9039
9040 8 lines: No errors, 3 warnings (2 treated as errors)
9041 @end example
9042
9043 Note that this pragma does not affect the set of warnings issued in
9044 any way, it merely changes the effect of a matching warning if one
9045 is produced as a result of other warnings options. As shown in this
9046 example, if the pragma results in a warning being treated as an error,
9047 the tag is changed from "warning:" to "error:" and the string
9048 "[warning-as-error]" is appended to the end of the message.
9049
9050 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
9051 @anchor{gnat_rm/implementation_defined_pragmas id57}@anchor{122}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{121}
9052 @section Pragma Warnings
9053
9054
9055 Syntax:
9056
9057 @example
9058 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
9059
9060 DETAILS ::= On | Off
9061 DETAILS ::= On | Off, local_NAME
9062 DETAILS ::= static_string_EXPRESSION
9063 DETAILS ::= On | Off, static_string_EXPRESSION
9064
9065 TOOL_NAME ::= GNAT | GNATProve
9066
9067 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
9068 @end example
9069
9070 Note: in Ada 83 mode, a string literal may be used in place of a static string
9071 expression (which does not exist in Ada 83).
9072
9073 Note if the second argument of @code{DETAILS} is a @code{local_NAME} then the
9074 second form is always understood. If the intention is to use
9075 the fourth form, then you can write @code{NAME & ""} to force the
9076 intepretation as a @emph{static_string_EXPRESSION}.
9077
9078 Note: if the first argument is a valid @code{TOOL_NAME}, it will be interpreted
9079 that way. The use of the @code{TOOL_NAME} argument is relevant only to users
9080 of SPARK and GNATprove, see last part of this section for details.
9081
9082 Normally warnings are enabled, with the output being controlled by
9083 the command line switch. Warnings (@code{Off}) turns off generation of
9084 warnings until a Warnings (@code{On}) is encountered or the end of the
9085 current unit. If generation of warnings is turned off using this
9086 pragma, then some or all of the warning messages are suppressed,
9087 regardless of the setting of the command line switches.
9088
9089 The @code{Reason} parameter may optionally appear as the last argument
9090 in any of the forms of this pragma. It is intended purely for the
9091 purposes of documenting the reason for the @code{Warnings} pragma.
9092 The compiler will check that the argument is a static string but
9093 otherwise ignore this argument. Other tools may provide specialized
9094 processing for this string.
9095
9096 The form with a single argument (or two arguments if Reason present),
9097 where the first argument is @code{ON} or @code{OFF}
9098 may be used as a configuration pragma.
9099
9100 If the @code{LOCAL_NAME} parameter is present, warnings are suppressed for
9101 the specified entity. This suppression is effective from the point where
9102 it occurs till the end of the extended scope of the variable (similar to
9103 the scope of @code{Suppress}). This form cannot be used as a configuration
9104 pragma.
9105
9106 In the case where the first argument is other than @code{ON} or
9107 @code{OFF},
9108 the third form with a single static_string_EXPRESSION argument (and possible
9109 reason) provides more precise
9110 control over which warnings are active. The string is a list of letters
9111 specifying which warnings are to be activated and which deactivated. The
9112 code for these letters is the same as the string used in the command
9113 line switch controlling warnings. For a brief summary, use the gnatmake
9114 command with no arguments, which will generate usage information containing
9115 the list of warnings switches supported. For
9116 full details see the section on @code{Warning Message Control} in the
9117 @cite{GNAT User's Guide}.
9118 This form can also be used as a configuration pragma.
9119
9120 The warnings controlled by the @code{-gnatw} switch are generated by the
9121 front end of the compiler. The GCC back end can provide additional warnings
9122 and they are controlled by the @code{-W} switch. Such warnings can be
9123 identified by the appearance of a string of the form @code{[-W@{xxx@}]} in the
9124 message which designates the @code{-W@emph{xxx}} switch that controls the message.
9125 The form with a single @emph{static_string_EXPRESSION} argument also works for these
9126 warnings, but the string must be a single full @code{-W@emph{xxx}} switch in this
9127 case. The above reference lists a few examples of these additional warnings.
9128
9129 The specified warnings will be in effect until the end of the program
9130 or another pragma @code{Warnings} is encountered. The effect of the pragma is
9131 cumulative. Initially the set of warnings is the standard default set
9132 as possibly modified by compiler switches. Then each pragma Warning
9133 modifies this set of warnings as specified. This form of the pragma may
9134 also be used as a configuration pragma.
9135
9136 The fourth form, with an @code{On|Off} parameter and a string, is used to
9137 control individual messages, based on their text. The string argument
9138 is a pattern that is used to match against the text of individual
9139 warning messages (not including the initial "warning: " tag).
9140
9141 The pattern may contain asterisks, which match zero or more characters in
9142 the message. For example, you can use
9143 @code{pragma Warnings (Off, "bits of*unused")} to suppress the warning
9144 message @code{warning: 960 bits of "a" unused}. No other regular
9145 expression notations are permitted. All characters other than asterisk in
9146 these three specific cases are treated as literal characters in the match.
9147 The match is case insensitive, for example XYZ matches xyz.
9148
9149 Note that the pattern matches if it occurs anywhere within the warning
9150 message string (it is not necessary to put an asterisk at the start and
9151 the end of the message, since this is implied).
9152
9153 The above use of patterns to match the message applies only to warning
9154 messages generated by the front end. This form of the pragma with a string
9155 argument can also be used to control warnings provided by the back end and
9156 mentioned above. By using a single full @code{-W@emph{xxx}} switch in the pragma,
9157 such warnings can be turned on and off.
9158
9159 There are two ways to use the pragma in this form. The OFF form can be used
9160 as a configuration pragma. The effect is to suppress all warnings (if any)
9161 that match the pattern string throughout the compilation (or match the
9162 -W switch in the back end case).
9163
9164 The second usage is to suppress a warning locally, and in this case, two
9165 pragmas must appear in sequence:
9166
9167 @example
9168 pragma Warnings (Off, Pattern);
9169 ... code where given warning is to be suppressed
9170 pragma Warnings (On, Pattern);
9171 @end example
9172
9173 In this usage, the pattern string must match in the Off and On
9174 pragmas, and (if @emph{-gnatw.w} is given) at least one matching
9175 warning must be suppressed.
9176
9177 Note: if the ON form is not found, then the effect of the OFF form extends
9178 until the end of the file (pragma Warnings is purely textual, so its effect
9179 does not stop at the end of the enclosing scope).
9180
9181 Note: to write a string that will match any warning, use the string
9182 @code{"***"}. It will not work to use a single asterisk or two
9183 asterisks since this looks like an operator name. This form with three
9184 asterisks is similar in effect to specifying @code{pragma Warnings (Off)} except (if @code{-gnatw.w} is given) that a matching
9185 @code{pragma Warnings (On, "***")} will be required. This can be
9186 helpful in avoiding forgetting to turn warnings back on.
9187
9188 Note: the debug flag @code{-gnatd.i} (@code{/NOWARNINGS_PRAGMAS} in VMS) can be
9189 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
9190 be useful in checking whether obsolete pragmas in existing programs are hiding
9191 real problems.
9192
9193 Note: pragma Warnings does not affect the processing of style messages. See
9194 separate entry for pragma Style_Checks for control of style messages.
9195
9196 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
9197 use the version of the pragma with a @code{TOOL_NAME} parameter.
9198
9199 If present, @code{TOOL_NAME} is the name of a tool, currently either @code{GNAT} for the
9200 compiler or @code{GNATprove} for the formal verification tool. A given tool only
9201 takes into account pragma Warnings that do not specify a tool name, or that
9202 specify the matching tool name. This makes it possible to disable warnings
9203 selectively for each tool, and as a consequence to detect useless pragma
9204 Warnings with switch @code{-gnatw.w}.
9205
9206 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
9207 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{123}
9208 @section Pragma Weak_External
9209
9210
9211 Syntax:
9212
9213 @example
9214 pragma Weak_External ([Entity =>] LOCAL_NAME);
9215 @end example
9216
9217 @code{LOCAL_NAME} must refer to an object that is declared at the library
9218 level. This pragma specifies that the given entity should be marked as a
9219 weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
9220 in GNU C and causes @code{LOCAL_NAME} to be emitted as a weak symbol instead
9221 of a regular symbol, that is to say a symbol that does not have to be
9222 resolved by the linker if used in conjunction with a pragma Import.
9223
9224 When a weak symbol is not resolved by the linker, its address is set to
9225 zero. This is useful in writing interfaces to external modules that may
9226 or may not be linked in the final executable, for example depending on
9227 configuration settings.
9228
9229 If a program references at run time an entity to which this pragma has been
9230 applied, and the corresponding symbol was not resolved at link time, then
9231 the execution of the program is erroneous. It is not erroneous to take the
9232 Address of such an entity, for example to guard potential references,
9233 as shown in the example below.
9234
9235 Some file formats do not support weak symbols so not all target machines
9236 support this pragma.
9237
9238 @example
9239 -- Example of the use of pragma Weak_External
9240
9241 package External_Module is
9242 key : Integer;
9243 pragma Import (C, key);
9244 pragma Weak_External (key);
9245 function Present return boolean;
9246 end External_Module;
9247
9248 with System; use System;
9249 package body External_Module is
9250 function Present return boolean is
9251 begin
9252 return key'Address /= System.Null_Address;
9253 end Present;
9254 end External_Module;
9255 @end example
9256
9257 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
9258 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{124}
9259 @section Pragma Wide_Character_Encoding
9260
9261
9262 Syntax:
9263
9264 @example
9265 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
9266 @end example
9267
9268 This pragma specifies the wide character encoding to be used in program
9269 source text appearing subsequently. It is a configuration pragma, but may
9270 also be used at any point that a pragma is allowed, and it is permissible
9271 to have more than one such pragma in a file, allowing multiple encodings
9272 to appear within the same file.
9273
9274 However, note that the pragma cannot immediately precede the relevant
9275 wide character, because then the previous encoding will still be in
9276 effect, causing "illegal character" errors.
9277
9278 The argument can be an identifier or a character literal. In the identifier
9279 case, it is one of @code{HEX}, @code{UPPER}, @code{SHIFT_JIS},
9280 @code{EUC}, @code{UTF8}, or @code{BRACKETS}. In the character literal
9281 case it is correspondingly one of the characters @code{h}, @code{u},
9282 @code{s}, @code{e}, @code{8}, or @code{b}.
9283
9284 Note that when the pragma is used within a file, it affects only the
9285 encoding within that file, and does not affect withed units, specs,
9286 or subunits.
9287
9288 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
9289 @anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{125}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{126}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{127}
9290 @chapter Implementation Defined Aspects
9291
9292
9293 Ada defines (throughout the Ada 2012 reference manual, summarized
9294 in Annex K) a set of aspects that can be specified for certain entities.
9295 These language defined aspects are implemented in GNAT in Ada 2012 mode
9296 and work as described in the Ada 2012 Reference Manual.
9297
9298 In addition, Ada 2012 allows implementations to define additional aspects
9299 whose meaning is defined by the implementation. GNAT provides
9300 a number of these implementation-defined aspects which can be used
9301 to extend and enhance the functionality of the compiler. This section of
9302 the GNAT reference manual describes these additional aspects.
9303
9304 Note that any program using these aspects may not be portable to
9305 other compilers (although GNAT implements this set of aspects on all
9306 platforms). Therefore if portability to other compilers is an important
9307 consideration, you should minimize the use of these aspects.
9308
9309 Note that for many of these aspects, the effect is essentially similar
9310 to the use of a pragma or attribute specification with the same name
9311 applied to the entity. For example, if we write:
9312
9313 @example
9314 type R is range 1 .. 100
9315 with Value_Size => 10;
9316 @end example
9317
9318 then the effect is the same as:
9319
9320 @example
9321 type R is range 1 .. 100;
9322 for R'Value_Size use 10;
9323 @end example
9324
9325 and if we write:
9326
9327 @example
9328 type R is new Integer
9329 with Shared => True;
9330 @end example
9331
9332 then the effect is the same as:
9333
9334 @example
9335 type R is new Integer;
9336 pragma Shared (R);
9337 @end example
9338
9339 In the documentation below, such cases are simply marked
9340 as being boolean aspects equivalent to the corresponding pragma
9341 or attribute definition clause.
9342
9343 @menu
9344 * Aspect Abstract_State::
9345 * Aspect Annotate::
9346 * Aspect Async_Readers::
9347 * Aspect Async_Writers::
9348 * Aspect Constant_After_Elaboration::
9349 * Aspect Contract_Cases::
9350 * Aspect Depends::
9351 * Aspect Default_Initial_Condition::
9352 * Aspect Dimension::
9353 * Aspect Dimension_System::
9354 * Aspect Disable_Controlled::
9355 * Aspect Effective_Reads::
9356 * Aspect Effective_Writes::
9357 * Aspect Extensions_Visible::
9358 * Aspect Favor_Top_Level::
9359 * Aspect Ghost::
9360 * Aspect Global::
9361 * Aspect Initial_Condition::
9362 * Aspect Initializes::
9363 * Aspect Inline_Always::
9364 * Aspect Invariant::
9365 * Aspect Invariant'Class::
9366 * Aspect Iterable::
9367 * Aspect Linker_Section::
9368 * Aspect Lock_Free::
9369 * Aspect Max_Queue_Length::
9370 * Aspect No_Caching::
9371 * Aspect No_Elaboration_Code_All::
9372 * Aspect No_Inline::
9373 * Aspect No_Tagged_Streams::
9374 * Aspect Object_Size::
9375 * Aspect Obsolescent::
9376 * Aspect Part_Of::
9377 * Aspect Persistent_BSS::
9378 * Aspect Predicate::
9379 * Aspect Pure_Function::
9380 * Aspect Refined_Depends::
9381 * Aspect Refined_Global::
9382 * Aspect Refined_Post::
9383 * Aspect Refined_State::
9384 * Aspect Remote_Access_Type::
9385 * Aspect Secondary_Stack_Size::
9386 * Aspect Scalar_Storage_Order::
9387 * Aspect Shared::
9388 * Aspect Simple_Storage_Pool::
9389 * Aspect Simple_Storage_Pool_Type::
9390 * Aspect SPARK_Mode::
9391 * Aspect Suppress_Debug_Info::
9392 * Aspect Suppress_Initialization::
9393 * Aspect Test_Case::
9394 * Aspect Thread_Local_Storage::
9395 * Aspect Universal_Aliasing::
9396 * Aspect Universal_Data::
9397 * Aspect Unmodified::
9398 * Aspect Unreferenced::
9399 * Aspect Unreferenced_Objects::
9400 * Aspect Value_Size::
9401 * Aspect Volatile_Full_Access::
9402 * Aspect Volatile_Function::
9403 * Aspect Warnings::
9404
9405 @end menu
9406
9407 @node Aspect Abstract_State,Aspect Annotate,,Implementation Defined Aspects
9408 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{128}
9409 @section Aspect Abstract_State
9410
9411
9412 @geindex Abstract_State
9413
9414 This aspect is equivalent to @ref{1c,,pragma Abstract_State}.
9415
9416 @node Aspect Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
9417 @anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{129}
9418 @section Aspect Annotate
9419
9420
9421 @geindex Annotate
9422
9423 There are three forms of this aspect (where ID is an identifier,
9424 and ARG is a general expression),
9425 corresponding to @ref{29,,pragma Annotate}.
9426
9427
9428 @table @asis
9429
9430 @item @emph{Annotate => ID}
9431
9432 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9433
9434 @item @emph{Annotate => (ID)}
9435
9436 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9437
9438 @item @emph{Annotate => (ID ,ID @{, ARG@})}
9439
9440 Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
9441 @end table
9442
9443 @node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
9444 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{12a}
9445 @section Aspect Async_Readers
9446
9447
9448 @geindex Async_Readers
9449
9450 This boolean aspect is equivalent to @ref{30,,pragma Async_Readers}.
9451
9452 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
9453 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{12b}
9454 @section Aspect Async_Writers
9455
9456
9457 @geindex Async_Writers
9458
9459 This boolean aspect is equivalent to @ref{33,,pragma Async_Writers}.
9460
9461 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
9462 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{12c}
9463 @section Aspect Constant_After_Elaboration
9464
9465
9466 @geindex Constant_After_Elaboration
9467
9468 This aspect is equivalent to @ref{44,,pragma Constant_After_Elaboration}.
9469
9470 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
9471 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{12d}
9472 @section Aspect Contract_Cases
9473
9474
9475 @geindex Contract_Cases
9476
9477 This aspect is equivalent to @ref{46,,pragma Contract_Cases}, the sequence
9478 of clauses being enclosed in parentheses so that syntactically it is an
9479 aggregate.
9480
9481 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
9482 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{12e}
9483 @section Aspect Depends
9484
9485
9486 @geindex Depends
9487
9488 This aspect is equivalent to @ref{55,,pragma Depends}.
9489
9490 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
9491 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{12f}
9492 @section Aspect Default_Initial_Condition
9493
9494
9495 @geindex Default_Initial_Condition
9496
9497 This aspect is equivalent to @ref{50,,pragma Default_Initial_Condition}.
9498
9499 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
9500 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{130}
9501 @section Aspect Dimension
9502
9503
9504 @geindex Dimension
9505
9506 The @code{Dimension} aspect is used to specify the dimensions of a given
9507 subtype of a dimensioned numeric type. The aspect also specifies a symbol
9508 used when doing formatted output of dimensioned quantities. The syntax is:
9509
9510 @example
9511 with Dimension =>
9512 ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
9513
9514 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
9515
9516 DIMENSION_VALUE ::=
9517 RATIONAL
9518 | others => RATIONAL
9519 | DISCRETE_CHOICE_LIST => RATIONAL
9520
9521 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
9522 @end example
9523
9524 This aspect can only be applied to a subtype whose parent type has
9525 a @code{Dimension_System} aspect. The aspect must specify values for
9526 all dimensions of the system. The rational values are the powers of the
9527 corresponding dimensions that are used by the compiler to verify that
9528 physical (numeric) computations are dimensionally consistent. For example,
9529 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
9530 For further examples of the usage
9531 of this aspect, see package @code{System.Dim.Mks}.
9532 Note that when the dimensioned type is an integer type, then any
9533 dimension value must be an integer literal.
9534
9535 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
9536 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{131}
9537 @section Aspect Dimension_System
9538
9539
9540 @geindex Dimension_System
9541
9542 The @code{Dimension_System} aspect is used to define a system of
9543 dimensions that will be used in subsequent subtype declarations with
9544 @code{Dimension} aspects that reference this system. The syntax is:
9545
9546 @example
9547 with Dimension_System => (DIMENSION @{, DIMENSION@});
9548
9549 DIMENSION ::= ([Unit_Name =>] IDENTIFIER,
9550 [Unit_Symbol =>] SYMBOL,
9551 [Dim_Symbol =>] SYMBOL)
9552
9553 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
9554 @end example
9555
9556 This aspect is applied to a type, which must be a numeric derived type
9557 (typically a floating-point type), that
9558 will represent values within the dimension system. Each @code{DIMENSION}
9559 corresponds to one particular dimension. A maximum of 7 dimensions may
9560 be specified. @code{Unit_Name} is the name of the dimension (for example
9561 @code{Meter}). @code{Unit_Symbol} is the shorthand used for quantities
9562 of this dimension (for example @code{m} for @code{Meter}).
9563 @code{Dim_Symbol} gives
9564 the identification within the dimension system (typically this is a
9565 single letter, e.g. @code{L} standing for length for unit name @code{Meter}).
9566 The @code{Unit_Symbol} is used in formatted output of dimensioned quantities.
9567 The @code{Dim_Symbol} is used in error messages when numeric operations have
9568 inconsistent dimensions.
9569
9570 GNAT provides the standard definition of the International MKS system in
9571 the run-time package @code{System.Dim.Mks}. You can easily define
9572 similar packages for cgs units or British units, and define conversion factors
9573 between values in different systems. The MKS system is characterized by the
9574 following aspect:
9575
9576 @example
9577 type Mks_Type is new Long_Long_Float with
9578 Dimension_System => (
9579 (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'),
9580 (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'),
9581 (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'),
9582 (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'),
9583 (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => '@@'),
9584 (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'),
9585 (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J'));
9586 @end example
9587
9588 Note that in the above type definition, we use the @code{at} symbol (@code{@@}) to
9589 represent a theta character (avoiding the use of extended Latin-1
9590 characters in this context).
9591
9592 See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
9593 Guide for detailed examples of use of the dimension system.
9594
9595 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
9596 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{132}
9597 @section Aspect Disable_Controlled
9598
9599
9600 @geindex Disable_Controlled
9601
9602 The aspect @code{Disable_Controlled} is defined for controlled record types. If
9603 active, this aspect causes suppression of all related calls to @code{Initialize},
9604 @code{Adjust}, and @code{Finalize}. The intended use is for conditional compilation,
9605 where for example you might want a record to be controlled or not depending on
9606 whether some run-time check is enabled or suppressed.
9607
9608 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9609 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{133}
9610 @section Aspect Effective_Reads
9611
9612
9613 @geindex Effective_Reads
9614
9615 This aspect is equivalent to @ref{5b,,pragma Effective_Reads}.
9616
9617 @node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
9618 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{134}
9619 @section Aspect Effective_Writes
9620
9621
9622 @geindex Effective_Writes
9623
9624 This aspect is equivalent to @ref{5d,,pragma Effective_Writes}.
9625
9626 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
9627 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{135}
9628 @section Aspect Extensions_Visible
9629
9630
9631 @geindex Extensions_Visible
9632
9633 This aspect is equivalent to @ref{69,,pragma Extensions_Visible}.
9634
9635 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9636 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{136}
9637 @section Aspect Favor_Top_Level
9638
9639
9640 @geindex Favor_Top_Level
9641
9642 This boolean aspect is equivalent to @ref{6e,,pragma Favor_Top_Level}.
9643
9644 @node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects
9645 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{137}
9646 @section Aspect Ghost
9647
9648
9649 @geindex Ghost
9650
9651 This aspect is equivalent to @ref{71,,pragma Ghost}.
9652
9653 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects
9654 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{138}
9655 @section Aspect Global
9656
9657
9658 @geindex Global
9659
9660 This aspect is equivalent to @ref{73,,pragma Global}.
9661
9662 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9663 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{139}
9664 @section Aspect Initial_Condition
9665
9666
9667 @geindex Initial_Condition
9668
9669 This aspect is equivalent to @ref{81,,pragma Initial_Condition}.
9670
9671 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9672 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{13a}
9673 @section Aspect Initializes
9674
9675
9676 @geindex Initializes
9677
9678 This aspect is equivalent to @ref{83,,pragma Initializes}.
9679
9680 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9681 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{13b}
9682 @section Aspect Inline_Always
9683
9684
9685 @geindex Inline_Always
9686
9687 This boolean aspect is equivalent to @ref{86,,pragma Inline_Always}.
9688
9689 @node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
9690 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{13c}
9691 @section Aspect Invariant
9692
9693
9694 @geindex Invariant
9695
9696 This aspect is equivalent to @ref{8d,,pragma Invariant}. It is a
9697 synonym for the language defined aspect @code{Type_Invariant} except
9698 that it is separately controllable using pragma @code{Assertion_Policy}.
9699
9700 @node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9701 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{13d}
9702 @section Aspect Invariant'Class
9703
9704
9705 @geindex Invariant'Class
9706
9707 This aspect is equivalent to @ref{106,,pragma Type_Invariant_Class}. It is a
9708 synonym for the language defined aspect @code{Type_Invariant'Class} except
9709 that it is separately controllable using pragma @code{Assertion_Policy}.
9710
9711 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
9712 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{13e}
9713 @section Aspect Iterable
9714
9715
9716 @geindex Iterable
9717
9718 This aspect provides a light-weight mechanism for loops and quantified
9719 expressions over container types, without the overhead imposed by the tampering
9720 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9721 with six named components, of which the last three are optional: @code{First},
9722 @code{Next}, @code{Has_Element}, @code{Element}, @code{Last}, and @code{Previous}.
9723 When only the first three components are specified, only the
9724 @code{for .. in} form of iteration over cursors is available. When @code{Element}
9725 is specified, both this form and the @code{for .. of} form of iteration over
9726 elements are available. If the last two components are specified, reverse
9727 iterations over the container can be specified (analogous to what can be done
9728 over predefined containers that support the @code{Reverse_Iterator} interface).
9729 The following is a typical example of use:
9730
9731 @example
9732 type List is private with
9733 Iterable => (First => First_Cursor,
9734 Next => Advance,
9735 Has_Element => Cursor_Has_Element,
9736 [Element => Get_Element]);
9737 @end example
9738
9739
9740 @itemize *
9741
9742 @item
9743 The value denoted by @code{First} must denote a primitive operation of the
9744 container type that returns a @code{Cursor}, which must a be a type declared in
9745 the container package or visible from it. For example:
9746 @end itemize
9747
9748 @example
9749 function First_Cursor (Cont : Container) return Cursor;
9750 @end example
9751
9752
9753 @itemize *
9754
9755 @item
9756 The value of @code{Next} is a primitive operation of the container type that takes
9757 both a container and a cursor and yields a cursor. For example:
9758 @end itemize
9759
9760 @example
9761 function Advance (Cont : Container; Position : Cursor) return Cursor;
9762 @end example
9763
9764
9765 @itemize *
9766
9767 @item
9768 The value of @code{Has_Element} is a primitive operation of the container type
9769 that takes both a container and a cursor and yields a boolean. For example:
9770 @end itemize
9771
9772 @example
9773 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9774 @end example
9775
9776
9777 @itemize *
9778
9779 @item
9780 The value of @code{Element} is a primitive operation of the container type that
9781 takes both a container and a cursor and yields an @code{Element_Type}, which must
9782 be a type declared in the container package or visible from it. For example:
9783 @end itemize
9784
9785 @example
9786 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9787 @end example
9788
9789 This aspect is used in the GNAT-defined formal container packages.
9790
9791 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
9792 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{13f}
9793 @section Aspect Linker_Section
9794
9795
9796 @geindex Linker_Section
9797
9798 This aspect is equivalent to @ref{95,,pragma Linker_Section}.
9799
9800 @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects
9801 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{140}
9802 @section Aspect Lock_Free
9803
9804
9805 @geindex Lock_Free
9806
9807 This boolean aspect is equivalent to @ref{97,,pragma Lock_Free}.
9808
9809 @node Aspect Max_Queue_Length,Aspect No_Caching,Aspect Lock_Free,Implementation Defined Aspects
9810 @anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{141}
9811 @section Aspect Max_Queue_Length
9812
9813
9814 @geindex Max_Queue_Length
9815
9816 This aspect is equivalent to @ref{9f,,pragma Max_Queue_Length}.
9817
9818 @node Aspect No_Caching,Aspect No_Elaboration_Code_All,Aspect Max_Queue_Length,Implementation Defined Aspects
9819 @anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{142}
9820 @section Aspect No_Caching
9821
9822
9823 @geindex No_Caching
9824
9825 This boolean aspect is equivalent to @ref{a1,,pragma No_Caching}.
9826
9827 @node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect No_Caching,Implementation Defined Aspects
9828 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{143}
9829 @section Aspect No_Elaboration_Code_All
9830
9831
9832 @geindex No_Elaboration_Code_All
9833
9834 This aspect is equivalent to @ref{a5,,pragma No_Elaboration_Code_All}
9835 for a program unit.
9836
9837 @node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9838 @anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{144}
9839 @section Aspect No_Inline
9840
9841
9842 @geindex No_Inline
9843
9844 This boolean aspect is equivalent to @ref{a8,,pragma No_Inline}.
9845
9846 @node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Inline,Implementation Defined Aspects
9847 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{145}
9848 @section Aspect No_Tagged_Streams
9849
9850
9851 @geindex No_Tagged_Streams
9852
9853 This aspect is equivalent to @ref{ac,,pragma No_Tagged_Streams} with an
9854 argument specifying a root tagged type (thus this aspect can only be
9855 applied to such a type).
9856
9857 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
9858 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{146}
9859 @section Aspect Object_Size
9860
9861
9862 @geindex Object_Size
9863
9864 This aspect is equivalent to @ref{147,,attribute Object_Size}.
9865
9866 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9867 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{148}
9868 @section Aspect Obsolescent
9869
9870
9871 @geindex Obsolsecent
9872
9873 This aspect is equivalent to @ref{af,,pragma Obsolescent}. Note that the
9874 evaluation of this aspect happens at the point of occurrence, it is not
9875 delayed until the freeze point.
9876
9877 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9878 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{149}
9879 @section Aspect Part_Of
9880
9881
9882 @geindex Part_Of
9883
9884 This aspect is equivalent to @ref{b7,,pragma Part_Of}.
9885
9886 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9887 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{14a}
9888 @section Aspect Persistent_BSS
9889
9890
9891 @geindex Persistent_BSS
9892
9893 This boolean aspect is equivalent to @ref{ba,,pragma Persistent_BSS}.
9894
9895 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9896 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{14b}
9897 @section Aspect Predicate
9898
9899
9900 @geindex Predicate
9901
9902 This aspect is equivalent to @ref{c2,,pragma Predicate}. It is thus
9903 similar to the language defined aspects @code{Dynamic_Predicate}
9904 and @code{Static_Predicate} except that whether the resulting
9905 predicate is static or dynamic is controlled by the form of the
9906 expression. It is also separately controllable using pragma
9907 @code{Assertion_Policy}.
9908
9909 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9910 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{14c}
9911 @section Aspect Pure_Function
9912
9913
9914 @geindex Pure_Function
9915
9916 This boolean aspect is equivalent to @ref{ce,,pragma Pure_Function}.
9917
9918 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
9919 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{14d}
9920 @section Aspect Refined_Depends
9921
9922
9923 @geindex Refined_Depends
9924
9925 This aspect is equivalent to @ref{d2,,pragma Refined_Depends}.
9926
9927 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
9928 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{14e}
9929 @section Aspect Refined_Global
9930
9931
9932 @geindex Refined_Global
9933
9934 This aspect is equivalent to @ref{d4,,pragma Refined_Global}.
9935
9936 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
9937 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{14f}
9938 @section Aspect Refined_Post
9939
9940
9941 @geindex Refined_Post
9942
9943 This aspect is equivalent to @ref{d6,,pragma Refined_Post}.
9944
9945 @node Aspect Refined_State,Aspect Remote_Access_Type,Aspect Refined_Post,Implementation Defined Aspects
9946 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{150}
9947 @section Aspect Refined_State
9948
9949
9950 @geindex Refined_State
9951
9952 This aspect is equivalent to @ref{d8,,pragma Refined_State}.
9953
9954 @node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Refined_State,Implementation Defined Aspects
9955 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{151}
9956 @section Aspect Remote_Access_Type
9957
9958
9959 @geindex Remote_Access_Type
9960
9961 This aspect is equivalent to @ref{dc,,pragma Remote_Access_Type}.
9962
9963 @node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects
9964 @anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{152}
9965 @section Aspect Secondary_Stack_Size
9966
9967
9968 @geindex Secondary_Stack_Size
9969
9970 This aspect is equivalent to @ref{e1,,pragma Secondary_Stack_Size}.
9971
9972 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects
9973 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{153}
9974 @section Aspect Scalar_Storage_Order
9975
9976
9977 @geindex Scalar_Storage_Order
9978
9979 This aspect is equivalent to a @ref{154,,attribute Scalar_Storage_Order}.
9980
9981 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
9982 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{155}
9983 @section Aspect Shared
9984
9985
9986 @geindex Shared
9987
9988 This boolean aspect is equivalent to @ref{e4,,pragma Shared}
9989 and is thus a synonym for aspect @code{Atomic}.
9990
9991 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
9992 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{156}
9993 @section Aspect Simple_Storage_Pool
9994
9995
9996 @geindex Simple_Storage_Pool
9997
9998 This aspect is equivalent to @ref{e9,,attribute Simple_Storage_Pool}.
9999
10000 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
10001 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{157}
10002 @section Aspect Simple_Storage_Pool_Type
10003
10004
10005 @geindex Simple_Storage_Pool_Type
10006
10007 This boolean aspect is equivalent to @ref{e7,,pragma Simple_Storage_Pool_Type}.
10008
10009 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
10010 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{158}
10011 @section Aspect SPARK_Mode
10012
10013
10014 @geindex SPARK_Mode
10015
10016 This aspect is equivalent to @ref{ef,,pragma SPARK_Mode} and
10017 may be specified for either or both of the specification and body
10018 of a subprogram or package.
10019
10020 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
10021 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{159}
10022 @section Aspect Suppress_Debug_Info
10023
10024
10025 @geindex Suppress_Debug_Info
10026
10027 This boolean aspect is equivalent to @ref{f7,,pragma Suppress_Debug_Info}.
10028
10029 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
10030 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{15a}
10031 @section Aspect Suppress_Initialization
10032
10033
10034 @geindex Suppress_Initialization
10035
10036 This boolean aspect is equivalent to @ref{fb,,pragma Suppress_Initialization}.
10037
10038 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
10039 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{15b}
10040 @section Aspect Test_Case
10041
10042
10043 @geindex Test_Case
10044
10045 This aspect is equivalent to @ref{fe,,pragma Test_Case}.
10046
10047 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
10048 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{15c}
10049 @section Aspect Thread_Local_Storage
10050
10051
10052 @geindex Thread_Local_Storage
10053
10054 This boolean aspect is equivalent to @ref{100,,pragma Thread_Local_Storage}.
10055
10056 @node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
10057 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{15d}
10058 @section Aspect Universal_Aliasing
10059
10060
10061 @geindex Universal_Aliasing
10062
10063 This boolean aspect is equivalent to @ref{10a,,pragma Universal_Aliasing}.
10064
10065 @node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
10066 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{15e}
10067 @section Aspect Universal_Data
10068
10069
10070 @geindex Universal_Data
10071
10072 This aspect is equivalent to @ref{10c,,pragma Universal_Data}.
10073
10074 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
10075 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{15f}
10076 @section Aspect Unmodified
10077
10078
10079 @geindex Unmodified
10080
10081 This boolean aspect is equivalent to @ref{10f,,pragma Unmodified}.
10082
10083 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
10084 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{160}
10085 @section Aspect Unreferenced
10086
10087
10088 @geindex Unreferenced
10089
10090 This boolean aspect is equivalent to @ref{110,,pragma Unreferenced}. Note that
10091 in the case of formal parameters, it is not permitted to have aspects for
10092 a formal parameter, so in this case the pragma form must be used.
10093
10094 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
10095 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{161}
10096 @section Aspect Unreferenced_Objects
10097
10098
10099 @geindex Unreferenced_Objects
10100
10101 This boolean aspect is equivalent to @ref{112,,pragma Unreferenced_Objects}.
10102
10103 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
10104 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{162}
10105 @section Aspect Value_Size
10106
10107
10108 @geindex Value_Size
10109
10110 This aspect is equivalent to @ref{163,,attribute Value_Size}.
10111
10112 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
10113 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{164}
10114 @section Aspect Volatile_Full_Access
10115
10116
10117 @geindex Volatile_Full_Access
10118
10119 This boolean aspect is equivalent to @ref{11d,,pragma Volatile_Full_Access}.
10120
10121 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
10122 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{165}
10123 @section Aspect Volatile_Function
10124
10125
10126 @geindex Volatile_Function
10127
10128 This boolean aspect is equivalent to @ref{11f,,pragma Volatile_Function}.
10129
10130 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
10131 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{166}
10132 @section Aspect Warnings
10133
10134
10135 @geindex Warnings
10136
10137 This aspect is equivalent to the two argument form of @ref{121,,pragma Warnings},
10138 where the first argument is @code{ON} or @code{OFF} and the second argument
10139 is the entity.
10140
10141 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
10142 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{167}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{168}
10143 @chapter Implementation Defined Attributes
10144
10145
10146 Ada defines (throughout the Ada reference manual,
10147 summarized in Annex K),
10148 a set of attributes that provide useful additional functionality in all
10149 areas of the language. These language defined attributes are implemented
10150 in GNAT and work as described in the Ada Reference Manual.
10151
10152 In addition, Ada allows implementations to define additional
10153 attributes whose meaning is defined by the implementation. GNAT provides
10154 a number of these implementation-dependent attributes which can be used
10155 to extend and enhance the functionality of the compiler. This section of
10156 the GNAT reference manual describes these additional attributes. It also
10157 describes additional implementation-dependent features of standard
10158 language-defined attributes.
10159
10160 Note that any program using these attributes may not be portable to
10161 other compilers (although GNAT implements this set of attributes on all
10162 platforms). Therefore if portability to other compilers is an important
10163 consideration, you should minimize the use of these attributes.
10164
10165 @menu
10166 * Attribute Abort_Signal::
10167 * Attribute Address_Size::
10168 * Attribute Asm_Input::
10169 * Attribute Asm_Output::
10170 * Attribute Atomic_Always_Lock_Free::
10171 * Attribute Bit::
10172 * Attribute Bit_Position::
10173 * Attribute Code_Address::
10174 * Attribute Compiler_Version::
10175 * Attribute Constrained::
10176 * Attribute Default_Bit_Order::
10177 * Attribute Default_Scalar_Storage_Order::
10178 * Attribute Deref::
10179 * Attribute Descriptor_Size::
10180 * Attribute Elaborated::
10181 * Attribute Elab_Body::
10182 * Attribute Elab_Spec::
10183 * Attribute Elab_Subp_Body::
10184 * Attribute Emax::
10185 * Attribute Enabled::
10186 * Attribute Enum_Rep::
10187 * Attribute Enum_Val::
10188 * Attribute Epsilon::
10189 * Attribute Fast_Math::
10190 * Attribute Finalization_Size::
10191 * Attribute Fixed_Value::
10192 * Attribute From_Any::
10193 * Attribute Has_Access_Values::
10194 * Attribute Has_Discriminants::
10195 * Attribute Img::
10196 * Attribute Integer_Value::
10197 * Attribute Invalid_Value::
10198 * Attribute Iterable::
10199 * Attribute Large::
10200 * Attribute Library_Level::
10201 * Attribute Lock_Free::
10202 * Attribute Loop_Entry::
10203 * Attribute Machine_Size::
10204 * Attribute Mantissa::
10205 * Attribute Maximum_Alignment::
10206 * Attribute Mechanism_Code::
10207 * Attribute Null_Parameter::
10208 * Attribute Object_Size::
10209 * Attribute Old::
10210 * Attribute Passed_By_Reference::
10211 * Attribute Pool_Address::
10212 * Attribute Range_Length::
10213 * Attribute Restriction_Set::
10214 * Attribute Result::
10215 * Attribute Safe_Emax::
10216 * Attribute Safe_Large::
10217 * Attribute Safe_Small::
10218 * Attribute Scalar_Storage_Order::
10219 * Attribute Simple_Storage_Pool::
10220 * Attribute Small::
10221 * Attribute Storage_Unit::
10222 * Attribute Stub_Type::
10223 * Attribute System_Allocator_Alignment::
10224 * Attribute Target_Name::
10225 * Attribute To_Address::
10226 * Attribute To_Any::
10227 * Attribute Type_Class::
10228 * Attribute Type_Key::
10229 * Attribute TypeCode::
10230 * Attribute Unconstrained_Array::
10231 * Attribute Universal_Literal_String::
10232 * Attribute Unrestricted_Access::
10233 * Attribute Update::
10234 * Attribute Valid_Scalars::
10235 * Attribute VADS_Size::
10236 * Attribute Value_Size::
10237 * Attribute Wchar_T_Size::
10238 * Attribute Word_Size::
10239
10240 @end menu
10241
10242 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
10243 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{169}
10244 @section Attribute Abort_Signal
10245
10246
10247 @geindex Abort_Signal
10248
10249 @code{Standard'Abort_Signal} (@code{Standard} is the only allowed
10250 prefix) provides the entity for the special exception used to signal
10251 task abort or asynchronous transfer of control. Normally this attribute
10252 should only be used in the tasking runtime (it is highly peculiar, and
10253 completely outside the normal semantics of Ada, for a user program to
10254 intercept the abort exception).
10255
10256 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
10257 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{16a}
10258 @section Attribute Address_Size
10259
10260
10261 @geindex Size of `@w{`}Address`@w{`}
10262
10263 @geindex Address_Size
10264
10265 @code{Standard'Address_Size} (@code{Standard} is the only allowed
10266 prefix) is a static constant giving the number of bits in an
10267 @code{Address}. It is the same value as System.Address'Size,
10268 but has the advantage of being static, while a direct
10269 reference to System.Address'Size is nonstatic because Address
10270 is a private type.
10271
10272 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
10273 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{16b}
10274 @section Attribute Asm_Input
10275
10276
10277 @geindex Asm_Input
10278
10279 The @code{Asm_Input} attribute denotes a function that takes two
10280 parameters. The first is a string, the second is an expression of the
10281 type designated by the prefix. The first (string) argument is required
10282 to be a static expression, and is the constraint for the parameter,
10283 (e.g., what kind of register is required). The second argument is the
10284 value to be used as the input argument. The possible values for the
10285 constant are the same as those used in the RTL, and are dependent on
10286 the configuration file used to built the GCC back end.
10287 @ref{16c,,Machine Code Insertions}
10288
10289 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
10290 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{16d}
10291 @section Attribute Asm_Output
10292
10293
10294 @geindex Asm_Output
10295
10296 The @code{Asm_Output} attribute denotes a function that takes two
10297 parameters. The first is a string, the second is the name of a variable
10298 of the type designated by the attribute prefix. The first (string)
10299 argument is required to be a static expression and designates the
10300 constraint for the parameter (e.g., what kind of register is
10301 required). The second argument is the variable to be updated with the
10302 result. The possible values for constraint are the same as those used in
10303 the RTL, and are dependent on the configuration file used to build the
10304 GCC back end. If there are no output operands, then this argument may
10305 either be omitted, or explicitly given as @code{No_Output_Operands}.
10306 @ref{16c,,Machine Code Insertions}
10307
10308 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
10309 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{16e}
10310 @section Attribute Atomic_Always_Lock_Free
10311
10312
10313 @geindex Atomic_Always_Lock_Free
10314
10315 The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type.
10316 The result is a Boolean value which is True if the type has discriminants,
10317 and False otherwise. The result indicate whether atomic operations are
10318 supported by the target for the given type.
10319
10320 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
10321 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{16f}
10322 @section Attribute Bit
10323
10324
10325 @geindex Bit
10326
10327 @code{obj'Bit}, where @code{obj} is any object, yields the bit
10328 offset within the storage unit (byte) that contains the first bit of
10329 storage allocated for the object. The value of this attribute is of the
10330 type @emph{universal_integer}, and is always a non-negative number not
10331 exceeding the value of @code{System.Storage_Unit}.
10332
10333 For an object that is a variable or a constant allocated in a register,
10334 the value is zero. (The use of this attribute does not force the
10335 allocation of a variable to memory).
10336
10337 For an object that is a formal parameter, this attribute applies
10338 to either the matching actual parameter or to a copy of the
10339 matching actual parameter.
10340
10341 For an access object the value is zero. Note that
10342 @code{obj.all'Bit} is subject to an @code{Access_Check} for the
10343 designated object. Similarly for a record component
10344 @code{X.C'Bit} is subject to a discriminant check and
10345 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
10346 are subject to index checks.
10347
10348 This attribute is designed to be compatible with the DEC Ada 83 definition
10349 and implementation of the @code{Bit} attribute.
10350
10351 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
10352 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{170}
10353 @section Attribute Bit_Position
10354
10355
10356 @geindex Bit_Position
10357
10358 @code{R.C'Bit_Position}, where @code{R} is a record object and @code{C} is one
10359 of the fields of the record type, yields the bit
10360 offset within the record contains the first bit of
10361 storage allocated for the object. The value of this attribute is of the
10362 type @emph{universal_integer}. The value depends only on the field
10363 @code{C} and is independent of the alignment of
10364 the containing record @code{R}.
10365
10366 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
10367 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{171}
10368 @section Attribute Code_Address
10369
10370
10371 @geindex Code_Address
10372
10373 @geindex Subprogram address
10374
10375 @geindex Address of subprogram code
10376
10377 The @code{'Address}
10378 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
10379 intended effect seems to be to provide
10380 an address value which can be used to call the subprogram by means of
10381 an address clause as in the following example:
10382
10383 @example
10384 procedure K is ...
10385
10386 procedure L;
10387 for L'Address use K'Address;
10388 pragma Import (Ada, L);
10389 @end example
10390
10391 A call to @code{L} is then expected to result in a call to @code{K}.
10392 In Ada 83, where there were no access-to-subprogram values, this was
10393 a common work-around for getting the effect of an indirect call.
10394 GNAT implements the above use of @code{Address} and the technique
10395 illustrated by the example code works correctly.
10396
10397 However, for some purposes, it is useful to have the address of the start
10398 of the generated code for the subprogram. On some architectures, this is
10399 not necessarily the same as the @code{Address} value described above.
10400 For example, the @code{Address} value may reference a subprogram
10401 descriptor rather than the subprogram itself.
10402
10403 The @code{'Code_Address} attribute, which can only be applied to
10404 subprogram entities, always returns the address of the start of the
10405 generated code of the specified subprogram, which may or may not be
10406 the same value as is returned by the corresponding @code{'Address}
10407 attribute.
10408
10409 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
10410 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{172}
10411 @section Attribute Compiler_Version
10412
10413
10414 @geindex Compiler_Version
10415
10416 @code{Standard'Compiler_Version} (@code{Standard} is the only allowed
10417 prefix) yields a static string identifying the version of the compiler
10418 being used to compile the unit containing the attribute reference.
10419
10420 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
10421 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{173}
10422 @section Attribute Constrained
10423
10424
10425 @geindex Constrained
10426
10427 In addition to the usage of this attribute in the Ada RM, GNAT
10428 also permits the use of the @code{'Constrained} attribute
10429 in a generic template
10430 for any type, including types without discriminants. The value of this
10431 attribute in the generic instance when applied to a scalar type or a
10432 record type without discriminants is always @code{True}. This usage is
10433 compatible with older Ada compilers, including notably DEC Ada.
10434
10435 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
10436 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{174}
10437 @section Attribute Default_Bit_Order
10438
10439
10440 @geindex Big endian
10441
10442 @geindex Little endian
10443
10444 @geindex Default_Bit_Order
10445
10446 @code{Standard'Default_Bit_Order} (@code{Standard} is the only
10447 permissible prefix), provides the value @code{System.Default_Bit_Order}
10448 as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
10449 @code{Low_Order_First}). This is used to construct the definition of
10450 @code{Default_Bit_Order} in package @code{System}.
10451
10452 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
10453 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{175}
10454 @section Attribute Default_Scalar_Storage_Order
10455
10456
10457 @geindex Big endian
10458
10459 @geindex Little endian
10460
10461 @geindex Default_Scalar_Storage_Order
10462
10463 @code{Standard'Default_Scalar_Storage_Order} (@code{Standard} is the only
10464 permissible prefix), provides the current value of the default scalar storage
10465 order (as specified using pragma @code{Default_Scalar_Storage_Order}, or
10466 equal to @code{Default_Bit_Order} if unspecified) as a
10467 @code{System.Bit_Order} value. This is a static attribute.
10468
10469 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
10470 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{176}
10471 @section Attribute Deref
10472
10473
10474 @geindex Deref
10475
10476 The attribute @code{typ'Deref(expr)} where @code{expr} is of type @code{System.Address} yields
10477 the variable of type @code{typ} that is located at the given address. It is similar
10478 to @code{(totyp (expr).all)}, where @code{totyp} is an unchecked conversion from address to
10479 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
10480 used on the left side of an assignment.
10481
10482 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
10483 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{177}
10484 @section Attribute Descriptor_Size
10485
10486
10487 @geindex Descriptor
10488
10489 @geindex Dope vector
10490
10491 @geindex Descriptor_Size
10492
10493 Nonstatic attribute @code{Descriptor_Size} returns the size in bits of the
10494 descriptor allocated for a type. The result is non-zero only for unconstrained
10495 array types and the returned value is of type universal integer. In GNAT, an
10496 array descriptor contains bounds information and is located immediately before
10497 the first element of the array.
10498
10499 @example
10500 type Unconstr_Array is array (Positive range <>) of Boolean;
10501 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
10502 @end example
10503
10504 The attribute takes into account any additional padding due to type alignment.
10505 In the example above, the descriptor contains two values of type
10506 @code{Positive} representing the low and high bound. Since @code{Positive} has
10507 a size of 31 bits and an alignment of 4, the descriptor size is @code{2 * Positive'Size + 2} or 64 bits.
10508
10509 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
10510 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{178}
10511 @section Attribute Elaborated
10512
10513
10514 @geindex Elaborated
10515
10516 The prefix of the @code{'Elaborated} attribute must be a unit name. The
10517 value is a Boolean which indicates whether or not the given unit has been
10518 elaborated. This attribute is primarily intended for internal use by the
10519 generated code for dynamic elaboration checking, but it can also be used
10520 in user programs. The value will always be True once elaboration of all
10521 units has been completed. An exception is for units which need no
10522 elaboration, the value is always False for such units.
10523
10524 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
10525 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{179}
10526 @section Attribute Elab_Body
10527
10528
10529 @geindex Elab_Body
10530
10531 This attribute can only be applied to a program unit name. It returns
10532 the entity for the corresponding elaboration procedure for elaborating
10533 the body of the referenced unit. This is used in the main generated
10534 elaboration procedure by the binder and is not normally used in any
10535 other context. However, there may be specialized situations in which it
10536 is useful to be able to call this elaboration procedure from Ada code,
10537 e.g., if it is necessary to do selective re-elaboration to fix some
10538 error.
10539
10540 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
10541 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{17a}
10542 @section Attribute Elab_Spec
10543
10544
10545 @geindex Elab_Spec
10546
10547 This attribute can only be applied to a program unit name. It returns
10548 the entity for the corresponding elaboration procedure for elaborating
10549 the spec of the referenced unit. This is used in the main
10550 generated elaboration procedure by the binder and is not normally used
10551 in any other context. However, there may be specialized situations in
10552 which it is useful to be able to call this elaboration procedure from
10553 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
10554 some error.
10555
10556 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
10557 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{17b}
10558 @section Attribute Elab_Subp_Body
10559
10560
10561 @geindex Elab_Subp_Body
10562
10563 This attribute can only be applied to a library level subprogram
10564 name and is only allowed in CodePeer mode. It returns the entity
10565 for the corresponding elaboration procedure for elaborating the body
10566 of the referenced subprogram unit. This is used in the main generated
10567 elaboration procedure by the binder in CodePeer mode only and is unrecognized
10568 otherwise.
10569
10570 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
10571 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{17c}
10572 @section Attribute Emax
10573
10574
10575 @geindex Ada 83 attributes
10576
10577 @geindex Emax
10578
10579 The @code{Emax} attribute is provided for compatibility with Ada 83. See
10580 the Ada 83 reference manual for an exact description of the semantics of
10581 this attribute.
10582
10583 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
10584 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{17d}
10585 @section Attribute Enabled
10586
10587
10588 @geindex Enabled
10589
10590 The @code{Enabled} attribute allows an application program to check at compile
10591 time to see if the designated check is currently enabled. The prefix is a
10592 simple identifier, referencing any predefined check name (other than
10593 @code{All_Checks}) or a check name introduced by pragma Check_Name. If
10594 no argument is given for the attribute, the check is for the general state
10595 of the check, if an argument is given, then it is an entity name, and the
10596 check indicates whether an @code{Suppress} or @code{Unsuppress} has been
10597 given naming the entity (if not, then the argument is ignored).
10598
10599 Note that instantiations inherit the check status at the point of the
10600 instantiation, so a useful idiom is to have a library package that
10601 introduces a check name with @code{pragma Check_Name}, and then contains
10602 generic packages or subprograms which use the @code{Enabled} attribute
10603 to see if the check is enabled. A user of this package can then issue
10604 a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
10605 the package or subprogram, controlling whether the check will be present.
10606
10607 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
10608 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{17e}
10609 @section Attribute Enum_Rep
10610
10611
10612 @geindex Representation of enums
10613
10614 @geindex Enum_Rep
10615
10616 For every enumeration subtype @code{S}, @code{S'Enum_Rep} denotes a
10617 function with the following spec:
10618
10619 @example
10620 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
10621 @end example
10622
10623 It is also allowable to apply @code{Enum_Rep} directly to an object of an
10624 enumeration type or to a non-overloaded enumeration
10625 literal. In this case @code{S'Enum_Rep} is equivalent to
10626 @code{typ'Enum_Rep(S)} where @code{typ} is the type of the
10627 enumeration literal or object.
10628
10629 The function returns the representation value for the given enumeration
10630 value. This will be equal to value of the @code{Pos} attribute in the
10631 absence of an enumeration representation clause. This is a static
10632 attribute (i.e.,:the result is static if the argument is static).
10633
10634 @code{S'Enum_Rep} can also be used with integer types and objects,
10635 in which case it simply returns the integer value. The reason for this
10636 is to allow it to be used for @code{(<>)} discrete formal arguments in
10637 a generic unit that can be instantiated with either enumeration types
10638 or integer types. Note that if @code{Enum_Rep} is used on a modular
10639 type whose upper bound exceeds the upper bound of the largest signed
10640 integer type, and the argument is a variable, so that the universal
10641 integer calculation is done at run time, then the call to @code{Enum_Rep}
10642 may raise @code{Constraint_Error}.
10643
10644 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10645 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{17f}
10646 @section Attribute Enum_Val
10647
10648
10649 @geindex Representation of enums
10650
10651 @geindex Enum_Val
10652
10653 For every enumeration subtype @code{S}, @code{S'Enum_Val} denotes a
10654 function with the following spec:
10655
10656 @example
10657 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10658 @end example
10659
10660 The function returns the enumeration value whose representation matches the
10661 argument, or raises Constraint_Error if no enumeration literal of the type
10662 has the matching value.
10663 This will be equal to value of the @code{Val} attribute in the
10664 absence of an enumeration representation clause. This is a static
10665 attribute (i.e., the result is static if the argument is static).
10666
10667 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10668 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{180}
10669 @section Attribute Epsilon
10670
10671
10672 @geindex Ada 83 attributes
10673
10674 @geindex Epsilon
10675
10676 The @code{Epsilon} attribute is provided for compatibility with Ada 83. See
10677 the Ada 83 reference manual for an exact description of the semantics of
10678 this attribute.
10679
10680 @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
10681 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{181}
10682 @section Attribute Fast_Math
10683
10684
10685 @geindex Fast_Math
10686
10687 @code{Standard'Fast_Math} (@code{Standard} is the only allowed
10688 prefix) yields a static Boolean value that is True if pragma
10689 @code{Fast_Math} is active, and False otherwise.
10690
10691 @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
10692 @anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{182}
10693 @section Attribute Finalization_Size
10694
10695
10696 @geindex Finalization_Size
10697
10698 The prefix of attribute @code{Finalization_Size} must be an object or
10699 a non-class-wide type. This attribute returns the size of any hidden data
10700 reserved by the compiler to handle finalization-related actions. The type of
10701 the attribute is @emph{universal_integer}.
10702
10703 @code{Finalization_Size} yields a value of zero for a type with no controlled
10704 parts, an object whose type has no controlled parts, or an object of a
10705 class-wide type whose tag denotes a type with no controlled parts.
10706
10707 Note that only heap-allocated objects contain finalization data.
10708
10709 @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
10710 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{183}
10711 @section Attribute Fixed_Value
10712
10713
10714 @geindex Fixed_Value
10715
10716 For every fixed-point type @code{S}, @code{S'Fixed_Value} denotes a
10717 function with the following specification:
10718
10719 @example
10720 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10721 @end example
10722
10723 The value returned is the fixed-point value @code{V} such that:
10724
10725 @example
10726 V = Arg * S'Small
10727 @end example
10728
10729 The effect is thus similar to first converting the argument to the
10730 integer type used to represent @code{S}, and then doing an unchecked
10731 conversion to the fixed-point type. The difference is
10732 that there are full range checks, to ensure that the result is in range.
10733 This attribute is primarily intended for use in implementation of the
10734 input-output functions for fixed-point values.
10735
10736 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10737 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{184}
10738 @section Attribute From_Any
10739
10740
10741 @geindex From_Any
10742
10743 This internal attribute is used for the generation of remote subprogram
10744 stubs in the context of the Distributed Systems Annex.
10745
10746 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10747 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{185}
10748 @section Attribute Has_Access_Values
10749
10750
10751 @geindex Access values
10752 @geindex testing for
10753
10754 @geindex Has_Access_Values
10755
10756 The prefix of the @code{Has_Access_Values} attribute is a type. The result
10757 is a Boolean value which is True if the is an access type, or is a composite
10758 type with a component (at any nesting depth) that is an access type, and is
10759 False otherwise.
10760 The intended use of this attribute is in conjunction with generic
10761 definitions. If the attribute is applied to a generic private type, it
10762 indicates whether or not the corresponding actual type has access values.
10763
10764 @node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
10765 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{186}
10766 @section Attribute Has_Discriminants
10767
10768
10769 @geindex Discriminants
10770 @geindex testing for
10771
10772 @geindex Has_Discriminants
10773
10774 The prefix of the @code{Has_Discriminants} attribute is a type. The result
10775 is a Boolean value which is True if the type has discriminants, and False
10776 otherwise. The intended use of this attribute is in conjunction with generic
10777 definitions. If the attribute is applied to a generic private type, it
10778 indicates whether or not the corresponding actual type has discriminants.
10779
10780 @node Attribute Img,Attribute Integer_Value,Attribute Has_Discriminants,Implementation Defined Attributes
10781 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{187}
10782 @section Attribute Img
10783
10784
10785 @geindex Img
10786
10787 The @code{Img} attribute differs from @code{Image} in that, while both can be
10788 applied directly to an object, @code{Img} cannot be applied to types.
10789
10790 Example usage of the attribute:
10791
10792 @example
10793 Put_Line ("X = " & X'Img);
10794 @end example
10795
10796 which has the same meaning as the more verbose:
10797
10798 @example
10799 Put_Line ("X = " & T'Image (X));
10800 @end example
10801
10802 where @code{T} is the (sub)type of the object @code{X}.
10803
10804 Note that technically, in analogy to @code{Image},
10805 @code{X'Img} returns a parameterless function
10806 that returns the appropriate string when called. This means that
10807 @code{X'Img} can be renamed as a function-returning-string, or used
10808 in an instantiation as a function parameter.
10809
10810 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Img,Implementation Defined Attributes
10811 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{188}
10812 @section Attribute Integer_Value
10813
10814
10815 @geindex Integer_Value
10816
10817 For every integer type @code{S}, @code{S'Integer_Value} denotes a
10818 function with the following spec:
10819
10820 @example
10821 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10822 @end example
10823
10824 The value returned is the integer value @code{V}, such that:
10825
10826 @example
10827 Arg = V * T'Small
10828 @end example
10829
10830 where @code{T} is the type of @code{Arg}.
10831 The effect is thus similar to first doing an unchecked conversion from
10832 the fixed-point type to its corresponding implementation type, and then
10833 converting the result to the target integer type. The difference is
10834 that there are full range checks, to ensure that the result is in range.
10835 This attribute is primarily intended for use in implementation of the
10836 standard input-output functions for fixed-point values.
10837
10838 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
10839 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{189}
10840 @section Attribute Invalid_Value
10841
10842
10843 @geindex Invalid_Value
10844
10845 For every scalar type S, S'Invalid_Value returns an undefined value of the
10846 type. If possible this value is an invalid representation for the type. The
10847 value returned is identical to the value used to initialize an otherwise
10848 uninitialized value of the type if pragma Initialize_Scalars is used,
10849 including the ability to modify the value with the binder -Sxx flag and
10850 relevant environment variables at run time.
10851
10852 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
10853 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{18a}
10854 @section Attribute Iterable
10855
10856
10857 @geindex Iterable
10858
10859 Equivalent to Aspect Iterable.
10860
10861 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
10862 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{18b}
10863 @section Attribute Large
10864
10865
10866 @geindex Ada 83 attributes
10867
10868 @geindex Large
10869
10870 The @code{Large} attribute is provided for compatibility with Ada 83. See
10871 the Ada 83 reference manual for an exact description of the semantics of
10872 this attribute.
10873
10874 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
10875 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{18c}
10876 @section Attribute Library_Level
10877
10878
10879 @geindex Library_Level
10880
10881 @code{P'Library_Level}, where P is an entity name,
10882 returns a Boolean value which is True if the entity is declared
10883 at the library level, and False otherwise. Note that within a
10884 generic instantition, the name of the generic unit denotes the
10885 instance, which means that this attribute can be used to test
10886 if a generic is instantiated at the library level, as shown
10887 in this example:
10888
10889 @example
10890 generic
10891 ...
10892 package Gen is
10893 pragma Compile_Time_Error
10894 (not Gen'Library_Level,
10895 "Gen can only be instantiated at library level");
10896 ...
10897 end Gen;
10898 @end example
10899
10900 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
10901 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{18d}
10902 @section Attribute Lock_Free
10903
10904
10905 @geindex Lock_Free
10906
10907 @code{P'Lock_Free}, where P is a protected object, returns True if a
10908 pragma @code{Lock_Free} applies to P.
10909
10910 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
10911 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18e}
10912 @section Attribute Loop_Entry
10913
10914
10915 @geindex Loop_Entry
10916
10917 Syntax:
10918
10919 @example
10920 X'Loop_Entry [(loop_name)]
10921 @end example
10922
10923 The @code{Loop_Entry} attribute is used to refer to the value that an
10924 expression had upon entry to a given loop in much the same way that the
10925 @code{Old} attribute in a subprogram postcondition can be used to refer
10926 to the value an expression had upon entry to the subprogram. The
10927 relevant loop is either identified by the given loop name, or it is the
10928 innermost enclosing loop when no loop name is given.
10929
10930 A @code{Loop_Entry} attribute can only occur within a
10931 @code{Loop_Variant} or @code{Loop_Invariant} pragma. A common use of
10932 @code{Loop_Entry} is to compare the current value of objects with their
10933 initial value at loop entry, in a @code{Loop_Invariant} pragma.
10934
10935 The effect of using @code{X'Loop_Entry} is the same as declaring
10936 a constant initialized with the initial value of @code{X} at loop
10937 entry. This copy is not performed if the loop is not entered, or if the
10938 corresponding pragmas are ignored or disabled.
10939
10940 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
10941 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18f}
10942 @section Attribute Machine_Size
10943
10944
10945 @geindex Machine_Size
10946
10947 This attribute is identical to the @code{Object_Size} attribute. It is
10948 provided for compatibility with the DEC Ada 83 attribute of this name.
10949
10950 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
10951 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{190}
10952 @section Attribute Mantissa
10953
10954
10955 @geindex Ada 83 attributes
10956
10957 @geindex Mantissa
10958
10959 The @code{Mantissa} attribute is provided for compatibility with Ada 83. See
10960 the Ada 83 reference manual for an exact description of the semantics of
10961 this attribute.
10962
10963 @node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
10964 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{191}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{192}
10965 @section Attribute Maximum_Alignment
10966
10967
10968 @geindex Alignment
10969 @geindex maximum
10970
10971 @geindex Maximum_Alignment
10972
10973 @code{Standard'Maximum_Alignment} (@code{Standard} is the only
10974 permissible prefix) provides the maximum useful alignment value for the
10975 target. This is a static value that can be used to specify the alignment
10976 for an object, guaranteeing that it is properly aligned in all
10977 cases.
10978
10979 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
10980 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{193}
10981 @section Attribute Mechanism_Code
10982
10983
10984 @geindex Return values
10985 @geindex passing mechanism
10986
10987 @geindex Parameters
10988 @geindex passing mechanism
10989
10990 @geindex Mechanism_Code
10991
10992 @code{func'Mechanism_Code} yields an integer code for the
10993 mechanism used for the result of function @code{func}, and
10994 @code{subprog'Mechanism_Code (n)} yields the mechanism
10995 used for formal parameter number @emph{n} (a static integer value, with 1
10996 meaning the first parameter) of subprogram @code{subprog}. The code returned is:
10997
10998
10999 @table @asis
11000
11001 @item @emph{1}
11002
11003 by copy (value)
11004
11005 @item @emph{2}
11006
11007 by reference
11008 @end table
11009
11010 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
11011 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{194}
11012 @section Attribute Null_Parameter
11013
11014
11015 @geindex Zero address
11016 @geindex passing
11017
11018 @geindex Null_Parameter
11019
11020 A reference @code{T'Null_Parameter} denotes an imaginary object of
11021 type or subtype @code{T} allocated at machine address zero. The attribute
11022 is allowed only as the default expression of a formal parameter, or as
11023 an actual expression of a subprogram call. In either case, the
11024 subprogram must be imported.
11025
11026 The identity of the object is represented by the address zero in the
11027 argument list, independent of the passing mechanism (explicit or
11028 default).
11029
11030 This capability is needed to specify that a zero address should be
11031 passed for a record or other composite object passed by reference.
11032 There is no way of indicating this without the @code{Null_Parameter}
11033 attribute.
11034
11035 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
11036 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{147}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{195}
11037 @section Attribute Object_Size
11038
11039
11040 @geindex Size
11041 @geindex used for objects
11042
11043 @geindex Object_Size
11044
11045 The size of an object is not necessarily the same as the size of the type
11046 of an object. This is because by default object sizes are increased to be
11047 a multiple of the alignment of the object. For example,
11048 @code{Natural'Size} is
11049 31, but by default objects of type @code{Natural} will have a size of 32 bits.
11050 Similarly, a record containing an integer and a character:
11051
11052 @example
11053 type Rec is record
11054 I : Integer;
11055 C : Character;
11056 end record;
11057 @end example
11058
11059 will have a size of 40 (that is @code{Rec'Size} will be 40). The
11060 alignment will be 4, because of the
11061 integer field, and so the default size of record objects for this type
11062 will be 64 (8 bytes).
11063
11064 If the alignment of the above record is specified to be 1, then the
11065 object size will be 40 (5 bytes). This is true by default, and also
11066 an object size of 40 can be explicitly specified in this case.
11067
11068 A consequence of this capability is that different object sizes can be
11069 given to subtypes that would otherwise be considered in Ada to be
11070 statically matching. But it makes no sense to consider such subtypes
11071 as statically matching. Consequently, GNAT adds a rule
11072 to the static matching rules that requires object sizes to match.
11073 Consider this example:
11074
11075 @example
11076 1. procedure BadAVConvert is
11077 2. type R is new Integer;
11078 3. subtype R1 is R range 1 .. 10;
11079 4. subtype R2 is R range 1 .. 10;
11080 5. for R1'Object_Size use 8;
11081 6. for R2'Object_Size use 16;
11082 7. type R1P is access all R1;
11083 8. type R2P is access all R2;
11084 9. R1PV : R1P := new R1'(4);
11085 10. R2PV : R2P;
11086 11. begin
11087 12. R2PV := R2P (R1PV);
11088 |
11089 >>> target designated subtype not compatible with
11090 type "R1" defined at line 3
11091
11092 13. end;
11093 @end example
11094
11095 In the absence of lines 5 and 6,
11096 types @code{R1} and @code{R2} statically match and
11097 hence the conversion on line 12 is legal. But since lines 5 and 6
11098 cause the object sizes to differ, GNAT considers that types
11099 @code{R1} and @code{R2} are not statically matching, and line 12
11100 generates the diagnostic shown above.
11101
11102 Similar additional checks are performed in other contexts requiring
11103 statically matching subtypes.
11104
11105 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
11106 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{196}
11107 @section Attribute Old
11108
11109
11110 @geindex Old
11111
11112 In addition to the usage of @code{Old} defined in the Ada 2012 RM (usage
11113 within @code{Post} aspect), GNAT also permits the use of this attribute
11114 in implementation defined pragmas @code{Postcondition},
11115 @code{Contract_Cases} and @code{Test_Case}. Also usages of
11116 @code{Old} which would be illegal according to the Ada 2012 RM
11117 definition are allowed under control of
11118 implementation defined pragma @code{Unevaluated_Use_Of_Old}.
11119
11120 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
11121 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{197}
11122 @section Attribute Passed_By_Reference
11123
11124
11125 @geindex Parameters
11126 @geindex when passed by reference
11127
11128 @geindex Passed_By_Reference
11129
11130 @code{typ'Passed_By_Reference} for any subtype @cite{typ} returns
11131 a value of type @code{Boolean} value that is @code{True} if the type is
11132 normally passed by reference and @code{False} if the type is normally
11133 passed by copy in calls. For scalar types, the result is always @code{False}
11134 and is static. For non-scalar types, the result is nonstatic.
11135
11136 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
11137 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{198}
11138 @section Attribute Pool_Address
11139
11140
11141 @geindex Parameters
11142 @geindex when passed by reference
11143
11144 @geindex Pool_Address
11145
11146 @code{X'Pool_Address} for any object @code{X} returns the address
11147 of X within its storage pool. This is the same as
11148 @code{X'Address}, except that for an unconstrained array whose
11149 bounds are allocated just before the first component,
11150 @code{X'Pool_Address} returns the address of those bounds,
11151 whereas @code{X'Address} returns the address of the first
11152 component.
11153
11154 Here, we are interpreting 'storage pool' broadly to mean
11155 @code{wherever the object is allocated}, which could be a
11156 user-defined storage pool,
11157 the global heap, on the stack, or in a static memory area.
11158 For an object created by @code{new}, @code{Ptr.all'Pool_Address} is
11159 what is passed to @code{Allocate} and returned from @code{Deallocate}.
11160
11161 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
11162 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{199}
11163 @section Attribute Range_Length
11164
11165
11166 @geindex Range_Length
11167
11168 @code{typ'Range_Length} for any discrete type @cite{typ} yields
11169 the number of values represented by the subtype (zero for a null
11170 range). The result is static for static subtypes. @code{Range_Length}
11171 applied to the index subtype of a one dimensional array always gives the
11172 same result as @code{Length} applied to the array itself.
11173
11174 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
11175 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{19a}
11176 @section Attribute Restriction_Set
11177
11178
11179 @geindex Restriction_Set
11180
11181 @geindex Restrictions
11182
11183 This attribute allows compile time testing of restrictions that
11184 are currently in effect. It is primarily intended for specializing
11185 code in the run-time based on restrictions that are active (e.g.
11186 don't need to save fpt registers if restriction No_Floating_Point
11187 is known to be in effect), but can be used anywhere.
11188
11189 There are two forms:
11190
11191 @example
11192 System'Restriction_Set (partition_boolean_restriction_NAME)
11193 System'Restriction_Set (No_Dependence => library_unit_NAME);
11194 @end example
11195
11196 In the case of the first form, the only restriction names
11197 allowed are parameterless restrictions that are checked
11198 for consistency at bind time. For a complete list see the
11199 subtype @code{System.Rident.Partition_Boolean_Restrictions}.
11200
11201 The result returned is True if the restriction is known to
11202 be in effect, and False if the restriction is known not to
11203 be in effect. An important guarantee is that the value of
11204 a Restriction_Set attribute is known to be consistent throughout
11205 all the code of a partition.
11206
11207 This is trivially achieved if the entire partition is compiled
11208 with a consistent set of restriction pragmas. However, the
11209 compilation model does not require this. It is possible to
11210 compile one set of units with one set of pragmas, and another
11211 set of units with another set of pragmas. It is even possible
11212 to compile a spec with one set of pragmas, and then WITH the
11213 same spec with a different set of pragmas. Inconsistencies
11214 in the actual use of the restriction are checked at bind time.
11215
11216 In order to achieve the guarantee of consistency for the
11217 Restriction_Set pragma, we consider that a use of the pragma
11218 that yields False is equivalent to a violation of the
11219 restriction.
11220
11221 So for example if you write
11222
11223 @example
11224 if System'Restriction_Set (No_Floating_Point) then
11225 ...
11226 else
11227 ...
11228 end if;
11229 @end example
11230
11231 And the result is False, so that the else branch is executed,
11232 you can assume that this restriction is not set for any unit
11233 in the partition. This is checked by considering this use of
11234 the restriction pragma to be a violation of the restriction
11235 No_Floating_Point. This means that no other unit can attempt
11236 to set this restriction (if some unit does attempt to set it,
11237 the binder will refuse to bind the partition).
11238
11239 Technical note: The restriction name and the unit name are
11240 intepreted entirely syntactically, as in the corresponding
11241 Restrictions pragma, they are not analyzed semantically,
11242 so they do not have a type.
11243
11244 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
11245 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{19b}
11246 @section Attribute Result
11247
11248
11249 @geindex Result
11250
11251 @code{function'Result} can only be used with in a Postcondition pragma
11252 for a function. The prefix must be the name of the corresponding function. This
11253 is used to refer to the result of the function in the postcondition expression.
11254 For a further discussion of the use of this attribute and examples of its use,
11255 see the description of pragma Postcondition.
11256
11257 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
11258 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{19c}
11259 @section Attribute Safe_Emax
11260
11261
11262 @geindex Ada 83 attributes
11263
11264 @geindex Safe_Emax
11265
11266 The @code{Safe_Emax} attribute is provided for compatibility with Ada 83. See
11267 the Ada 83 reference manual for an exact description of the semantics of
11268 this attribute.
11269
11270 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
11271 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{19d}
11272 @section Attribute Safe_Large
11273
11274
11275 @geindex Ada 83 attributes
11276
11277 @geindex Safe_Large
11278
11279 The @code{Safe_Large} attribute is provided for compatibility with Ada 83. See
11280 the Ada 83 reference manual for an exact description of the semantics of
11281 this attribute.
11282
11283 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
11284 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{19e}
11285 @section Attribute Safe_Small
11286
11287
11288 @geindex Ada 83 attributes
11289
11290 @geindex Safe_Small
11291
11292 The @code{Safe_Small} attribute is provided for compatibility with Ada 83. See
11293 the Ada 83 reference manual for an exact description of the semantics of
11294 this attribute.
11295
11296 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
11297 @anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19f}@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{154}
11298 @section Attribute Scalar_Storage_Order
11299
11300
11301 @geindex Endianness
11302
11303 @geindex Scalar storage order
11304
11305 @geindex Scalar_Storage_Order
11306
11307 For every array or record type @code{S}, the representation attribute
11308 @code{Scalar_Storage_Order} denotes the order in which storage elements
11309 that make up scalar components are ordered within S. The value given must
11310 be a static expression of type System.Bit_Order. The following is an example
11311 of the use of this feature:
11312
11313 @example
11314 -- Component type definitions
11315
11316 subtype Yr_Type is Natural range 0 .. 127;
11317 subtype Mo_Type is Natural range 1 .. 12;
11318 subtype Da_Type is Natural range 1 .. 31;
11319
11320 -- Record declaration
11321
11322 type Date is record
11323 Years_Since_1980 : Yr_Type;
11324 Month : Mo_Type;
11325 Day_Of_Month : Da_Type;
11326 end record;
11327
11328 -- Record representation clause
11329
11330 for Date use record
11331 Years_Since_1980 at 0 range 0 .. 6;
11332 Month at 0 range 7 .. 10;
11333 Day_Of_Month at 0 range 11 .. 15;
11334 end record;
11335
11336 -- Attribute definition clauses
11337
11338 for Date'Bit_Order use System.High_Order_First;
11339 for Date'Scalar_Storage_Order use System.High_Order_First;
11340 -- If Scalar_Storage_Order is specified, it must be consistent with
11341 -- Bit_Order, so it's best to always define the latter explicitly if
11342 -- the former is used.
11343 @end example
11344
11345 Other properties are as for the standard representation attribute @code{Bit_Order}
11346 defined by Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
11347
11348 For a record type @code{T}, if @code{T'Scalar_Storage_Order} is
11349 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
11350 this means that if a @code{Scalar_Storage_Order} attribute definition
11351 clause is not confirming, then the type's @code{Bit_Order} shall be
11352 specified explicitly and set to the same value.
11353
11354 Derived types inherit an explicitly set scalar storage order from their parent
11355 types. This may be overridden for the derived type by giving an explicit scalar
11356 storage order for it. However, for a record extension, the derived type must
11357 have the same scalar storage order as the parent type.
11358
11359 A component of a record type that is itself a record or an array and that does
11360 not start and end on a byte boundary must have have the same scalar storage
11361 order as the record type. A component of a bit-packed array type that is itself
11362 a record or an array must have the same scalar storage order as the array type.
11363
11364 No component of a type that has an explicit @code{Scalar_Storage_Order}
11365 attribute definition may be aliased.
11366
11367 A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
11368 with a value equal to @code{System.Default_Bit_Order}) has no effect.
11369
11370 If the opposite storage order is specified, then whenever the value of
11371 a scalar component of an object of type @code{S} is read, the storage
11372 elements of the enclosing machine scalar are first reversed (before
11373 retrieving the component value, possibly applying some shift and mask
11374 operatings on the enclosing machine scalar), and the opposite operation
11375 is done for writes.
11376
11377 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
11378 are relaxed. Instead, the following rules apply:
11379
11380
11381 @itemize *
11382
11383 @item
11384 the underlying storage elements are those at positions
11385 @code{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
11386
11387 @item
11388 the sequence of underlying storage elements shall have
11389 a size no greater than the largest machine scalar
11390
11391 @item
11392 the enclosing machine scalar is defined as the smallest machine
11393 scalar starting at a position no greater than
11394 @code{position + first_bit / storage_element_size} and covering
11395 storage elements at least up to @code{position + (last_bit + storage_element_size - 1) / storage_element_size`}
11396
11397 @item
11398 the position of the component is interpreted relative to that machine
11399 scalar.
11400 @end itemize
11401
11402 If no scalar storage order is specified for a type (either directly, or by
11403 inheritance in the case of a derived type), then the default is normally
11404 the native ordering of the target, but this default can be overridden using
11405 pragma @code{Default_Scalar_Storage_Order}.
11406
11407 If a component of @code{T} is itself of a record or array type, the specfied
11408 @code{Scalar_Storage_Order} does @emph{not} apply to that nested type: an explicit
11409 attribute definition clause must be provided for the component type as well
11410 if desired.
11411
11412 Note that the scalar storage order only affects the in-memory data
11413 representation. It has no effect on the representation used by stream
11414 attributes.
11415
11416 Note that debuggers may be unable to display the correct value of scalar
11417 components of a type for which the opposite storage order is specified.
11418
11419 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
11420 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e9}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{1a0}
11421 @section Attribute Simple_Storage_Pool
11422
11423
11424 @geindex Storage pool
11425 @geindex simple
11426
11427 @geindex Simple storage pool
11428
11429 @geindex Simple_Storage_Pool
11430
11431 For every nonformal, nonderived access-to-object type @code{Acc}, the
11432 representation attribute @code{Simple_Storage_Pool} may be specified
11433 via an attribute_definition_clause (or by specifying the equivalent aspect):
11434
11435 @example
11436 My_Pool : My_Simple_Storage_Pool_Type;
11437
11438 type Acc is access My_Data_Type;
11439
11440 for Acc'Simple_Storage_Pool use My_Pool;
11441 @end example
11442
11443 The name given in an attribute_definition_clause for the
11444 @code{Simple_Storage_Pool} attribute shall denote a variable of
11445 a 'simple storage pool type' (see pragma @cite{Simple_Storage_Pool_Type}).
11446
11447 The use of this attribute is only allowed for a prefix denoting a type
11448 for which it has been specified. The type of the attribute is the type
11449 of the variable specified as the simple storage pool of the access type,
11450 and the attribute denotes that variable.
11451
11452 It is illegal to specify both @code{Storage_Pool} and @code{Simple_Storage_Pool}
11453 for the same access type.
11454
11455 If the @code{Simple_Storage_Pool} attribute has been specified for an access
11456 type, then applying the @code{Storage_Pool} attribute to the type is flagged
11457 with a warning and its evaluation raises the exception @code{Program_Error}.
11458
11459 If the Simple_Storage_Pool attribute has been specified for an access
11460 type @code{S}, then the evaluation of the attribute @code{S'Storage_Size}
11461 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
11462 which is intended to indicate the number of storage elements reserved for
11463 the simple storage pool. If the Storage_Size function has not been defined
11464 for the simple storage pool type, then this attribute returns zero.
11465
11466 If an access type @code{S} has a specified simple storage pool of type
11467 @code{SSP}, then the evaluation of an allocator for that access type calls
11468 the primitive @code{Allocate} procedure for type @code{SSP}, passing
11469 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
11470 semantics of such allocators is the same as those defined for allocators
11471 in section 13.11 of the @cite{Ada Reference Manual}, with the term
11472 @emph{simple storage pool} substituted for @emph{storage pool}.
11473
11474 If an access type @code{S} has a specified simple storage pool of type
11475 @code{SSP}, then a call to an instance of the @code{Ada.Unchecked_Deallocation}
11476 for that access type invokes the primitive @code{Deallocate} procedure
11477 for type @code{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
11478 parameter. The detailed semantics of such unchecked deallocations is the same
11479 as defined in section 13.11.2 of the Ada Reference Manual, except that the
11480 term @emph{simple storage pool} is substituted for @emph{storage pool}.
11481
11482 @node Attribute Small,Attribute Storage_Unit,Attribute Simple_Storage_Pool,Implementation Defined Attributes
11483 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{1a1}
11484 @section Attribute Small
11485
11486
11487 @geindex Ada 83 attributes
11488
11489 @geindex Small
11490
11491 The @code{Small} attribute is defined in Ada 95 (and Ada 2005) only for
11492 fixed-point types.
11493 GNAT also allows this attribute to be applied to floating-point types
11494 for compatibility with Ada 83. See
11495 the Ada 83 reference manual for an exact description of the semantics of
11496 this attribute when applied to floating-point types.
11497
11498 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small,Implementation Defined Attributes
11499 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{1a2}
11500 @section Attribute Storage_Unit
11501
11502
11503 @geindex Storage_Unit
11504
11505 @code{Standard'Storage_Unit} (@code{Standard} is the only permissible
11506 prefix) provides the same value as @code{System.Storage_Unit}.
11507
11508 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
11509 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{1a3}
11510 @section Attribute Stub_Type
11511
11512
11513 @geindex Stub_Type
11514
11515 The GNAT implementation of remote access-to-classwide types is
11516 organized as described in AARM section E.4 (20.t): a value of an RACW type
11517 (designating a remote object) is represented as a normal access
11518 value, pointing to a "stub" object which in turn contains the
11519 necessary information to contact the designated remote object. A
11520 call on any dispatching operation of such a stub object does the
11521 remote call, if necessary, using the information in the stub object
11522 to locate the target partition, etc.
11523
11524 For a prefix @code{T} that denotes a remote access-to-classwide type,
11525 @code{T'Stub_Type} denotes the type of the corresponding stub objects.
11526
11527 By construction, the layout of @code{T'Stub_Type} is identical to that of
11528 type @code{RACW_Stub_Type} declared in the internal implementation-defined
11529 unit @code{System.Partition_Interface}. Use of this attribute will create
11530 an implicit dependency on this unit.
11531
11532 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
11533 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{1a4}
11534 @section Attribute System_Allocator_Alignment
11535
11536
11537 @geindex Alignment
11538 @geindex allocator
11539
11540 @geindex System_Allocator_Alignment
11541
11542 @code{Standard'System_Allocator_Alignment} (@code{Standard} is the only
11543 permissible prefix) provides the observable guaranted to be honored by
11544 the system allocator (malloc). This is a static value that can be used
11545 in user storage pools based on malloc either to reject allocation
11546 with alignment too large or to enable a realignment circuitry if the
11547 alignment request is larger than this value.
11548
11549 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
11550 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{1a5}
11551 @section Attribute Target_Name
11552
11553
11554 @geindex Target_Name
11555
11556 @code{Standard'Target_Name} (@code{Standard} is the only permissible
11557 prefix) provides a static string value that identifies the target
11558 for the current compilation. For GCC implementations, this is the
11559 standard gcc target name without the terminating slash (for
11560 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
11561
11562 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
11563 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{1a6}
11564 @section Attribute To_Address
11565
11566
11567 @geindex To_Address
11568
11569 The @code{System'To_Address}
11570 (@code{System} is the only permissible prefix)
11571 denotes a function identical to
11572 @code{System.Storage_Elements.To_Address} except that
11573 it is a static attribute. This means that if its argument is
11574 a static expression, then the result of the attribute is a
11575 static expression. This means that such an expression can be
11576 used in contexts (e.g., preelaborable packages) which require a
11577 static expression and where the function call could not be used
11578 (since the function call is always nonstatic, even if its
11579 argument is static). The argument must be in the range
11580 -(2**(m-1)) .. 2**m-1, where m is the memory size
11581 (typically 32 or 64). Negative values are intepreted in a
11582 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
11583 a 32 bits machine).
11584
11585 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
11586 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{1a7}
11587 @section Attribute To_Any
11588
11589
11590 @geindex To_Any
11591
11592 This internal attribute is used for the generation of remote subprogram
11593 stubs in the context of the Distributed Systems Annex.
11594
11595 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
11596 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1a8}
11597 @section Attribute Type_Class
11598
11599
11600 @geindex Type_Class
11601
11602 @code{typ'Type_Class} for any type or subtype @cite{typ} yields
11603 the value of the type class for the full type of @cite{typ}. If
11604 @cite{typ} is a generic formal type, the value is the value for the
11605 corresponding actual subtype. The value of this attribute is of type
11606 @code{System.Aux_DEC.Type_Class}, which has the following definition:
11607
11608 @example
11609 type Type_Class is
11610 (Type_Class_Enumeration,
11611 Type_Class_Integer,
11612 Type_Class_Fixed_Point,
11613 Type_Class_Floating_Point,
11614 Type_Class_Array,
11615 Type_Class_Record,
11616 Type_Class_Access,
11617 Type_Class_Task,
11618 Type_Class_Address);
11619 @end example
11620
11621 Protected types yield the value @code{Type_Class_Task}, which thus
11622 applies to all concurrent types. This attribute is designed to
11623 be compatible with the DEC Ada 83 attribute of the same name.
11624
11625 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
11626 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1a9}
11627 @section Attribute Type_Key
11628
11629
11630 @geindex Type_Key
11631
11632 The @code{Type_Key} attribute is applicable to a type or subtype and
11633 yields a value of type Standard.String containing encoded information
11634 about the type or subtype. This provides improved compatibility with
11635 other implementations that support this attribute.
11636
11637 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
11638 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1aa}
11639 @section Attribute TypeCode
11640
11641
11642 @geindex TypeCode
11643
11644 This internal attribute is used for the generation of remote subprogram
11645 stubs in the context of the Distributed Systems Annex.
11646
11647 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
11648 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1ab}
11649 @section Attribute Unconstrained_Array
11650
11651
11652 @geindex Unconstrained_Array
11653
11654 The @code{Unconstrained_Array} attribute can be used with a prefix that
11655 denotes any type or subtype. It is a static attribute that yields
11656 @code{True} if the prefix designates an unconstrained array,
11657 and @code{False} otherwise. In a generic instance, the result is
11658 still static, and yields the result of applying this test to the
11659 generic actual.
11660
11661 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
11662 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1ac}
11663 @section Attribute Universal_Literal_String
11664
11665
11666 @geindex Named numbers
11667 @geindex representation of
11668
11669 @geindex Universal_Literal_String
11670
11671 The prefix of @code{Universal_Literal_String} must be a named
11672 number. The static result is the string consisting of the characters of
11673 the number as defined in the original source. This allows the user
11674 program to access the actual text of named numbers without intermediate
11675 conversions and without the need to enclose the strings in quotes (which
11676 would preclude their use as numbers).
11677
11678 For example, the following program prints the first 50 digits of pi:
11679
11680 @example
11681 with Text_IO; use Text_IO;
11682 with Ada.Numerics;
11683 procedure Pi is
11684 begin
11685 Put (Ada.Numerics.Pi'Universal_Literal_String);
11686 end;
11687 @end example
11688
11689 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11690 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1ad}
11691 @section Attribute Unrestricted_Access
11692
11693
11694 @geindex Access
11695 @geindex unrestricted
11696
11697 @geindex Unrestricted_Access
11698
11699 The @code{Unrestricted_Access} attribute is similar to @code{Access}
11700 except that all accessibility and aliased view checks are omitted. This
11701 is a user-beware attribute.
11702
11703 For objects, it is similar to @code{Address}, for which it is a
11704 desirable replacement where the value desired is an access type.
11705 In other words, its effect is similar to first applying the
11706 @code{Address} attribute and then doing an unchecked conversion to a
11707 desired access type.
11708
11709 For subprograms, @code{P'Unrestricted_Access} may be used where
11710 @code{P'Access} would be illegal, to construct a value of a
11711 less-nested named access type that designates a more-nested
11712 subprogram. This value may be used in indirect calls, so long as the
11713 more-nested subprogram still exists; once the subprogram containing it
11714 has returned, such calls are erroneous. For example:
11715
11716 @example
11717 package body P is
11718
11719 type Less_Nested is not null access procedure;
11720 Global : Less_Nested;
11721
11722 procedure P1 is
11723 begin
11724 Global.all;
11725 end P1;
11726
11727 procedure P2 is
11728 Local_Var : Integer;
11729
11730 procedure More_Nested is
11731 begin
11732 ... Local_Var ...
11733 end More_Nested;
11734 begin
11735 Global := More_Nested'Unrestricted_Access;
11736 P1;
11737 end P2;
11738
11739 end P;
11740 @end example
11741
11742 When P1 is called from P2, the call via Global is OK, but if P1 were
11743 called after P2 returns, it would be an erroneous use of a dangling
11744 pointer.
11745
11746 For objects, it is possible to use @code{Unrestricted_Access} for any
11747 type. However, if the result is of an access-to-unconstrained array
11748 subtype, then the resulting pointer has the same scope as the context
11749 of the attribute, and must not be returned to some enclosing scope.
11750 For instance, if a function uses @code{Unrestricted_Access} to create
11751 an access-to-unconstrained-array and returns that value to the caller,
11752 the result will involve dangling pointers. In addition, it is only
11753 valid to create pointers to unconstrained arrays using this attribute
11754 if the pointer has the normal default 'fat' representation where a
11755 pointer has two components, one points to the array and one points to
11756 the bounds. If a size clause is used to force 'thin' representation
11757 for a pointer to unconstrained where there is only space for a single
11758 pointer, then the resulting pointer is not usable.
11759
11760 In the simple case where a direct use of Unrestricted_Access attempts
11761 to make a thin pointer for a non-aliased object, the compiler will
11762 reject the use as illegal, as shown in the following example:
11763
11764 @example
11765 with System; use System;
11766 procedure SliceUA2 is
11767 type A is access all String;
11768 for A'Size use Standard'Address_Size;
11769
11770 procedure P (Arg : A) is
11771 begin
11772 null;
11773 end P;
11774
11775 X : String := "hello world!";
11776 X2 : aliased String := "hello world!";
11777
11778 AV : A := X'Unrestricted_Access; -- ERROR
11779 |
11780 >>> illegal use of Unrestricted_Access attribute
11781 >>> attempt to generate thin pointer to unaliased object
11782
11783 begin
11784 P (X'Unrestricted_Access); -- ERROR
11785 |
11786 >>> illegal use of Unrestricted_Access attribute
11787 >>> attempt to generate thin pointer to unaliased object
11788
11789 P (X(7 .. 12)'Unrestricted_Access); -- ERROR
11790 |
11791 >>> illegal use of Unrestricted_Access attribute
11792 >>> attempt to generate thin pointer to unaliased object
11793
11794 P (X2'Unrestricted_Access); -- OK
11795 end;
11796 @end example
11797
11798 but other cases cannot be detected by the compiler, and are
11799 considered to be erroneous. Consider the following example:
11800
11801 @example
11802 with System; use System;
11803 with System; use System;
11804 procedure SliceUA is
11805 type AF is access all String;
11806
11807 type A is access all String;
11808 for A'Size use Standard'Address_Size;
11809
11810 procedure P (Arg : A) is
11811 begin
11812 if Arg'Length /= 6 then
11813 raise Program_Error;
11814 end if;
11815 end P;
11816
11817 X : String := "hello world!";
11818 Y : AF := X (7 .. 12)'Unrestricted_Access;
11819
11820 begin
11821 P (A (Y));
11822 end;
11823 @end example
11824
11825 A normal unconstrained array value
11826 or a constrained array object marked as aliased has the bounds in memory
11827 just before the array, so a thin pointer can retrieve both the data and
11828 the bounds. But in this case, the non-aliased object @code{X} does not have the
11829 bounds before the string. If the size clause for type @code{A}
11830 were not present, then the pointer
11831 would be a fat pointer, where one component is a pointer to the bounds,
11832 and all would be well. But with the size clause present, the conversion from
11833 fat pointer to thin pointer in the call loses the bounds, and so this
11834 is erroneous, and the program likely raises a @code{Program_Error} exception.
11835
11836 In general, it is advisable to completely
11837 avoid mixing the use of thin pointers and the use of
11838 @code{Unrestricted_Access} where the designated type is an
11839 unconstrained array. The use of thin pointers should be restricted to
11840 cases of porting legacy code that implicitly assumes the size of pointers,
11841 and such code should not in any case be using this attribute.
11842
11843 Another erroneous situation arises if the attribute is
11844 applied to a constant. The resulting pointer can be used to access the
11845 constant, but the effect of trying to modify a constant in this manner
11846 is not well-defined. Consider this example:
11847
11848 @example
11849 P : constant Integer := 4;
11850 type R is access all Integer;
11851 RV : R := P'Unrestricted_Access;
11852 ..
11853 RV.all := 3;
11854 @end example
11855
11856 Here we attempt to modify the constant P from 4 to 3, but the compiler may
11857 or may not notice this attempt, and subsequent references to P may yield
11858 either the value 3 or the value 4 or the assignment may blow up if the
11859 compiler decides to put P in read-only memory. One particular case where
11860 @code{Unrestricted_Access} can be used in this way is to modify the
11861 value of an @code{in} parameter:
11862
11863 @example
11864 procedure K (S : in String) is
11865 type R is access all Character;
11866 RV : R := S (3)'Unrestricted_Access;
11867 begin
11868 RV.all := 'a';
11869 end;
11870 @end example
11871
11872 In general this is a risky approach. It may appear to "work" but such uses of
11873 @code{Unrestricted_Access} are potentially non-portable, even from one version
11874 of GNAT to another, so are best avoided if possible.
11875
11876 @node Attribute Update,Attribute Valid_Scalars,Attribute Unrestricted_Access,Implementation Defined Attributes
11877 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1ae}
11878 @section Attribute Update
11879
11880
11881 @geindex Update
11882
11883 The @code{Update} attribute creates a copy of an array or record value
11884 with one or more modified components. The syntax is:
11885
11886 @example
11887 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
11888 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
11889 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
11890 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
11891
11892 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
11893 INDEX_EXPRESSION_LIST_LIST ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
11894 INDEX_EXPRESSION_LIST ::= ( EXPRESSION @{, EXPRESSION @} )
11895 @end example
11896
11897 where @code{PREFIX} is the name of an array or record object, the
11898 association list in parentheses does not contain an @code{others}
11899 choice and the box symbol @code{<>} may not appear in any
11900 expression. The effect is to yield a copy of the array or record value
11901 which is unchanged apart from the components mentioned in the
11902 association list, which are changed to the indicated value. The
11903 original value of the array or record value is not affected. For
11904 example:
11905
11906 @example
11907 type Arr is Array (1 .. 5) of Integer;
11908 ...
11909 Avar1 : Arr := (1,2,3,4,5);
11910 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
11911 @end example
11912
11913 yields a value for @code{Avar2} of 1,10,20,20,5 with @code{Avar1}
11914 begin unmodified. Similarly:
11915
11916 @example
11917 type Rec is A, B, C : Integer;
11918 ...
11919 Rvar1 : Rec := (A => 1, B => 2, C => 3);
11920 Rvar2 : Rec := Rvar1'Update (B => 20);
11921 @end example
11922
11923 yields a value for @code{Rvar2} of (A => 1, B => 20, C => 3),
11924 with @code{Rvar1} being unmodifed.
11925 Note that the value of the attribute reference is computed
11926 completely before it is used. This means that if you write:
11927
11928 @example
11929 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
11930 @end example
11931
11932 then the value of @code{Avar1} is not modified if @code{Function_Call}
11933 raises an exception, unlike the effect of a series of direct assignments
11934 to elements of @code{Avar1}. In general this requires that
11935 two extra complete copies of the object are required, which should be
11936 kept in mind when considering efficiency.
11937
11938 The @code{Update} attribute cannot be applied to prefixes of a limited
11939 type, and cannot reference discriminants in the case of a record type.
11940 The accessibility level of an Update attribute result object is defined
11941 as for an aggregate.
11942
11943 In the record case, no component can be mentioned more than once. In
11944 the array case, two overlapping ranges can appear in the association list,
11945 in which case the modifications are processed left to right.
11946
11947 Multi-dimensional arrays can be modified, as shown by this example:
11948
11949 @example
11950 A : array (1 .. 10, 1 .. 10) of Integer;
11951 ..
11952 A := A'Update ((1, 2) => 20, (3, 4) => 30);
11953 @end example
11954
11955 which changes element (1,2) to 20 and (3,4) to 30.
11956
11957 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Update,Implementation Defined Attributes
11958 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1af}
11959 @section Attribute Valid_Scalars
11960
11961
11962 @geindex Valid_Scalars
11963
11964 The @code{'Valid_Scalars} attribute is intended to make it easier to check the
11965 validity of scalar subcomponents of composite objects. The attribute is defined
11966 for any prefix @code{P} which denotes an object. Prefix @code{P} can be any type
11967 except for tagged private or @code{Unchecked_Union} types. The value of the
11968 attribute is of type @code{Boolean}.
11969
11970 @code{P'Valid_Scalars} yields @code{True} if and only if the evaluation of
11971 @code{C'Valid} yields @code{True} for every scalar subcomponent @code{C} of @code{P}, or if
11972 @code{P} has no scalar subcomponents. Attribute @code{'Valid_Scalars} is equivalent
11973 to attribute @code{'Valid} for scalar types.
11974
11975 It is not specified in what order the subcomponents are checked, nor whether
11976 any more are checked after any one of them is determined to be invalid. If the
11977 prefix @code{P} is of a class-wide type @code{T'Class} (where @code{T} is the associated
11978 specific type), or if the prefix @code{P} is of a specific tagged type @code{T}, then
11979 only the subcomponents of @code{T} are checked; in other words, components of
11980 extensions of @code{T} are not checked even if @code{T'Class (P)'Tag /= T'Tag}.
11981
11982 The compiler will issue a warning if it can be determined at compile time that
11983 the prefix of the attribute has no scalar subcomponents.
11984
11985 Note: @code{Valid_Scalars} can generate a lot of code, especially in the case of
11986 a large variant record. If the attribute is called in many places in the same
11987 program applied to objects of the same type, it can reduce program size to
11988 write a function with a single use of the attribute, and then call that
11989 function from multiple places.
11990
11991 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
11992 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1b0}
11993 @section Attribute VADS_Size
11994
11995
11996 @geindex Size
11997 @geindex VADS compatibility
11998
11999 @geindex VADS_Size
12000
12001 The @code{'VADS_Size} attribute is intended to make it easier to port
12002 legacy code which relies on the semantics of @code{'Size} as implemented
12003 by the VADS Ada 83 compiler. GNAT makes a best effort at duplicating the
12004 same semantic interpretation. In particular, @code{'VADS_Size} applied
12005 to a predefined or other primitive type with no Size clause yields the
12006 Object_Size (for example, @code{Natural'Size} is 32 rather than 31 on
12007 typical machines). In addition @code{'VADS_Size} applied to an object
12008 gives the result that would be obtained by applying the attribute to
12009 the corresponding type.
12010
12011 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
12012 @anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1b1}@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{163}
12013 @section Attribute Value_Size
12014
12015
12016 @geindex Size
12017 @geindex setting for not-first subtype
12018
12019 @geindex Value_Size
12020
12021 @code{type'Value_Size} is the number of bits required to represent
12022 a value of the given subtype. It is the same as @code{type'Size},
12023 but, unlike @code{Size}, may be set for non-first subtypes.
12024
12025 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
12026 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1b2}
12027 @section Attribute Wchar_T_Size
12028
12029
12030 @geindex Wchar_T_Size
12031
12032 @code{Standard'Wchar_T_Size} (@code{Standard} is the only permissible
12033 prefix) provides the size in bits of the C @code{wchar_t} type
12034 primarily for constructing the definition of this type in
12035 package @code{Interfaces.C}. The result is a static constant.
12036
12037 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
12038 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1b3}
12039 @section Attribute Word_Size
12040
12041
12042 @geindex Word_Size
12043
12044 @code{Standard'Word_Size} (@code{Standard} is the only permissible
12045 prefix) provides the value @code{System.Word_Size}. The result is
12046 a static constant.
12047
12048 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
12049 @anchor{gnat_rm/standard_and_implementation_defined_restrictions standard-and-implementation-defined-restrictions}@anchor{9}@anchor{gnat_rm/standard_and_implementation_defined_restrictions doc}@anchor{1b4}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1b5}
12050 @chapter Standard and Implementation Defined Restrictions
12051
12052
12053 All Ada Reference Manual-defined Restriction identifiers are implemented:
12054
12055
12056 @itemize *
12057
12058 @item
12059 language-defined restrictions (see 13.12.1)
12060
12061 @item
12062 tasking restrictions (see D.7)
12063
12064 @item
12065 high integrity restrictions (see H.4)
12066 @end itemize
12067
12068 GNAT implements additional restriction identifiers. All restrictions, whether
12069 language defined or GNAT-specific, are listed in the following.
12070
12071 @menu
12072 * Partition-Wide Restrictions::
12073 * Program Unit Level Restrictions::
12074
12075 @end menu
12076
12077 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
12078 @anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1b6}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1b7}
12079 @section Partition-Wide Restrictions
12080
12081
12082 There are two separate lists of restriction identifiers. The first
12083 set requires consistency throughout a partition (in other words, if the
12084 restriction identifier is used for any compilation unit in the partition,
12085 then all compilation units in the partition must obey the restriction).
12086
12087 @menu
12088 * Immediate_Reclamation::
12089 * Max_Asynchronous_Select_Nesting::
12090 * Max_Entry_Queue_Length::
12091 * Max_Protected_Entries::
12092 * Max_Select_Alternatives::
12093 * Max_Storage_At_Blocking::
12094 * Max_Task_Entries::
12095 * Max_Tasks::
12096 * No_Abort_Statements::
12097 * No_Access_Parameter_Allocators::
12098 * No_Access_Subprograms::
12099 * No_Allocators::
12100 * No_Anonymous_Allocators::
12101 * No_Asynchronous_Control::
12102 * No_Calendar::
12103 * No_Coextensions::
12104 * No_Default_Initialization::
12105 * No_Delay::
12106 * No_Dependence::
12107 * No_Direct_Boolean_Operators::
12108 * No_Dispatch::
12109 * No_Dispatching_Calls::
12110 * No_Dynamic_Attachment::
12111 * No_Dynamic_Priorities::
12112 * No_Entry_Calls_In_Elaboration_Code::
12113 * No_Enumeration_Maps::
12114 * No_Exception_Handlers::
12115 * No_Exception_Propagation::
12116 * No_Exception_Registration::
12117 * No_Exceptions::
12118 * No_Finalization::
12119 * No_Fixed_Point::
12120 * No_Floating_Point::
12121 * No_Implicit_Conditionals::
12122 * No_Implicit_Dynamic_Code::
12123 * No_Implicit_Heap_Allocations::
12124 * No_Implicit_Protected_Object_Allocations::
12125 * No_Implicit_Task_Allocations::
12126 * No_Initialize_Scalars::
12127 * No_IO::
12128 * No_Local_Allocators::
12129 * No_Local_Protected_Objects::
12130 * No_Local_Timing_Events::
12131 * No_Long_Long_Integers::
12132 * No_Multiple_Elaboration::
12133 * No_Nested_Finalization::
12134 * No_Protected_Type_Allocators::
12135 * No_Protected_Types::
12136 * No_Recursion::
12137 * No_Reentrancy::
12138 * No_Relative_Delay::
12139 * No_Requeue_Statements::
12140 * No_Secondary_Stack::
12141 * No_Select_Statements::
12142 * No_Specific_Termination_Handlers::
12143 * No_Specification_of_Aspect::
12144 * No_Standard_Allocators_After_Elaboration::
12145 * No_Standard_Storage_Pools::
12146 * No_Stream_Optimizations::
12147 * No_Streams::
12148 * No_Task_Allocators::
12149 * No_Task_At_Interrupt_Priority::
12150 * No_Task_Attributes_Package::
12151 * No_Task_Hierarchy::
12152 * No_Task_Termination::
12153 * No_Tasking::
12154 * No_Terminate_Alternatives::
12155 * No_Unchecked_Access::
12156 * No_Unchecked_Conversion::
12157 * No_Unchecked_Deallocation::
12158 * No_Use_Of_Entity::
12159 * Pure_Barriers::
12160 * Simple_Barriers::
12161 * Static_Priorities::
12162 * Static_Storage_Size::
12163
12164 @end menu
12165
12166 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
12167 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1b8}
12168 @subsection Immediate_Reclamation
12169
12170
12171 @geindex Immediate_Reclamation
12172
12173 [RM H.4] This restriction ensures that, except for storage occupied by
12174 objects created by allocators and not deallocated via unchecked
12175 deallocation, any storage reserved at run time for an object is
12176 immediately reclaimed when the object no longer exists.
12177
12178 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
12179 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1b9}
12180 @subsection Max_Asynchronous_Select_Nesting
12181
12182
12183 @geindex Max_Asynchronous_Select_Nesting
12184
12185 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
12186 selects. Violations of this restriction with a value of zero are
12187 detected at compile time. Violations of this restriction with values
12188 other than zero cause Storage_Error to be raised.
12189
12190 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
12191 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1ba}
12192 @subsection Max_Entry_Queue_Length
12193
12194
12195 @geindex Max_Entry_Queue_Length
12196
12197 [RM D.7] This restriction is a declaration that any protected entry compiled in
12198 the scope of the restriction has at most the specified number of
12199 tasks waiting on the entry at any one time, and so no queue is required.
12200 Note that this restriction is checked at run time. Violation of this
12201 restriction results in the raising of Program_Error exception at the point of
12202 the call.
12203
12204 @geindex Max_Entry_Queue_Depth
12205
12206 The restriction @code{Max_Entry_Queue_Depth} is recognized as a
12207 synonym for @code{Max_Entry_Queue_Length}. This is retained for historical
12208 compatibility purposes (and a warning will be generated for its use if
12209 warnings on obsolescent features are activated).
12210
12211 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
12212 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1bb}
12213 @subsection Max_Protected_Entries
12214
12215
12216 @geindex Max_Protected_Entries
12217
12218 [RM D.7] Specifies the maximum number of entries per protected type. The
12219 bounds of every entry family of a protected unit shall be static, or shall be
12220 defined by a discriminant of a subtype whose corresponding bound is static.
12221
12222 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
12223 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1bc}
12224 @subsection Max_Select_Alternatives
12225
12226
12227 @geindex Max_Select_Alternatives
12228
12229 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
12230
12231 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
12232 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1bd}
12233 @subsection Max_Storage_At_Blocking
12234
12235
12236 @geindex Max_Storage_At_Blocking
12237
12238 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
12239 Storage_Size that can be retained by a blocked task. A violation of this
12240 restriction causes Storage_Error to be raised.
12241
12242 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
12243 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1be}
12244 @subsection Max_Task_Entries
12245
12246
12247 @geindex Max_Task_Entries
12248
12249 [RM D.7] Specifies the maximum number of entries
12250 per task. The bounds of every entry family
12251 of a task unit shall be static, or shall be
12252 defined by a discriminant of a subtype whose
12253 corresponding bound is static.
12254
12255 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
12256 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1bf}
12257 @subsection Max_Tasks
12258
12259
12260 @geindex Max_Tasks
12261
12262 [RM D.7] Specifies the maximum number of task that may be created, not
12263 counting the creation of the environment task. Violations of this
12264 restriction with a value of zero are detected at compile
12265 time. Violations of this restriction with values other than zero cause
12266 Storage_Error to be raised.
12267
12268 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
12269 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1c0}
12270 @subsection No_Abort_Statements
12271
12272
12273 @geindex No_Abort_Statements
12274
12275 [RM D.7] There are no abort_statements, and there are
12276 no calls to Task_Identification.Abort_Task.
12277
12278 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
12279 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1c1}
12280 @subsection No_Access_Parameter_Allocators
12281
12282
12283 @geindex No_Access_Parameter_Allocators
12284
12285 [RM H.4] This restriction ensures at compile time that there are no
12286 occurrences of an allocator as the actual parameter to an access
12287 parameter.
12288
12289 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
12290 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1c2}
12291 @subsection No_Access_Subprograms
12292
12293
12294 @geindex No_Access_Subprograms
12295
12296 [RM H.4] This restriction ensures at compile time that there are no
12297 declarations of access-to-subprogram types.
12298
12299 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
12300 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1c3}
12301 @subsection No_Allocators
12302
12303
12304 @geindex No_Allocators
12305
12306 [RM H.4] This restriction ensures at compile time that there are no
12307 occurrences of an allocator.
12308
12309 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
12310 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1c4}
12311 @subsection No_Anonymous_Allocators
12312
12313
12314 @geindex No_Anonymous_Allocators
12315
12316 [RM H.4] This restriction ensures at compile time that there are no
12317 occurrences of an allocator of anonymous access type.
12318
12319 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
12320 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1c5}
12321 @subsection No_Asynchronous_Control
12322
12323
12324 @geindex No_Asynchronous_Control
12325
12326 [RM J.13] This restriction ensures at compile time that there are no semantic
12327 dependences on the predefined package Asynchronous_Task_Control.
12328
12329 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
12330 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1c6}
12331 @subsection No_Calendar
12332
12333
12334 @geindex No_Calendar
12335
12336 [GNAT] This restriction ensures at compile time that there are no semantic
12337 dependences on package Calendar.
12338
12339 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
12340 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1c7}
12341 @subsection No_Coextensions
12342
12343
12344 @geindex No_Coextensions
12345
12346 [RM H.4] This restriction ensures at compile time that there are no
12347 coextensions. See 3.10.2.
12348
12349 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
12350 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1c8}
12351 @subsection No_Default_Initialization
12352
12353
12354 @geindex No_Default_Initialization
12355
12356 [GNAT] This restriction prohibits any instance of default initialization
12357 of variables. The binder implements a consistency rule which prevents
12358 any unit compiled without the restriction from with'ing a unit with the
12359 restriction (this allows the generation of initialization procedures to
12360 be skipped, since you can be sure that no call is ever generated to an
12361 initialization procedure in a unit with the restriction active). If used
12362 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
12363 is to prohibit all cases of variables declared without a specific
12364 initializer (including the case of OUT scalar parameters).
12365
12366 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
12367 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1c9}
12368 @subsection No_Delay
12369
12370
12371 @geindex No_Delay
12372
12373 [RM H.4] This restriction ensures at compile time that there are no
12374 delay statements and no semantic dependences on package Calendar.
12375
12376 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
12377 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1ca}
12378 @subsection No_Dependence
12379
12380
12381 @geindex No_Dependence
12382
12383 [RM 13.12.1] This restriction ensures at compile time that there are no
12384 dependences on a library unit.
12385
12386 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
12387 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1cb}
12388 @subsection No_Direct_Boolean_Operators
12389
12390
12391 @geindex No_Direct_Boolean_Operators
12392
12393 [GNAT] This restriction ensures that no logical operators (and/or/xor)
12394 are used on operands of type Boolean (or any type derived from Boolean).
12395 This is intended for use in safety critical programs where the certification
12396 protocol requires the use of short-circuit (and then, or else) forms for all
12397 composite boolean operations.
12398
12399 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
12400 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1cc}
12401 @subsection No_Dispatch
12402
12403
12404 @geindex No_Dispatch
12405
12406 [RM H.4] This restriction ensures at compile time that there are no
12407 occurrences of @code{T'Class}, for any (tagged) subtype @code{T}.
12408
12409 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
12410 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1cd}
12411 @subsection No_Dispatching_Calls
12412
12413
12414 @geindex No_Dispatching_Calls
12415
12416 [GNAT] This restriction ensures at compile time that the code generated by the
12417 compiler involves no dispatching calls. The use of this restriction allows the
12418 safe use of record extensions, classwide membership tests and other classwide
12419 features not involving implicit dispatching. This restriction ensures that
12420 the code contains no indirect calls through a dispatching mechanism. Note that
12421 this includes internally-generated calls created by the compiler, for example
12422 in the implementation of class-wide objects assignments. The
12423 membership test is allowed in the presence of this restriction, because its
12424 implementation requires no dispatching.
12425 This restriction is comparable to the official Ada restriction
12426 @code{No_Dispatch} except that it is a bit less restrictive in that it allows
12427 all classwide constructs that do not imply dispatching.
12428 The following example indicates constructs that violate this restriction.
12429
12430 @example
12431 package Pkg is
12432 type T is tagged record
12433 Data : Natural;
12434 end record;
12435 procedure P (X : T);
12436
12437 type DT is new T with record
12438 More_Data : Natural;
12439 end record;
12440 procedure Q (X : DT);
12441 end Pkg;
12442
12443 with Pkg; use Pkg;
12444 procedure Example is
12445 procedure Test (O : T'Class) is
12446 N : Natural := O'Size;-- Error: Dispatching call
12447 C : T'Class := O; -- Error: implicit Dispatching Call
12448 begin
12449 if O in DT'Class then -- OK : Membership test
12450 Q (DT (O)); -- OK : Type conversion plus direct call
12451 else
12452 P (O); -- Error: Dispatching call
12453 end if;
12454 end Test;
12455
12456 Obj : DT;
12457 begin
12458 P (Obj); -- OK : Direct call
12459 P (T (Obj)); -- OK : Type conversion plus direct call
12460 P (T'Class (Obj)); -- Error: Dispatching call
12461
12462 Test (Obj); -- OK : Type conversion
12463
12464 if Obj in T'Class then -- OK : Membership test
12465 null;
12466 end if;
12467 end Example;
12468 @end example
12469
12470 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
12471 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1ce}
12472 @subsection No_Dynamic_Attachment
12473
12474
12475 @geindex No_Dynamic_Attachment
12476
12477 [RM D.7] This restriction ensures that there is no call to any of the
12478 operations defined in package Ada.Interrupts
12479 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
12480 Detach_Handler, and Reference).
12481
12482 @geindex No_Dynamic_Interrupts
12483
12484 The restriction @code{No_Dynamic_Interrupts} is recognized as a
12485 synonym for @code{No_Dynamic_Attachment}. This is retained for historical
12486 compatibility purposes (and a warning will be generated for its use if
12487 warnings on obsolescent features are activated).
12488
12489 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
12490 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1cf}
12491 @subsection No_Dynamic_Priorities
12492
12493
12494 @geindex No_Dynamic_Priorities
12495
12496 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
12497
12498 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
12499 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1d0}
12500 @subsection No_Entry_Calls_In_Elaboration_Code
12501
12502
12503 @geindex No_Entry_Calls_In_Elaboration_Code
12504
12505 [GNAT] This restriction ensures at compile time that no task or protected entry
12506 calls are made during elaboration code. As a result of the use of this
12507 restriction, the compiler can assume that no code past an accept statement
12508 in a task can be executed at elaboration time.
12509
12510 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
12511 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1d1}
12512 @subsection No_Enumeration_Maps
12513
12514
12515 @geindex No_Enumeration_Maps
12516
12517 [GNAT] This restriction ensures at compile time that no operations requiring
12518 enumeration maps are used (that is Image and Value attributes applied
12519 to enumeration types).
12520
12521 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
12522 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1d2}
12523 @subsection No_Exception_Handlers
12524
12525
12526 @geindex No_Exception_Handlers
12527
12528 [GNAT] This restriction ensures at compile time that there are no explicit
12529 exception handlers. It also indicates that no exception propagation will
12530 be provided. In this mode, exceptions may be raised but will result in
12531 an immediate call to the last chance handler, a routine that the user
12532 must define with the following profile:
12533
12534 @example
12535 procedure Last_Chance_Handler
12536 (Source_Location : System.Address; Line : Integer);
12537 pragma Export (C, Last_Chance_Handler,
12538 "__gnat_last_chance_handler");
12539 @end example
12540
12541 The parameter is a C null-terminated string representing a message to be
12542 associated with the exception (typically the source location of the raise
12543 statement generated by the compiler). The Line parameter when nonzero
12544 represents the line number in the source program where the raise occurs.
12545
12546 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
12547 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1d3}
12548 @subsection No_Exception_Propagation
12549
12550
12551 @geindex No_Exception_Propagation
12552
12553 [GNAT] This restriction guarantees that exceptions are never propagated
12554 to an outer subprogram scope. The only case in which an exception may
12555 be raised is when the handler is statically in the same subprogram, so
12556 that the effect of a raise is essentially like a goto statement. Any
12557 other raise statement (implicit or explicit) will be considered
12558 unhandled. Exception handlers are allowed, but may not contain an
12559 exception occurrence identifier (exception choice). In addition, use of
12560 the package GNAT.Current_Exception is not permitted, and reraise
12561 statements (raise with no operand) are not permitted.
12562
12563 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
12564 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1d4}
12565 @subsection No_Exception_Registration
12566
12567
12568 @geindex No_Exception_Registration
12569
12570 [GNAT] This restriction ensures at compile time that no stream operations for
12571 types Exception_Id or Exception_Occurrence are used. This also makes it
12572 impossible to pass exceptions to or from a partition with this restriction
12573 in a distributed environment. If this restriction is active, the generated
12574 code is simplified by omitting the otherwise-required global registration
12575 of exceptions when they are declared.
12576
12577 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
12578 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1d5}
12579 @subsection No_Exceptions
12580
12581
12582 @geindex No_Exceptions
12583
12584 [RM H.4] This restriction ensures at compile time that there are no
12585 raise statements and no exception handlers and also suppresses the
12586 generation of language-defined run-time checks.
12587
12588 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
12589 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1d6}
12590 @subsection No_Finalization
12591
12592
12593 @geindex No_Finalization
12594
12595 [GNAT] This restriction disables the language features described in
12596 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
12597 performed by the compiler to support these features. The following types
12598 are no longer considered controlled when this restriction is in effect:
12599
12600
12601 @itemize *
12602
12603 @item
12604 @code{Ada.Finalization.Controlled}
12605
12606 @item
12607 @code{Ada.Finalization.Limited_Controlled}
12608
12609 @item
12610 Derivations from @code{Controlled} or @code{Limited_Controlled}
12611
12612 @item
12613 Class-wide types
12614
12615 @item
12616 Protected types
12617
12618 @item
12619 Task types
12620
12621 @item
12622 Array and record types with controlled components
12623 @end itemize
12624
12625 The compiler no longer generates code to initialize, finalize or adjust an
12626 object or a nested component, either declared on the stack or on the heap. The
12627 deallocation of a controlled object no longer finalizes its contents.
12628
12629 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
12630 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1d7}
12631 @subsection No_Fixed_Point
12632
12633
12634 @geindex No_Fixed_Point
12635
12636 [RM H.4] This restriction ensures at compile time that there are no
12637 occurrences of fixed point types and operations.
12638
12639 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
12640 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1d8}
12641 @subsection No_Floating_Point
12642
12643
12644 @geindex No_Floating_Point
12645
12646 [RM H.4] This restriction ensures at compile time that there are no
12647 occurrences of floating point types and operations.
12648
12649 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
12650 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1d9}
12651 @subsection No_Implicit_Conditionals
12652
12653
12654 @geindex No_Implicit_Conditionals
12655
12656 [GNAT] This restriction ensures that the generated code does not contain any
12657 implicit conditionals, either by modifying the generated code where possible,
12658 or by rejecting any construct that would otherwise generate an implicit
12659 conditional. Note that this check does not include run time constraint
12660 checks, which on some targets may generate implicit conditionals as
12661 well. To control the latter, constraint checks can be suppressed in the
12662 normal manner. Constructs generating implicit conditionals include comparisons
12663 of composite objects and the Max/Min attributes.
12664
12665 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12666 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1da}
12667 @subsection No_Implicit_Dynamic_Code
12668
12669
12670 @geindex No_Implicit_Dynamic_Code
12671
12672 @geindex trampoline
12673
12674 [GNAT] This restriction prevents the compiler from building 'trampolines'.
12675 This is a structure that is built on the stack and contains dynamic
12676 code to be executed at run time. On some targets, a trampoline is
12677 built for the following features: @code{Access},
12678 @code{Unrestricted_Access}, or @code{Address} of a nested subprogram;
12679 nested task bodies; primitive operations of nested tagged types.
12680 Trampolines do not work on machines that prevent execution of stack
12681 data. For example, on windows systems, enabling DEP (data execution
12682 protection) will cause trampolines to raise an exception.
12683 Trampolines are also quite slow at run time.
12684
12685 On many targets, trampolines have been largely eliminated. Look at the
12686 version of system.ads for your target --- if it has
12687 Always_Compatible_Rep equal to False, then trampolines are largely
12688 eliminated. In particular, a trampoline is built for the following
12689 features: @code{Address} of a nested subprogram;
12690 @code{Access} or @code{Unrestricted_Access} of a nested subprogram,
12691 but only if pragma Favor_Top_Level applies, or the access type has a
12692 foreign-language convention; primitive operations of nested tagged
12693 types.
12694
12695 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12696 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1db}
12697 @subsection No_Implicit_Heap_Allocations
12698
12699
12700 @geindex No_Implicit_Heap_Allocations
12701
12702 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12703
12704 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12705 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1dc}
12706 @subsection No_Implicit_Protected_Object_Allocations
12707
12708
12709 @geindex No_Implicit_Protected_Object_Allocations
12710
12711 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12712 protected object.
12713
12714 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12715 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1dd}
12716 @subsection No_Implicit_Task_Allocations
12717
12718
12719 @geindex No_Implicit_Task_Allocations
12720
12721 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12722
12723 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12724 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1de}
12725 @subsection No_Initialize_Scalars
12726
12727
12728 @geindex No_Initialize_Scalars
12729
12730 [GNAT] This restriction ensures that no unit in the partition is compiled with
12731 pragma Initialize_Scalars. This allows the generation of more efficient
12732 code, and in particular eliminates dummy null initialization routines that
12733 are otherwise generated for some record and array types.
12734
12735 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
12736 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1df}
12737 @subsection No_IO
12738
12739
12740 @geindex No_IO
12741
12742 [RM H.4] This restriction ensures at compile time that there are no
12743 dependences on any of the library units Sequential_IO, Direct_IO,
12744 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
12745
12746 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
12747 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1e0}
12748 @subsection No_Local_Allocators
12749
12750
12751 @geindex No_Local_Allocators
12752
12753 [RM H.4] This restriction ensures at compile time that there are no
12754 occurrences of an allocator in subprograms, generic subprograms, tasks,
12755 and entry bodies.
12756
12757 @node No_Local_Protected_Objects,No_Local_Timing_Events,No_Local_Allocators,Partition-Wide Restrictions
12758 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1e1}
12759 @subsection No_Local_Protected_Objects
12760
12761
12762 @geindex No_Local_Protected_Objects
12763
12764 [RM D.7] This restriction ensures at compile time that protected objects are
12765 only declared at the library level.
12766
12767 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Protected_Objects,Partition-Wide Restrictions
12768 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1e2}
12769 @subsection No_Local_Timing_Events
12770
12771
12772 @geindex No_Local_Timing_Events
12773
12774 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
12775 declared at the library level.
12776
12777 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
12778 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1e3}
12779 @subsection No_Long_Long_Integers
12780
12781
12782 @geindex No_Long_Long_Integers
12783
12784 [GNAT] This partition-wide restriction forbids any explicit reference to
12785 type Standard.Long_Long_Integer, and also forbids declaring range types whose
12786 implicit base type is Long_Long_Integer, and modular types whose size exceeds
12787 Long_Integer'Size.
12788
12789 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
12790 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1e4}
12791 @subsection No_Multiple_Elaboration
12792
12793
12794 @geindex No_Multiple_Elaboration
12795
12796 [GNAT] When this restriction is active and the static elaboration model is
12797 used, and -fpreserve-control-flow is not used, the compiler is allowed to
12798 suppress the elaboration counter normally associated with the unit, even if
12799 the unit has elaboration code. This counter is typically used to check for
12800 access before elaboration and to control multiple elaboration attempts. If the
12801 restriction is used, then the situations in which multiple elaboration is
12802 possible, including non-Ada main programs and Stand Alone libraries, are not
12803 permitted and will be diagnosed by the binder.
12804
12805 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
12806 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1e5}
12807 @subsection No_Nested_Finalization
12808
12809
12810 @geindex No_Nested_Finalization
12811
12812 [RM D.7] All objects requiring finalization are declared at the library level.
12813
12814 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
12815 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1e6}
12816 @subsection No_Protected_Type_Allocators
12817
12818
12819 @geindex No_Protected_Type_Allocators
12820
12821 [RM D.7] This restriction ensures at compile time that there are no allocator
12822 expressions that attempt to allocate protected objects.
12823
12824 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
12825 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1e7}
12826 @subsection No_Protected_Types
12827
12828
12829 @geindex No_Protected_Types
12830
12831 [RM H.4] This restriction ensures at compile time that there are no
12832 declarations of protected types or protected objects.
12833
12834 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
12835 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1e8}
12836 @subsection No_Recursion
12837
12838
12839 @geindex No_Recursion
12840
12841 [RM H.4] A program execution is erroneous if a subprogram is invoked as
12842 part of its execution.
12843
12844 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
12845 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1e9}
12846 @subsection No_Reentrancy
12847
12848
12849 @geindex No_Reentrancy
12850
12851 [RM H.4] A program execution is erroneous if a subprogram is executed by
12852 two tasks at the same time.
12853
12854 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
12855 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1ea}
12856 @subsection No_Relative_Delay
12857
12858
12859 @geindex No_Relative_Delay
12860
12861 [RM D.7] This restriction ensures at compile time that there are no delay
12862 relative statements and prevents expressions such as @code{delay 1.23;} from
12863 appearing in source code.
12864
12865 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
12866 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1eb}
12867 @subsection No_Requeue_Statements
12868
12869
12870 @geindex No_Requeue_Statements
12871
12872 [RM D.7] This restriction ensures at compile time that no requeue statements
12873 are permitted and prevents keyword @code{requeue} from being used in source
12874 code.
12875
12876 @geindex No_Requeue
12877
12878 The restriction @code{No_Requeue} is recognized as a
12879 synonym for @code{No_Requeue_Statements}. This is retained for historical
12880 compatibility purposes (and a warning will be generated for its use if
12881 warnings on oNobsolescent features are activated).
12882
12883 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
12884 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1ec}
12885 @subsection No_Secondary_Stack
12886
12887
12888 @geindex No_Secondary_Stack
12889
12890 [GNAT] This restriction ensures at compile time that the generated code
12891 does not contain any reference to the secondary stack. The secondary
12892 stack is used to implement functions returning unconstrained objects
12893 (arrays or records) on some targets. Suppresses the allocation of
12894 secondary stacks for tasks (excluding the environment task) at run time.
12895
12896 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
12897 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1ed}
12898 @subsection No_Select_Statements
12899
12900
12901 @geindex No_Select_Statements
12902
12903 [RM D.7] This restriction ensures at compile time no select statements of any
12904 kind are permitted, that is the keyword @code{select} may not appear.
12905
12906 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
12907 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1ee}
12908 @subsection No_Specific_Termination_Handlers
12909
12910
12911 @geindex No_Specific_Termination_Handlers
12912
12913 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
12914 or to Ada.Task_Termination.Specific_Handler.
12915
12916 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
12917 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1ef}
12918 @subsection No_Specification_of_Aspect
12919
12920
12921 @geindex No_Specification_of_Aspect
12922
12923 [RM 13.12.1] This restriction checks at compile time that no aspect
12924 specification, attribute definition clause, or pragma is given for a
12925 given aspect.
12926
12927 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
12928 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1f0}
12929 @subsection No_Standard_Allocators_After_Elaboration
12930
12931
12932 @geindex No_Standard_Allocators_After_Elaboration
12933
12934 [RM D.7] Specifies that an allocator using a standard storage pool
12935 should never be evaluated at run time after the elaboration of the
12936 library items of the partition has completed. Otherwise, Storage_Error
12937 is raised.
12938
12939 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
12940 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1f1}
12941 @subsection No_Standard_Storage_Pools
12942
12943
12944 @geindex No_Standard_Storage_Pools
12945
12946 [GNAT] This restriction ensures at compile time that no access types
12947 use the standard default storage pool. Any access type declared must
12948 have an explicit Storage_Pool attribute defined specifying a
12949 user-defined storage pool.
12950
12951 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
12952 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1f2}
12953 @subsection No_Stream_Optimizations
12954
12955
12956 @geindex No_Stream_Optimizations
12957
12958 [GNAT] This restriction affects the performance of stream operations on types
12959 @code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
12960 compiler uses block reads and writes when manipulating @code{String} objects
12961 due to their superior performance. When this restriction is in effect, the
12962 compiler performs all IO operations on a per-character basis.
12963
12964 @node No_Streams,No_Task_Allocators,No_Stream_Optimizations,Partition-Wide Restrictions
12965 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1f3}
12966 @subsection No_Streams
12967
12968
12969 @geindex No_Streams
12970
12971 [GNAT] This restriction ensures at compile/bind time that there are no
12972 stream objects created and no use of stream attributes.
12973 This restriction does not forbid dependences on the package
12974 @code{Ada.Streams}. So it is permissible to with
12975 @code{Ada.Streams} (or another package that does so itself)
12976 as long as no actual stream objects are created and no
12977 stream attributes are used.
12978
12979 Note that the use of restriction allows optimization of tagged types,
12980 since they do not need to worry about dispatching stream operations.
12981 To take maximum advantage of this space-saving optimization, any
12982 unit declaring a tagged type should be compiled with the restriction,
12983 though this is not required.
12984
12985 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Streams,Partition-Wide Restrictions
12986 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1f4}
12987 @subsection No_Task_Allocators
12988
12989
12990 @geindex No_Task_Allocators
12991
12992 [RM D.7] There are no allocators for task types
12993 or types containing task subcomponents.
12994
12995 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
12996 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1f5}
12997 @subsection No_Task_At_Interrupt_Priority
12998
12999
13000 @geindex No_Task_At_Interrupt_Priority
13001
13002 [GNAT] This restriction ensures at compile time that there is no
13003 Interrupt_Priority aspect or pragma for a task or a task type. As
13004 a consequence, the tasks are always created with a priority below
13005 that an interrupt priority.
13006
13007 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
13008 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1f6}
13009 @subsection No_Task_Attributes_Package
13010
13011
13012 @geindex No_Task_Attributes_Package
13013
13014 [GNAT] This restriction ensures at compile time that there are no implicit or
13015 explicit dependencies on the package @code{Ada.Task_Attributes}.
13016
13017 @geindex No_Task_Attributes
13018
13019 The restriction @code{No_Task_Attributes} is recognized as a synonym
13020 for @code{No_Task_Attributes_Package}. This is retained for historical
13021 compatibility purposes (and a warning will be generated for its use if
13022 warnings on obsolescent features are activated).
13023
13024 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
13025 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1f7}
13026 @subsection No_Task_Hierarchy
13027
13028
13029 @geindex No_Task_Hierarchy
13030
13031 [RM D.7] All (non-environment) tasks depend
13032 directly on the environment task of the partition.
13033
13034 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
13035 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1f8}
13036 @subsection No_Task_Termination
13037
13038
13039 @geindex No_Task_Termination
13040
13041 [RM D.7] Tasks that terminate are erroneous.
13042
13043 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
13044 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1f9}
13045 @subsection No_Tasking
13046
13047
13048 @geindex No_Tasking
13049
13050 [GNAT] This restriction prevents the declaration of tasks or task types
13051 throughout the partition. It is similar in effect to the use of
13052 @code{Max_Tasks => 0} except that violations are caught at compile time
13053 and cause an error message to be output either by the compiler or
13054 binder.
13055
13056 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
13057 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1fa}
13058 @subsection No_Terminate_Alternatives
13059
13060
13061 @geindex No_Terminate_Alternatives
13062
13063 [RM D.7] There are no selective accepts with terminate alternatives.
13064
13065 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
13066 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1fb}
13067 @subsection No_Unchecked_Access
13068
13069
13070 @geindex No_Unchecked_Access
13071
13072 [RM H.4] This restriction ensures at compile time that there are no
13073 occurrences of the Unchecked_Access attribute.
13074
13075 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
13076 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{1fc}
13077 @subsection No_Unchecked_Conversion
13078
13079
13080 @geindex No_Unchecked_Conversion
13081
13082 [RM J.13] This restriction ensures at compile time that there are no semantic
13083 dependences on the predefined generic function Unchecked_Conversion.
13084
13085 @node No_Unchecked_Deallocation,No_Use_Of_Entity,No_Unchecked_Conversion,Partition-Wide Restrictions
13086 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{1fd}
13087 @subsection No_Unchecked_Deallocation
13088
13089
13090 @geindex No_Unchecked_Deallocation
13091
13092 [RM J.13] This restriction ensures at compile time that there are no semantic
13093 dependences on the predefined generic procedure Unchecked_Deallocation.
13094
13095 @node No_Use_Of_Entity,Pure_Barriers,No_Unchecked_Deallocation,Partition-Wide Restrictions
13096 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{1fe}
13097 @subsection No_Use_Of_Entity
13098
13099
13100 @geindex No_Use_Of_Entity
13101
13102 [GNAT] This restriction ensures at compile time that there are no references
13103 to the entity given in the form
13104
13105 @example
13106 No_Use_Of_Entity => Name
13107 @end example
13108
13109 where @code{Name} is the fully qualified entity, for example
13110
13111 @example
13112 No_Use_Of_Entity => Ada.Text_IO.Put_Line
13113 @end example
13114
13115 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
13116 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{1ff}
13117 @subsection Pure_Barriers
13118
13119
13120 @geindex Pure_Barriers
13121
13122 [GNAT] This restriction ensures at compile time that protected entry
13123 barriers are restricted to:
13124
13125
13126 @itemize *
13127
13128 @item
13129 components of the protected object (excluding selection from dereferences),
13130
13131 @item
13132 constant declarations,
13133
13134 @item
13135 named numbers,
13136
13137 @item
13138 enumeration literals,
13139
13140 @item
13141 integer literals,
13142
13143 @item
13144 real literals,
13145
13146 @item
13147 character literals,
13148
13149 @item
13150 implicitly defined comparison operators,
13151
13152 @item
13153 uses of the Standard."not" operator,
13154
13155 @item
13156 short-circuit operator,
13157
13158 @item
13159 the Count attribute
13160 @end itemize
13161
13162 This restriction is a relaxation of the Simple_Barriers restriction,
13163 but still ensures absence of side effects, exceptions, and recursion
13164 during the evaluation of the barriers.
13165
13166 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
13167 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{200}
13168 @subsection Simple_Barriers
13169
13170
13171 @geindex Simple_Barriers
13172
13173 [RM D.7] This restriction ensures at compile time that barriers in entry
13174 declarations for protected types are restricted to either static boolean
13175 expressions or references to simple boolean variables defined in the private
13176 part of the protected type. No other form of entry barriers is permitted.
13177
13178 @geindex Boolean_Entry_Barriers
13179
13180 The restriction @code{Boolean_Entry_Barriers} is recognized as a
13181 synonym for @code{Simple_Barriers}. This is retained for historical
13182 compatibility purposes (and a warning will be generated for its use if
13183 warnings on obsolescent features are activated).
13184
13185 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
13186 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{201}
13187 @subsection Static_Priorities
13188
13189
13190 @geindex Static_Priorities
13191
13192 [GNAT] This restriction ensures at compile time that all priority expressions
13193 are static, and that there are no dependences on the package
13194 @code{Ada.Dynamic_Priorities}.
13195
13196 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
13197 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{202}
13198 @subsection Static_Storage_Size
13199
13200
13201 @geindex Static_Storage_Size
13202
13203 [GNAT] This restriction ensures at compile time that any expression appearing
13204 in a Storage_Size pragma or attribute definition clause is static.
13205
13206 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
13207 @anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{203}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{204}
13208 @section Program Unit Level Restrictions
13209
13210
13211 The second set of restriction identifiers
13212 does not require partition-wide consistency.
13213 The restriction may be enforced for a single
13214 compilation unit without any effect on any of the
13215 other compilation units in the partition.
13216
13217 @menu
13218 * No_Elaboration_Code::
13219 * No_Dynamic_Sized_Objects::
13220 * No_Entry_Queue::
13221 * No_Implementation_Aspect_Specifications::
13222 * No_Implementation_Attributes::
13223 * No_Implementation_Identifiers::
13224 * No_Implementation_Pragmas::
13225 * No_Implementation_Restrictions::
13226 * No_Implementation_Units::
13227 * No_Implicit_Aliasing::
13228 * No_Implicit_Loops::
13229 * No_Obsolescent_Features::
13230 * No_Wide_Characters::
13231 * Static_Dispatch_Tables::
13232 * SPARK_05::
13233
13234 @end menu
13235
13236 @node No_Elaboration_Code,No_Dynamic_Sized_Objects,,Program Unit Level Restrictions
13237 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{205}
13238 @subsection No_Elaboration_Code
13239
13240
13241 @geindex No_Elaboration_Code
13242
13243 [GNAT] This restriction ensures at compile time that no elaboration code is
13244 generated. Note that this is not the same condition as is enforced
13245 by pragma @code{Preelaborate}. There are cases in which pragma
13246 @code{Preelaborate} still permits code to be generated (e.g., code
13247 to initialize a large array to all zeroes), and there are cases of units
13248 which do not meet the requirements for pragma @code{Preelaborate},
13249 but for which no elaboration code is generated. Generally, it is
13250 the case that preelaborable units will meet the restrictions, with
13251 the exception of large aggregates initialized with an others_clause,
13252 and exception declarations (which generate calls to a run-time
13253 registry procedure). This restriction is enforced on
13254 a unit by unit basis, it need not be obeyed consistently
13255 throughout a partition.
13256
13257 In the case of aggregates with others, if the aggregate has a dynamic
13258 size, there is no way to eliminate the elaboration code (such dynamic
13259 bounds would be incompatible with @code{Preelaborate} in any case). If
13260 the bounds are static, then use of this restriction actually modifies
13261 the code choice of the compiler to avoid generating a loop, and instead
13262 generate the aggregate statically if possible, no matter how many times
13263 the data for the others clause must be repeatedly generated.
13264
13265 It is not possible to precisely document
13266 the constructs which are compatible with this restriction, since,
13267 unlike most other restrictions, this is not a restriction on the
13268 source code, but a restriction on the generated object code. For
13269 example, if the source contains a declaration:
13270
13271 @example
13272 Val : constant Integer := X;
13273 @end example
13274
13275 where X is not a static constant, it may be possible, depending
13276 on complex optimization circuitry, for the compiler to figure
13277 out the value of X at compile time, in which case this initialization
13278 can be done by the loader, and requires no initialization code. It
13279 is not possible to document the precise conditions under which the
13280 optimizer can figure this out.
13281
13282 Note that this the implementation of this restriction requires full
13283 code generation. If it is used in conjunction with "semantics only"
13284 checking, then some cases of violations may be missed.
13285
13286 When this restriction is active, we are not requesting control-flow
13287 preservation with -fpreserve-control-flow, and the static elaboration model is
13288 used, the compiler is allowed to suppress the elaboration counter normally
13289 associated with the unit. This counter is typically used to check for access
13290 before elaboration and to control multiple elaboration attempts.
13291
13292 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Elaboration_Code,Program Unit Level Restrictions
13293 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{206}
13294 @subsection No_Dynamic_Sized_Objects
13295
13296
13297 @geindex No_Dynamic_Sized_Objects
13298
13299 [GNAT] This restriction disallows certain constructs that might lead to the
13300 creation of dynamic-sized composite objects (or array or discriminated type).
13301 An array subtype indication is illegal if the bounds are not static
13302 or references to discriminants of an enclosing type.
13303 A discriminated subtype indication is illegal if the type has
13304 discriminant-dependent array components or a variant part, and the
13305 discriminants are not static. In addition, array and record aggregates are
13306 illegal in corresponding cases. Note that this restriction does not forbid
13307 access discriminants. It is often a good idea to combine this restriction
13308 with No_Secondary_Stack.
13309
13310 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
13311 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{207}
13312 @subsection No_Entry_Queue
13313
13314
13315 @geindex No_Entry_Queue
13316
13317 [GNAT] This restriction is a declaration that any protected entry compiled in
13318 the scope of the restriction has at most one task waiting on the entry
13319 at any one time, and so no queue is required. This restriction is not
13320 checked at compile time. A program execution is erroneous if an attempt
13321 is made to queue a second task on such an entry.
13322
13323 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
13324 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{208}
13325 @subsection No_Implementation_Aspect_Specifications
13326
13327
13328 @geindex No_Implementation_Aspect_Specifications
13329
13330 [RM 13.12.1] This restriction checks at compile time that no
13331 GNAT-defined aspects are present. With this restriction, the only
13332 aspects that can be used are those defined in the Ada Reference Manual.
13333
13334 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
13335 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{209}
13336 @subsection No_Implementation_Attributes
13337
13338
13339 @geindex No_Implementation_Attributes
13340
13341 [RM 13.12.1] This restriction checks at compile time that no
13342 GNAT-defined attributes are present. With this restriction, the only
13343 attributes that can be used are those defined in the Ada Reference
13344 Manual.
13345
13346 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
13347 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{20a}
13348 @subsection No_Implementation_Identifiers
13349
13350
13351 @geindex No_Implementation_Identifiers
13352
13353 [RM 13.12.1] This restriction checks at compile time that no
13354 implementation-defined identifiers (marked with pragma Implementation_Defined)
13355 occur within language-defined packages.
13356
13357 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
13358 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{20b}
13359 @subsection No_Implementation_Pragmas
13360
13361
13362 @geindex No_Implementation_Pragmas
13363
13364 [RM 13.12.1] This restriction checks at compile time that no
13365 GNAT-defined pragmas are present. With this restriction, the only
13366 pragmas that can be used are those defined in the Ada Reference Manual.
13367
13368 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
13369 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{20c}
13370 @subsection No_Implementation_Restrictions
13371
13372
13373 @geindex No_Implementation_Restrictions
13374
13375 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
13376 identifiers (other than @code{No_Implementation_Restrictions} itself)
13377 are present. With this restriction, the only other restriction identifiers
13378 that can be used are those defined in the Ada Reference Manual.
13379
13380 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
13381 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{20d}
13382 @subsection No_Implementation_Units
13383
13384
13385 @geindex No_Implementation_Units
13386
13387 [RM 13.12.1] This restriction checks at compile time that there is no
13388 mention in the context clause of any implementation-defined descendants
13389 of packages Ada, Interfaces, or System.
13390
13391 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
13392 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{20e}
13393 @subsection No_Implicit_Aliasing
13394
13395
13396 @geindex No_Implicit_Aliasing
13397
13398 [GNAT] This restriction, which is not required to be partition-wide consistent,
13399 requires an explicit aliased keyword for an object to which 'Access,
13400 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
13401 the 'Unrestricted_Access attribute for objects. Note: the reason that
13402 Unrestricted_Access is forbidden is that it would require the prefix
13403 to be aliased, and in such cases, it can always be replaced by
13404 the standard attribute Unchecked_Access which is preferable.
13405
13406 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
13407 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{20f}
13408 @subsection No_Implicit_Loops
13409
13410
13411 @geindex No_Implicit_Loops
13412
13413 [GNAT] This restriction ensures that the generated code of the unit marked
13414 with this restriction does not contain any implicit @code{for} loops, either by
13415 modifying the generated code where possible, or by rejecting any construct
13416 that would otherwise generate an implicit @code{for} loop. If this restriction is
13417 active, it is possible to build large array aggregates with all static
13418 components without generating an intermediate temporary, and without generating
13419 a loop to initialize individual components. Otherwise, a loop is created for
13420 arrays larger than about 5000 scalar components. Note that if this restriction
13421 is set in the spec of a package, it will not apply to its body.
13422
13423 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
13424 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{210}
13425 @subsection No_Obsolescent_Features
13426
13427
13428 @geindex No_Obsolescent_Features
13429
13430 [RM 13.12.1] This restriction checks at compile time that no obsolescent
13431 features are used, as defined in Annex J of the Ada Reference Manual.
13432
13433 @node No_Wide_Characters,Static_Dispatch_Tables,No_Obsolescent_Features,Program Unit Level Restrictions
13434 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{211}
13435 @subsection No_Wide_Characters
13436
13437
13438 @geindex No_Wide_Characters
13439
13440 [GNAT] This restriction ensures at compile time that no uses of the types
13441 @code{Wide_Character} or @code{Wide_String} or corresponding wide
13442 wide types
13443 appear, and that no wide or wide wide string or character literals
13444 appear in the program (that is literals representing characters not in
13445 type @code{Character}).
13446
13447 @node Static_Dispatch_Tables,SPARK_05,No_Wide_Characters,Program Unit Level Restrictions
13448 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{212}
13449 @subsection Static_Dispatch_Tables
13450
13451
13452 @geindex Static_Dispatch_Tables
13453
13454 [GNAT] This restriction checks at compile time that all the artifacts
13455 associated with dispatch tables can be placed in read-only memory.
13456
13457 @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions
13458 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{213}
13459 @subsection SPARK_05
13460
13461
13462 @geindex SPARK_05
13463
13464 [GNAT] This restriction checks at compile time that some constructs forbidden
13465 in SPARK 2005 are not present. Note that SPARK 2005 has been superseded by
13466 SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
13467 a codebase respects SPARK 2014 restrictions, mark the code with pragma or
13468 aspect @code{SPARK_Mode}, and run the tool GNATprove at Stone assurance level, as
13469 follows:
13470
13471 @example
13472 gnatprove -P project.gpr --mode=stone
13473 @end example
13474
13475 or equivalently:
13476
13477 @example
13478 gnatprove -P project.gpr --mode=check_all
13479 @end example
13480
13481 With restriction @code{SPARK_05}, error messages related to SPARK 2005 restriction
13482 have the form:
13483
13484 @example
13485 violation of restriction "SPARK_05" at <source-location>
13486 <error message>
13487 @end example
13488
13489 @geindex SPARK
13490
13491 The restriction @code{SPARK} is recognized as a synonym for @code{SPARK_05}. This is
13492 retained for historical compatibility purposes (and an unconditional warning
13493 will be generated for its use, advising replacement by @code{SPARK_05}).
13494
13495 This is not a replacement for the semantic checks performed by the
13496 SPARK Examiner tool, as the compiler currently only deals with code,
13497 not SPARK 2005 annotations, and does not guarantee catching all
13498 cases of constructs forbidden by SPARK 2005.
13499
13500 Thus it may well be the case that code which passes the compiler with
13501 the SPARK 2005 restriction is rejected by the SPARK Examiner, e.g. due to
13502 the different visibility rules of the Examiner based on SPARK 2005
13503 @code{inherit} annotations.
13504
13505 This restriction can be useful in providing an initial filter for code
13506 developed using SPARK 2005, or in examining legacy code to see how far
13507 it is from meeting SPARK 2005 restrictions.
13508
13509 The list below summarizes the checks that are performed when this
13510 restriction is in force:
13511
13512
13513 @itemize *
13514
13515 @item
13516 No block statements
13517
13518 @item
13519 No case statements with only an others clause
13520
13521 @item
13522 Exit statements in loops must respect the SPARK 2005 language restrictions
13523
13524 @item
13525 No goto statements
13526
13527 @item
13528 Return can only appear as last statement in function
13529
13530 @item
13531 Function must have return statement
13532
13533 @item
13534 Loop parameter specification must include subtype mark
13535
13536 @item
13537 Prefix of expanded name cannot be a loop statement
13538
13539 @item
13540 Abstract subprogram not allowed
13541
13542 @item
13543 User-defined operators not allowed
13544
13545 @item
13546 Access type parameters not allowed
13547
13548 @item
13549 Default expressions for parameters not allowed
13550
13551 @item
13552 Default expressions for record fields not allowed
13553
13554 @item
13555 No tasking constructs allowed
13556
13557 @item
13558 Label needed at end of subprograms and packages
13559
13560 @item
13561 No mixing of positional and named parameter association
13562
13563 @item
13564 No access types as result type
13565
13566 @item
13567 No unconstrained arrays as result types
13568
13569 @item
13570 No null procedures
13571
13572 @item
13573 Initial and later declarations must be in correct order (declaration can't come after body)
13574
13575 @item
13576 No attributes on private types if full declaration not visible
13577
13578 @item
13579 No package declaration within package specification
13580
13581 @item
13582 No controlled types
13583
13584 @item
13585 No discriminant types
13586
13587 @item
13588 No overloading
13589
13590 @item
13591 Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
13592
13593 @item
13594 Access attribute not allowed
13595
13596 @item
13597 Allocator not allowed
13598
13599 @item
13600 Result of catenation must be String
13601
13602 @item
13603 Operands of catenation must be string literal, static char or another catenation
13604
13605 @item
13606 No conditional expressions
13607
13608 @item
13609 No explicit dereference
13610
13611 @item
13612 Quantified expression not allowed
13613
13614 @item
13615 Slicing not allowed
13616
13617 @item
13618 No exception renaming
13619
13620 @item
13621 No generic renaming
13622
13623 @item
13624 No object renaming
13625
13626 @item
13627 No use clause
13628
13629 @item
13630 Aggregates must be qualified
13631
13632 @item
13633 Nonstatic choice in array aggregates not allowed
13634
13635 @item
13636 The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
13637
13638 @item
13639 No mixing of positional and named association in aggregate, no multi choice
13640
13641 @item
13642 AND, OR and XOR for arrays only allowed when operands have same static bounds
13643
13644 @item
13645 Fixed point operands to * or / must be qualified or converted
13646
13647 @item
13648 Comparison operators not allowed for Booleans or arrays (except strings)
13649
13650 @item
13651 Equality not allowed for arrays with non-matching static bounds (except strings)
13652
13653 @item
13654 Conversion / qualification not allowed for arrays with non-matching static bounds
13655
13656 @item
13657 Subprogram declaration only allowed in package spec (unless followed by import)
13658
13659 @item
13660 Access types not allowed
13661
13662 @item
13663 Incomplete type declaration not allowed
13664
13665 @item
13666 Object and subtype declarations must respect SPARK 2005 restrictions
13667
13668 @item
13669 Digits or delta constraint not allowed
13670
13671 @item
13672 Decimal fixed point type not allowed
13673
13674 @item
13675 Aliasing of objects not allowed
13676
13677 @item
13678 Modular type modulus must be power of 2
13679
13680 @item
13681 Base not allowed on subtype mark
13682
13683 @item
13684 Unary operators not allowed on modular types (except not)
13685
13686 @item
13687 Untagged record cannot be null
13688
13689 @item
13690 No class-wide operations
13691
13692 @item
13693 Initialization expressions must respect SPARK 2005 restrictions
13694
13695 @item
13696 Nonstatic ranges not allowed except in iteration schemes
13697
13698 @item
13699 String subtypes must have lower bound of 1
13700
13701 @item
13702 Subtype of Boolean cannot have constraint
13703
13704 @item
13705 At most one tagged type or extension per package
13706
13707 @item
13708 Interface is not allowed
13709
13710 @item
13711 Character literal cannot be prefixed (selector name cannot be character literal)
13712
13713 @item
13714 Record aggregate cannot contain 'others'
13715
13716 @item
13717 Component association in record aggregate must contain a single choice
13718
13719 @item
13720 Ancestor part cannot be a type mark
13721
13722 @item
13723 Attributes 'Image, 'Width and 'Value not allowed
13724
13725 @item
13726 Functions may not update globals
13727
13728 @item
13729 Subprograms may not contain direct calls to themselves (prevents recursion within unit)
13730
13731 @item
13732 Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
13733 @end itemize
13734
13735 The following restrictions are enforced, but note that they are actually more
13736 strict that the latest SPARK 2005 language definition:
13737
13738
13739 @itemize *
13740
13741 @item
13742 No derived types other than tagged type extensions
13743
13744 @item
13745 Subtype of unconstrained array must have constraint
13746 @end itemize
13747
13748 This list summarises the main SPARK 2005 language rules that are not
13749 currently checked by the SPARK_05 restriction:
13750
13751
13752 @itemize *
13753
13754 @item
13755 SPARK 2005 annotations are treated as comments so are not checked at all
13756
13757 @item
13758 Based real literals not allowed
13759
13760 @item
13761 Objects cannot be initialized at declaration by calls to user-defined functions
13762
13763 @item
13764 Objects cannot be initialized at declaration by assignments from variables
13765
13766 @item
13767 Objects cannot be initialized at declaration by assignments from indexed/selected components
13768
13769 @item
13770 Ranges shall not be null
13771
13772 @item
13773 A fixed point delta expression must be a simple expression
13774
13775 @item
13776 Restrictions on where renaming declarations may be placed
13777
13778 @item
13779 Externals of mode 'out' cannot be referenced
13780
13781 @item
13782 Externals of mode 'in' cannot be updated
13783
13784 @item
13785 Loop with no iteration scheme or exits only allowed as last statement in main program or task
13786
13787 @item
13788 Subprogram cannot have parent unit name
13789
13790 @item
13791 SPARK 2005 inherited subprogram must be prefixed with overriding
13792
13793 @item
13794 External variables (or functions that reference them) may not be passed as actual parameters
13795
13796 @item
13797 Globals must be explicitly mentioned in contract
13798
13799 @item
13800 Deferred constants cannot be completed by pragma Import
13801
13802 @item
13803 Package initialization cannot read/write variables from other packages
13804
13805 @item
13806 Prefix not allowed for entities that are directly visible
13807
13808 @item
13809 Identifier declaration can't override inherited package name
13810
13811 @item
13812 Cannot use Standard or other predefined packages as identifiers
13813
13814 @item
13815 After renaming, cannot use the original name
13816
13817 @item
13818 Subprograms can only be renamed to remove package prefix
13819
13820 @item
13821 Pragma import must be immediately after entity it names
13822
13823 @item
13824 No mutual recursion between multiple units (this can be checked with gnatcheck)
13825 @end itemize
13826
13827 Note that if a unit is compiled in Ada 95 mode with the SPARK 2005 restriction,
13828 violations will be reported for constructs forbidden in SPARK 95,
13829 instead of SPARK 2005.
13830
13831 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13832 @anchor{gnat_rm/implementation_advice doc}@anchor{214}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}@anchor{gnat_rm/implementation_advice id1}@anchor{215}
13833 @chapter Implementation Advice
13834
13835
13836 The main text of the Ada Reference Manual describes the required
13837 behavior of all Ada compilers, and the GNAT compiler conforms to
13838 these requirements.
13839
13840 In addition, there are sections throughout the Ada Reference Manual headed
13841 by the phrase 'Implementation advice'. These sections are not normative,
13842 i.e., they do not specify requirements that all compilers must
13843 follow. Rather they provide advice on generally desirable behavior.
13844 They are not requirements, because they describe behavior that cannot
13845 be provided on all systems, or may be undesirable on some systems.
13846
13847 As far as practical, GNAT follows the implementation advice in
13848 the Ada Reference Manual. Each such RM section corresponds to a section
13849 in this chapter whose title specifies the
13850 RM section number and paragraph number and the subject of
13851 the advice. The contents of each section consists of the RM text within
13852 quotation marks,
13853 followed by the GNAT interpretation of the advice. Most often, this simply says
13854 'followed', which means that GNAT follows the advice. However, in a
13855 number of cases, GNAT deliberately deviates from this advice, in which
13856 case the text describes what GNAT does and why.
13857
13858 @geindex Error detection
13859
13860 @menu
13861 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection.
13862 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units.
13863 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors.
13864 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas.
13865 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas.
13866 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets.
13867 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types.
13868 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types.
13869 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values.
13870 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types.
13871 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays.
13872 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small.
13873 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation.
13874 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information.
13875 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks.
13876 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses.
13877 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types.
13878 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses.
13879 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses.
13880 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses.
13881 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses.
13882 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses.
13883 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses.
13884 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses.
13885 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes.
13886 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering.
13887 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private.
13888 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations.
13889 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion.
13890 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage.
13891 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation.
13892 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes.
13893 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types.
13894 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling.
13895 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling.
13896 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation.
13897 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate.
13898 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export.
13899 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces.
13900 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C.
13901 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL.
13902 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran.
13903 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations.
13904 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations.
13905 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support.
13906 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers.
13907 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts.
13908 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements.
13909 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names.
13910 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes.
13911 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies.
13912 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies.
13913 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort.
13914 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions.
13915 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time.
13916 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem.
13917 * RM F(7); COBOL Support: RM F 7 COBOL Support.
13918 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support.
13919 * RM G; Numerics: RM G Numerics.
13920 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types.
13921 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions.
13922 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements.
13923 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy.
13924 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy.
13925
13926 @end menu
13927
13928 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13929 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{216}
13930 @section RM 1.1.3(20): Error Detection
13931
13932
13933 @quotation
13934
13935 "If an implementation detects the use of an unsupported Specialized Needs
13936 Annex feature at run time, it should raise @code{Program_Error} if
13937 feasible."
13938 @end quotation
13939
13940 Not relevant. All specialized needs annex features are either supported,
13941 or diagnosed at compile time.
13942
13943 @geindex Child Units
13944
13945 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13946 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{217}
13947 @section RM 1.1.3(31): Child Units
13948
13949
13950 @quotation
13951
13952 "If an implementation wishes to provide implementation-defined
13953 extensions to the functionality of a language-defined library unit, it
13954 should normally do so by adding children to the library unit."
13955 @end quotation
13956
13957 Followed.
13958
13959 @geindex Bounded errors
13960
13961 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13962 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{218}
13963 @section RM 1.1.5(12): Bounded Errors
13964
13965
13966 @quotation
13967
13968 "If an implementation detects a bounded error or erroneous
13969 execution, it should raise @code{Program_Error}."
13970 @end quotation
13971
13972 Followed in all cases in which the implementation detects a bounded
13973 error or erroneous execution. Not all such situations are detected at
13974 runtime.
13975
13976 @geindex Pragmas
13977
13978 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
13979 @anchor{gnat_rm/implementation_advice id2}@anchor{219}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{21a}
13980 @section RM 2.8(16): Pragmas
13981
13982
13983 @quotation
13984
13985 "Normally, implementation-defined pragmas should have no semantic effect
13986 for error-free programs; that is, if the implementation-defined pragmas
13987 are removed from a working program, the program should still be legal,
13988 and should still have the same semantics."
13989 @end quotation
13990
13991 The following implementation defined pragmas are exceptions to this
13992 rule:
13993
13994
13995 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx}
13996 @headitem
13997
13998 Pragma
13999
14000 @tab
14001
14002 Explanation
14003
14004 @item
14005
14006 @emph{Abort_Defer}
14007
14008 @tab
14009
14010 Affects semantics
14011
14012 @item
14013
14014 @emph{Ada_83}
14015
14016 @tab
14017
14018 Affects legality
14019
14020 @item
14021
14022 @emph{Assert}
14023
14024 @tab
14025
14026 Affects semantics
14027
14028 @item
14029
14030 @emph{CPP_Class}
14031
14032 @tab
14033
14034 Affects semantics
14035
14036 @item
14037
14038 @emph{CPP_Constructor}
14039
14040 @tab
14041
14042 Affects semantics
14043
14044 @item
14045
14046 @emph{Debug}
14047
14048 @tab
14049
14050 Affects semantics
14051
14052 @item
14053
14054 @emph{Interface_Name}
14055
14056 @tab
14057
14058 Affects semantics
14059
14060 @item
14061
14062 @emph{Machine_Attribute}
14063
14064 @tab
14065
14066 Affects semantics
14067
14068 @item
14069
14070 @emph{Unimplemented_Unit}
14071
14072 @tab
14073
14074 Affects legality
14075
14076 @item
14077
14078 @emph{Unchecked_Union}
14079
14080 @tab
14081
14082 Affects semantics
14083
14084 @end multitable
14085
14086
14087 In each of the above cases, it is essential to the purpose of the pragma
14088 that this advice not be followed. For details see
14089 @ref{7,,Implementation Defined Pragmas}.
14090
14091 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
14092 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{21b}
14093 @section RM 2.8(17-19): Pragmas
14094
14095
14096 @quotation
14097
14098 "Normally, an implementation should not define pragmas that can
14099 make an illegal program legal, except as follows:
14100
14101
14102 @itemize *
14103
14104 @item
14105 A pragma used to complete a declaration, such as a pragma @code{Import};
14106
14107 @item
14108 A pragma used to configure the environment by adding, removing, or
14109 replacing @code{library_items}."
14110 @end itemize
14111 @end quotation
14112
14113 See @ref{21a,,RM 2.8(16); Pragmas}.
14114
14115 @geindex Character Sets
14116
14117 @geindex Alternative Character Sets
14118
14119 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
14120 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{21c}
14121 @section RM 3.5.2(5): Alternative Character Sets
14122
14123
14124 @quotation
14125
14126 "If an implementation supports a mode with alternative interpretations
14127 for @code{Character} and @code{Wide_Character}, the set of graphic
14128 characters of @code{Character} should nevertheless remain a proper
14129 subset of the set of graphic characters of @code{Wide_Character}. Any
14130 character set 'localizations' should be reflected in the results of
14131 the subprograms defined in the language-defined package
14132 @code{Characters.Handling} (see A.3) available in such a mode. In a mode with
14133 an alternative interpretation of @code{Character}, the implementation should
14134 also support a corresponding change in what is a legal
14135 @code{identifier_letter}."
14136 @end quotation
14137
14138 Not all wide character modes follow this advice, in particular the JIS
14139 and IEC modes reflect standard usage in Japan, and in these encoding,
14140 the upper half of the Latin-1 set is not part of the wide-character
14141 subset, since the most significant bit is used for wide character
14142 encoding. However, this only applies to the external forms. Internally
14143 there is no such restriction.
14144
14145 @geindex Integer types
14146
14147 @node RM 3 5 4 28 Integer Types,RM 3 5 4 29 Integer Types,RM 3 5 2 5 Alternative Character Sets,Implementation Advice
14148 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{21d}
14149 @section RM 3.5.4(28): Integer Types
14150
14151
14152 @quotation
14153
14154 "An implementation should support @code{Long_Integer} in addition to
14155 @code{Integer} if the target machine supports 32-bit (or longer)
14156 arithmetic. No other named integer subtypes are recommended for package
14157 @code{Standard}. Instead, appropriate named integer subtypes should be
14158 provided in the library package @code{Interfaces} (see B.2)."
14159 @end quotation
14160
14161 @code{Long_Integer} is supported. Other standard integer types are supported
14162 so this advice is not fully followed. These types
14163 are supported for convenient interface to C, and so that all hardware
14164 types of the machine are easily available.
14165
14166 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
14167 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{21e}
14168 @section RM 3.5.4(29): Integer Types
14169
14170
14171 @quotation
14172
14173 "An implementation for a two's complement machine should support
14174 modular types with a binary modulus up to @code{System.Max_Int*2+2}. An
14175 implementation should support a non-binary modules up to @code{Integer'Last}."
14176 @end quotation
14177
14178 Followed.
14179
14180 @geindex Enumeration values
14181
14182 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
14183 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{21f}
14184 @section RM 3.5.5(8): Enumeration Values
14185
14186
14187 @quotation
14188
14189 "For the evaluation of a call on @code{S'Pos} for an enumeration
14190 subtype, if the value of the operand does not correspond to the internal
14191 code for any enumeration literal of its type (perhaps due to an
14192 un-initialized variable), then the implementation should raise
14193 @code{Program_Error}. This is particularly important for enumeration
14194 types with noncontiguous internal codes specified by an
14195 enumeration_representation_clause."
14196 @end quotation
14197
14198 Followed.
14199
14200 @geindex Float types
14201
14202 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
14203 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{220}
14204 @section RM 3.5.7(17): Float Types
14205
14206
14207 @quotation
14208
14209 "An implementation should support @code{Long_Float} in addition to
14210 @code{Float} if the target machine supports 11 or more digits of
14211 precision. No other named floating point subtypes are recommended for
14212 package @code{Standard}. Instead, appropriate named floating point subtypes
14213 should be provided in the library package @code{Interfaces} (see B.2)."
14214 @end quotation
14215
14216 @code{Short_Float} and @code{Long_Long_Float} are also provided. The
14217 former provides improved compatibility with other implementations
14218 supporting this type. The latter corresponds to the highest precision
14219 floating-point type supported by the hardware. On most machines, this
14220 will be the same as @code{Long_Float}, but on some machines, it will
14221 correspond to the IEEE extended form. The notable case is all ia32
14222 (x86) implementations, where @code{Long_Long_Float} corresponds to
14223 the 80-bit extended precision format supported in hardware on this
14224 processor. Note that the 128-bit format on SPARC is not supported,
14225 since this is a software rather than a hardware format.
14226
14227 @geindex Multidimensional arrays
14228
14229 @geindex Arrays
14230 @geindex multidimensional
14231
14232 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration'Small,RM 3 5 7 17 Float Types,Implementation Advice
14233 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{221}
14234 @section RM 3.6.2(11): Multidimensional Arrays
14235
14236
14237 @quotation
14238
14239 "An implementation should normally represent multidimensional arrays in
14240 row-major order, consistent with the notation used for multidimensional
14241 array aggregates (see 4.3.3). However, if a pragma @code{Convention}
14242 (@code{Fortran}, ...) applies to a multidimensional array type, then
14243 column-major order should be used instead (see B.5, @emph{Interfacing with Fortran})."
14244 @end quotation
14245
14246 Followed.
14247
14248 @geindex Duration'Small
14249
14250 @node RM 9 6 30-31 Duration'Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
14251 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{222}
14252 @section RM 9.6(30-31): Duration'Small
14253
14254
14255 @quotation
14256
14257 "Whenever possible in an implementation, the value of @code{Duration'Small}
14258 should be no greater than 100 microseconds."
14259 @end quotation
14260
14261 Followed. (@code{Duration'Small} = 10**(-9)).
14262
14263 @quotation
14264
14265 "The time base for @code{delay_relative_statements} should be monotonic;
14266 it need not be the same time base as used for @code{Calendar.Clock}."
14267 @end quotation
14268
14269 Followed.
14270
14271 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration'Small,Implementation Advice
14272 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{223}
14273 @section RM 10.2.1(12): Consistent Representation
14274
14275
14276 @quotation
14277
14278 "In an implementation, a type declared in a pre-elaborated package should
14279 have the same representation in every elaboration of a given version of
14280 the package, whether the elaborations occur in distinct executions of
14281 the same program, or in executions of distinct programs or partitions
14282 that include the given version."
14283 @end quotation
14284
14285 Followed, except in the case of tagged types. Tagged types involve
14286 implicit pointers to a local copy of a dispatch table, and these pointers
14287 have representations which thus depend on a particular elaboration of the
14288 package. It is not easy to see how it would be possible to follow this
14289 advice without severely impacting efficiency of execution.
14290
14291 @geindex Exception information
14292
14293 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
14294 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{224}
14295 @section RM 11.4.1(19): Exception Information
14296
14297
14298 @quotation
14299
14300 "@code{Exception_Message} by default and @code{Exception_Information}
14301 should produce information useful for
14302 debugging. @code{Exception_Message} should be short, about one
14303 line. @code{Exception_Information} can be long. @code{Exception_Message}
14304 should not include the
14305 @code{Exception_Name}. @code{Exception_Information} should include both
14306 the @code{Exception_Name} and the @code{Exception_Message}."
14307 @end quotation
14308
14309 Followed. For each exception that doesn't have a specified
14310 @code{Exception_Message}, the compiler generates one containing the location
14311 of the raise statement. This location has the form 'file_name:line', where
14312 file_name is the short file name (without path information) and line is the line
14313 number in the file. Note that in the case of the Zero Cost Exception
14314 mechanism, these messages become redundant with the Exception_Information that
14315 contains a full backtrace of the calling sequence, so they are disabled.
14316 To disable explicitly the generation of the source location message, use the
14317 Pragma @code{Discard_Names}.
14318
14319 @geindex Suppression of checks
14320
14321 @geindex Checks
14322 @geindex suppression of
14323
14324 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
14325 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{225}
14326 @section RM 11.5(28): Suppression of Checks
14327
14328
14329 @quotation
14330
14331 "The implementation should minimize the code executed for checks that
14332 have been suppressed."
14333 @end quotation
14334
14335 Followed.
14336
14337 @geindex Representation clauses
14338
14339 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
14340 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{226}
14341 @section RM 13.1 (21-24): Representation Clauses
14342
14343
14344 @quotation
14345
14346 "The recommended level of support for all representation items is
14347 qualified as follows:
14348
14349 An implementation need not support representation items containing
14350 nonstatic expressions, except that an implementation should support a
14351 representation item for a given entity if each nonstatic expression in
14352 the representation item is a name that statically denotes a constant
14353 declared before the entity."
14354 @end quotation
14355
14356 Followed. In fact, GNAT goes beyond the recommended level of support
14357 by allowing nonstatic expressions in some representation clauses even
14358 without the need to declare constants initialized with the values of
14359 such expressions.
14360 For example:
14361
14362 @example
14363 X : Integer;
14364 Y : Float;
14365 for Y'Address use X'Address;>>
14366
14367
14368 "An implementation need not support a specification for the `@w{`}Size`@w{`}
14369 for a given composite subtype, nor the size or storage place for an
14370 object (including a component) of a given composite subtype, unless the
14371 constraints on the subtype and its composite subcomponents (if any) are
14372 all static constraints."
14373 @end example
14374
14375 Followed. Size Clauses are not permitted on nonstatic components, as
14376 described above.
14377
14378 @quotation
14379
14380 "An aliased component, or a component whose type is by-reference, should
14381 always be allocated at an addressable location."
14382 @end quotation
14383
14384 Followed.
14385
14386 @geindex Packed types
14387
14388 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
14389 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{227}
14390 @section RM 13.2(6-8): Packed Types
14391
14392
14393 @quotation
14394
14395 "If a type is packed, then the implementation should try to minimize
14396 storage allocated to objects of the type, possibly at the expense of
14397 speed of accessing components, subject to reasonable complexity in
14398 addressing calculations.
14399
14400 The recommended level of support pragma @code{Pack} is:
14401
14402 For a packed record type, the components should be packed as tightly as
14403 possible subject to the Sizes of the component subtypes, and subject to
14404 any @emph{record_representation_clause} that applies to the type; the
14405 implementation may, but need not, reorder components or cross aligned
14406 word boundaries to improve the packing. A component whose @code{Size} is
14407 greater than the word size may be allocated an integral number of words."
14408 @end quotation
14409
14410 Followed. Tight packing of arrays is supported for all component sizes
14411 up to 64-bits. If the array component size is 1 (that is to say, if
14412 the component is a boolean type or an enumeration type with two values)
14413 then values of the type are implicitly initialized to zero. This
14414 happens both for objects of the packed type, and for objects that have a
14415 subcomponent of the packed type.
14416
14417 @quotation
14418
14419 "An implementation should support Address clauses for imported
14420 subprograms."
14421 @end quotation
14422
14423 Followed.
14424
14425 @geindex Address clauses
14426
14427 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
14428 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{228}
14429 @section RM 13.3(14-19): Address Clauses
14430
14431
14432 @quotation
14433
14434 "For an array @code{X}, @code{X'Address} should point at the first
14435 component of the array, and not at the array bounds."
14436 @end quotation
14437
14438 Followed.
14439
14440 @quotation
14441
14442 "The recommended level of support for the @code{Address} attribute is:
14443
14444 @code{X'Address} should produce a useful result if @code{X} is an
14445 object that is aliased or of a by-reference type, or is an entity whose
14446 @code{Address} has been specified."
14447 @end quotation
14448
14449 Followed. A valid address will be produced even if none of those
14450 conditions have been met. If necessary, the object is forced into
14451 memory to ensure the address is valid.
14452
14453 @quotation
14454
14455 "An implementation should support @code{Address} clauses for imported
14456 subprograms."
14457 @end quotation
14458
14459 Followed.
14460
14461 @quotation
14462
14463 "Objects (including subcomponents) that are aliased or of a by-reference
14464 type should be allocated on storage element boundaries."
14465 @end quotation
14466
14467 Followed.
14468
14469 @quotation
14470
14471 "If the @code{Address} of an object is specified, or it is imported or exported,
14472 then the implementation should not perform optimizations based on
14473 assumptions of no aliases."
14474 @end quotation
14475
14476 Followed.
14477
14478 @geindex Alignment clauses
14479
14480 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
14481 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{229}
14482 @section RM 13.3(29-35): Alignment Clauses
14483
14484
14485 @quotation
14486
14487 "The recommended level of support for the @code{Alignment} attribute for
14488 subtypes is:
14489
14490 An implementation should support specified Alignments that are factors
14491 and multiples of the number of storage elements per word, subject to the
14492 following:"
14493 @end quotation
14494
14495 Followed.
14496
14497 @quotation
14498
14499 "An implementation need not support specified Alignments for
14500 combinations of Sizes and Alignments that cannot be easily
14501 loaded and stored by available machine instructions."
14502 @end quotation
14503
14504 Followed.
14505
14506 @quotation
14507
14508 "An implementation need not support specified Alignments that are
14509 greater than the maximum @code{Alignment} the implementation ever returns by
14510 default."
14511 @end quotation
14512
14513 Followed.
14514
14515 @quotation
14516
14517 "The recommended level of support for the @code{Alignment} attribute for
14518 objects is:
14519
14520 Same as above, for subtypes, but in addition:"
14521 @end quotation
14522
14523 Followed.
14524
14525 @quotation
14526
14527 "For stand-alone library-level objects of statically constrained
14528 subtypes, the implementation should support all alignments
14529 supported by the target linker. For example, page alignment is likely to
14530 be supported for such objects, but not for subtypes."
14531 @end quotation
14532
14533 Followed.
14534
14535 @geindex Size clauses
14536
14537 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
14538 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{22a}
14539 @section RM 13.3(42-43): Size Clauses
14540
14541
14542 @quotation
14543
14544 "The recommended level of support for the @code{Size} attribute of
14545 objects is:
14546
14547 A @code{Size} clause should be supported for an object if the specified
14548 @code{Size} is at least as large as its subtype's @code{Size}, and
14549 corresponds to a size in storage elements that is a multiple of the
14550 object's @code{Alignment} (if the @code{Alignment} is nonzero)."
14551 @end quotation
14552
14553 Followed.
14554
14555 @node RM 13 3 50-56 Size Clauses,RM 13 3 71-73 Component Size Clauses,RM 13 3 42-43 Size Clauses,Implementation Advice
14556 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{22b}
14557 @section RM 13.3(50-56): Size Clauses
14558
14559
14560 @quotation
14561
14562 "If the @code{Size} of a subtype is specified, and allows for efficient
14563 independent addressability (see 9.10) on the target architecture, then
14564 the @code{Size} of the following objects of the subtype should equal the
14565 @code{Size} of the subtype:
14566
14567 Aliased objects (including components)."
14568 @end quotation
14569
14570 Followed.
14571
14572 @quotation
14573
14574 "@cite{Size} clause on a composite subtype should not affect the
14575 internal layout of components."
14576 @end quotation
14577
14578 Followed. But note that this can be overridden by use of the implementation
14579 pragma Implicit_Packing in the case of packed arrays.
14580
14581 @quotation
14582
14583 "The recommended level of support for the @code{Size} attribute of subtypes is:
14584
14585 The @code{Size} (if not specified) of a static discrete or fixed point
14586 subtype should be the number of bits needed to represent each value
14587 belonging to the subtype using an unbiased representation, leaving space
14588 for a sign bit only if the subtype contains negative values. If such a
14589 subtype is a first subtype, then an implementation should support a
14590 specified @code{Size} for it that reflects this representation."
14591 @end quotation
14592
14593 Followed.
14594
14595 @quotation
14596
14597 "For a subtype implemented with levels of indirection, the @code{Size}
14598 should include the size of the pointers, but not the size of what they
14599 point at."
14600 @end quotation
14601
14602 Followed.
14603
14604 @geindex Component_Size clauses
14605
14606 @node RM 13 3 71-73 Component Size Clauses,RM 13 4 9-10 Enumeration Representation Clauses,RM 13 3 50-56 Size Clauses,Implementation Advice
14607 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{22c}
14608 @section RM 13.3(71-73): Component Size Clauses
14609
14610
14611 @quotation
14612
14613 "The recommended level of support for the @code{Component_Size}
14614 attribute is:
14615
14616 An implementation need not support specified @code{Component_Sizes} that are
14617 less than the @code{Size} of the component subtype."
14618 @end quotation
14619
14620 Followed.
14621
14622 @quotation
14623
14624 "An implementation should support specified Component_Sizes that
14625 are factors and multiples of the word size. For such
14626 Component_Sizes, the array should contain no gaps between
14627 components. For other Component_Sizes (if supported), the array
14628 should contain no gaps between components when packing is also
14629 specified; the implementation should forbid this combination in cases
14630 where it cannot support a no-gaps representation."
14631 @end quotation
14632
14633 Followed.
14634
14635 @geindex Enumeration representation clauses
14636
14637 @geindex Representation clauses
14638 @geindex enumeration
14639
14640 @node RM 13 4 9-10 Enumeration Representation Clauses,RM 13 5 1 17-22 Record Representation Clauses,RM 13 3 71-73 Component Size Clauses,Implementation Advice
14641 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{22d}
14642 @section RM 13.4(9-10): Enumeration Representation Clauses
14643
14644
14645 @quotation
14646
14647 "The recommended level of support for enumeration representation clauses
14648 is:
14649
14650 An implementation need not support enumeration representation clauses
14651 for boolean types, but should at minimum support the internal codes in
14652 the range @code{System.Min_Int .. System.Max_Int}."
14653 @end quotation
14654
14655 Followed.
14656
14657 @geindex Record representation clauses
14658
14659 @geindex Representation clauses
14660 @geindex records
14661
14662 @node RM 13 5 1 17-22 Record Representation Clauses,RM 13 5 2 5 Storage Place Attributes,RM 13 4 9-10 Enumeration Representation Clauses,Implementation Advice
14663 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{22e}
14664 @section RM 13.5.1(17-22): Record Representation Clauses
14665
14666
14667 @quotation
14668
14669 "The recommended level of support for
14670 @emph{record_representation_clause}s is:
14671
14672 An implementation should support storage places that can be extracted
14673 with a load, mask, shift sequence of machine code, and set with a load,
14674 shift, mask, store sequence, given the available machine instructions
14675 and run-time model."
14676 @end quotation
14677
14678 Followed.
14679
14680 @quotation
14681
14682 "A storage place should be supported if its size is equal to the
14683 @code{Size} of the component subtype, and it starts and ends on a
14684 boundary that obeys the @code{Alignment} of the component subtype."
14685 @end quotation
14686
14687 Followed.
14688
14689 @quotation
14690
14691 "If the default bit ordering applies to the declaration of a given type,
14692 then for a component whose subtype's @code{Size} is less than the word
14693 size, any storage place that does not cross an aligned word boundary
14694 should be supported."
14695 @end quotation
14696
14697 Followed.
14698
14699 @quotation
14700
14701 "An implementation may reserve a storage place for the tag field of a
14702 tagged type, and disallow other components from overlapping that place."
14703 @end quotation
14704
14705 Followed. The storage place for the tag field is the beginning of the tagged
14706 record, and its size is Address'Size. GNAT will reject an explicit component
14707 clause for the tag field.
14708
14709 @quotation
14710
14711 "An implementation need not support a @emph{component_clause} for a
14712 component of an extension part if the storage place is not after the
14713 storage places of all components of the parent type, whether or not
14714 those storage places had been specified."
14715 @end quotation
14716
14717 Followed. The above advice on record representation clauses is followed,
14718 and all mentioned features are implemented.
14719
14720 @geindex Storage place attributes
14721
14722 @node RM 13 5 2 5 Storage Place Attributes,RM 13 5 3 7-8 Bit Ordering,RM 13 5 1 17-22 Record Representation Clauses,Implementation Advice
14723 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{22f}
14724 @section RM 13.5.2(5): Storage Place Attributes
14725
14726
14727 @quotation
14728
14729 "If a component is represented using some form of pointer (such as an
14730 offset) to the actual data of the component, and this data is contiguous
14731 with the rest of the object, then the storage place attributes should
14732 reflect the place of the actual data, not the pointer. If a component is
14733 allocated discontinuously from the rest of the object, then a warning
14734 should be generated upon reference to one of its storage place
14735 attributes."
14736 @end quotation
14737
14738 Followed. There are no such components in GNAT.
14739
14740 @geindex Bit ordering
14741
14742 @node RM 13 5 3 7-8 Bit Ordering,RM 13 7 37 Address as Private,RM 13 5 2 5 Storage Place Attributes,Implementation Advice
14743 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{230}
14744 @section RM 13.5.3(7-8): Bit Ordering
14745
14746
14747 @quotation
14748
14749 "The recommended level of support for the non-default bit ordering is:
14750
14751 If @code{Word_Size} = @code{Storage_Unit}, then the implementation
14752 should support the non-default bit ordering in addition to the default
14753 bit ordering."
14754 @end quotation
14755
14756 Followed. Word size does not equal storage size in this implementation.
14757 Thus non-default bit ordering is not supported.
14758
14759 @geindex Address
14760 @geindex as private type
14761
14762 @node RM 13 7 37 Address as Private,RM 13 7 1 16 Address Operations,RM 13 5 3 7-8 Bit Ordering,Implementation Advice
14763 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{231}
14764 @section RM 13.7(37): Address as Private
14765
14766
14767 @quotation
14768
14769 "@cite{Address} should be of a private type."
14770 @end quotation
14771
14772 Followed.
14773
14774 @geindex Operations
14775 @geindex on `@w{`}Address`@w{`}
14776
14777 @geindex Address
14778 @geindex operations of
14779
14780 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14781 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{232}
14782 @section RM 13.7.1(16): Address Operations
14783
14784
14785 @quotation
14786
14787 "Operations in @code{System} and its children should reflect the target
14788 environment semantics as closely as is reasonable. For example, on most
14789 machines, it makes sense for address arithmetic to 'wrap around'.
14790 Operations that do not make sense should raise @code{Program_Error}."
14791 @end quotation
14792
14793 Followed. Address arithmetic is modular arithmetic that wraps around. No
14794 operation raises @code{Program_Error}, since all operations make sense.
14795
14796 @geindex Unchecked conversion
14797
14798 @node RM 13 9 14-17 Unchecked Conversion,RM 13 11 23-25 Implicit Heap Usage,RM 13 7 1 16 Address Operations,Implementation Advice
14799 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{233}
14800 @section RM 13.9(14-17): Unchecked Conversion
14801
14802
14803 @quotation
14804
14805 "The @code{Size} of an array object should not include its bounds; hence,
14806 the bounds should not be part of the converted data."
14807 @end quotation
14808
14809 Followed.
14810
14811 @quotation
14812
14813 "The implementation should not generate unnecessary run-time checks to
14814 ensure that the representation of @code{S} is a representation of the
14815 target type. It should take advantage of the permission to return by
14816 reference when possible. Restrictions on unchecked conversions should be
14817 avoided unless required by the target environment."
14818 @end quotation
14819
14820 Followed. There are no restrictions on unchecked conversion. A warning is
14821 generated if the source and target types do not have the same size since
14822 the semantics in this case may be target dependent.
14823
14824 @quotation
14825
14826 "The recommended level of support for unchecked conversions is:
14827
14828 Unchecked conversions should be supported and should be reversible in
14829 the cases where this clause defines the result. To enable meaningful use
14830 of unchecked conversion, a contiguous representation should be used for
14831 elementary subtypes, for statically constrained array subtypes whose
14832 component subtype is one of the subtypes described in this paragraph,
14833 and for record subtypes without discriminants whose component subtypes
14834 are described in this paragraph."
14835 @end quotation
14836
14837 Followed.
14838
14839 @geindex Heap usage
14840 @geindex implicit
14841
14842 @node RM 13 11 23-25 Implicit Heap Usage,RM 13 11 2 17 Unchecked Deallocation,RM 13 9 14-17 Unchecked Conversion,Implementation Advice
14843 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{234}
14844 @section RM 13.11(23-25): Implicit Heap Usage
14845
14846
14847 @quotation
14848
14849 "An implementation should document any cases in which it dynamically
14850 allocates heap storage for a purpose other than the evaluation of an
14851 allocator."
14852 @end quotation
14853
14854 Followed, the only other points at which heap storage is dynamically
14855 allocated are as follows:
14856
14857
14858 @itemize *
14859
14860 @item
14861 At initial elaboration time, to allocate dynamically sized global
14862 objects.
14863
14864 @item
14865 To allocate space for a task when a task is created.
14866
14867 @item
14868 To extend the secondary stack dynamically when needed. The secondary
14869 stack is used for returning variable length results.
14870 @end itemize
14871
14872
14873 @quotation
14874
14875 "A default (implementation-provided) storage pool for an
14876 access-to-constant type should not have overhead to support deallocation of
14877 individual objects."
14878 @end quotation
14879
14880 Followed.
14881
14882 @quotation
14883
14884 "A storage pool for an anonymous access type should be created at the
14885 point of an allocator for the type, and be reclaimed when the designated
14886 object becomes inaccessible."
14887 @end quotation
14888
14889 Followed.
14890
14891 @geindex Unchecked deallocation
14892
14893 @node RM 13 11 2 17 Unchecked Deallocation,RM 13 13 2 1 6 Stream Oriented Attributes,RM 13 11 23-25 Implicit Heap Usage,Implementation Advice
14894 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{235}
14895 @section RM 13.11.2(17): Unchecked Deallocation
14896
14897
14898 @quotation
14899
14900 "For a standard storage pool, @code{Free} should actually reclaim the
14901 storage."
14902 @end quotation
14903
14904 Followed.
14905
14906 @geindex Stream oriented attributes
14907
14908 @node RM 13 13 2 1 6 Stream Oriented Attributes,RM A 1 52 Names of Predefined Numeric Types,RM 13 11 2 17 Unchecked Deallocation,Implementation Advice
14909 @anchor{gnat_rm/implementation_advice rm-13-13-2-1-6-stream-oriented-attributes}@anchor{236}
14910 @section RM 13.13.2(1.6): Stream Oriented Attributes
14911
14912
14913 @quotation
14914
14915 "If not specified, the value of Stream_Size for an elementary type
14916 should be the number of bits that corresponds to the minimum number of
14917 stream elements required by the first subtype of the type, rounded up
14918 to the nearest factor or multiple of the word size that is also a
14919 multiple of the stream element size."
14920 @end quotation
14921
14922 Followed, except that the number of stream elements is a power of 2.
14923 The Stream_Size may be used to override the default choice.
14924
14925 However, such an implementation is based on direct binary
14926 representations and is therefore target- and endianness-dependent. To
14927 address this issue, GNAT also supplies an alternate implementation of
14928 the stream attributes @code{Read} and @code{Write}, which uses the
14929 target-independent XDR standard representation for scalar types.
14930
14931 @geindex XDR representation
14932
14933 @geindex Read attribute
14934
14935 @geindex Write attribute
14936
14937 @geindex Stream oriented attributes
14938
14939 The XDR implementation is provided as an alternative body of the
14940 @code{System.Stream_Attributes} package, in the file
14941 @code{s-stratt-xdr.adb} in the GNAT library.
14942 There is no @code{s-stratt-xdr.ads} file.
14943 In order to install the XDR implementation, do the following:
14944
14945
14946 @itemize *
14947
14948 @item
14949 Replace the default implementation of the
14950 @code{System.Stream_Attributes} package with the XDR implementation.
14951 For example on a Unix platform issue the commands:
14952
14953 @example
14954 $ mv s-stratt.adb s-stratt-default.adb
14955 $ mv s-stratt-xdr.adb s-stratt.adb
14956 @end example
14957
14958 @item
14959 Rebuild the GNAT run-time library as documented in
14960 the @emph{GNAT and Libraries} section of the @cite{GNAT User's Guide}.
14961 @end itemize
14962
14963 @node RM A 1 52 Names of Predefined Numeric Types,RM A 3 2 49 Ada Characters Handling,RM 13 13 2 1 6 Stream Oriented Attributes,Implementation Advice
14964 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{237}
14965 @section RM A.1(52): Names of Predefined Numeric Types
14966
14967
14968 @quotation
14969
14970 "If an implementation provides additional named predefined integer types,
14971 then the names should end with @code{Integer} as in
14972 @code{Long_Integer}. If an implementation provides additional named
14973 predefined floating point types, then the names should end with
14974 @code{Float} as in @code{Long_Float}."
14975 @end quotation
14976
14977 Followed.
14978
14979 @geindex Ada.Characters.Handling
14980
14981 @node RM A 3 2 49 Ada Characters Handling,RM A 4 4 106 Bounded-Length String Handling,RM A 1 52 Names of Predefined Numeric Types,Implementation Advice
14982 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{238}
14983 @section RM A.3.2(49): @code{Ada.Characters.Handling}
14984
14985
14986 @quotation
14987
14988 "If an implementation provides a localized definition of @code{Character}
14989 or @code{Wide_Character}, then the effects of the subprograms in
14990 @code{Characters.Handling} should reflect the localizations.
14991 See also 3.5.2."
14992 @end quotation
14993
14994 Followed. GNAT provides no such localized definitions.
14995
14996 @geindex Bounded-length strings
14997
14998 @node RM A 4 4 106 Bounded-Length String Handling,RM A 5 2 46-47 Random Number Generation,RM A 3 2 49 Ada Characters Handling,Implementation Advice
14999 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{239}
15000 @section RM A.4.4(106): Bounded-Length String Handling
15001
15002
15003 @quotation
15004
15005 "Bounded string objects should not be implemented by implicit pointers
15006 and dynamic allocation."
15007 @end quotation
15008
15009 Followed. No implicit pointers or dynamic allocation are used.
15010
15011 @geindex Random number generation
15012
15013 @node RM A 5 2 46-47 Random Number Generation,RM A 10 7 23 Get_Immediate,RM A 4 4 106 Bounded-Length String Handling,Implementation Advice
15014 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{23a}
15015 @section RM A.5.2(46-47): Random Number Generation
15016
15017
15018 @quotation
15019
15020 "Any storage associated with an object of type @code{Generator} should be
15021 reclaimed on exit from the scope of the object."
15022 @end quotation
15023
15024 Followed.
15025
15026 @quotation
15027
15028 "If the generator period is sufficiently long in relation to the number
15029 of distinct initiator values, then each possible value of
15030 @code{Initiator} passed to @code{Reset} should initiate a sequence of
15031 random numbers that does not, in a practical sense, overlap the sequence
15032 initiated by any other value. If this is not possible, then the mapping
15033 between initiator values and generator states should be a rapidly
15034 varying function of the initiator value."
15035 @end quotation
15036
15037 Followed. The generator period is sufficiently long for the first
15038 condition here to hold true.
15039
15040 @geindex Get_Immediate
15041
15042 @node RM A 10 7 23 Get_Immediate,RM B 1 39-41 Pragma Export,RM A 5 2 46-47 Random Number Generation,Implementation Advice
15043 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{23b}
15044 @section RM A.10.7(23): @code{Get_Immediate}
15045
15046
15047 @quotation
15048
15049 "The @code{Get_Immediate} procedures should be implemented with
15050 unbuffered input. For a device such as a keyboard, input should be
15051 available if a key has already been typed, whereas for a disk
15052 file, input should always be available except at end of file. For a file
15053 associated with a keyboard-like device, any line-editing features of the
15054 underlying operating system should be disabled during the execution of
15055 @code{Get_Immediate}."
15056 @end quotation
15057
15058 Followed on all targets except VxWorks. For VxWorks, there is no way to
15059 provide this functionality that does not result in the input buffer being
15060 flushed before the @code{Get_Immediate} call. A special unit
15061 @code{Interfaces.Vxworks.IO} is provided that contains routines to enable
15062 this functionality.
15063
15064 @geindex Export
15065
15066 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 10 7 23 Get_Immediate,Implementation Advice
15067 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{23c}
15068 @section RM B.1(39-41): Pragma @code{Export}
15069
15070
15071 @quotation
15072
15073 "If an implementation supports pragma @code{Export} to a given language,
15074 then it should also allow the main subprogram to be written in that
15075 language. It should support some mechanism for invoking the elaboration
15076 of the Ada library units included in the system, and for invoking the
15077 finalization of the environment task. On typical systems, the
15078 recommended mechanism is to provide two subprograms whose link names are
15079 @code{adainit} and @code{adafinal}. @code{adainit} should contain the
15080 elaboration code for library units. @code{adafinal} should contain the
15081 finalization code. These subprograms should have no effect the second
15082 and subsequent time they are called."
15083 @end quotation
15084
15085 Followed.
15086
15087 @quotation
15088
15089 "Automatic elaboration of pre-elaborated packages should be
15090 provided when pragma @code{Export} is supported."
15091 @end quotation
15092
15093 Followed when the main program is in Ada. If the main program is in a
15094 foreign language, then
15095 @code{adainit} must be called to elaborate pre-elaborated
15096 packages.
15097
15098 @quotation
15099
15100 "For each supported convention @emph{L} other than @code{Intrinsic}, an
15101 implementation should support @code{Import} and @code{Export} pragmas
15102 for objects of @emph{L}-compatible types and for subprograms, and pragma
15103 @cite{Convention} for @emph{L}-eligible types and for subprograms,
15104 presuming the other language has corresponding features. Pragma
15105 @code{Convention} need not be supported for scalar types."
15106 @end quotation
15107
15108 Followed.
15109
15110 @geindex Package Interfaces
15111
15112 @geindex Interfaces
15113
15114 @node RM B 2 12-13 Package Interfaces,RM B 3 63-71 Interfacing with C,RM B 1 39-41 Pragma Export,Implementation Advice
15115 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{23d}
15116 @section RM B.2(12-13): Package @code{Interfaces}
15117
15118
15119 @quotation
15120
15121 "For each implementation-defined convention identifier, there should be a
15122 child package of package Interfaces with the corresponding name. This
15123 package should contain any declarations that would be useful for
15124 interfacing to the language (implementation) represented by the
15125 convention. Any declarations useful for interfacing to any language on
15126 the given hardware architecture should be provided directly in
15127 @code{Interfaces}."
15128 @end quotation
15129
15130 Followed.
15131
15132 @quotation
15133
15134 "An implementation supporting an interface to C, COBOL, or Fortran should
15135 provide the corresponding package or packages described in the following
15136 clauses."
15137 @end quotation
15138
15139 Followed. GNAT provides all the packages described in this section.
15140
15141 @geindex C
15142 @geindex interfacing with
15143
15144 @node RM B 3 63-71 Interfacing with C,RM B 4 95-98 Interfacing with COBOL,RM B 2 12-13 Package Interfaces,Implementation Advice
15145 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{23e}
15146 @section RM B.3(63-71): Interfacing with C
15147
15148
15149 @quotation
15150
15151 "An implementation should support the following interface correspondences
15152 between Ada and C."
15153 @end quotation
15154
15155 Followed.
15156
15157 @quotation
15158
15159 "An Ada procedure corresponds to a void-returning C function."
15160 @end quotation
15161
15162 Followed.
15163
15164 @quotation
15165
15166 "An Ada function corresponds to a non-void C function."
15167 @end quotation
15168
15169 Followed.
15170
15171 @quotation
15172
15173 "An Ada @code{in} scalar parameter is passed as a scalar argument to a C
15174 function."
15175 @end quotation
15176
15177 Followed.
15178
15179 @quotation
15180
15181 "An Ada @code{in} parameter of an access-to-object type with designated
15182 type @code{T} is passed as a @code{t*} argument to a C function,
15183 where @code{t} is the C type corresponding to the Ada type @code{T}."
15184 @end quotation
15185
15186 Followed.
15187
15188 @quotation
15189
15190 "An Ada access @code{T} parameter, or an Ada @code{out} or @code{in out}
15191 parameter of an elementary type @code{T}, is passed as a @code{t*}
15192 argument to a C function, where @code{t} is the C type corresponding to
15193 the Ada type @code{T}. In the case of an elementary @code{out} or
15194 @code{in out} parameter, a pointer to a temporary copy is used to
15195 preserve by-copy semantics."
15196 @end quotation
15197
15198 Followed.
15199
15200 @quotation
15201
15202 "An Ada parameter of a record type @code{T}, of any mode, is passed as a
15203 @code{t*} argument to a C function, where @code{t} is the C
15204 structure corresponding to the Ada type @code{T}."
15205 @end quotation
15206
15207 Followed. This convention may be overridden by the use of the C_Pass_By_Copy
15208 pragma, or Convention, or by explicitly specifying the mechanism for a given
15209 call using an extended import or export pragma.
15210
15211 @quotation
15212
15213 "An Ada parameter of an array type with component type @code{T}, of any
15214 mode, is passed as a @code{t*} argument to a C function, where
15215 @code{t} is the C type corresponding to the Ada type @code{T}."
15216 @end quotation
15217
15218 Followed.
15219
15220 @quotation
15221
15222 "An Ada parameter of an access-to-subprogram type is passed as a pointer
15223 to a C function whose prototype corresponds to the designated
15224 subprogram's specification."
15225 @end quotation
15226
15227 Followed.
15228
15229 @geindex COBOL
15230 @geindex interfacing with
15231
15232 @node RM B 4 95-98 Interfacing with COBOL,RM B 5 22-26 Interfacing with Fortran,RM B 3 63-71 Interfacing with C,Implementation Advice
15233 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{23f}
15234 @section RM B.4(95-98): Interfacing with COBOL
15235
15236
15237 @quotation
15238
15239 "An Ada implementation should support the following interface
15240 correspondences between Ada and COBOL."
15241 @end quotation
15242
15243 Followed.
15244
15245 @quotation
15246
15247 "An Ada access @code{T} parameter is passed as a @code{BY REFERENCE} data item of
15248 the COBOL type corresponding to @code{T}."
15249 @end quotation
15250
15251 Followed.
15252
15253 @quotation
15254
15255 "An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
15256 the corresponding COBOL type."
15257 @end quotation
15258
15259 Followed.
15260
15261 @quotation
15262
15263 "Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
15264 COBOL type corresponding to the Ada parameter type; for scalars, a local
15265 copy is used if necessary to ensure by-copy semantics."
15266 @end quotation
15267
15268 Followed.
15269
15270 @geindex Fortran
15271 @geindex interfacing with
15272
15273 @node RM B 5 22-26 Interfacing with Fortran,RM C 1 3-5 Access to Machine Operations,RM B 4 95-98 Interfacing with COBOL,Implementation Advice
15274 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{240}
15275 @section RM B.5(22-26): Interfacing with Fortran
15276
15277
15278 @quotation
15279
15280 "An Ada implementation should support the following interface
15281 correspondences between Ada and Fortran:"
15282 @end quotation
15283
15284 Followed.
15285
15286 @quotation
15287
15288 "An Ada procedure corresponds to a Fortran subroutine."
15289 @end quotation
15290
15291 Followed.
15292
15293 @quotation
15294
15295 "An Ada function corresponds to a Fortran function."
15296 @end quotation
15297
15298 Followed.
15299
15300 @quotation
15301
15302 "An Ada parameter of an elementary, array, or record type @code{T} is
15303 passed as a @code{T} argument to a Fortran procedure, where @code{T} is
15304 the Fortran type corresponding to the Ada type @code{T}, and where the
15305 INTENT attribute of the corresponding dummy argument matches the Ada
15306 formal parameter mode; the Fortran implementation's parameter passing
15307 conventions are used. For elementary types, a local copy is used if
15308 necessary to ensure by-copy semantics."
15309 @end quotation
15310
15311 Followed.
15312
15313 @quotation
15314
15315 "An Ada parameter of an access-to-subprogram type is passed as a
15316 reference to a Fortran procedure whose interface corresponds to the
15317 designated subprogram's specification."
15318 @end quotation
15319
15320 Followed.
15321
15322 @geindex Machine operations
15323
15324 @node RM C 1 3-5 Access to Machine Operations,RM C 1 10-16 Access to Machine Operations,RM B 5 22-26 Interfacing with Fortran,Implementation Advice
15325 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{241}
15326 @section RM C.1(3-5): Access to Machine Operations
15327
15328
15329 @quotation
15330
15331 "The machine code or intrinsic support should allow access to all
15332 operations normally available to assembly language programmers for the
15333 target environment, including privileged instructions, if any."
15334 @end quotation
15335
15336 Followed.
15337
15338 @quotation
15339
15340 "The interfacing pragmas (see Annex B) should support interface to
15341 assembler; the default assembler should be associated with the
15342 convention identifier @code{Assembler}."
15343 @end quotation
15344
15345 Followed.
15346
15347 @quotation
15348
15349 "If an entity is exported to assembly language, then the implementation
15350 should allocate it at an addressable location, and should ensure that it
15351 is retained by the linking process, even if not otherwise referenced
15352 from the Ada code. The implementation should assume that any call to a
15353 machine code or assembler subprogram is allowed to read or update every
15354 object that is specified as exported."
15355 @end quotation
15356
15357 Followed.
15358
15359 @node RM C 1 10-16 Access to Machine Operations,RM C 3 28 Interrupt Support,RM C 1 3-5 Access to Machine Operations,Implementation Advice
15360 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{242}
15361 @section RM C.1(10-16): Access to Machine Operations
15362
15363
15364 @quotation
15365
15366 "The implementation should ensure that little or no overhead is
15367 associated with calling intrinsic and machine-code subprograms."
15368 @end quotation
15369
15370 Followed for both intrinsics and machine-code subprograms.
15371
15372 @quotation
15373
15374 "It is recommended that intrinsic subprograms be provided for convenient
15375 access to any machine operations that provide special capabilities or
15376 efficiency and that are not otherwise available through the language
15377 constructs."
15378 @end quotation
15379
15380 Followed. A full set of machine operation intrinsic subprograms is provided.
15381
15382 @quotation
15383
15384 "Atomic read-modify-write operations---e.g., test and set, compare and
15385 swap, decrement and test, enqueue/dequeue."
15386 @end quotation
15387
15388 Followed on any target supporting such operations.
15389
15390 @quotation
15391
15392 "Standard numeric functions---e.g.:, sin, log."
15393 @end quotation
15394
15395 Followed on any target supporting such operations.
15396
15397 @quotation
15398
15399 "String manipulation operations---e.g.:, translate and test."
15400 @end quotation
15401
15402 Followed on any target supporting such operations.
15403
15404 @quotation
15405
15406 "Vector operations---e.g.:, compare vector against thresholds."
15407 @end quotation
15408
15409 Followed on any target supporting such operations.
15410
15411 @quotation
15412
15413 "Direct operations on I/O ports."
15414 @end quotation
15415
15416 Followed on any target supporting such operations.
15417
15418 @geindex Interrupt support
15419
15420 @node RM C 3 28 Interrupt Support,RM C 3 1 20-21 Protected Procedure Handlers,RM C 1 10-16 Access to Machine Operations,Implementation Advice
15421 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{243}
15422 @section RM C.3(28): Interrupt Support
15423
15424
15425 @quotation
15426
15427 "If the @code{Ceiling_Locking} policy is not in effect, the
15428 implementation should provide means for the application to specify which
15429 interrupts are to be blocked during protected actions, if the underlying
15430 system allows for a finer-grain control of interrupt blocking."
15431 @end quotation
15432
15433 Followed. The underlying system does not allow for finer-grain control
15434 of interrupt blocking.
15435
15436 @geindex Protected procedure handlers
15437
15438 @node RM C 3 1 20-21 Protected Procedure Handlers,RM C 3 2 25 Package Interrupts,RM C 3 28 Interrupt Support,Implementation Advice
15439 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{244}
15440 @section RM C.3.1(20-21): Protected Procedure Handlers
15441
15442
15443 @quotation
15444
15445 "Whenever possible, the implementation should allow interrupt handlers to
15446 be called directly by the hardware."
15447 @end quotation
15448
15449 Followed on any target where the underlying operating system permits
15450 such direct calls.
15451
15452 @quotation
15453
15454 "Whenever practical, violations of any
15455 implementation-defined restrictions should be detected before run time."
15456 @end quotation
15457
15458 Followed. Compile time warnings are given when possible.
15459
15460 @geindex Package `@w{`}Interrupts`@w{`}
15461
15462 @geindex Interrupts
15463
15464 @node RM C 3 2 25 Package Interrupts,RM C 4 14 Pre-elaboration Requirements,RM C 3 1 20-21 Protected Procedure Handlers,Implementation Advice
15465 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{245}
15466 @section RM C.3.2(25): Package @code{Interrupts}
15467
15468
15469 @quotation
15470
15471 "If implementation-defined forms of interrupt handler procedures are
15472 supported, such as protected procedures with parameters, then for each
15473 such form of a handler, a type analogous to @code{Parameterless_Handler}
15474 should be specified in a child package of @code{Interrupts}, with the
15475 same operations as in the predefined package Interrupts."
15476 @end quotation
15477
15478 Followed.
15479
15480 @geindex Pre-elaboration requirements
15481
15482 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
15483 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{246}
15484 @section RM C.4(14): Pre-elaboration Requirements
15485
15486
15487 @quotation
15488
15489 "It is recommended that pre-elaborated packages be implemented in such a
15490 way that there should be little or no code executed at run time for the
15491 elaboration of entities not already covered by the Implementation
15492 Requirements."
15493 @end quotation
15494
15495 Followed. Executable code is generated in some cases, e.g., loops
15496 to initialize large arrays.
15497
15498 @node RM C 5 8 Pragma Discard_Names,RM C 7 2 30 The Package Task_Attributes,RM C 4 14 Pre-elaboration Requirements,Implementation Advice
15499 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{247}
15500 @section RM C.5(8): Pragma @code{Discard_Names}
15501
15502
15503 @quotation
15504
15505 "If the pragma applies to an entity, then the implementation should
15506 reduce the amount of storage used for storing names associated with that
15507 entity."
15508 @end quotation
15509
15510 Followed.
15511
15512 @geindex Package Task_Attributes
15513
15514 @geindex Task_Attributes
15515
15516 @node RM C 7 2 30 The Package Task_Attributes,RM D 3 17 Locking Policies,RM C 5 8 Pragma Discard_Names,Implementation Advice
15517 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{248}
15518 @section RM C.7.2(30): The Package Task_Attributes
15519
15520
15521 @quotation
15522
15523 "Some implementations are targeted to domains in which memory use at run
15524 time must be completely deterministic. For such implementations, it is
15525 recommended that the storage for task attributes will be pre-allocated
15526 statically and not from the heap. This can be accomplished by either
15527 placing restrictions on the number and the size of the task's
15528 attributes, or by using the pre-allocated storage for the first @code{N}
15529 attribute objects, and the heap for the others. In the latter case,
15530 @code{N} should be documented."
15531 @end quotation
15532
15533 Not followed. This implementation is not targeted to such a domain.
15534
15535 @geindex Locking Policies
15536
15537 @node RM D 3 17 Locking Policies,RM D 4 16 Entry Queuing Policies,RM C 7 2 30 The Package Task_Attributes,Implementation Advice
15538 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{249}
15539 @section RM D.3(17): Locking Policies
15540
15541
15542 @quotation
15543
15544 "The implementation should use names that end with @code{_Locking} for
15545 locking policies defined by the implementation."
15546 @end quotation
15547
15548 Followed. Two implementation-defined locking policies are defined,
15549 whose names (@code{Inheritance_Locking} and
15550 @code{Concurrent_Readers_Locking}) follow this suggestion.
15551
15552 @geindex Entry queuing policies
15553
15554 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
15555 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{24a}
15556 @section RM D.4(16): Entry Queuing Policies
15557
15558
15559 @quotation
15560
15561 "Names that end with @code{_Queuing} should be used
15562 for all implementation-defined queuing policies."
15563 @end quotation
15564
15565 Followed. No such implementation-defined queuing policies exist.
15566
15567 @geindex Preemptive abort
15568
15569 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
15570 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{24b}
15571 @section RM D.6(9-10): Preemptive Abort
15572
15573
15574 @quotation
15575
15576 "Even though the @emph{abort_statement} is included in the list of
15577 potentially blocking operations (see 9.5.1), it is recommended that this
15578 statement be implemented in a way that never requires the task executing
15579 the @emph{abort_statement} to block."
15580 @end quotation
15581
15582 Followed.
15583
15584 @quotation
15585
15586 "On a multi-processor, the delay associated with aborting a task on
15587 another processor should be bounded; the implementation should use
15588 periodic polling, if necessary, to achieve this."
15589 @end quotation
15590
15591 Followed.
15592
15593 @geindex Tasking restrictions
15594
15595 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
15596 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{24c}
15597 @section RM D.7(21): Tasking Restrictions
15598
15599
15600 @quotation
15601
15602 "When feasible, the implementation should take advantage of the specified
15603 restrictions to produce a more efficient implementation."
15604 @end quotation
15605
15606 GNAT currently takes advantage of these restrictions by providing an optimized
15607 run time when the Ravenscar profile and the GNAT restricted run time set
15608 of restrictions are specified. See pragma @code{Profile (Ravenscar)} and
15609 pragma @code{Profile (Restricted)} for more details.
15610
15611 @geindex Time
15612 @geindex monotonic
15613
15614 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
15615 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{24d}
15616 @section RM D.8(47-49): Monotonic Time
15617
15618
15619 @quotation
15620
15621 "When appropriate, implementations should provide configuration
15622 mechanisms to change the value of @code{Tick}."
15623 @end quotation
15624
15625 Such configuration mechanisms are not appropriate to this implementation
15626 and are thus not supported.
15627
15628 @quotation
15629
15630 "It is recommended that @code{Calendar.Clock} and @code{Real_Time.Clock}
15631 be implemented as transformations of the same time base."
15632 @end quotation
15633
15634 Followed.
15635
15636 @quotation
15637
15638 "It is recommended that the best time base which exists in
15639 the underlying system be available to the application through
15640 @code{Clock}. @cite{Best} may mean highest accuracy or largest range."
15641 @end quotation
15642
15643 Followed.
15644
15645 @geindex Partition communication subsystem
15646
15647 @geindex PCS
15648
15649 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
15650 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{24e}
15651 @section RM E.5(28-29): Partition Communication Subsystem
15652
15653
15654 @quotation
15655
15656 "Whenever possible, the PCS on the called partition should allow for
15657 multiple tasks to call the RPC-receiver with different messages and
15658 should allow them to block until the corresponding subprogram body
15659 returns."
15660 @end quotation
15661
15662 Followed by GLADE, a separately supplied PCS that can be used with
15663 GNAT.
15664
15665 @quotation
15666
15667 "The @code{Write} operation on a stream of type @code{Params_Stream_Type}
15668 should raise @code{Storage_Error} if it runs out of space trying to
15669 write the @code{Item} into the stream."
15670 @end quotation
15671
15672 Followed by GLADE, a separately supplied PCS that can be used with
15673 GNAT.
15674
15675 @geindex COBOL support
15676
15677 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
15678 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{24f}
15679 @section RM F(7): COBOL Support
15680
15681
15682 @quotation
15683
15684 "If COBOL (respectively, C) is widely supported in the target
15685 environment, implementations supporting the Information Systems Annex
15686 should provide the child package @code{Interfaces.COBOL} (respectively,
15687 @code{Interfaces.C}) specified in Annex B and should support a
15688 @code{convention_identifier} of COBOL (respectively, C) in the interfacing
15689 pragmas (see Annex B), thus allowing Ada programs to interface with
15690 programs written in that language."
15691 @end quotation
15692
15693 Followed.
15694
15695 @geindex Decimal radix support
15696
15697 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15698 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{250}
15699 @section RM F.1(2): Decimal Radix Support
15700
15701
15702 @quotation
15703
15704 "Packed decimal should be used as the internal representation for objects
15705 of subtype @code{S} when @code{S}'Machine_Radix = 10."
15706 @end quotation
15707
15708 Not followed. GNAT ignores @code{S}'Machine_Radix and always uses binary
15709 representations.
15710
15711 @geindex Numerics
15712
15713 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15714 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{251}
15715 @section RM G: Numerics
15716
15717
15718 @quotation
15719
15720 "If Fortran (respectively, C) is widely supported in the target
15721 environment, implementations supporting the Numerics Annex
15722 should provide the child package @code{Interfaces.Fortran} (respectively,
15723 @code{Interfaces.C}) specified in Annex B and should support a
15724 @code{convention_identifier} of Fortran (respectively, C) in the interfacing
15725 pragmas (see Annex B), thus allowing Ada programs to interface with
15726 programs written in that language."
15727 @end quotation
15728
15729 Followed.
15730
15731 @geindex Complex types
15732
15733 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15734 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{252}
15735 @section RM G.1.1(56-58): Complex Types
15736
15737
15738 @quotation
15739
15740 "Because the usual mathematical meaning of multiplication of a complex
15741 operand and a real operand is that of the scaling of both components of
15742 the former by the latter, an implementation should not perform this
15743 operation by first promoting the real operand to complex type and then
15744 performing a full complex multiplication. In systems that, in the
15745 future, support an Ada binding to IEC 559:1989, the latter technique
15746 will not generate the required result when one of the components of the
15747 complex operand is infinite. (Explicit multiplication of the infinite
15748 component by the zero component obtained during promotion yields a NaN
15749 that propagates into the final result.) Analogous advice applies in the
15750 case of multiplication of a complex operand and a pure-imaginary
15751 operand, and in the case of division of a complex operand by a real or
15752 pure-imaginary operand."
15753 @end quotation
15754
15755 Not followed.
15756
15757 @quotation
15758
15759 "Similarly, because the usual mathematical meaning of addition of a
15760 complex operand and a real operand is that the imaginary operand remains
15761 unchanged, an implementation should not perform this operation by first
15762 promoting the real operand to complex type and then performing a full
15763 complex addition. In implementations in which the @code{Signed_Zeros}
15764 attribute of the component type is @code{True} (and which therefore
15765 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15766 predefined arithmetic operations), the latter technique will not
15767 generate the required result when the imaginary component of the complex
15768 operand is a negatively signed zero. (Explicit addition of the negative
15769 zero to the zero obtained during promotion yields a positive zero.)
15770 Analogous advice applies in the case of addition of a complex operand
15771 and a pure-imaginary operand, and in the case of subtraction of a
15772 complex operand and a real or pure-imaginary operand."
15773 @end quotation
15774
15775 Not followed.
15776
15777 @quotation
15778
15779 "Implementations in which @code{Real'Signed_Zeros} is @code{True} should
15780 attempt to provide a rational treatment of the signs of zero results and
15781 result components. As one example, the result of the @code{Argument}
15782 function should have the sign of the imaginary component of the
15783 parameter @code{X} when the point represented by that parameter lies on
15784 the positive real axis; as another, the sign of the imaginary component
15785 of the @code{Compose_From_Polar} function should be the same as
15786 (respectively, the opposite of) that of the @code{Argument} parameter when that
15787 parameter has a value of zero and the @code{Modulus} parameter has a
15788 nonnegative (respectively, negative) value."
15789 @end quotation
15790
15791 Followed.
15792
15793 @geindex Complex elementary functions
15794
15795 @node RM G 1 2 49 Complex Elementary Functions,RM G 2 4 19 Accuracy Requirements,RM G 1 1 56-58 Complex Types,Implementation Advice
15796 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{253}
15797 @section RM G.1.2(49): Complex Elementary Functions
15798
15799
15800 @quotation
15801
15802 "Implementations in which @code{Complex_Types.Real'Signed_Zeros} is
15803 @code{True} should attempt to provide a rational treatment of the signs
15804 of zero results and result components. For example, many of the complex
15805 elementary functions have components that are odd functions of one of
15806 the parameter components; in these cases, the result component should
15807 have the sign of the parameter component at the origin. Other complex
15808 elementary functions have zero components whose sign is opposite that of
15809 a parameter component at the origin, or is always positive or always
15810 negative."
15811 @end quotation
15812
15813 Followed.
15814
15815 @geindex Accuracy requirements
15816
15817 @node RM G 2 4 19 Accuracy Requirements,RM G 2 6 15 Complex Arithmetic Accuracy,RM G 1 2 49 Complex Elementary Functions,Implementation Advice
15818 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{254}
15819 @section RM G.2.4(19): Accuracy Requirements
15820
15821
15822 @quotation
15823
15824 "The versions of the forward trigonometric functions without a
15825 @code{Cycle} parameter should not be implemented by calling the
15826 corresponding version with a @code{Cycle} parameter of
15827 @code{2.0*Numerics.Pi}, since this will not provide the required
15828 accuracy in some portions of the domain. For the same reason, the
15829 version of @code{Log} without a @code{Base} parameter should not be
15830 implemented by calling the corresponding version with a @code{Base}
15831 parameter of @code{Numerics.e}."
15832 @end quotation
15833
15834 Followed.
15835
15836 @geindex Complex arithmetic accuracy
15837
15838 @geindex Accuracy
15839 @geindex complex arithmetic
15840
15841 @node RM G 2 6 15 Complex Arithmetic Accuracy,RM H 6 15/2 Pragma Partition_Elaboration_Policy,RM G 2 4 19 Accuracy Requirements,Implementation Advice
15842 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{255}
15843 @section RM G.2.6(15): Complex Arithmetic Accuracy
15844
15845
15846 @quotation
15847
15848 "The version of the @code{Compose_From_Polar} function without a
15849 @code{Cycle} parameter should not be implemented by calling the
15850 corresponding version with a @code{Cycle} parameter of
15851 @code{2.0*Numerics.Pi}, since this will not provide the required
15852 accuracy in some portions of the domain."
15853 @end quotation
15854
15855 Followed.
15856
15857 @geindex Sequential elaboration policy
15858
15859 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15860 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{256}
15861 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15862
15863
15864 @quotation
15865
15866 "If the partition elaboration policy is @code{Sequential} and the
15867 Environment task becomes permanently blocked during elaboration then the
15868 partition is deadlocked and it is recommended that the partition be
15869 immediately terminated."
15870 @end quotation
15871
15872 Not followed.
15873
15874 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15875 @anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{257}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{258}
15876 @chapter Implementation Defined Characteristics
15877
15878
15879 In addition to the implementation dependent pragmas and attributes, and the
15880 implementation advice, there are a number of other Ada features that are
15881 potentially implementation dependent and are designated as
15882 implementation-defined. These are mentioned throughout the Ada Reference
15883 Manual, and are summarized in Annex M.
15884
15885 A requirement for conforming Ada compilers is that they provide
15886 documentation describing how the implementation deals with each of these
15887 issues. In this chapter you will find each point in Annex M listed,
15888 followed by a description of how GNAT
15889 handles the implementation dependence.
15890
15891 You can use this chapter as a guide to minimizing implementation
15892 dependent features in your programs if portability to other compilers
15893 and other operating systems is an important consideration. The numbers
15894 in each entry below correspond to the paragraph numbers in the Ada
15895 Reference Manual.
15896
15897
15898 @itemize *
15899
15900 @item
15901 "Whether or not each recommendation given in Implementation
15902 Advice is followed. See 1.1.2(37)."
15903 @end itemize
15904
15905 See @ref{a,,Implementation Advice}.
15906
15907
15908 @itemize *
15909
15910 @item
15911 "Capacity limitations of the implementation. See 1.1.3(3)."
15912 @end itemize
15913
15914 The complexity of programs that can be processed is limited only by the
15915 total amount of available virtual memory, and disk space for the
15916 generated object files.
15917
15918
15919 @itemize *
15920
15921 @item
15922 "Variations from the standard that are impractical to avoid
15923 given the implementation's execution environment. See 1.1.3(6)."
15924 @end itemize
15925
15926 There are no variations from the standard.
15927
15928
15929 @itemize *
15930
15931 @item
15932 "Which code_statements cause external
15933 interactions. See 1.1.3(10)."
15934 @end itemize
15935
15936 Any @emph{code_statement} can potentially cause external interactions.
15937
15938
15939 @itemize *
15940
15941 @item
15942 "The coded representation for the text of an Ada
15943 program. See 2.1(4)."
15944 @end itemize
15945
15946 See separate section on source representation.
15947
15948
15949 @itemize *
15950
15951 @item
15952 "The control functions allowed in comments. See 2.1(14)."
15953 @end itemize
15954
15955 See separate section on source representation.
15956
15957
15958 @itemize *
15959
15960 @item
15961 "The representation for an end of line. See 2.2(2)."
15962 @end itemize
15963
15964 See separate section on source representation.
15965
15966
15967 @itemize *
15968
15969 @item
15970 "Maximum supported line length and lexical element
15971 length. See 2.2(15)."
15972 @end itemize
15973
15974 The maximum line length is 255 characters and the maximum length of
15975 a lexical element is also 255 characters. This is the default setting
15976 if not overridden by the use of compiler switch @emph{-gnaty} (which
15977 sets the maximum to 79) or @emph{-gnatyMnn} which allows the maximum
15978 line length to be specified to be any value up to 32767. The maximum
15979 length of a lexical element is the same as the maximum line length.
15980
15981
15982 @itemize *
15983
15984 @item
15985 "Implementation defined pragmas. See 2.8(14)."
15986 @end itemize
15987
15988 See @ref{7,,Implementation Defined Pragmas}.
15989
15990
15991 @itemize *
15992
15993 @item
15994 "Effect of pragma @code{Optimize}. See 2.8(27)."
15995 @end itemize
15996
15997 Pragma @code{Optimize}, if given with a @code{Time} or @code{Space}
15998 parameter, checks that the optimization flag is set, and aborts if it is
15999 not.
16000
16001
16002 @itemize *
16003
16004 @item
16005 "The sequence of characters of the value returned by
16006 @code{S'Image} when some of the graphic characters of
16007 @code{S'Wide_Image} are not defined in @code{Character}. See
16008 3.5(37)."
16009 @end itemize
16010
16011 The sequence of characters is as defined by the wide character encoding
16012 method used for the source. See section on source representation for
16013 further details.
16014
16015
16016 @itemize *
16017
16018 @item
16019 "The predefined integer types declared in
16020 @code{Standard}. See 3.5.4(25)."
16021 @end itemize
16022
16023
16024 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16025 @headitem
16026
16027 Type
16028
16029 @tab
16030
16031 Representation
16032
16033 @item
16034
16035 @emph{Short_Short_Integer}
16036
16037 @tab
16038
16039 8 bit signed
16040
16041 @item
16042
16043 @emph{Short_Integer}
16044
16045 @tab
16046
16047 (Short) 16 bit signed
16048
16049 @item
16050
16051 @emph{Integer}
16052
16053 @tab
16054
16055 32 bit signed
16056
16057 @item
16058
16059 @emph{Long_Integer}
16060
16061 @tab
16062
16063 64 bit signed (on most 64 bit targets,
16064 depending on the C definition of long).
16065 32 bit signed (all other targets)
16066
16067 @item
16068
16069 @emph{Long_Long_Integer}
16070
16071 @tab
16072
16073 64 bit signed
16074
16075 @end multitable
16076
16077
16078
16079 @itemize *
16080
16081 @item
16082 "Any nonstandard integer types and the operators defined
16083 for them. See 3.5.4(26)."
16084 @end itemize
16085
16086 There are no nonstandard integer types.
16087
16088
16089 @itemize *
16090
16091 @item
16092 "Any nonstandard real types and the operators defined for
16093 them. See 3.5.6(8)."
16094 @end itemize
16095
16096 There are no nonstandard real types.
16097
16098
16099 @itemize *
16100
16101 @item
16102 "What combinations of requested decimal precision and range
16103 are supported for floating point types. See 3.5.7(7)."
16104 @end itemize
16105
16106 The precision and range is as defined by the IEEE standard.
16107
16108
16109 @itemize *
16110
16111 @item
16112 "The predefined floating point types declared in
16113 @code{Standard}. See 3.5.7(16)."
16114 @end itemize
16115
16116
16117 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16118 @headitem
16119
16120 Type
16121
16122 @tab
16123
16124 Representation
16125
16126 @item
16127
16128 @emph{Short_Float}
16129
16130 @tab
16131
16132 32 bit IEEE short
16133
16134 @item
16135
16136 @emph{Float}
16137
16138 @tab
16139
16140 (Short) 32 bit IEEE short
16141
16142 @item
16143
16144 @emph{Long_Float}
16145
16146 @tab
16147
16148 64 bit IEEE long
16149
16150 @item
16151
16152 @emph{Long_Long_Float}
16153
16154 @tab
16155
16156 64 bit IEEE long (80 bit IEEE long on x86 processors)
16157
16158 @end multitable
16159
16160
16161
16162 @itemize *
16163
16164 @item
16165 "The small of an ordinary fixed point type. See 3.5.9(8)."
16166 @end itemize
16167
16168 @code{Fine_Delta} is 2**(-63)
16169
16170
16171 @itemize *
16172
16173 @item
16174 "What combinations of small, range, and digits are
16175 supported for fixed point types. See 3.5.9(10)."
16176 @end itemize
16177
16178 Any combinations are permitted that do not result in a small less than
16179 @code{Fine_Delta} and do not result in a mantissa larger than 63 bits.
16180 If the mantissa is larger than 53 bits on machines where Long_Long_Float
16181 is 64 bits (true of all architectures except ia32), then the output from
16182 Text_IO is accurate to only 53 bits, rather than the full mantissa. This
16183 is because floating-point conversions are used to convert fixed point.
16184
16185
16186 @itemize *
16187
16188 @item
16189 "The result of @code{Tags.Expanded_Name} for types declared
16190 within an unnamed @emph{block_statement}. See 3.9(10)."
16191 @end itemize
16192
16193 Block numbers of the form @code{B@emph{nnn}}, where @emph{nnn} is a
16194 decimal integer are allocated.
16195
16196
16197 @itemize *
16198
16199 @item
16200 "Implementation-defined attributes. See 4.1.4(12)."
16201 @end itemize
16202
16203 See @ref{8,,Implementation Defined Attributes}.
16204
16205
16206 @itemize *
16207
16208 @item
16209 "Any implementation-defined time types. See 9.6(6)."
16210 @end itemize
16211
16212 There are no implementation-defined time types.
16213
16214
16215 @itemize *
16216
16217 @item
16218 "The time base associated with relative delays."
16219 @end itemize
16220
16221 See 9.6(20). The time base used is that provided by the C library
16222 function @code{gettimeofday}.
16223
16224
16225 @itemize *
16226
16227 @item
16228 "The time base of the type @code{Calendar.Time}. See
16229 9.6(23)."
16230 @end itemize
16231
16232 The time base used is that provided by the C library function
16233 @code{gettimeofday}.
16234
16235
16236 @itemize *
16237
16238 @item
16239 "The time zone used for package @code{Calendar}
16240 operations. See 9.6(24)."
16241 @end itemize
16242
16243 The time zone used by package @code{Calendar} is the current system time zone
16244 setting for local time, as accessed by the C library function
16245 @code{localtime}.
16246
16247
16248 @itemize *
16249
16250 @item
16251 "Any limit on @emph{delay_until_statements} of
16252 @emph{select_statements}. See 9.6(29)."
16253 @end itemize
16254
16255 There are no such limits.
16256
16257
16258 @itemize *
16259
16260 @item
16261 "Whether or not two non-overlapping parts of a composite
16262 object are independently addressable, in the case where packing, record
16263 layout, or @code{Component_Size} is specified for the object. See
16264 9.10(1)."
16265 @end itemize
16266
16267 Separate components are independently addressable if they do not share
16268 overlapping storage units.
16269
16270
16271 @itemize *
16272
16273 @item
16274 "The representation for a compilation. See 10.1(2)."
16275 @end itemize
16276
16277 A compilation is represented by a sequence of files presented to the
16278 compiler in a single invocation of the @emph{gcc} command.
16279
16280
16281 @itemize *
16282
16283 @item
16284 "Any restrictions on compilations that contain multiple
16285 compilation_units. See 10.1(4)."
16286 @end itemize
16287
16288 No single file can contain more than one compilation unit, but any
16289 sequence of files can be presented to the compiler as a single
16290 compilation.
16291
16292
16293 @itemize *
16294
16295 @item
16296 "The mechanisms for creating an environment and for adding
16297 and replacing compilation units. See 10.1.4(3)."
16298 @end itemize
16299
16300 See separate section on compilation model.
16301
16302
16303 @itemize *
16304
16305 @item
16306 "The manner of explicitly assigning library units to a
16307 partition. See 10.2(2)."
16308 @end itemize
16309
16310 If a unit contains an Ada main program, then the Ada units for the partition
16311 are determined by recursive application of the rules in the Ada Reference
16312 Manual section 10.2(2-6). In other words, the Ada units will be those that
16313 are needed by the main program, and then this definition of need is applied
16314 recursively to those units, and the partition contains the transitive
16315 closure determined by this relationship. In short, all the necessary units
16316 are included, with no need to explicitly specify the list. If additional
16317 units are required, e.g., by foreign language units, then all units must be
16318 mentioned in the context clause of one of the needed Ada units.
16319
16320 If the partition contains no main program, or if the main program is in
16321 a language other than Ada, then GNAT
16322 provides the binder options @emph{-z} and @emph{-n} respectively, and in
16323 this case a list of units can be explicitly supplied to the binder for
16324 inclusion in the partition (all units needed by these units will also
16325 be included automatically). For full details on the use of these
16326 options, refer to @emph{GNAT Make Program gnatmake} in the
16327 @cite{GNAT User's Guide}.
16328
16329
16330 @itemize *
16331
16332 @item
16333 "The implementation-defined means, if any, of specifying
16334 which compilation units are needed by a given compilation unit. See
16335 10.2(2)."
16336 @end itemize
16337
16338 The units needed by a given compilation unit are as defined in
16339 the Ada Reference Manual section 10.2(2-6). There are no
16340 implementation-defined pragmas or other implementation-defined
16341 means for specifying needed units.
16342
16343
16344 @itemize *
16345
16346 @item
16347 "The manner of designating the main subprogram of a
16348 partition. See 10.2(7)."
16349 @end itemize
16350
16351 The main program is designated by providing the name of the
16352 corresponding @code{ALI} file as the input parameter to the binder.
16353
16354
16355 @itemize *
16356
16357 @item
16358 "The order of elaboration of @emph{library_items}. See
16359 10.2(18)."
16360 @end itemize
16361
16362 The first constraint on ordering is that it meets the requirements of
16363 Chapter 10 of the Ada Reference Manual. This still leaves some
16364 implementation dependent choices, which are resolved by first
16365 elaborating bodies as early as possible (i.e., in preference to specs
16366 where there is a choice), and second by evaluating the immediate with
16367 clauses of a unit to determine the probably best choice, and
16368 third by elaborating in alphabetical order of unit names
16369 where a choice still remains.
16370
16371
16372 @itemize *
16373
16374 @item
16375 "Parameter passing and function return for the main
16376 subprogram. See 10.2(21)."
16377 @end itemize
16378
16379 The main program has no parameters. It may be a procedure, or a function
16380 returning an integer type. In the latter case, the returned integer
16381 value is the return code of the program (overriding any value that
16382 may have been set by a call to @code{Ada.Command_Line.Set_Exit_Status}).
16383
16384
16385 @itemize *
16386
16387 @item
16388 "The mechanisms for building and running partitions. See
16389 10.2(24)."
16390 @end itemize
16391
16392 GNAT itself supports programs with only a single partition. The GNATDIST
16393 tool provided with the GLADE package (which also includes an implementation
16394 of the PCS) provides a completely flexible method for building and running
16395 programs consisting of multiple partitions. See the separate GLADE manual
16396 for details.
16397
16398
16399 @itemize *
16400
16401 @item
16402 "The details of program execution, including program
16403 termination. See 10.2(25)."
16404 @end itemize
16405
16406 See separate section on compilation model.
16407
16408
16409 @itemize *
16410
16411 @item
16412 "The semantics of any non-active partitions supported by the
16413 implementation. See 10.2(28)."
16414 @end itemize
16415
16416 Passive partitions are supported on targets where shared memory is
16417 provided by the operating system. See the GLADE reference manual for
16418 further details.
16419
16420
16421 @itemize *
16422
16423 @item
16424 "The information returned by @code{Exception_Message}. See
16425 11.4.1(10)."
16426 @end itemize
16427
16428 Exception message returns the null string unless a specific message has
16429 been passed by the program.
16430
16431
16432 @itemize *
16433
16434 @item
16435 "The result of @code{Exceptions.Exception_Name} for types
16436 declared within an unnamed @emph{block_statement}. See 11.4.1(12)."
16437 @end itemize
16438
16439 Blocks have implementation defined names of the form @code{B@emph{nnn}}
16440 where @emph{nnn} is an integer.
16441
16442
16443 @itemize *
16444
16445 @item
16446 "The information returned by
16447 @code{Exception_Information}. See 11.4.1(13)."
16448 @end itemize
16449
16450 @code{Exception_Information} returns a string in the following format:
16451
16452 @example
16453 *Exception_Name:* nnnnn
16454 *Message:* mmmmm
16455 *PID:* ppp
16456 *Load address:* 0xhhhh
16457 *Call stack traceback locations:*
16458 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
16459 @end example
16460
16461 where
16462
16463 @quotation
16464
16465
16466 @itemize *
16467
16468 @item
16469 @code{nnnn} is the fully qualified name of the exception in all upper
16470 case letters. This line is always present.
16471
16472 @item
16473 @code{mmmm} is the message (this line present only if message is non-null)
16474
16475 @item
16476 @code{ppp} is the Process Id value as a decimal integer (this line is
16477 present only if the Process Id is nonzero). Currently we are
16478 not making use of this field.
16479
16480 @item
16481 The Load address line, the Call stack traceback locations line and the
16482 following values are present only if at least one traceback location was
16483 recorded. The Load address indicates the address at which the main executable
16484 was loaded; this line may not be present if operating system hasn't relocated
16485 the main executable. The values are given in C style format, with lower case
16486 letters for a-f, and only as many digits present as are necessary.
16487 The line terminator sequence at the end of each line, including
16488 the last line is a single @code{LF} character (@code{16#0A#}).
16489 @end itemize
16490 @end quotation
16491
16492
16493 @itemize *
16494
16495 @item
16496 "Implementation-defined check names. See 11.5(27)."
16497 @end itemize
16498
16499 The implementation defined check names include Alignment_Check,
16500 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
16501 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
16502 program can add implementation-defined check names by means of the pragma
16503 Check_Name. See the description of pragma @code{Suppress} for full details.
16504
16505
16506 @itemize *
16507
16508 @item
16509 "The interpretation of each aspect of representation. See
16510 13.1(20)."
16511 @end itemize
16512
16513 See separate section on data representations.
16514
16515
16516 @itemize *
16517
16518 @item
16519 "Any restrictions placed upon representation items. See
16520 13.1(20)."
16521 @end itemize
16522
16523 See separate section on data representations.
16524
16525
16526 @itemize *
16527
16528 @item
16529 "The meaning of @code{Size} for indefinite subtypes. See
16530 13.3(48)."
16531 @end itemize
16532
16533 Size for an indefinite subtype is the maximum possible size, except that
16534 for the case of a subprogram parameter, the size of the parameter object
16535 is the actual size.
16536
16537
16538 @itemize *
16539
16540 @item
16541 "The default external representation for a type tag. See
16542 13.3(75)."
16543 @end itemize
16544
16545 The default external representation for a type tag is the fully expanded
16546 name of the type in upper case letters.
16547
16548
16549 @itemize *
16550
16551 @item
16552 "What determines whether a compilation unit is the same in
16553 two different partitions. See 13.3(76)."
16554 @end itemize
16555
16556 A compilation unit is the same in two different partitions if and only
16557 if it derives from the same source file.
16558
16559
16560 @itemize *
16561
16562 @item
16563 "Implementation-defined components. See 13.5.1(15)."
16564 @end itemize
16565
16566 The only implementation defined component is the tag for a tagged type,
16567 which contains a pointer to the dispatching table.
16568
16569
16570 @itemize *
16571
16572 @item
16573 "If @code{Word_Size} = @code{Storage_Unit}, the default bit
16574 ordering. See 13.5.3(5)."
16575 @end itemize
16576
16577 @code{Word_Size} (32) is not the same as @code{Storage_Unit} (8) for this
16578 implementation, so no non-default bit ordering is supported. The default
16579 bit ordering corresponds to the natural endianness of the target architecture.
16580
16581
16582 @itemize *
16583
16584 @item
16585 "The contents of the visible part of package @code{System}
16586 and its language-defined children. See 13.7(2)."
16587 @end itemize
16588
16589 See the definition of these packages in files @code{system.ads} and
16590 @code{s-stoele.ads}. Note that two declarations are added to package
16591 System.
16592
16593 @example
16594 Max_Priority : constant Positive := Priority'Last;
16595 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
16596 @end example
16597
16598
16599 @itemize *
16600
16601 @item
16602 "The contents of the visible part of package
16603 @code{System.Machine_Code}, and the meaning of
16604 @emph{code_statements}. See 13.8(7)."
16605 @end itemize
16606
16607 See the definition and documentation in file @code{s-maccod.ads}.
16608
16609
16610 @itemize *
16611
16612 @item
16613 "The effect of unchecked conversion. See 13.9(11)."
16614 @end itemize
16615
16616 Unchecked conversion between types of the same size
16617 results in an uninterpreted transmission of the bits from one type
16618 to the other. If the types are of unequal sizes, then in the case of
16619 discrete types, a shorter source is first zero or sign extended as
16620 necessary, and a shorter target is simply truncated on the left.
16621 For all non-discrete types, the source is first copied if necessary
16622 to ensure that the alignment requirements of the target are met, then
16623 a pointer is constructed to the source value, and the result is obtained
16624 by dereferencing this pointer after converting it to be a pointer to the
16625 target type. Unchecked conversions where the target subtype is an
16626 unconstrained array are not permitted. If the target alignment is
16627 greater than the source alignment, then a copy of the result is
16628 made with appropriate alignment
16629
16630
16631 @itemize *
16632
16633 @item
16634 "The semantics of operations on invalid representations.
16635 See 13.9.2(10-11)."
16636 @end itemize
16637
16638 For assignments and other operations where the use of invalid values cannot
16639 result in erroneous behavior, the compiler ignores the possibility of invalid
16640 values. An exception is raised at the point where an invalid value would
16641 result in erroneous behavior. For example executing:
16642
16643 @example
16644 procedure invalidvals is
16645 X : Integer := -1;
16646 Y : Natural range 1 .. 10;
16647 for Y'Address use X'Address;
16648 Z : Natural range 1 .. 10;
16649 A : array (Natural range 1 .. 10) of Integer;
16650 begin
16651 Z := Y; -- no exception
16652 A (Z) := 3; -- exception raised;
16653 end;
16654 @end example
16655
16656 As indicated, an exception is raised on the array assignment, but not
16657 on the simple assignment of the invalid negative value from Y to Z.
16658
16659
16660 @itemize *
16661
16662 @item
16663 "The manner of choosing a storage pool for an access type
16664 when @code{Storage_Pool} is not specified for the type. See 13.11(17)."
16665 @end itemize
16666
16667 There are 3 different standard pools used by the compiler when
16668 @code{Storage_Pool} is not specified depending whether the type is local
16669 to a subprogram or defined at the library level and whether
16670 @code{Storage_Size`@w{`}is specified or not. See documentation in the runtime
16671 library units `@w{`}System.Pool_Global}, @code{System.Pool_Size} and
16672 @code{System.Pool_Local} in files @code{s-poosiz.ads},
16673 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
16674 default pools used.
16675
16676
16677 @itemize *
16678
16679 @item
16680 "Whether or not the implementation provides user-accessible
16681 names for the standard pool type(s). See 13.11(17)."
16682 @end itemize
16683
16684 See documentation in the sources of the run time mentioned in the previous
16685 paragraph. All these pools are accessible by means of @cite{with}ing
16686 these units.
16687
16688
16689 @itemize *
16690
16691 @item
16692 "The meaning of @code{Storage_Size}. See 13.11(18)."
16693 @end itemize
16694
16695 @code{Storage_Size} is measured in storage units, and refers to the
16696 total space available for an access type collection, or to the primary
16697 stack space for a task.
16698
16699
16700 @itemize *
16701
16702 @item
16703 "Implementation-defined aspects of storage pools. See
16704 13.11(22)."
16705 @end itemize
16706
16707 See documentation in the sources of the run time mentioned in the
16708 paragraph about standard storage pools above
16709 for details on GNAT-defined aspects of storage pools.
16710
16711
16712 @itemize *
16713
16714 @item
16715 "The set of restrictions allowed in a pragma
16716 @code{Restrictions}. See 13.12(7)."
16717 @end itemize
16718
16719 See @ref{9,,Standard and Implementation Defined Restrictions}.
16720
16721
16722 @itemize *
16723
16724 @item
16725 "The consequences of violating limitations on
16726 @code{Restrictions} pragmas. See 13.12(9)."
16727 @end itemize
16728
16729 Restrictions that can be checked at compile time result in illegalities
16730 if violated. Currently there are no other consequences of violating
16731 restrictions.
16732
16733
16734 @itemize *
16735
16736 @item
16737 "The representation used by the @code{Read} and
16738 @code{Write} attributes of elementary types in terms of stream
16739 elements. See 13.13.2(9)."
16740 @end itemize
16741
16742 The representation is the in-memory representation of the base type of
16743 the type, using the number of bits corresponding to the
16744 @code{type'Size} value, and the natural ordering of the machine.
16745
16746
16747 @itemize *
16748
16749 @item
16750 "The names and characteristics of the numeric subtypes
16751 declared in the visible part of package @code{Standard}. See A.1(3)."
16752 @end itemize
16753
16754 See items describing the integer and floating-point types supported.
16755
16756
16757 @itemize *
16758
16759 @item
16760 "The string returned by @code{Character_Set_Version}.
16761 See A.3.5(3)."
16762 @end itemize
16763
16764 @code{Ada.Wide_Characters.Handling.Character_Set_Version} returns
16765 the string "Unicode 4.0", referring to version 4.0 of the
16766 Unicode specification.
16767
16768
16769 @itemize *
16770
16771 @item
16772 "The accuracy actually achieved by the elementary
16773 functions. See A.5.1(1)."
16774 @end itemize
16775
16776 The elementary functions correspond to the functions available in the C
16777 library. Only fast math mode is implemented.
16778
16779
16780 @itemize *
16781
16782 @item
16783 "The sign of a zero result from some of the operators or
16784 functions in @code{Numerics.Generic_Elementary_Functions}, when
16785 @code{Float_Type'Signed_Zeros} is @code{True}. See A.5.1(46)."
16786 @end itemize
16787
16788 The sign of zeroes follows the requirements of the IEEE 754 standard on
16789 floating-point.
16790
16791
16792 @itemize *
16793
16794 @item
16795 "The value of
16796 @code{Numerics.Float_Random.Max_Image_Width}. See A.5.2(27)."
16797 @end itemize
16798
16799 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16800
16801
16802 @itemize *
16803
16804 @item
16805 "The value of
16806 @code{Numerics.Discrete_Random.Max_Image_Width}. See A.5.2(27)."
16807 @end itemize
16808
16809 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16810
16811
16812 @itemize *
16813
16814 @item
16815 "The algorithms for random number generation. See
16816 A.5.2(32)."
16817 @end itemize
16818
16819 The algorithm is the Mersenne Twister, as documented in the source file
16820 @code{s-rannum.adb}. This version of the algorithm has a period of
16821 2**19937-1.
16822
16823
16824 @itemize *
16825
16826 @item
16827 "The string representation of a random number generator's
16828 state. See A.5.2(38)."
16829 @end itemize
16830
16831 The value returned by the Image function is the concatenation of
16832 the fixed-width decimal representations of the 624 32-bit integers
16833 of the state vector.
16834
16835
16836 @itemize *
16837
16838 @item
16839 "The minimum time interval between calls to the
16840 time-dependent Reset procedure that are guaranteed to initiate different
16841 random number sequences. See A.5.2(45)."
16842 @end itemize
16843
16844 The minimum period between reset calls to guarantee distinct series of
16845 random numbers is one microsecond.
16846
16847
16848 @itemize *
16849
16850 @item
16851 "The values of the @code{Model_Mantissa},
16852 @code{Model_Emin}, @code{Model_Epsilon}, @code{Model},
16853 @code{Safe_First}, and @code{Safe_Last} attributes, if the Numerics
16854 Annex is not supported. See A.5.3(72)."
16855 @end itemize
16856
16857 Run the compiler with @emph{-gnatS} to produce a listing of package
16858 @code{Standard}, has the values of all numeric attributes.
16859
16860
16861 @itemize *
16862
16863 @item
16864 "Any implementation-defined characteristics of the
16865 input-output packages. See A.7(14)."
16866 @end itemize
16867
16868 There are no special implementation defined characteristics for these
16869 packages.
16870
16871
16872 @itemize *
16873
16874 @item
16875 "The value of @code{Buffer_Size} in @code{Storage_IO}. See
16876 A.9(10)."
16877 @end itemize
16878
16879 All type representations are contiguous, and the @code{Buffer_Size} is
16880 the value of @code{type'Size} rounded up to the next storage unit
16881 boundary.
16882
16883
16884 @itemize *
16885
16886 @item
16887 "External files for standard input, standard output, and
16888 standard error See A.10(5)."
16889 @end itemize
16890
16891 These files are mapped onto the files provided by the C streams
16892 libraries. See source file @code{i-cstrea.ads} for further details.
16893
16894
16895 @itemize *
16896
16897 @item
16898 "The accuracy of the value produced by @code{Put}. See
16899 A.10.9(36)."
16900 @end itemize
16901
16902 If more digits are requested in the output than are represented by the
16903 precision of the value, zeroes are output in the corresponding least
16904 significant digit positions.
16905
16906
16907 @itemize *
16908
16909 @item
16910 "The meaning of @code{Argument_Count}, @code{Argument}, and
16911 @code{Command_Name}. See A.15(1)."
16912 @end itemize
16913
16914 These are mapped onto the @code{argv} and @code{argc} parameters of the
16915 main program in the natural manner.
16916
16917
16918 @itemize *
16919
16920 @item
16921 "The interpretation of the @code{Form} parameter in procedure
16922 @code{Create_Directory}. See A.16(56)."
16923 @end itemize
16924
16925 The @code{Form} parameter is not used.
16926
16927
16928 @itemize *
16929
16930 @item
16931 "The interpretation of the @code{Form} parameter in procedure
16932 @code{Create_Path}. See A.16(60)."
16933 @end itemize
16934
16935 The @code{Form} parameter is not used.
16936
16937
16938 @itemize *
16939
16940 @item
16941 "The interpretation of the @code{Form} parameter in procedure
16942 @code{Copy_File}. See A.16(68)."
16943 @end itemize
16944
16945 The @code{Form} parameter is case-insensitive.
16946 Two fields are recognized in the @code{Form} parameter:
16947
16948 @example
16949 *preserve=<value>*
16950 *mode=<value>*
16951 @end example
16952
16953 <value> starts immediately after the character '=' and ends with the
16954 character immediately preceding the next comma (',') or with the last
16955 character of the parameter.
16956
16957 The only possible values for preserve= are:
16958
16959
16960 @multitable {xxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16961 @headitem
16962
16963 Value
16964
16965 @tab
16966
16967 Meaning
16968
16969 @item
16970
16971 @emph{no_attributes}
16972
16973 @tab
16974
16975 Do not try to preserve any file attributes. This is the
16976 default if no preserve= is found in Form.
16977
16978 @item
16979
16980 @emph{all_attributes}
16981
16982 @tab
16983
16984 Try to preserve all file attributes (timestamps, access rights).
16985
16986 @item
16987
16988 @emph{timestamps}
16989
16990 @tab
16991
16992 Preserve the timestamp of the copied file, but not the other
16993 file attributes.
16994
16995 @end multitable
16996
16997
16998 The only possible values for mode= are:
16999
17000
17001 @multitable {xxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17002 @headitem
17003
17004 Value
17005
17006 @tab
17007
17008 Meaning
17009
17010 @item
17011
17012 @emph{copy}
17013
17014 @tab
17015
17016 Only do the copy if the destination file does not already exist.
17017 If it already exists, Copy_File fails.
17018
17019 @item
17020
17021 @emph{overwrite}
17022
17023 @tab
17024
17025 Copy the file in all cases. Overwrite an already existing destination file.
17026
17027 @item
17028
17029 @emph{append}
17030
17031 @tab
17032
17033 Append the original file to the destination file. If the destination file
17034 does not exist, the destination file is a copy of the source file.
17035 When mode=append, the field preserve=, if it exists, is not taken into account.
17036
17037 @end multitable
17038
17039
17040 If the Form parameter includes one or both of the fields and the value or
17041 values are incorrect, Copy_file fails with Use_Error.
17042
17043 Examples of correct Forms:
17044
17045 @example
17046 Form => "preserve=no_attributes,mode=overwrite" (the default)
17047 Form => "mode=append"
17048 Form => "mode=copy, preserve=all_attributes"
17049 @end example
17050
17051 Examples of incorrect Forms:
17052
17053 @example
17054 Form => "preserve=junk"
17055 Form => "mode=internal, preserve=timestamps"
17056 @end example
17057
17058
17059 @itemize *
17060
17061 @item
17062 "The interpretation of the @code{Pattern} parameter, when not the null string,
17063 in the @code{Start_Search} and @code{Search} procedures.
17064 See A.16(104) and A.16(112)."
17065 @end itemize
17066
17067 When the @code{Pattern} parameter is not the null string, it is interpreted
17068 according to the syntax of regular expressions as defined in the
17069 @code{GNAT.Regexp} package.
17070
17071 See @ref{259,,GNAT.Regexp (g-regexp.ads)}.
17072
17073
17074 @itemize *
17075
17076 @item
17077 "Implementation-defined convention names. See B.1(11)."
17078 @end itemize
17079
17080 The following convention names are supported
17081
17082
17083 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17084 @headitem
17085
17086 Convention Name
17087
17088 @tab
17089
17090 Interpretation
17091
17092 @item
17093
17094 @emph{Ada}
17095
17096 @tab
17097
17098 Ada
17099
17100 @item
17101
17102 @emph{Ada_Pass_By_Copy}
17103
17104 @tab
17105
17106 Allowed for any types except by-reference types such as limited
17107 records. Compatible with convention Ada, but causes any parameters
17108 with this convention to be passed by copy.
17109
17110 @item
17111
17112 @emph{Ada_Pass_By_Reference}
17113
17114 @tab
17115
17116 Allowed for any types except by-copy types such as scalars.
17117 Compatible with convention Ada, but causes any parameters
17118 with this convention to be passed by reference.
17119
17120 @item
17121
17122 @emph{Assembler}
17123
17124 @tab
17125
17126 Assembly language
17127
17128 @item
17129
17130 @emph{Asm}
17131
17132 @tab
17133
17134 Synonym for Assembler
17135
17136 @item
17137
17138 @emph{Assembly}
17139
17140 @tab
17141
17142 Synonym for Assembler
17143
17144 @item
17145
17146 @emph{C}
17147
17148 @tab
17149
17150 C
17151
17152 @item
17153
17154 @emph{C_Pass_By_Copy}
17155
17156 @tab
17157
17158 Allowed only for record types, like C, but also notes that record
17159 is to be passed by copy rather than reference.
17160
17161 @item
17162
17163 @emph{COBOL}
17164
17165 @tab
17166
17167 COBOL
17168
17169 @item
17170
17171 @emph{C_Plus_Plus (or CPP)}
17172
17173 @tab
17174
17175 C++
17176
17177 @item
17178
17179 @emph{Default}
17180
17181 @tab
17182
17183 Treated the same as C
17184
17185 @item
17186
17187 @emph{External}
17188
17189 @tab
17190
17191 Treated the same as C
17192
17193 @item
17194
17195 @emph{Fortran}
17196
17197 @tab
17198
17199 Fortran
17200
17201 @item
17202
17203 @emph{Intrinsic}
17204
17205 @tab
17206
17207 For support of pragma @code{Import} with convention Intrinsic, see
17208 separate section on Intrinsic Subprograms.
17209
17210 @item
17211
17212 @emph{Stdcall}
17213
17214 @tab
17215
17216 Stdcall (used for Windows implementations only). This convention correspond
17217 to the WINAPI (previously called Pascal convention) C/C++ convention under
17218 Windows. A routine with this convention cleans the stack before
17219 exit. This pragma cannot be applied to a dispatching call.
17220
17221 @item
17222
17223 @emph{DLL}
17224
17225 @tab
17226
17227 Synonym for Stdcall
17228
17229 @item
17230
17231 @emph{Win32}
17232
17233 @tab
17234
17235 Synonym for Stdcall
17236
17237 @item
17238
17239 @emph{Stubbed}
17240
17241 @tab
17242
17243 Stubbed is a special convention used to indicate that the body of the
17244 subprogram will be entirely ignored. Any call to the subprogram
17245 is converted into a raise of the @code{Program_Error} exception. If a
17246 pragma @code{Import} specifies convention @code{stubbed} then no body need
17247 be present at all. This convention is useful during development for the
17248 inclusion of subprograms whose body has not yet been written.
17249 In addition, all otherwise unrecognized convention names are also
17250 treated as being synonymous with convention C. In all implementations
17251 except for VMS, use of such other names results in a warning. In VMS
17252 implementations, these names are accepted silently.
17253
17254 @end multitable
17255
17256
17257
17258 @itemize *
17259
17260 @item
17261 "The meaning of link names. See B.1(36)."
17262 @end itemize
17263
17264 Link names are the actual names used by the linker.
17265
17266
17267 @itemize *
17268
17269 @item
17270 "The manner of choosing link names when neither the link
17271 name nor the address of an imported or exported entity is specified. See
17272 B.1(36)."
17273 @end itemize
17274
17275 The default linker name is that which would be assigned by the relevant
17276 external language, interpreting the Ada name as being in all lower case
17277 letters.
17278
17279
17280 @itemize *
17281
17282 @item
17283 "The effect of pragma @code{Linker_Options}. See B.1(37)."
17284 @end itemize
17285
17286 The string passed to @code{Linker_Options} is presented uninterpreted as
17287 an argument to the link command, unless it contains ASCII.NUL characters.
17288 NUL characters if they appear act as argument separators, so for example
17289
17290 @example
17291 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
17292 @end example
17293
17294 causes two separate arguments @code{-labc} and @code{-ldef} to be passed to the
17295 linker. The order of linker options is preserved for a given unit. The final
17296 list of options passed to the linker is in reverse order of the elaboration
17297 order. For example, linker options for a body always appear before the options
17298 from the corresponding package spec.
17299
17300
17301 @itemize *
17302
17303 @item
17304 "The contents of the visible part of package
17305 @code{Interfaces} and its language-defined descendants. See B.2(1)."
17306 @end itemize
17307
17308 See files with prefix @code{i-} in the distributed library.
17309
17310
17311 @itemize *
17312
17313 @item
17314 "Implementation-defined children of package
17315 @code{Interfaces}. The contents of the visible part of package
17316 @code{Interfaces}. See B.2(11)."
17317 @end itemize
17318
17319 See files with prefix @code{i-} in the distributed library.
17320
17321
17322 @itemize *
17323
17324 @item
17325 "The types @code{Floating}, @code{Long_Floating},
17326 @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and
17327 @code{COBOL_Character}; and the initialization of the variables
17328 @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in
17329 @code{Interfaces.COBOL}. See B.4(50)."
17330 @end itemize
17331
17332
17333 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17334 @headitem
17335
17336 COBOL
17337
17338 @tab
17339
17340 Ada
17341
17342 @item
17343
17344 @emph{Floating}
17345
17346 @tab
17347
17348 Float
17349
17350 @item
17351
17352 @emph{Long_Floating}
17353
17354 @tab
17355
17356 (Floating) Long_Float
17357
17358 @item
17359
17360 @emph{Binary}
17361
17362 @tab
17363
17364 Integer
17365
17366 @item
17367
17368 @emph{Long_Binary}
17369
17370 @tab
17371
17372 Long_Long_Integer
17373
17374 @item
17375
17376 @emph{Decimal_Element}
17377
17378 @tab
17379
17380 Character
17381
17382 @item
17383
17384 @emph{COBOL_Character}
17385
17386 @tab
17387
17388 Character
17389
17390 @end multitable
17391
17392
17393 For initialization, see the file @code{i-cobol.ads} in the distributed library.
17394
17395
17396 @itemize *
17397
17398 @item
17399 "Support for access to machine instructions. See C.1(1)."
17400 @end itemize
17401
17402 See documentation in file @code{s-maccod.ads} in the distributed library.
17403
17404
17405 @itemize *
17406
17407 @item
17408 "Implementation-defined aspects of access to machine
17409 operations. See C.1(9)."
17410 @end itemize
17411
17412 See documentation in file @code{s-maccod.ads} in the distributed library.
17413
17414
17415 @itemize *
17416
17417 @item
17418 "Implementation-defined aspects of interrupts. See C.3(2)."
17419 @end itemize
17420
17421 Interrupts are mapped to signals or conditions as appropriate. See
17422 definition of unit
17423 @code{Ada.Interrupt_Names} in source file @code{a-intnam.ads} for details
17424 on the interrupts supported on a particular target.
17425
17426
17427 @itemize *
17428
17429 @item
17430 "Implementation-defined aspects of pre-elaboration. See
17431 C.4(13)."
17432 @end itemize
17433
17434 GNAT does not permit a partition to be restarted without reloading,
17435 except under control of the debugger.
17436
17437
17438 @itemize *
17439
17440 @item
17441 "The semantics of pragma @code{Discard_Names}. See C.5(7)."
17442 @end itemize
17443
17444 Pragma @code{Discard_Names} causes names of enumeration literals to
17445 be suppressed. In the presence of this pragma, the Image attribute
17446 provides the image of the Pos of the literal, and Value accepts
17447 Pos values.
17448
17449 For tagged types, when pragmas @code{Discard_Names} and @code{No_Tagged_Streams}
17450 simultaneously apply, their Expanded_Name and External_Tag are initialized
17451 with empty strings. This is useful to avoid exposing entity names at binary
17452 level.
17453
17454
17455 @itemize *
17456
17457 @item
17458 "The result of the @code{Task_Identification.Image}
17459 attribute. See C.7.1(7)."
17460 @end itemize
17461
17462 The result of this attribute is a string that identifies
17463 the object or component that denotes a given task. If a variable @code{Var}
17464 has a task type, the image for this task will have the form @code{Var_@emph{XXXXXXXX}},
17465 where the suffix @emph{XXXXXXXX}
17466 is the hexadecimal representation of the virtual address of the corresponding
17467 task control block. If the variable is an array of tasks, the image of each
17468 task will have the form of an indexed component indicating the position of a
17469 given task in the array, e.g., @code{Group(5)_@emph{XXXXXXX}}. If the task is a
17470 component of a record, the image of the task will have the form of a selected
17471 component. These rules are fully recursive, so that the image of a task that
17472 is a subcomponent of a composite object corresponds to the expression that
17473 designates this task.
17474
17475 If a task is created by an allocator, its image depends on the context. If the
17476 allocator is part of an object declaration, the rules described above are used
17477 to construct its image, and this image is not affected by subsequent
17478 assignments. If the allocator appears within an expression, the image
17479 includes only the name of the task type.
17480
17481 If the configuration pragma Discard_Names is present, or if the restriction
17482 No_Implicit_Heap_Allocation is in effect, the image reduces to
17483 the numeric suffix, that is to say the hexadecimal representation of the
17484 virtual address of the control block of the task.
17485
17486
17487 @itemize *
17488
17489 @item
17490 "The value of @code{Current_Task} when in a protected entry
17491 or interrupt handler. See C.7.1(17)."
17492 @end itemize
17493
17494 Protected entries or interrupt handlers can be executed by any
17495 convenient thread, so the value of @code{Current_Task} is undefined.
17496
17497
17498 @itemize *
17499
17500 @item
17501 "The effect of calling @code{Current_Task} from an entry
17502 body or interrupt handler. See C.7.1(19)."
17503 @end itemize
17504
17505 When GNAT can determine statically that @code{Current_Task} is called directly in
17506 the body of an entry (or barrier) then a warning is emitted and @code{Program_Error}
17507 is raised at run time. Otherwise, the effect of calling @code{Current_Task} from an
17508 entry body or interrupt handler is to return the identification of the task
17509 currently executing the code.
17510
17511
17512 @itemize *
17513
17514 @item
17515 "Implementation-defined aspects of
17516 @code{Task_Attributes}. See C.7.2(19)."
17517 @end itemize
17518
17519 There are no implementation-defined aspects of @code{Task_Attributes}.
17520
17521
17522 @itemize *
17523
17524 @item
17525 "Values of all @code{Metrics}. See D(2)."
17526 @end itemize
17527
17528 The metrics information for GNAT depends on the performance of the
17529 underlying operating system. The sources of the run-time for tasking
17530 implementation, together with the output from @emph{-gnatG} can be
17531 used to determine the exact sequence of operating systems calls made
17532 to implement various tasking constructs. Together with appropriate
17533 information on the performance of the underlying operating system,
17534 on the exact target in use, this information can be used to determine
17535 the required metrics.
17536
17537
17538 @itemize *
17539
17540 @item
17541 "The declarations of @code{Any_Priority} and
17542 @code{Priority}. See D.1(11)."
17543 @end itemize
17544
17545 See declarations in file @code{system.ads}.
17546
17547
17548 @itemize *
17549
17550 @item
17551 "Implementation-defined execution resources. See D.1(15)."
17552 @end itemize
17553
17554 There are no implementation-defined execution resources.
17555
17556
17557 @itemize *
17558
17559 @item
17560 "Whether, on a multiprocessor, a task that is waiting for
17561 access to a protected object keeps its processor busy. See D.2.1(3)."
17562 @end itemize
17563
17564 On a multi-processor, a task that is waiting for access to a protected
17565 object does not keep its processor busy.
17566
17567
17568 @itemize *
17569
17570 @item
17571 "The affect of implementation defined execution resources
17572 on task dispatching. See D.2.1(9)."
17573 @end itemize
17574
17575 Tasks map to threads in the threads package used by GNAT. Where possible
17576 and appropriate, these threads correspond to native threads of the
17577 underlying operating system.
17578
17579
17580 @itemize *
17581
17582 @item
17583 "Implementation-defined @emph{policy_identifiers} allowed
17584 in a pragma @code{Task_Dispatching_Policy}. See D.2.2(3)."
17585 @end itemize
17586
17587 There are no implementation-defined policy-identifiers allowed in this
17588 pragma.
17589
17590
17591 @itemize *
17592
17593 @item
17594 "Implementation-defined aspects of priority inversion. See
17595 D.2.2(16)."
17596 @end itemize
17597
17598 Execution of a task cannot be preempted by the implementation processing
17599 of delay expirations for lower priority tasks.
17600
17601
17602 @itemize *
17603
17604 @item
17605 "Implementation-defined task dispatching. See D.2.2(18)."
17606 @end itemize
17607
17608 The policy is the same as that of the underlying threads implementation.
17609
17610
17611 @itemize *
17612
17613 @item
17614 "Implementation-defined @emph{policy_identifiers} allowed
17615 in a pragma @code{Locking_Policy}. See D.3(4)."
17616 @end itemize
17617
17618 The two implementation defined policies permitted in GNAT are
17619 @code{Inheritance_Locking} and @code{Concurrent_Readers_Locking}. On
17620 targets that support the @code{Inheritance_Locking} policy, locking is
17621 implemented by inheritance, i.e., the task owning the lock operates
17622 at a priority equal to the highest priority of any task currently
17623 requesting the lock. On targets that support the
17624 @code{Concurrent_Readers_Locking} policy, locking is implemented with a
17625 read/write lock allowing multiple protected object functions to enter
17626 concurrently.
17627
17628
17629 @itemize *
17630
17631 @item
17632 "Default ceiling priorities. See D.3(10)."
17633 @end itemize
17634
17635 The ceiling priority of protected objects of the type
17636 @code{System.Interrupt_Priority'Last} as described in the Ada
17637 Reference Manual D.3(10),
17638
17639
17640 @itemize *
17641
17642 @item
17643 "The ceiling of any protected object used internally by
17644 the implementation. See D.3(16)."
17645 @end itemize
17646
17647 The ceiling priority of internal protected objects is
17648 @code{System.Priority'Last}.
17649
17650
17651 @itemize *
17652
17653 @item
17654 "Implementation-defined queuing policies. See D.4(1)."
17655 @end itemize
17656
17657 There are no implementation-defined queuing policies.
17658
17659
17660 @itemize *
17661
17662 @item
17663 "On a multiprocessor, any conditions that cause the
17664 completion of an aborted construct to be delayed later than what is
17665 specified for a single processor. See D.6(3)."
17666 @end itemize
17667
17668 The semantics for abort on a multi-processor is the same as on a single
17669 processor, there are no further delays.
17670
17671
17672 @itemize *
17673
17674 @item
17675 "Any operations that implicitly require heap storage
17676 allocation. See D.7(8)."
17677 @end itemize
17678
17679 The only operation that implicitly requires heap storage allocation is
17680 task creation.
17681
17682
17683 @itemize *
17684
17685 @item
17686 "What happens when a task terminates in the presence of
17687 pragma @code{No_Task_Termination}. See D.7(15)."
17688 @end itemize
17689
17690 Execution is erroneous in that case.
17691
17692
17693 @itemize *
17694
17695 @item
17696 "Implementation-defined aspects of pragma
17697 @code{Restrictions}. See D.7(20)."
17698 @end itemize
17699
17700 There are no such implementation-defined aspects.
17701
17702
17703 @itemize *
17704
17705 @item
17706 "Implementation-defined aspects of package
17707 @code{Real_Time}. See D.8(17)."
17708 @end itemize
17709
17710 There are no implementation defined aspects of package @code{Real_Time}.
17711
17712
17713 @itemize *
17714
17715 @item
17716 "Implementation-defined aspects of
17717 @emph{delay_statements}. See D.9(8)."
17718 @end itemize
17719
17720 Any difference greater than one microsecond will cause the task to be
17721 delayed (see D.9(7)).
17722
17723
17724 @itemize *
17725
17726 @item
17727 "The upper bound on the duration of interrupt blocking
17728 caused by the implementation. See D.12(5)."
17729 @end itemize
17730
17731 The upper bound is determined by the underlying operating system. In
17732 no cases is it more than 10 milliseconds.
17733
17734
17735 @itemize *
17736
17737 @item
17738 "The means for creating and executing distributed
17739 programs. See E(5)."
17740 @end itemize
17741
17742 The GLADE package provides a utility GNATDIST for creating and executing
17743 distributed programs. See the GLADE reference manual for further details.
17744
17745
17746 @itemize *
17747
17748 @item
17749 "Any events that can result in a partition becoming
17750 inaccessible. See E.1(7)."
17751 @end itemize
17752
17753 See the GLADE reference manual for full details on such events.
17754
17755
17756 @itemize *
17757
17758 @item
17759 "The scheduling policies, treatment of priorities, and
17760 management of shared resources between partitions in certain cases. See
17761 E.1(11)."
17762 @end itemize
17763
17764 See the GLADE reference manual for full details on these aspects of
17765 multi-partition execution.
17766
17767
17768 @itemize *
17769
17770 @item
17771 "Events that cause the version of a compilation unit to
17772 change. See E.3(5)."
17773 @end itemize
17774
17775 Editing the source file of a compilation unit, or the source files of
17776 any units on which it is dependent in a significant way cause the version
17777 to change. No other actions cause the version number to change. All changes
17778 are significant except those which affect only layout, capitalization or
17779 comments.
17780
17781
17782 @itemize *
17783
17784 @item
17785 "Whether the execution of the remote subprogram is
17786 immediately aborted as a result of cancellation. See E.4(13)."
17787 @end itemize
17788
17789 See the GLADE reference manual for details on the effect of abort in
17790 a distributed application.
17791
17792
17793 @itemize *
17794
17795 @item
17796 "Implementation-defined aspects of the PCS. See E.5(25)."
17797 @end itemize
17798
17799 See the GLADE reference manual for a full description of all implementation
17800 defined aspects of the PCS.
17801
17802
17803 @itemize *
17804
17805 @item
17806 "Implementation-defined interfaces in the PCS. See
17807 E.5(26)."
17808 @end itemize
17809
17810 See the GLADE reference manual for a full description of all
17811 implementation defined interfaces.
17812
17813
17814 @itemize *
17815
17816 @item
17817 "The values of named numbers in the package
17818 @code{Decimal}. See F.2(7)."
17819 @end itemize
17820
17821
17822 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx}
17823 @headitem
17824
17825 Named Number
17826
17827 @tab
17828
17829 Value
17830
17831 @item
17832
17833 @emph{Max_Scale}
17834
17835 @tab
17836
17837 +18
17838
17839 @item
17840
17841 @emph{Min_Scale}
17842
17843 @tab
17844
17845 -18
17846
17847 @item
17848
17849 @emph{Min_Delta}
17850
17851 @tab
17852
17853 1.0E-18
17854
17855 @item
17856
17857 @emph{Max_Delta}
17858
17859 @tab
17860
17861 1.0E+18
17862
17863 @item
17864
17865 @emph{Max_Decimal_Digits}
17866
17867 @tab
17868
17869 18
17870
17871 @end multitable
17872
17873
17874
17875 @itemize *
17876
17877 @item
17878 "The value of @code{Max_Picture_Length} in the package
17879 @code{Text_IO.Editing}. See F.3.3(16)."
17880 @end itemize
17881
17882 64
17883
17884
17885 @itemize *
17886
17887 @item
17888 "The value of @code{Max_Picture_Length} in the package
17889 @code{Wide_Text_IO.Editing}. See F.3.4(5)."
17890 @end itemize
17891
17892 64
17893
17894
17895 @itemize *
17896
17897 @item
17898 "The accuracy actually achieved by the complex elementary
17899 functions and by other complex arithmetic operations. See G.1(1)."
17900 @end itemize
17901
17902 Standard library functions are used for the complex arithmetic
17903 operations. Only fast math mode is currently supported.
17904
17905
17906 @itemize *
17907
17908 @item
17909 "The sign of a zero result (or a component thereof) from
17910 any operator or function in @code{Numerics.Generic_Complex_Types}, when
17911 @code{Real'Signed_Zeros} is True. See G.1.1(53)."
17912 @end itemize
17913
17914 The signs of zero values are as recommended by the relevant
17915 implementation advice.
17916
17917
17918 @itemize *
17919
17920 @item
17921 "The sign of a zero result (or a component thereof) from
17922 any operator or function in
17923 @code{Numerics.Generic_Complex_Elementary_Functions}, when
17924 @code{Real'Signed_Zeros} is @code{True}. See G.1.2(45)."
17925 @end itemize
17926
17927 The signs of zero values are as recommended by the relevant
17928 implementation advice.
17929
17930
17931 @itemize *
17932
17933 @item
17934 "Whether the strict mode or the relaxed mode is the
17935 default. See G.2(2)."
17936 @end itemize
17937
17938 The strict mode is the default. There is no separate relaxed mode. GNAT
17939 provides a highly efficient implementation of strict mode.
17940
17941
17942 @itemize *
17943
17944 @item
17945 "The result interval in certain cases of fixed-to-float
17946 conversion. See G.2.1(10)."
17947 @end itemize
17948
17949 For cases where the result interval is implementation dependent, the
17950 accuracy is that provided by performing all operations in 64-bit IEEE
17951 floating-point format.
17952
17953
17954 @itemize *
17955
17956 @item
17957 "The result of a floating point arithmetic operation in
17958 overflow situations, when the @code{Machine_Overflows} attribute of the
17959 result type is @code{False}. See G.2.1(13)."
17960 @end itemize
17961
17962 Infinite and NaN values are produced as dictated by the IEEE
17963 floating-point standard.
17964 Note that on machines that are not fully compliant with the IEEE
17965 floating-point standard, such as Alpha, the @emph{-mieee} compiler flag
17966 must be used for achieving IEEE conforming behavior (although at the cost
17967 of a significant performance penalty), so infinite and NaN values are
17968 properly generated.
17969
17970
17971 @itemize *
17972
17973 @item
17974 "The result interval for division (or exponentiation by a
17975 negative exponent), when the floating point hardware implements division
17976 as multiplication by a reciprocal. See G.2.1(16)."
17977 @end itemize
17978
17979 Not relevant, division is IEEE exact.
17980
17981
17982 @itemize *
17983
17984 @item
17985 "The definition of close result set, which determines the
17986 accuracy of certain fixed point multiplications and divisions. See
17987 G.2.3(5)."
17988 @end itemize
17989
17990 Operations in the close result set are performed using IEEE long format
17991 floating-point arithmetic. The input operands are converted to
17992 floating-point, the operation is done in floating-point, and the result
17993 is converted to the target type.
17994
17995
17996 @itemize *
17997
17998 @item
17999 "Conditions on a @emph{universal_real} operand of a fixed
18000 point multiplication or division for which the result shall be in the
18001 perfect result set. See G.2.3(22)."
18002 @end itemize
18003
18004 The result is only defined to be in the perfect result set if the result
18005 can be computed by a single scaling operation involving a scale factor
18006 representable in 64-bits.
18007
18008
18009 @itemize *
18010
18011 @item
18012 "The result of a fixed point arithmetic operation in
18013 overflow situations, when the @code{Machine_Overflows} attribute of the
18014 result type is @code{False}. See G.2.3(27)."
18015 @end itemize
18016
18017 Not relevant, @code{Machine_Overflows} is @code{True} for fixed-point
18018 types.
18019
18020
18021 @itemize *
18022
18023 @item
18024 "The result of an elementary function reference in
18025 overflow situations, when the @code{Machine_Overflows} attribute of the
18026 result type is @code{False}. See G.2.4(4)."
18027 @end itemize
18028
18029 IEEE infinite and Nan values are produced as appropriate.
18030
18031
18032 @itemize *
18033
18034 @item
18035 "The value of the angle threshold, within which certain
18036 elementary functions, complex arithmetic operations, and complex
18037 elementary functions yield results conforming to a maximum relative
18038 error bound. See G.2.4(10)."
18039 @end itemize
18040
18041 Information on this subject is not yet available.
18042
18043
18044 @itemize *
18045
18046 @item
18047 "The accuracy of certain elementary functions for
18048 parameters beyond the angle threshold. See G.2.4(10)."
18049 @end itemize
18050
18051 Information on this subject is not yet available.
18052
18053
18054 @itemize *
18055
18056 @item
18057 "The result of a complex arithmetic operation or complex
18058 elementary function reference in overflow situations, when the
18059 @code{Machine_Overflows} attribute of the corresponding real type is
18060 @code{False}. See G.2.6(5)."
18061 @end itemize
18062
18063 IEEE infinite and Nan values are produced as appropriate.
18064
18065
18066 @itemize *
18067
18068 @item
18069 "The accuracy of certain complex arithmetic operations and
18070 certain complex elementary functions for parameters (or components
18071 thereof) beyond the angle threshold. See G.2.6(8)."
18072 @end itemize
18073
18074 Information on those subjects is not yet available.
18075
18076
18077 @itemize *
18078
18079 @item
18080 "Information regarding bounded errors and erroneous
18081 execution. See H.2(1)."
18082 @end itemize
18083
18084 Information on this subject is not yet available.
18085
18086
18087 @itemize *
18088
18089 @item
18090 "Implementation-defined aspects of pragma
18091 @code{Inspection_Point}. See H.3.2(8)."
18092 @end itemize
18093
18094 Pragma @code{Inspection_Point} ensures that the variable is live and can
18095 be examined by the debugger at the inspection point.
18096
18097
18098 @itemize *
18099
18100 @item
18101 "Implementation-defined aspects of pragma
18102 @code{Restrictions}. See H.4(25)."
18103 @end itemize
18104
18105 There are no implementation-defined aspects of pragma @code{Restrictions}. The
18106 use of pragma @code{Restrictions [No_Exceptions]} has no effect on the
18107 generated code. Checks must suppressed by use of pragma @code{Suppress}.
18108
18109
18110 @itemize *
18111
18112 @item
18113 "Any restrictions on pragma @code{Restrictions}. See
18114 H.4(27)."
18115 @end itemize
18116
18117 There are no restrictions on pragma @code{Restrictions}.
18118
18119 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
18120 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{25a}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{25b}
18121 @chapter Intrinsic Subprograms
18122
18123
18124 @geindex Intrinsic Subprograms
18125
18126 GNAT allows a user application program to write the declaration:
18127
18128 @example
18129 pragma Import (Intrinsic, name);
18130 @end example
18131
18132 providing that the name corresponds to one of the implemented intrinsic
18133 subprograms in GNAT, and that the parameter profile of the referenced
18134 subprogram meets the requirements. This chapter describes the set of
18135 implemented intrinsic subprograms, and the requirements on parameter profiles.
18136 Note that no body is supplied; as with other uses of pragma Import, the
18137 body is supplied elsewhere (in this case by the compiler itself). Note
18138 that any use of this feature is potentially non-portable, since the
18139 Ada standard does not require Ada compilers to implement this feature.
18140
18141 @menu
18142 * Intrinsic Operators::
18143 * Compilation_ISO_Date::
18144 * Compilation_Date::
18145 * Compilation_Time::
18146 * Enclosing_Entity::
18147 * Exception_Information::
18148 * Exception_Message::
18149 * Exception_Name::
18150 * File::
18151 * Line::
18152 * Shifts and Rotates::
18153 * Source_Location::
18154
18155 @end menu
18156
18157 @node Intrinsic Operators,Compilation_ISO_Date,,Intrinsic Subprograms
18158 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{25c}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{25d}
18159 @section Intrinsic Operators
18160
18161
18162 @geindex Intrinsic operator
18163
18164 All the predefined numeric operators in package Standard
18165 in @code{pragma Import (Intrinsic,..)}
18166 declarations. In the binary operator case, the operands must have the same
18167 size. The operand or operands must also be appropriate for
18168 the operator. For example, for addition, the operands must
18169 both be floating-point or both be fixed-point, and the
18170 right operand for @code{"**"} must have a root type of
18171 @code{Standard.Integer'Base}.
18172 You can use an intrinsic operator declaration as in the following example:
18173
18174 @example
18175 type Int1 is new Integer;
18176 type Int2 is new Integer;
18177
18178 function "+" (X1 : Int1; X2 : Int2) return Int1;
18179 function "+" (X1 : Int1; X2 : Int2) return Int2;
18180 pragma Import (Intrinsic, "+");
18181 @end example
18182
18183 This declaration would permit 'mixed mode' arithmetic on items
18184 of the differing types @code{Int1} and @code{Int2}.
18185 It is also possible to specify such operators for private types, if the
18186 full views are appropriate arithmetic types.
18187
18188 @node Compilation_ISO_Date,Compilation_Date,Intrinsic Operators,Intrinsic Subprograms
18189 @anchor{gnat_rm/intrinsic_subprograms id3}@anchor{25e}@anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{25f}
18190 @section Compilation_ISO_Date
18191
18192
18193 @geindex Compilation_ISO_Date
18194
18195 This intrinsic subprogram is used in the implementation of the
18196 library package @code{GNAT.Source_Info}. The only useful use of the
18197 intrinsic import in this case is the one in this unit, so an
18198 application program should simply call the function
18199 @code{GNAT.Source_Info.Compilation_ISO_Date} to obtain the date of
18200 the current compilation (in local time format YYYY-MM-DD).
18201
18202 @node Compilation_Date,Compilation_Time,Compilation_ISO_Date,Intrinsic Subprograms
18203 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{260}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{261}
18204 @section Compilation_Date
18205
18206
18207 @geindex Compilation_Date
18208
18209 Same as Compilation_ISO_Date, except the string is in the form
18210 MMM DD YYYY.
18211
18212 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
18213 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{262}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{263}
18214 @section Compilation_Time
18215
18216
18217 @geindex Compilation_Time
18218
18219 This intrinsic subprogram is used in the implementation of the
18220 library package @code{GNAT.Source_Info}. The only useful use of the
18221 intrinsic import in this case is the one in this unit, so an
18222 application program should simply call the function
18223 @code{GNAT.Source_Info.Compilation_Time} to obtain the time of
18224 the current compilation (in local time format HH:MM:SS).
18225
18226 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
18227 @anchor{gnat_rm/intrinsic_subprograms id6}@anchor{264}@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{265}
18228 @section Enclosing_Entity
18229
18230
18231 @geindex Enclosing_Entity
18232
18233 This intrinsic subprogram is used in the implementation of the
18234 library package @code{GNAT.Source_Info}. The only useful use of the
18235 intrinsic import in this case is the one in this unit, so an
18236 application program should simply call the function
18237 @code{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
18238 the current subprogram, package, task, entry, or protected subprogram.
18239
18240 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
18241 @anchor{gnat_rm/intrinsic_subprograms id7}@anchor{266}@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{267}
18242 @section Exception_Information
18243
18244
18245 @geindex Exception_Information'
18246
18247 This intrinsic subprogram is used in the implementation of the
18248 library package @code{GNAT.Current_Exception}. The only useful
18249 use of the intrinsic import in this case is the one in this unit,
18250 so an application program should simply call the function
18251 @code{GNAT.Current_Exception.Exception_Information} to obtain
18252 the exception information associated with the current exception.
18253
18254 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
18255 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{268}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{269}
18256 @section Exception_Message
18257
18258
18259 @geindex Exception_Message
18260
18261 This intrinsic subprogram is used in the implementation of the
18262 library package @code{GNAT.Current_Exception}. The only useful
18263 use of the intrinsic import in this case is the one in this unit,
18264 so an application program should simply call the function
18265 @code{GNAT.Current_Exception.Exception_Message} to obtain
18266 the message associated with the current exception.
18267
18268 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
18269 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{26a}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{26b}
18270 @section Exception_Name
18271
18272
18273 @geindex Exception_Name
18274
18275 This intrinsic subprogram is used in the implementation of the
18276 library package @code{GNAT.Current_Exception}. The only useful
18277 use of the intrinsic import in this case is the one in this unit,
18278 so an application program should simply call the function
18279 @code{GNAT.Current_Exception.Exception_Name} to obtain
18280 the name of the current exception.
18281
18282 @node File,Line,Exception_Name,Intrinsic Subprograms
18283 @anchor{gnat_rm/intrinsic_subprograms id10}@anchor{26c}@anchor{gnat_rm/intrinsic_subprograms file}@anchor{26d}
18284 @section File
18285
18286
18287 @geindex File
18288
18289 This intrinsic subprogram is used in the implementation of the
18290 library package @code{GNAT.Source_Info}. The only useful use of the
18291 intrinsic import in this case is the one in this unit, so an
18292 application program should simply call the function
18293 @code{GNAT.Source_Info.File} to obtain the name of the current
18294 file.
18295
18296 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
18297 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{26e}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{26f}
18298 @section Line
18299
18300
18301 @geindex Line
18302
18303 This intrinsic subprogram is used in the implementation of the
18304 library package @code{GNAT.Source_Info}. The only useful use of the
18305 intrinsic import in this case is the one in this unit, so an
18306 application program should simply call the function
18307 @code{GNAT.Source_Info.Line} to obtain the number of the current
18308 source line.
18309
18310 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
18311 @anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{270}@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{271}
18312 @section Shifts and Rotates
18313
18314
18315 @geindex Shift_Left
18316
18317 @geindex Shift_Right
18318
18319 @geindex Shift_Right_Arithmetic
18320
18321 @geindex Rotate_Left
18322
18323 @geindex Rotate_Right
18324
18325 In standard Ada, the shift and rotate functions are available only
18326 for the predefined modular types in package @code{Interfaces}. However, in
18327 GNAT it is possible to define these functions for any integer
18328 type (signed or modular), as in this example:
18329
18330 @example
18331 function Shift_Left
18332 (Value : T;
18333 Amount : Natural) return T;
18334 @end example
18335
18336 The function name must be one of
18337 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
18338 Rotate_Right. T must be an integer type. T'Size must be
18339 8, 16, 32 or 64 bits; if T is modular, the modulus
18340 must be 2**8, 2**16, 2**32 or 2**64.
18341 The result type must be the same as the type of @code{Value}.
18342 The shift amount must be Natural.
18343 The formal parameter names can be anything.
18344
18345 A more convenient way of providing these shift operators is to use
18346 the Provide_Shift_Operators pragma, which provides the function declarations
18347 and corresponding pragma Import's for all five shift functions.
18348
18349 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
18350 @anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{272}@anchor{gnat_rm/intrinsic_subprograms id13}@anchor{273}
18351 @section Source_Location
18352
18353
18354 @geindex Source_Location
18355
18356 This intrinsic subprogram is used in the implementation of the
18357 library routine @code{GNAT.Source_Info}. The only useful use of the
18358 intrinsic import in this case is the one in this unit, so an
18359 application program should simply call the function
18360 @code{GNAT.Source_Info.Source_Location} to obtain the current
18361 source file location.
18362
18363 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
18364 @anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{274}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{275}
18365 @chapter Representation Clauses and Pragmas
18366
18367
18368 @geindex Representation Clauses
18369
18370 @geindex Representation Clause
18371
18372 @geindex Representation Pragma
18373
18374 @geindex Pragma
18375 @geindex representation
18376
18377 This section describes the representation clauses accepted by GNAT, and
18378 their effect on the representation of corresponding data objects.
18379
18380 GNAT fully implements Annex C (Systems Programming). This means that all
18381 the implementation advice sections in chapter 13 are fully implemented.
18382 However, these sections only require a minimal level of support for
18383 representation clauses. GNAT provides much more extensive capabilities,
18384 and this section describes the additional capabilities provided.
18385
18386 @menu
18387 * Alignment Clauses::
18388 * Size Clauses::
18389 * Storage_Size Clauses::
18390 * Size of Variant Record Objects::
18391 * Biased Representation::
18392 * Value_Size and Object_Size Clauses::
18393 * Component_Size Clauses::
18394 * Bit_Order Clauses::
18395 * Effect of Bit_Order on Byte Ordering::
18396 * Pragma Pack for Arrays::
18397 * Pragma Pack for Records::
18398 * Record Representation Clauses::
18399 * Handling of Records with Holes::
18400 * Enumeration Clauses::
18401 * Address Clauses::
18402 * Use of Address Clauses for Memory-Mapped I/O::
18403 * Effect of Convention on Representation::
18404 * Conventions and Anonymous Access Types::
18405 * Determining the Representations chosen by GNAT::
18406
18407 @end menu
18408
18409 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
18410 @anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{276}@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{277}
18411 @section Alignment Clauses
18412
18413
18414 @geindex Alignment Clause
18415
18416 GNAT requires that all alignment clauses specify 0 or a power of 2, and
18417 all default alignments are always a power of 2. Specifying 0 is the
18418 same as specifying 1.
18419
18420 The default alignment values are as follows:
18421
18422
18423 @itemize *
18424
18425 @item
18426 @emph{Elementary Types}.
18427
18428 For elementary types, the alignment is the minimum of the actual size of
18429 objects of the type divided by @code{Storage_Unit},
18430 and the maximum alignment supported by the target.
18431 (This maximum alignment is given by the GNAT-specific attribute
18432 @code{Standard'Maximum_Alignment}; see @ref{191,,Attribute Maximum_Alignment}.)
18433
18434 @geindex Maximum_Alignment attribute
18435
18436 For example, for type @code{Long_Float}, the object size is 8 bytes, and the
18437 default alignment will be 8 on any target that supports alignments
18438 this large, but on some targets, the maximum alignment may be smaller
18439 than 8, in which case objects of type @code{Long_Float} will be maximally
18440 aligned.
18441
18442 @item
18443 @emph{Arrays}.
18444
18445 For arrays, the alignment is equal to the alignment of the component type
18446 for the normal case where no packing or component size is given. If the
18447 array is packed, and the packing is effective (see separate section on
18448 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
18449 arrays or arrays whose length is not known at compile time, depending on
18450 whether the component size is divisible by 4, 2, or is odd. For short packed
18451 arrays, which are handled internally as modular types, the alignment
18452 will be as described for elementary types, e.g. a packed array of length
18453 31 bits will have an object size of four bytes, and an alignment of 4.
18454
18455 @item
18456 @emph{Records}.
18457
18458 For the normal unpacked case, the alignment of a record is equal to
18459 the maximum alignment of any of its components. For tagged records, this
18460 includes the implicit access type used for the tag. If a pragma @code{Pack}
18461 is used and all components are packable (see separate section on pragma
18462 @code{Pack}), then the resulting alignment is 1, unless the layout of the
18463 record makes it profitable to increase it.
18464
18465 A special case is when:
18466
18467
18468 @itemize *
18469
18470 @item
18471 the size of the record is given explicitly, or a
18472 full record representation clause is given, and
18473
18474 @item
18475 the size of the record is 2, 4, or 8 bytes.
18476 @end itemize
18477
18478 In this case, an alignment is chosen to match the
18479 size of the record. For example, if we have:
18480
18481 @example
18482 type Small is record
18483 A, B : Character;
18484 end record;
18485 for Small'Size use 16;
18486 @end example
18487
18488 then the default alignment of the record type @code{Small} is 2, not 1. This
18489 leads to more efficient code when the record is treated as a unit, and also
18490 allows the type to specified as @code{Atomic} on architectures requiring
18491 strict alignment.
18492 @end itemize
18493
18494 An alignment clause may specify a larger alignment than the default value
18495 up to some maximum value dependent on the target (obtainable by using the
18496 attribute reference @code{Standard'Maximum_Alignment}). It may also specify
18497 a smaller alignment than the default value for enumeration, integer and
18498 fixed point types, as well as for record types, for example
18499
18500 @example
18501 type V is record
18502 A : Integer;
18503 end record;
18504
18505 for V'alignment use 1;
18506 @end example
18507
18508 @geindex Alignment
18509 @geindex default
18510
18511 The default alignment for the type @code{V} is 4, as a result of the
18512 Integer field in the record, but it is permissible, as shown, to
18513 override the default alignment of the record with a smaller value.
18514
18515 @geindex Alignment
18516 @geindex subtypes
18517
18518 Note that according to the Ada standard, an alignment clause applies only
18519 to the first named subtype. If additional subtypes are declared, then the
18520 compiler is allowed to choose any alignment it likes, and there is no way
18521 to control this choice. Consider:
18522
18523 @example
18524 type R is range 1 .. 10_000;
18525 for R'Alignment use 1;
18526 subtype RS is R range 1 .. 1000;
18527 @end example
18528
18529 The alignment clause specifies an alignment of 1 for the first named subtype
18530 @code{R} but this does not necessarily apply to @code{RS}. When writing
18531 portable Ada code, you should avoid writing code that explicitly or
18532 implicitly relies on the alignment of such subtypes.
18533
18534 For the GNAT compiler, if an explicit alignment clause is given, this
18535 value is also used for any subsequent subtypes. So for GNAT, in the
18536 above example, you can count on the alignment of @code{RS} being 1. But this
18537 assumption is non-portable, and other compilers may choose different
18538 alignments for the subtype @code{RS}.
18539
18540 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
18541 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{278}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{279}
18542 @section Size Clauses
18543
18544
18545 @geindex Size Clause
18546
18547 The default size for a type @code{T} is obtainable through the
18548 language-defined attribute @code{T'Size} and also through the
18549 equivalent GNAT-defined attribute @code{T'Value_Size}.
18550 For objects of type @code{T}, GNAT will generally increase the type size
18551 so that the object size (obtainable through the GNAT-defined attribute
18552 @code{T'Object_Size})
18553 is a multiple of @code{T'Alignment * Storage_Unit}.
18554
18555 For example:
18556
18557 @example
18558 type Smallint is range 1 .. 6;
18559
18560 type Rec is record
18561 Y1 : integer;
18562 Y2 : boolean;
18563 end record;
18564 @end example
18565
18566 In this example, @code{Smallint'Size} = @code{Smallint'Value_Size} = 3,
18567 as specified by the RM rules,
18568 but objects of this type will have a size of 8
18569 (@code{Smallint'Object_Size} = 8),
18570 since objects by default occupy an integral number
18571 of storage units. On some targets, notably older
18572 versions of the Digital Alpha, the size of stand
18573 alone objects of this type may be 32, reflecting
18574 the inability of the hardware to do byte load/stores.
18575
18576 Similarly, the size of type @code{Rec} is 40 bits
18577 (@code{Rec'Size} = @code{Rec'Value_Size} = 40), but
18578 the alignment is 4, so objects of this type will have
18579 their size increased to 64 bits so that it is a multiple
18580 of the alignment (in bits). This decision is
18581 in accordance with the specific Implementation Advice in RM 13.3(43):
18582
18583 @quotation
18584
18585 "A @code{Size} clause should be supported for an object if the specified
18586 @code{Size} is at least as large as its subtype's @code{Size}, and corresponds
18587 to a size in storage elements that is a multiple of the object's
18588 @code{Alignment} (if the @code{Alignment} is nonzero)."
18589 @end quotation
18590
18591 An explicit size clause may be used to override the default size by
18592 increasing it. For example, if we have:
18593
18594 @example
18595 type My_Boolean is new Boolean;
18596 for My_Boolean'Size use 32;
18597 @end example
18598
18599 then values of this type will always be 32 bits long. In the case of
18600 discrete types, the size can be increased up to 64 bits, with the effect
18601 that the entire specified field is used to hold the value, sign- or
18602 zero-extended as appropriate. If more than 64 bits is specified, then
18603 padding space is allocated after the value, and a warning is issued that
18604 there are unused bits.
18605
18606 Similarly the size of records and arrays may be increased, and the effect
18607 is to add padding bits after the value. This also causes a warning message
18608 to be generated.
18609
18610 The largest Size value permitted in GNAT is 2**31-1. Since this is a
18611 Size in bits, this corresponds to an object of size 256 megabytes (minus
18612 one). This limitation is true on all targets. The reason for this
18613 limitation is that it improves the quality of the code in many cases
18614 if it is known that a Size value can be accommodated in an object of
18615 type Integer.
18616
18617 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
18618 @anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{27a}@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{27b}
18619 @section Storage_Size Clauses
18620
18621
18622 @geindex Storage_Size Clause
18623
18624 For tasks, the @code{Storage_Size} clause specifies the amount of space
18625 to be allocated for the task stack. This cannot be extended, and if the
18626 stack is exhausted, then @code{Storage_Error} will be raised (if stack
18627 checking is enabled). Use a @code{Storage_Size} attribute definition clause,
18628 or a @code{Storage_Size} pragma in the task definition to set the
18629 appropriate required size. A useful technique is to include in every
18630 task definition a pragma of the form:
18631
18632 @example
18633 pragma Storage_Size (Default_Stack_Size);
18634 @end example
18635
18636 Then @code{Default_Stack_Size} can be defined in a global package, and
18637 modified as required. Any tasks requiring stack sizes different from the
18638 default can have an appropriate alternative reference in the pragma.
18639
18640 You can also use the @emph{-d} binder switch to modify the default stack
18641 size.
18642
18643 For access types, the @code{Storage_Size} clause specifies the maximum
18644 space available for allocation of objects of the type. If this space is
18645 exceeded then @code{Storage_Error} will be raised by an allocation attempt.
18646 In the case where the access type is declared local to a subprogram, the
18647 use of a @code{Storage_Size} clause triggers automatic use of a special
18648 predefined storage pool (@code{System.Pool_Size}) that ensures that all
18649 space for the pool is automatically reclaimed on exit from the scope in
18650 which the type is declared.
18651
18652 A special case recognized by the compiler is the specification of a
18653 @code{Storage_Size} of zero for an access type. This means that no
18654 items can be allocated from the pool, and this is recognized at compile
18655 time, and all the overhead normally associated with maintaining a fixed
18656 size storage pool is eliminated. Consider the following example:
18657
18658 @example
18659 procedure p is
18660 type R is array (Natural) of Character;
18661 type P is access all R;
18662 for P'Storage_Size use 0;
18663 -- Above access type intended only for interfacing purposes
18664
18665 y : P;
18666
18667 procedure g (m : P);
18668 pragma Import (C, g);
18669
18670 -- ...
18671
18672 begin
18673 -- ...
18674 y := new R;
18675 end;
18676 @end example
18677
18678 As indicated in this example, these dummy storage pools are often useful in
18679 connection with interfacing where no object will ever be allocated. If you
18680 compile the above example, you get the warning:
18681
18682 @example
18683 p.adb:16:09: warning: allocation from empty storage pool
18684 p.adb:16:09: warning: Storage_Error will be raised at run time
18685 @end example
18686
18687 Of course in practice, there will not be any explicit allocators in the
18688 case of such an access declaration.
18689
18690 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
18691 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{27c}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{27d}
18692 @section Size of Variant Record Objects
18693
18694
18695 @geindex Size
18696 @geindex variant record objects
18697
18698 @geindex Variant record objects
18699 @geindex size
18700
18701 In the case of variant record objects, there is a question whether Size gives
18702 information about a particular variant, or the maximum size required
18703 for any variant. Consider the following program
18704
18705 @example
18706 with Text_IO; use Text_IO;
18707 procedure q is
18708 type R1 (A : Boolean := False) is record
18709 case A is
18710 when True => X : Character;
18711 when False => null;
18712 end case;
18713 end record;
18714
18715 V1 : R1 (False);
18716 V2 : R1;
18717
18718 begin
18719 Put_Line (Integer'Image (V1'Size));
18720 Put_Line (Integer'Image (V2'Size));
18721 end q;
18722 @end example
18723
18724 Here we are dealing with a variant record, where the True variant
18725 requires 16 bits, and the False variant requires 8 bits.
18726 In the above example, both V1 and V2 contain the False variant,
18727 which is only 8 bits long. However, the result of running the
18728 program is:
18729
18730 @example
18731 8
18732 16
18733 @end example
18734
18735 The reason for the difference here is that the discriminant value of
18736 V1 is fixed, and will always be False. It is not possible to assign
18737 a True variant value to V1, therefore 8 bits is sufficient. On the
18738 other hand, in the case of V2, the initial discriminant value is
18739 False (from the default), but it is possible to assign a True
18740 variant value to V2, therefore 16 bits must be allocated for V2
18741 in the general case, even fewer bits may be needed at any particular
18742 point during the program execution.
18743
18744 As can be seen from the output of this program, the @code{'Size}
18745 attribute applied to such an object in GNAT gives the actual allocated
18746 size of the variable, which is the largest size of any of the variants.
18747 The Ada Reference Manual is not completely clear on what choice should
18748 be made here, but the GNAT behavior seems most consistent with the
18749 language in the RM.
18750
18751 In some cases, it may be desirable to obtain the size of the current
18752 variant, rather than the size of the largest variant. This can be
18753 achieved in GNAT by making use of the fact that in the case of a
18754 subprogram parameter, GNAT does indeed return the size of the current
18755 variant (because a subprogram has no way of knowing how much space
18756 is actually allocated for the actual).
18757
18758 Consider the following modified version of the above program:
18759
18760 @example
18761 with Text_IO; use Text_IO;
18762 procedure q is
18763 type R1 (A : Boolean := False) is record
18764 case A is
18765 when True => X : Character;
18766 when False => null;
18767 end case;
18768 end record;
18769
18770 V2 : R1;
18771
18772 function Size (V : R1) return Integer is
18773 begin
18774 return V'Size;
18775 end Size;
18776
18777 begin
18778 Put_Line (Integer'Image (V2'Size));
18779 Put_Line (Integer'Image (Size (V2)));
18780 V2 := (True, 'x');
18781 Put_Line (Integer'Image (V2'Size));
18782 Put_Line (Integer'Image (Size (V2)));
18783 end q;
18784 @end example
18785
18786 The output from this program is
18787
18788 @example
18789 16
18790 8
18791 16
18792 16
18793 @end example
18794
18795 Here we see that while the @code{'Size} attribute always returns
18796 the maximum size, regardless of the current variant value, the
18797 @code{Size} function does indeed return the size of the current
18798 variant value.
18799
18800 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18801 @anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{27e}@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{27f}
18802 @section Biased Representation
18803
18804
18805 @geindex Size for biased representation
18806
18807 @geindex Biased representation
18808
18809 In the case of scalars with a range starting at other than zero, it is
18810 possible in some cases to specify a size smaller than the default minimum
18811 value, and in such cases, GNAT uses an unsigned biased representation,
18812 in which zero is used to represent the lower bound, and successive values
18813 represent successive values of the type.
18814
18815 For example, suppose we have the declaration:
18816
18817 @example
18818 type Small is range -7 .. -4;
18819 for Small'Size use 2;
18820 @end example
18821
18822 Although the default size of type @code{Small} is 4, the @code{Size}
18823 clause is accepted by GNAT and results in the following representation
18824 scheme:
18825
18826 @example
18827 -7 is represented as 2#00#
18828 -6 is represented as 2#01#
18829 -5 is represented as 2#10#
18830 -4 is represented as 2#11#
18831 @end example
18832
18833 Biased representation is only used if the specified @code{Size} clause
18834 cannot be accepted in any other manner. These reduced sizes that force
18835 biased representation can be used for all discrete types except for
18836 enumeration types for which a representation clause is given.
18837
18838 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
18839 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{280}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{281}
18840 @section Value_Size and Object_Size Clauses
18841
18842
18843 @geindex Value_Size
18844
18845 @geindex Object_Size
18846
18847 @geindex Size
18848 @geindex of objects
18849
18850 In Ada 95 and Ada 2005, @code{T'Size} for a type @code{T} is the minimum
18851 number of bits required to hold values of type @code{T}.
18852 Although this interpretation was allowed in Ada 83, it was not required,
18853 and this requirement in practice can cause some significant difficulties.
18854 For example, in most Ada 83 compilers, @code{Natural'Size} was 32.
18855 However, in Ada 95 and Ada 2005,
18856 @code{Natural'Size} is
18857 typically 31. This means that code may change in behavior when moving
18858 from Ada 83 to Ada 95 or Ada 2005. For example, consider:
18859
18860 @example
18861 type Rec is record;
18862 A : Natural;
18863 B : Natural;
18864 end record;
18865
18866 for Rec use record
18867 at 0 range 0 .. Natural'Size - 1;
18868 at 0 range Natural'Size .. 2 * Natural'Size - 1;
18869 end record;
18870 @end example
18871
18872 In the above code, since the typical size of @code{Natural} objects
18873 is 32 bits and @code{Natural'Size} is 31, the above code can cause
18874 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
18875 there are cases where the fact that the object size can exceed the
18876 size of the type causes surprises.
18877
18878 To help get around this problem GNAT provides two implementation
18879 defined attributes, @code{Value_Size} and @code{Object_Size}. When
18880 applied to a type, these attributes yield the size of the type
18881 (corresponding to the RM defined size attribute), and the size of
18882 objects of the type respectively.
18883
18884 The @code{Object_Size} is used for determining the default size of
18885 objects and components. This size value can be referred to using the
18886 @code{Object_Size} attribute. The phrase 'is used' here means that it is
18887 the basis of the determination of the size. The backend is free to
18888 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
18889 character might be stored in 32 bits on a machine with no efficient
18890 byte access instructions such as the Alpha.
18891
18892 The default rules for the value of @code{Object_Size} for
18893 discrete types are as follows:
18894
18895
18896 @itemize *
18897
18898 @item
18899 The @code{Object_Size} for base subtypes reflect the natural hardware
18900 size in bits (run the compiler with @emph{-gnatS} to find those values
18901 for numeric types). Enumeration types and fixed-point base subtypes have
18902 8, 16, 32, or 64 bits for this size, depending on the range of values
18903 to be stored.
18904
18905 @item
18906 The @code{Object_Size} of a subtype is the same as the
18907 @code{Object_Size} of
18908 the type from which it is obtained.
18909
18910 @item
18911 The @code{Object_Size} of a derived base type is copied from the parent
18912 base type, and the @code{Object_Size} of a derived first subtype is copied
18913 from the parent first subtype.
18914 @end itemize
18915
18916 The @code{Value_Size} attribute
18917 is the (minimum) number of bits required to store a value
18918 of the type.
18919 This value is used to determine how tightly to pack
18920 records or arrays with components of this type, and also affects
18921 the semantics of unchecked conversion (unchecked conversions where
18922 the @code{Value_Size} values differ generate a warning, and are potentially
18923 target dependent).
18924
18925 The default rules for the value of @code{Value_Size} are as follows:
18926
18927
18928 @itemize *
18929
18930 @item
18931 The @code{Value_Size} for a base subtype is the minimum number of bits
18932 required to store all values of the type (including the sign bit
18933 only if negative values are possible).
18934
18935 @item
18936 If a subtype statically matches the first subtype of a given type, then it has
18937 by default the same @code{Value_Size} as the first subtype. This is a
18938 consequence of RM 13.1(14): "if two subtypes statically match,
18939 then their subtype-specific aspects are the same".)
18940
18941 @item
18942 All other subtypes have a @code{Value_Size} corresponding to the minimum
18943 number of bits required to store all values of the subtype. For
18944 dynamic bounds, it is assumed that the value can range down or up
18945 to the corresponding bound of the ancestor
18946 @end itemize
18947
18948 The RM defined attribute @code{Size} corresponds to the
18949 @code{Value_Size} attribute.
18950
18951 The @code{Size} attribute may be defined for a first-named subtype. This sets
18952 the @code{Value_Size} of
18953 the first-named subtype to the given value, and the
18954 @code{Object_Size} of this first-named subtype to the given value padded up
18955 to an appropriate boundary. It is a consequence of the default rules
18956 above that this @code{Object_Size} will apply to all further subtypes. On the
18957 other hand, @code{Value_Size} is affected only for the first subtype, any
18958 dynamic subtypes obtained from it directly, and any statically matching
18959 subtypes. The @code{Value_Size} of any other static subtypes is not affected.
18960
18961 @code{Value_Size} and
18962 @code{Object_Size} may be explicitly set for any subtype using
18963 an attribute definition clause. Note that the use of these attributes
18964 can cause the RM 13.1(14) rule to be violated. If two access types
18965 reference aliased objects whose subtypes have differing @code{Object_Size}
18966 values as a result of explicit attribute definition clauses, then it
18967 is illegal to convert from one access subtype to the other. For a more
18968 complete description of this additional legality rule, see the
18969 description of the @code{Object_Size} attribute.
18970
18971 To get a feel for the difference, consider the following examples (note
18972 that in each case the base is @code{Short_Short_Integer} with a size of 8):
18973
18974
18975 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx}
18976 @headitem
18977
18978 Type or subtype declaration
18979
18980 @tab
18981
18982 Object_Size
18983
18984 @tab
18985
18986 Value_Size
18987
18988 @item
18989
18990 @code{type x1 is range 0 .. 5;}
18991
18992 @tab
18993
18994 8
18995
18996 @tab
18997
18998 3
18999
19000 @item
19001
19002 @code{type x2 is range 0 .. 5;}
19003 @code{for x2'size use 12;}
19004
19005 @tab
19006
19007 16
19008
19009 @tab
19010
19011 12
19012
19013 @item
19014
19015 @code{subtype x3 is x2 range 0 .. 3;}
19016
19017 @tab
19018
19019 16
19020
19021 @tab
19022
19023 2
19024
19025 @item
19026
19027 @code{subtype x4 is x2'base range 0 .. 10;}
19028
19029 @tab
19030
19031 8
19032
19033 @tab
19034
19035 4
19036
19037 @item
19038
19039 @code{dynamic : x2'Base range -64 .. +63;}
19040
19041 @tab
19042
19043 @tab
19044
19045 @item
19046
19047 @code{subtype x5 is x2 range 0 .. dynamic;}
19048
19049 @tab
19050
19051 16
19052
19053 @tab
19054
19055 3*
19056
19057 @item
19058
19059 @code{subtype x6 is x2'base range 0 .. dynamic;}
19060
19061 @tab
19062
19063 8
19064
19065 @tab
19066
19067 7*
19068
19069 @end multitable
19070
19071
19072 Note: the entries marked '*' are not actually specified by the Ada
19073 Reference Manual, which has nothing to say about size in the dynamic
19074 case. What GNAT does is to allocate sufficient bits to accomodate any
19075 possible dynamic values for the bounds at run-time.
19076
19077 So far, so good, but GNAT has to obey the RM rules, so the question is
19078 under what conditions must the RM @code{Size} be used.
19079 The following is a list
19080 of the occasions on which the RM @code{Size} must be used:
19081
19082
19083 @itemize *
19084
19085 @item
19086 Component size for packed arrays or records
19087
19088 @item
19089 Value of the attribute @code{Size} for a type
19090
19091 @item
19092 Warning about sizes not matching for unchecked conversion
19093 @end itemize
19094
19095 For record types, the @code{Object_Size} is always a multiple of the
19096 alignment of the type (this is true for all types). In some cases the
19097 @code{Value_Size} can be smaller. Consider:
19098
19099 @example
19100 type R is record
19101 X : Integer;
19102 Y : Character;
19103 end record;
19104 @end example
19105
19106 On a typical 32-bit architecture, the X component will occupy four bytes
19107 and the Y component will occupy one byte, for a total of 5 bytes. As a
19108 result @code{R'Value_Size} will be 40 (bits) since this is the minimum size
19109 required to store a value of this type. For example, it is permissible
19110 to have a component of type R in an array whose component size is
19111 specified to be 40 bits.
19112
19113 However, @code{R'Object_Size} will be 64 (bits). The difference is due to
19114 the alignment requirement for objects of the record type. The X
19115 component will require four-byte alignment because that is what type
19116 Integer requires, whereas the Y component, a Character, will only
19117 require 1-byte alignment. Since the alignment required for X is the
19118 greatest of all the components' alignments, that is the alignment
19119 required for the enclosing record type, i.e., 4 bytes or 32 bits. As
19120 indicated above, the actual object size must be rounded up so that it is
19121 a multiple of the alignment value. Therefore, 40 bits rounded up to the
19122 next multiple of 32 yields 64 bits.
19123
19124 For all other types, the @code{Object_Size}
19125 and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}).
19126 Only @code{Size} may be specified for such types.
19127
19128 Note that @code{Value_Size} can be used to force biased representation
19129 for a particular subtype. Consider this example:
19130
19131 @example
19132 type R is (A, B, C, D, E, F);
19133 subtype RAB is R range A .. B;
19134 subtype REF is R range E .. F;
19135 @end example
19136
19137 By default, @code{RAB}
19138 has a size of 1 (sufficient to accommodate the representation
19139 of @code{A} and @code{B}, 0 and 1), and @code{REF}
19140 has a size of 3 (sufficient to accommodate the representation
19141 of @code{E} and @code{F}, 4 and 5). But if we add the
19142 following @code{Value_Size} attribute definition clause:
19143
19144 @example
19145 for REF'Value_Size use 1;
19146 @end example
19147
19148 then biased representation is forced for @code{REF},
19149 and 0 will represent @code{E} and 1 will represent @code{F}.
19150 A warning is issued when a @code{Value_Size} attribute
19151 definition clause forces biased representation. This
19152 warning can be turned off using @code{-gnatw.B}.
19153
19154 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
19155 @anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{282}@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{283}
19156 @section Component_Size Clauses
19157
19158
19159 @geindex Component_Size Clause
19160
19161 Normally, the value specified in a component size clause must be consistent
19162 with the subtype of the array component with regard to size and alignment.
19163 In other words, the value specified must be at least equal to the size
19164 of this subtype, and must be a multiple of the alignment value.
19165
19166 In addition, component size clauses are allowed which cause the array
19167 to be packed, by specifying a smaller value. A first case is for
19168 component size values in the range 1 through 63. The value specified
19169 must not be smaller than the Size of the subtype. GNAT will accurately
19170 honor all packing requests in this range. For example, if we have:
19171
19172 @example
19173 type r is array (1 .. 8) of Natural;
19174 for r'Component_Size use 31;
19175 @end example
19176
19177 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
19178 Of course access to the components of such an array is considerably
19179 less efficient than if the natural component size of 32 is used.
19180 A second case is when the subtype of the component is a record type
19181 padded because of its default alignment. For example, if we have:
19182
19183 @example
19184 type r is record
19185 i : Integer;
19186 j : Integer;
19187 b : Boolean;
19188 end record;
19189
19190 type a is array (1 .. 8) of r;
19191 for a'Component_Size use 72;
19192 @end example
19193
19194 then the resulting array has a length of 72 bytes, instead of 96 bytes
19195 if the alignment of the record (4) was obeyed.
19196
19197 Note that there is no point in giving both a component size clause
19198 and a pragma Pack for the same array type. if such duplicate
19199 clauses are given, the pragma Pack will be ignored.
19200
19201 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
19202 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{284}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{285}
19203 @section Bit_Order Clauses
19204
19205
19206 @geindex Bit_Order Clause
19207
19208 @geindex bit ordering
19209
19210 @geindex ordering
19211 @geindex of bits
19212
19213 For record subtypes, GNAT permits the specification of the @code{Bit_Order}
19214 attribute. The specification may either correspond to the default bit
19215 order for the target, in which case the specification has no effect and
19216 places no additional restrictions, or it may be for the non-standard
19217 setting (that is the opposite of the default).
19218
19219 In the case where the non-standard value is specified, the effect is
19220 to renumber bits within each byte, but the ordering of bytes is not
19221 affected. There are certain
19222 restrictions placed on component clauses as follows:
19223
19224
19225 @itemize *
19226
19227 @item
19228 Components fitting within a single storage unit.
19229
19230 These are unrestricted, and the effect is merely to renumber bits. For
19231 example if we are on a little-endian machine with @code{Low_Order_First}
19232 being the default, then the following two declarations have exactly
19233 the same effect:
19234
19235 @example
19236 type R1 is record
19237 A : Boolean;
19238 B : Integer range 1 .. 120;
19239 end record;
19240
19241 for R1 use record
19242 A at 0 range 0 .. 0;
19243 B at 0 range 1 .. 7;
19244 end record;
19245
19246 type R2 is record
19247 A : Boolean;
19248 B : Integer range 1 .. 120;
19249 end record;
19250
19251 for R2'Bit_Order use High_Order_First;
19252
19253 for R2 use record
19254 A at 0 range 7 .. 7;
19255 B at 0 range 0 .. 6;
19256 end record;
19257 @end example
19258
19259 The useful application here is to write the second declaration with the
19260 @code{Bit_Order} attribute definition clause, and know that it will be treated
19261 the same, regardless of whether the target is little-endian or big-endian.
19262
19263 @item
19264 Components occupying an integral number of bytes.
19265
19266 These are components that exactly fit in two or more bytes. Such component
19267 declarations are allowed, but have no effect, since it is important to realize
19268 that the @code{Bit_Order} specification does not affect the ordering of bytes.
19269 In particular, the following attempt at getting an endian-independent integer
19270 does not work:
19271
19272 @example
19273 type R2 is record
19274 A : Integer;
19275 end record;
19276
19277 for R2'Bit_Order use High_Order_First;
19278
19279 for R2 use record
19280 A at 0 range 0 .. 31;
19281 end record;
19282 @end example
19283
19284 This declaration will result in a little-endian integer on a
19285 little-endian machine, and a big-endian integer on a big-endian machine.
19286 If byte flipping is required for interoperability between big- and
19287 little-endian machines, this must be explicitly programmed. This capability
19288 is not provided by @code{Bit_Order}.
19289
19290 @item
19291 Components that are positioned across byte boundaries.
19292
19293 but do not occupy an integral number of bytes. Given that bytes are not
19294 reordered, such fields would occupy a non-contiguous sequence of bits
19295 in memory, requiring non-trivial code to reassemble. They are for this
19296 reason not permitted, and any component clause specifying such a layout
19297 will be flagged as illegal by GNAT.
19298 @end itemize
19299
19300 Since the misconception that Bit_Order automatically deals with all
19301 endian-related incompatibilities is a common one, the specification of
19302 a component field that is an integral number of bytes will always
19303 generate a warning. This warning may be suppressed using @code{pragma Warnings (Off)}
19304 if desired. The following section contains additional
19305 details regarding the issue of byte ordering.
19306
19307 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
19308 @anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{286}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{287}
19309 @section Effect of Bit_Order on Byte Ordering
19310
19311
19312 @geindex byte ordering
19313
19314 @geindex ordering
19315 @geindex of bytes
19316
19317 In this section we will review the effect of the @code{Bit_Order} attribute
19318 definition clause on byte ordering. Briefly, it has no effect at all, but
19319 a detailed example will be helpful. Before giving this
19320 example, let us review the precise
19321 definition of the effect of defining @code{Bit_Order}. The effect of a
19322 non-standard bit order is described in section 13.5.3 of the Ada
19323 Reference Manual:
19324
19325 @quotation
19326
19327 "2 A bit ordering is a method of interpreting the meaning of
19328 the storage place attributes."
19329 @end quotation
19330
19331 To understand the precise definition of storage place attributes in
19332 this context, we visit section 13.5.1 of the manual:
19333
19334 @quotation
19335
19336 "13 A record_representation_clause (without the mod_clause)
19337 specifies the layout. The storage place attributes (see 13.5.2)
19338 are taken from the values of the position, first_bit, and last_bit
19339 expressions after normalizing those values so that first_bit is
19340 less than Storage_Unit."
19341 @end quotation
19342
19343 The critical point here is that storage places are taken from
19344 the values after normalization, not before. So the @code{Bit_Order}
19345 interpretation applies to normalized values. The interpretation
19346 is described in the later part of the 13.5.3 paragraph:
19347
19348 @quotation
19349
19350 "2 A bit ordering is a method of interpreting the meaning of
19351 the storage place attributes. High_Order_First (known in the
19352 vernacular as 'big endian') means that the first bit of a
19353 storage element (bit 0) is the most significant bit (interpreting
19354 the sequence of bits that represent a component as an unsigned
19355 integer value). Low_Order_First (known in the vernacular as
19356 'little endian') means the opposite: the first bit is the
19357 least significant."
19358 @end quotation
19359
19360 Note that the numbering is with respect to the bits of a storage
19361 unit. In other words, the specification affects only the numbering
19362 of bits within a single storage unit.
19363
19364 We can make the effect clearer by giving an example.
19365
19366 Suppose that we have an external device which presents two bytes, the first
19367 byte presented, which is the first (low addressed byte) of the two byte
19368 record is called Master, and the second byte is called Slave.
19369
19370 The left most (most significant bit is called Control for each byte, and
19371 the remaining 7 bits are called V1, V2, ... V7, where V7 is the rightmost
19372 (least significant) bit.
19373
19374 On a big-endian machine, we can write the following representation clause
19375
19376 @example
19377 type Data is record
19378 Master_Control : Bit;
19379 Master_V1 : Bit;
19380 Master_V2 : Bit;
19381 Master_V3 : Bit;
19382 Master_V4 : Bit;
19383 Master_V5 : Bit;
19384 Master_V6 : Bit;
19385 Master_V7 : Bit;
19386 Slave_Control : Bit;
19387 Slave_V1 : Bit;
19388 Slave_V2 : Bit;
19389 Slave_V3 : Bit;
19390 Slave_V4 : Bit;
19391 Slave_V5 : Bit;
19392 Slave_V6 : Bit;
19393 Slave_V7 : Bit;
19394 end record;
19395
19396 for Data use record
19397 Master_Control at 0 range 0 .. 0;
19398 Master_V1 at 0 range 1 .. 1;
19399 Master_V2 at 0 range 2 .. 2;
19400 Master_V3 at 0 range 3 .. 3;
19401 Master_V4 at 0 range 4 .. 4;
19402 Master_V5 at 0 range 5 .. 5;
19403 Master_V6 at 0 range 6 .. 6;
19404 Master_V7 at 0 range 7 .. 7;
19405 Slave_Control at 1 range 0 .. 0;
19406 Slave_V1 at 1 range 1 .. 1;
19407 Slave_V2 at 1 range 2 .. 2;
19408 Slave_V3 at 1 range 3 .. 3;
19409 Slave_V4 at 1 range 4 .. 4;
19410 Slave_V5 at 1 range 5 .. 5;
19411 Slave_V6 at 1 range 6 .. 6;
19412 Slave_V7 at 1 range 7 .. 7;
19413 end record;
19414 @end example
19415
19416 Now if we move this to a little endian machine, then the bit ordering within
19417 the byte is backwards, so we have to rewrite the record rep clause as:
19418
19419 @example
19420 for Data use record
19421 Master_Control at 0 range 7 .. 7;
19422 Master_V1 at 0 range 6 .. 6;
19423 Master_V2 at 0 range 5 .. 5;
19424 Master_V3 at 0 range 4 .. 4;
19425 Master_V4 at 0 range 3 .. 3;
19426 Master_V5 at 0 range 2 .. 2;
19427 Master_V6 at 0 range 1 .. 1;
19428 Master_V7 at 0 range 0 .. 0;
19429 Slave_Control at 1 range 7 .. 7;
19430 Slave_V1 at 1 range 6 .. 6;
19431 Slave_V2 at 1 range 5 .. 5;
19432 Slave_V3 at 1 range 4 .. 4;
19433 Slave_V4 at 1 range 3 .. 3;
19434 Slave_V5 at 1 range 2 .. 2;
19435 Slave_V6 at 1 range 1 .. 1;
19436 Slave_V7 at 1 range 0 .. 0;
19437 end record;
19438 @end example
19439
19440 It is a nuisance to have to rewrite the clause, especially if
19441 the code has to be maintained on both machines. However,
19442 this is a case that we can handle with the
19443 @code{Bit_Order} attribute if it is implemented.
19444 Note that the implementation is not required on byte addressed
19445 machines, but it is indeed implemented in GNAT.
19446 This means that we can simply use the
19447 first record clause, together with the declaration
19448
19449 @example
19450 for Data'Bit_Order use High_Order_First;
19451 @end example
19452
19453 and the effect is what is desired, namely the layout is exactly the same,
19454 independent of whether the code is compiled on a big-endian or little-endian
19455 machine.
19456
19457 The important point to understand is that byte ordering is not affected.
19458 A @code{Bit_Order} attribute definition never affects which byte a field
19459 ends up in, only where it ends up in that byte.
19460 To make this clear, let us rewrite the record rep clause of the previous
19461 example as:
19462
19463 @example
19464 for Data'Bit_Order use High_Order_First;
19465 for Data use record
19466 Master_Control at 0 range 0 .. 0;
19467 Master_V1 at 0 range 1 .. 1;
19468 Master_V2 at 0 range 2 .. 2;
19469 Master_V3 at 0 range 3 .. 3;
19470 Master_V4 at 0 range 4 .. 4;
19471 Master_V5 at 0 range 5 .. 5;
19472 Master_V6 at 0 range 6 .. 6;
19473 Master_V7 at 0 range 7 .. 7;
19474 Slave_Control at 0 range 8 .. 8;
19475 Slave_V1 at 0 range 9 .. 9;
19476 Slave_V2 at 0 range 10 .. 10;
19477 Slave_V3 at 0 range 11 .. 11;
19478 Slave_V4 at 0 range 12 .. 12;
19479 Slave_V5 at 0 range 13 .. 13;
19480 Slave_V6 at 0 range 14 .. 14;
19481 Slave_V7 at 0 range 15 .. 15;
19482 end record;
19483 @end example
19484
19485 This is exactly equivalent to saying (a repeat of the first example):
19486
19487 @example
19488 for Data'Bit_Order use High_Order_First;
19489 for Data use record
19490 Master_Control at 0 range 0 .. 0;
19491 Master_V1 at 0 range 1 .. 1;
19492 Master_V2 at 0 range 2 .. 2;
19493 Master_V3 at 0 range 3 .. 3;
19494 Master_V4 at 0 range 4 .. 4;
19495 Master_V5 at 0 range 5 .. 5;
19496 Master_V6 at 0 range 6 .. 6;
19497 Master_V7 at 0 range 7 .. 7;
19498 Slave_Control at 1 range 0 .. 0;
19499 Slave_V1 at 1 range 1 .. 1;
19500 Slave_V2 at 1 range 2 .. 2;
19501 Slave_V3 at 1 range 3 .. 3;
19502 Slave_V4 at 1 range 4 .. 4;
19503 Slave_V5 at 1 range 5 .. 5;
19504 Slave_V6 at 1 range 6 .. 6;
19505 Slave_V7 at 1 range 7 .. 7;
19506 end record;
19507 @end example
19508
19509 Why are they equivalent? Well take a specific field, the @code{Slave_V2}
19510 field. The storage place attributes are obtained by normalizing the
19511 values given so that the @code{First_Bit} value is less than 8. After
19512 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
19513 we specified in the other case.
19514
19515 Now one might expect that the @code{Bit_Order} attribute might affect
19516 bit numbering within the entire record component (two bytes in this
19517 case, thus affecting which byte fields end up in), but that is not
19518 the way this feature is defined, it only affects numbering of bits,
19519 not which byte they end up in.
19520
19521 Consequently it never makes sense to specify a starting bit number
19522 greater than 7 (for a byte addressable field) if an attribute
19523 definition for @code{Bit_Order} has been given, and indeed it
19524 may be actively confusing to specify such a value, so the compiler
19525 generates a warning for such usage.
19526
19527 If you do need to control byte ordering then appropriate conditional
19528 values must be used. If in our example, the slave byte came first on
19529 some machines we might write:
19530
19531 @example
19532 Master_Byte_First constant Boolean := ...;
19533
19534 Master_Byte : constant Natural :=
19535 1 - Boolean'Pos (Master_Byte_First);
19536 Slave_Byte : constant Natural :=
19537 Boolean'Pos (Master_Byte_First);
19538
19539 for Data'Bit_Order use High_Order_First;
19540 for Data use record
19541 Master_Control at Master_Byte range 0 .. 0;
19542 Master_V1 at Master_Byte range 1 .. 1;
19543 Master_V2 at Master_Byte range 2 .. 2;
19544 Master_V3 at Master_Byte range 3 .. 3;
19545 Master_V4 at Master_Byte range 4 .. 4;
19546 Master_V5 at Master_Byte range 5 .. 5;
19547 Master_V6 at Master_Byte range 6 .. 6;
19548 Master_V7 at Master_Byte range 7 .. 7;
19549 Slave_Control at Slave_Byte range 0 .. 0;
19550 Slave_V1 at Slave_Byte range 1 .. 1;
19551 Slave_V2 at Slave_Byte range 2 .. 2;
19552 Slave_V3 at Slave_Byte range 3 .. 3;
19553 Slave_V4 at Slave_Byte range 4 .. 4;
19554 Slave_V5 at Slave_Byte range 5 .. 5;
19555 Slave_V6 at Slave_Byte range 6 .. 6;
19556 Slave_V7 at Slave_Byte range 7 .. 7;
19557 end record;
19558 @end example
19559
19560 Now to switch between machines, all that is necessary is
19561 to set the boolean constant @code{Master_Byte_First} in
19562 an appropriate manner.
19563
19564 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
19565 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{288}@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{289}
19566 @section Pragma Pack for Arrays
19567
19568
19569 @geindex Pragma Pack (for arrays)
19570
19571 Pragma @code{Pack} applied to an array has an effect that depends upon whether the
19572 component type is @emph{packable}. For a component type to be @emph{packable}, it must
19573 be one of the following cases:
19574
19575
19576 @itemize *
19577
19578 @item
19579 Any elementary type.
19580
19581 @item
19582 Any small packed array type with a static size.
19583
19584 @item
19585 Any small simple record type with a static size.
19586 @end itemize
19587
19588 For all these cases, if the component subtype size is in the range
19589 1 through 64, then the effect of the pragma @code{Pack} is exactly as though a
19590 component size were specified giving the component subtype size.
19591
19592 All other types are non-packable, they occupy an integral number of storage
19593 units and the only effect of pragma Pack is to remove alignment gaps.
19594
19595 For example if we have:
19596
19597 @example
19598 type r is range 0 .. 17;
19599
19600 type ar is array (1 .. 8) of r;
19601 pragma Pack (ar);
19602 @end example
19603
19604 Then the component size of @code{ar} will be set to 5 (i.e., to @code{r'size},
19605 and the size of the array @code{ar} will be exactly 40 bits).
19606
19607 Note that in some cases this rather fierce approach to packing can produce
19608 unexpected effects. For example, in Ada 95 and Ada 2005,
19609 subtype @code{Natural} typically has a size of 31, meaning that if you
19610 pack an array of @code{Natural}, you get 31-bit
19611 close packing, which saves a few bits, but results in far less efficient
19612 access. Since many other Ada compilers will ignore such a packing request,
19613 GNAT will generate a warning on some uses of pragma @code{Pack} that it guesses
19614 might not be what is intended. You can easily remove this warning by
19615 using an explicit @code{Component_Size} setting instead, which never generates
19616 a warning, since the intention of the programmer is clear in this case.
19617
19618 GNAT treats packed arrays in one of two ways. If the size of the array is
19619 known at compile time and is less than 64 bits, then internally the array
19620 is represented as a single modular type, of exactly the appropriate number
19621 of bits. If the length is greater than 63 bits, or is not known at compile
19622 time, then the packed array is represented as an array of bytes, and the
19623 length is always a multiple of 8 bits.
19624
19625 Note that to represent a packed array as a modular type, the alignment must
19626 be suitable for the modular type involved. For example, on typical machines
19627 a 32-bit packed array will be represented by a 32-bit modular integer with
19628 an alignment of four bytes. If you explicitly override the default alignment
19629 with an alignment clause that is too small, the modular representation
19630 cannot be used. For example, consider the following set of declarations:
19631
19632 @example
19633 type R is range 1 .. 3;
19634 type S is array (1 .. 31) of R;
19635 for S'Component_Size use 2;
19636 for S'Size use 62;
19637 for S'Alignment use 1;
19638 @end example
19639
19640 If the alignment clause were not present, then a 62-bit modular
19641 representation would be chosen (typically with an alignment of 4 or 8
19642 bytes depending on the target). But the default alignment is overridden
19643 with the explicit alignment clause. This means that the modular
19644 representation cannot be used, and instead the array of bytes
19645 representation must be used, meaning that the length must be a multiple
19646 of 8. Thus the above set of declarations will result in a diagnostic
19647 rejecting the size clause and noting that the minimum size allowed is 64.
19648
19649 @geindex Pragma Pack (for type Natural)
19650
19651 @geindex Pragma Pack warning
19652
19653 One special case that is worth noting occurs when the base type of the
19654 component size is 8/16/32 and the subtype is one bit less. Notably this
19655 occurs with subtype @code{Natural}. Consider:
19656
19657 @example
19658 type Arr is array (1 .. 32) of Natural;
19659 pragma Pack (Arr);
19660 @end example
19661
19662 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
19663 since typically @code{Natural'Size} is 32 in Ada 83, and in any case most
19664 Ada 83 compilers did not attempt 31 bit packing.
19665
19666 In Ada 95 and Ada 2005, @code{Natural'Size} is required to be 31. Furthermore,
19667 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
19668 substantial unintended performance penalty when porting legacy Ada 83 code.
19669 To help prevent this, GNAT generates a warning in such cases. If you really
19670 want 31 bit packing in a case like this, you can set the component size
19671 explicitly:
19672
19673 @example
19674 type Arr is array (1 .. 32) of Natural;
19675 for Arr'Component_Size use 31;
19676 @end example
19677
19678 Here 31-bit packing is achieved as required, and no warning is generated,
19679 since in this case the programmer intention is clear.
19680
19681 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
19682 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{28a}@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{28b}
19683 @section Pragma Pack for Records
19684
19685
19686 @geindex Pragma Pack (for records)
19687
19688 Pragma @code{Pack} applied to a record will pack the components to reduce
19689 wasted space from alignment gaps and by reducing the amount of space
19690 taken by components. We distinguish between @emph{packable} components and
19691 @emph{non-packable} components.
19692 Components of the following types are considered packable:
19693
19694
19695 @itemize *
19696
19697 @item
19698 Components of an elementary type are packable unless they are aliased,
19699 independent, or of an atomic type.
19700
19701 @item
19702 Small packed arrays, where the size is statically known, are represented
19703 internally as modular integers, and so they are also packable.
19704
19705 @item
19706 Small simple records, where the size is statically known, are also packable.
19707 @end itemize
19708
19709 For all these cases, if the @code{'Size} value is in the range 1 through 64, the
19710 components occupy the exact number of bits corresponding to this value
19711 and are packed with no padding bits, i.e. they can start on an arbitrary
19712 bit boundary.
19713
19714 All other types are non-packable, they occupy an integral number of storage
19715 units and the only effect of pragma @code{Pack} is to remove alignment gaps.
19716
19717 For example, consider the record
19718
19719 @example
19720 type Rb1 is array (1 .. 13) of Boolean;
19721 pragma Pack (Rb1);
19722
19723 type Rb2 is array (1 .. 65) of Boolean;
19724 pragma Pack (Rb2);
19725
19726 type AF is new Float with Atomic;
19727
19728 type X2 is record
19729 L1 : Boolean;
19730 L2 : Duration;
19731 L3 : AF;
19732 L4 : Boolean;
19733 L5 : Rb1;
19734 L6 : Rb2;
19735 end record;
19736 pragma Pack (X2);
19737 @end example
19738
19739 The representation for the record @code{X2} is as follows:
19740
19741 @example
19742 for X2'Size use 224;
19743 for X2 use record
19744 L1 at 0 range 0 .. 0;
19745 L2 at 0 range 1 .. 64;
19746 L3 at 12 range 0 .. 31;
19747 L4 at 16 range 0 .. 0;
19748 L5 at 16 range 1 .. 13;
19749 L6 at 18 range 0 .. 71;
19750 end record;
19751 @end example
19752
19753 Studying this example, we see that the packable fields @code{L1}
19754 and @code{L2} are
19755 of length equal to their sizes, and placed at specific bit boundaries (and
19756 not byte boundaries) to
19757 eliminate padding. But @code{L3} is of a non-packable float type (because
19758 it is aliased), so it is on the next appropriate alignment boundary.
19759
19760 The next two fields are fully packable, so @code{L4} and @code{L5} are
19761 minimally packed with no gaps. However, type @code{Rb2} is a packed
19762 array that is longer than 64 bits, so it is itself non-packable. Thus
19763 the @code{L6} field is aligned to the next byte boundary, and takes an
19764 integral number of bytes, i.e., 72 bits.
19765
19766 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19767 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{28c}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{28d}
19768 @section Record Representation Clauses
19769
19770
19771 @geindex Record Representation Clause
19772
19773 Record representation clauses may be given for all record types, including
19774 types obtained by record extension. Component clauses are allowed for any
19775 static component. The restrictions on component clauses depend on the type
19776 of the component.
19777
19778 @geindex Component Clause
19779
19780 For all components of an elementary type, the only restriction on component
19781 clauses is that the size must be at least the @code{'Size} value of the type
19782 (actually the Value_Size). There are no restrictions due to alignment,
19783 and such components may freely cross storage boundaries.
19784
19785 Packed arrays with a size up to and including 64 bits are represented
19786 internally using a modular type with the appropriate number of bits, and
19787 thus the same lack of restriction applies. For example, if you declare:
19788
19789 @example
19790 type R is array (1 .. 49) of Boolean;
19791 pragma Pack (R);
19792 for R'Size use 49;
19793 @end example
19794
19795 then a component clause for a component of type @code{R} may start on any
19796 specified bit boundary, and may specify a value of 49 bits or greater.
19797
19798 For packed bit arrays that are longer than 64 bits, there are two
19799 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
19800 including the important case of single bits or boolean values, then
19801 there are no limitations on placement of such components, and they
19802 may start and end at arbitrary bit boundaries.
19803
19804 If the component size is not a power of 2 (e.g., 3 or 5), then
19805 an array of this type longer than 64 bits must always be placed on
19806 on a storage unit (byte) boundary and occupy an integral number
19807 of storage units (bytes). Any component clause that does not
19808 meet this requirement will be rejected.
19809
19810 Any aliased component, or component of an aliased type, must
19811 have its normal alignment and size. A component clause that
19812 does not meet this requirement will be rejected.
19813
19814 The tag field of a tagged type always occupies an address sized field at
19815 the start of the record. No component clause may attempt to overlay this
19816 tag. When a tagged type appears as a component, the tag field must have
19817 proper alignment
19818
19819 In the case of a record extension @code{T1}, of a type @code{T}, no component clause applied
19820 to the type @code{T1} can specify a storage location that would overlap the first
19821 @code{T'Size} bytes of the record.
19822
19823 For all other component types, including non-bit-packed arrays,
19824 the component can be placed at an arbitrary bit boundary,
19825 so for example, the following is permitted:
19826
19827 @example
19828 type R is array (1 .. 10) of Boolean;
19829 for R'Size use 80;
19830
19831 type Q is record
19832 G, H : Boolean;
19833 L, M : R;
19834 end record;
19835
19836 for Q use record
19837 G at 0 range 0 .. 0;
19838 H at 0 range 1 .. 1;
19839 L at 0 range 2 .. 81;
19840 R at 0 range 82 .. 161;
19841 end record;
19842 @end example
19843
19844 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
19845 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{28e}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{28f}
19846 @section Handling of Records with Holes
19847
19848
19849 @geindex Handling of Records with Holes
19850
19851 As a result of alignment considerations, records may contain "holes"
19852 or gaps
19853 which do not correspond to the data bits of any of the components.
19854 Record representation clauses can also result in holes in records.
19855
19856 GNAT does not attempt to clear these holes, so in record objects,
19857 they should be considered to hold undefined rubbish. The generated
19858 equality routine just tests components so does not access these
19859 undefined bits, and assignment and copy operations may or may not
19860 preserve the contents of these holes (for assignments, the holes
19861 in the target will in practice contain either the bits that are
19862 present in the holes in the source, or the bits that were present
19863 in the target before the assignment).
19864
19865 If it is necessary to ensure that holes in records have all zero
19866 bits, then record objects for which this initialization is desired
19867 should be explicitly set to all zero values using Unchecked_Conversion
19868 or address overlays. For example
19869
19870 @example
19871 type HRec is record
19872 C : Character;
19873 I : Integer;
19874 end record;
19875 @end example
19876
19877 On typical machines, integers need to be aligned on a four-byte
19878 boundary, resulting in three bytes of undefined rubbish following
19879 the 8-bit field for C. To ensure that the hole in a variable of
19880 type HRec is set to all zero bits,
19881 you could for example do:
19882
19883 @example
19884 type Base is record
19885 Dummy1, Dummy2 : Integer := 0;
19886 end record;
19887
19888 BaseVar : Base;
19889 RealVar : Hrec;
19890 for RealVar'Address use BaseVar'Address;
19891 @end example
19892
19893 Now the 8-bytes of the value of RealVar start out containing all zero
19894 bits. A safer approach is to just define dummy fields, avoiding the
19895 holes, as in:
19896
19897 @example
19898 type HRec is record
19899 C : Character;
19900 Dummy1 : Short_Short_Integer := 0;
19901 Dummy2 : Short_Short_Integer := 0;
19902 Dummy3 : Short_Short_Integer := 0;
19903 I : Integer;
19904 end record;
19905 @end example
19906
19907 And to make absolutely sure that the intent of this is followed, you
19908 can use representation clauses:
19909
19910 @example
19911 for Hrec use record
19912 C at 0 range 0 .. 7;
19913 Dummy1 at 1 range 0 .. 7;
19914 Dummy2 at 2 range 0 .. 7;
19915 Dummy3 at 3 range 0 .. 7;
19916 I at 4 range 0 .. 31;
19917 end record;
19918 for Hrec'Size use 64;
19919 @end example
19920
19921 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
19922 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{290}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{291}
19923 @section Enumeration Clauses
19924
19925
19926 The only restriction on enumeration clauses is that the range of values
19927 must be representable. For the signed case, if one or more of the
19928 representation values are negative, all values must be in the range:
19929
19930 @example
19931 System.Min_Int .. System.Max_Int
19932 @end example
19933
19934 For the unsigned case, where all values are nonnegative, the values must
19935 be in the range:
19936
19937 @example
19938 0 .. System.Max_Binary_Modulus;
19939 @end example
19940
19941 A @emph{confirming} representation clause is one in which the values range
19942 from 0 in sequence, i.e., a clause that confirms the default representation
19943 for an enumeration type.
19944 Such a confirming representation
19945 is permitted by these rules, and is specially recognized by the compiler so
19946 that no extra overhead results from the use of such a clause.
19947
19948 If an array has an index type which is an enumeration type to which an
19949 enumeration clause has been applied, then the array is stored in a compact
19950 manner. Consider the declarations:
19951
19952 @example
19953 type r is (A, B, C);
19954 for r use (A => 1, B => 5, C => 10);
19955 type t is array (r) of Character;
19956 @end example
19957
19958 The array type t corresponds to a vector with exactly three elements and
19959 has a default size equal to @code{3*Character'Size}. This ensures efficient
19960 use of space, but means that accesses to elements of the array will incur
19961 the overhead of converting representation values to the corresponding
19962 positional values, (i.e., the value delivered by the @code{Pos} attribute).
19963
19964 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
19965 @anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{292}@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{293}
19966 @section Address Clauses
19967
19968
19969 @geindex Address Clause
19970
19971 The reference manual allows a general restriction on representation clauses,
19972 as found in RM 13.1(22):
19973
19974 @quotation
19975
19976 "An implementation need not support representation
19977 items containing nonstatic expressions, except that
19978 an implementation should support a representation item
19979 for a given entity if each nonstatic expression in the
19980 representation item is a name that statically denotes
19981 a constant declared before the entity."
19982 @end quotation
19983
19984 In practice this is applicable only to address clauses, since this is the
19985 only case in which a nonstatic expression is permitted by the syntax. As
19986 the AARM notes in sections 13.1 (22.a-22.h):
19987
19988 @quotation
19989
19990 22.a Reason: This is to avoid the following sort of thing:
19991
19992 22.b X : Integer := F(...);
19993 Y : Address := G(...);
19994 for X'Address use Y;
19995
19996 22.c In the above, we have to evaluate the
19997 initialization expression for X before we
19998 know where to put the result. This seems
19999 like an unreasonable implementation burden.
20000
20001 22.d The above code should instead be written
20002 like this:
20003
20004 22.e Y : constant Address := G(...);
20005 X : Integer := F(...);
20006 for X'Address use Y;
20007
20008 22.f This allows the expression 'Y' to be safely
20009 evaluated before X is created.
20010
20011 22.g The constant could be a formal parameter of mode in.
20012
20013 22.h An implementation can support other nonstatic
20014 expressions if it wants to. Expressions of type
20015 Address are hardly ever static, but their value
20016 might be known at compile time anyway in many
20017 cases.
20018 @end quotation
20019
20020 GNAT does indeed permit many additional cases of nonstatic expressions. In
20021 particular, if the type involved is elementary there are no restrictions
20022 (since in this case, holding a temporary copy of the initialization value,
20023 if one is present, is inexpensive). In addition, if there is no implicit or
20024 explicit initialization, then there are no restrictions. GNAT will reject
20025 only the case where all three of these conditions hold:
20026
20027
20028 @itemize *
20029
20030 @item
20031 The type of the item is non-elementary (e.g., a record or array).
20032
20033 @item
20034 There is explicit or implicit initialization required for the object.
20035 Note that access values are always implicitly initialized.
20036
20037 @item
20038 The address value is nonstatic. Here GNAT is more permissive than the
20039 RM, and allows the address value to be the address of a previously declared
20040 stand-alone variable, as long as it does not itself have an address clause.
20041
20042 @example
20043 Anchor : Some_Initialized_Type;
20044 Overlay : Some_Initialized_Type;
20045 for Overlay'Address use Anchor'Address;
20046 @end example
20047
20048 However, the prefix of the address clause cannot be an array component, or
20049 a component of a discriminated record.
20050 @end itemize
20051
20052 As noted above in section 22.h, address values are typically nonstatic. In
20053 particular the To_Address function, even if applied to a literal value, is
20054 a nonstatic function call. To avoid this minor annoyance, GNAT provides
20055 the implementation defined attribute 'To_Address. The following two
20056 expressions have identical values:
20057
20058 @geindex Attribute
20059
20060 @geindex To_Address
20061
20062 @example
20063 To_Address (16#1234_0000#)
20064 System'To_Address (16#1234_0000#);
20065 @end example
20066
20067 except that the second form is considered to be a static expression, and
20068 thus when used as an address clause value is always permitted.
20069
20070 Additionally, GNAT treats as static an address clause that is an
20071 unchecked_conversion of a static integer value. This simplifies the porting
20072 of legacy code, and provides a portable equivalent to the GNAT attribute
20073 @code{To_Address}.
20074
20075 Another issue with address clauses is the interaction with alignment
20076 requirements. When an address clause is given for an object, the address
20077 value must be consistent with the alignment of the object (which is usually
20078 the same as the alignment of the type of the object). If an address clause
20079 is given that specifies an inappropriately aligned address value, then the
20080 program execution is erroneous.
20081
20082 Since this source of erroneous behavior can have unfortunate effects on
20083 machines with strict alignment requirements, GNAT
20084 checks (at compile time if possible, generating a warning, or at execution
20085 time with a run-time check) that the alignment is appropriate. If the
20086 run-time check fails, then @code{Program_Error} is raised. This run-time
20087 check is suppressed if range checks are suppressed, or if the special GNAT
20088 check Alignment_Check is suppressed, or if
20089 @code{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
20090 suppressed by default on non-strict alignment machines (such as the x86).
20091
20092 Finally, GNAT does not permit overlaying of objects of class-wide types. In
20093 most cases, the compiler can detect an attempt at such overlays and will
20094 generate a warning at compile time and a Program_Error exception at run time.
20095
20096 @geindex Export
20097
20098 An address clause cannot be given for an exported object. More
20099 understandably the real restriction is that objects with an address
20100 clause cannot be exported. This is because such variables are not
20101 defined by the Ada program, so there is no external object to export.
20102
20103 @geindex Import
20104
20105 It is permissible to give an address clause and a pragma Import for the
20106 same object. In this case, the variable is not really defined by the
20107 Ada program, so there is no external symbol to be linked. The link name
20108 and the external name are ignored in this case. The reason that we allow this
20109 combination is that it provides a useful idiom to avoid unwanted
20110 initializations on objects with address clauses.
20111
20112 When an address clause is given for an object that has implicit or
20113 explicit initialization, then by default initialization takes place. This
20114 means that the effect of the object declaration is to overwrite the
20115 memory at the specified address. This is almost always not what the
20116 programmer wants, so GNAT will output a warning:
20117
20118 @example
20119 with System;
20120 package G is
20121 type R is record
20122 M : Integer := 0;
20123 end record;
20124
20125 Ext : R;
20126 for Ext'Address use System'To_Address (16#1234_1234#);
20127 |
20128 >>> warning: implicit initialization of "Ext" may
20129 modify overlaid storage
20130 >>> warning: use pragma Import for "Ext" to suppress
20131 initialization (RM B(24))
20132
20133 end G;
20134 @end example
20135
20136 As indicated by the warning message, the solution is to use a (dummy) pragma
20137 Import to suppress this initialization. The pragma tell the compiler that the
20138 object is declared and initialized elsewhere. The following package compiles
20139 without warnings (and the initialization is suppressed):
20140
20141 @example
20142 with System;
20143 package G is
20144 type R is record
20145 M : Integer := 0;
20146 end record;
20147
20148 Ext : R;
20149 for Ext'Address use System'To_Address (16#1234_1234#);
20150 pragma Import (Ada, Ext);
20151 end G;
20152 @end example
20153
20154 A final issue with address clauses involves their use for overlaying
20155 variables, as in the following example:
20156
20157 @geindex Overlaying of objects
20158
20159 @example
20160 A : Integer;
20161 B : Integer;
20162 for B'Address use A'Address;
20163 @end example
20164
20165 or alternatively, using the form recommended by the RM:
20166
20167 @example
20168 A : Integer;
20169 Addr : constant Address := A'Address;
20170 B : Integer;
20171 for B'Address use Addr;
20172 @end example
20173
20174 In both of these cases, @code{A} and @code{B} become aliased to one another
20175 via the address clause. This use of address clauses to overlay
20176 variables, achieving an effect similar to unchecked conversion
20177 was erroneous in Ada 83, but in Ada 95 and Ada 2005
20178 the effect is implementation defined. Furthermore, the
20179 Ada RM specifically recommends that in a situation
20180 like this, @code{B} should be subject to the following
20181 implementation advice (RM 13.3(19)):
20182
20183 @quotation
20184
20185 "19 If the Address of an object is specified, or it is imported
20186 or exported, then the implementation should not perform
20187 optimizations based on assumptions of no aliases."
20188 @end quotation
20189
20190 GNAT follows this recommendation, and goes further by also applying
20191 this recommendation to the overlaid variable (@code{A} in the above example)
20192 in this case. This means that the overlay works "as expected", in that
20193 a modification to one of the variables will affect the value of the other.
20194
20195 More generally, GNAT interprets this recommendation conservatively for
20196 address clauses: in the cases other than overlays, it considers that the
20197 object is effectively subject to pragma @code{Volatile} and implements the
20198 associated semantics.
20199
20200 Note that when address clause overlays are used in this way, there is an
20201 issue of unintentional initialization, as shown by this example:
20202
20203 @example
20204 package Overwrite_Record is
20205 type R is record
20206 A : Character := 'C';
20207 B : Character := 'A';
20208 end record;
20209 X : Short_Integer := 3;
20210 Y : R;
20211 for Y'Address use X'Address;
20212 |
20213 >>> warning: default initialization of "Y" may
20214 modify "X", use pragma Import for "Y" to
20215 suppress initialization (RM B.1(24))
20216
20217 end Overwrite_Record;
20218 @end example
20219
20220 Here the default initialization of @code{Y} will clobber the value
20221 of @code{X}, which justifies the warning. The warning notes that
20222 this effect can be eliminated by adding a @code{pragma Import}
20223 which suppresses the initialization:
20224
20225 @example
20226 package Overwrite_Record is
20227 type R is record
20228 A : Character := 'C';
20229 B : Character := 'A';
20230 end record;
20231 X : Short_Integer := 3;
20232 Y : R;
20233 for Y'Address use X'Address;
20234 pragma Import (Ada, Y);
20235 end Overwrite_Record;
20236 @end example
20237
20238 Note that the use of @code{pragma Initialize_Scalars} may cause variables to
20239 be initialized when they would not otherwise have been in the absence
20240 of the use of this pragma. This may cause an overlay to have this
20241 unintended clobbering effect. The compiler avoids this for scalar
20242 types, but not for composite objects (where in general the effect
20243 of @code{Initialize_Scalars} is part of the initialization routine
20244 for the composite object:
20245
20246 @example
20247 pragma Initialize_Scalars;
20248 with Ada.Text_IO; use Ada.Text_IO;
20249 procedure Overwrite_Array is
20250 type Arr is array (1 .. 5) of Integer;
20251 X : Arr := (others => 1);
20252 A : Arr;
20253 for A'Address use X'Address;
20254 |
20255 >>> warning: default initialization of "A" may
20256 modify "X", use pragma Import for "A" to
20257 suppress initialization (RM B.1(24))
20258
20259 begin
20260 if X /= Arr'(others => 1) then
20261 Put_Line ("X was clobbered");
20262 else
20263 Put_Line ("X was not clobbered");
20264 end if;
20265 end Overwrite_Array;
20266 @end example
20267
20268 The above program generates the warning as shown, and at execution
20269 time, prints @code{X was clobbered}. If the @code{pragma Import} is
20270 added as suggested:
20271
20272 @example
20273 pragma Initialize_Scalars;
20274 with Ada.Text_IO; use Ada.Text_IO;
20275 procedure Overwrite_Array is
20276 type Arr is array (1 .. 5) of Integer;
20277 X : Arr := (others => 1);
20278 A : Arr;
20279 for A'Address use X'Address;
20280 pragma Import (Ada, A);
20281 begin
20282 if X /= Arr'(others => 1) then
20283 Put_Line ("X was clobbered");
20284 else
20285 Put_Line ("X was not clobbered");
20286 end if;
20287 end Overwrite_Array;
20288 @end example
20289
20290 then the program compiles without the warning and when run will generate
20291 the output @code{X was not clobbered}.
20292
20293 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
20294 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{294}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{295}
20295 @section Use of Address Clauses for Memory-Mapped I/O
20296
20297
20298 @geindex Memory-mapped I/O
20299
20300 A common pattern is to use an address clause to map an atomic variable to
20301 a location in memory that corresponds to a memory-mapped I/O operation or
20302 operations, for example:
20303
20304 @example
20305 type Mem_Word is record
20306 A,B,C,D : Byte;
20307 end record;
20308 pragma Atomic (Mem_Word);
20309 for Mem_Word_Size use 32;
20310
20311 Mem : Mem_Word;
20312 for Mem'Address use some-address;
20313 ...
20314 Temp := Mem;
20315 Temp.A := 32;
20316 Mem := Temp;
20317 @end example
20318
20319 For a full access (reference or modification) of the variable (Mem) in this
20320 case, as in the above examples, GNAT guarantees that the entire atomic word
20321 will be accessed, in accordance with the RM C.6(15) clause.
20322
20323 A problem arises with a component access such as:
20324
20325 @example
20326 Mem.A := 32;
20327 @end example
20328
20329 Note that the component A is not declared as atomic. This means that it is
20330 not clear what this assignment means. It could correspond to full word read
20331 and write as given in the first example, or on architectures that supported
20332 such an operation it might be a single byte store instruction. The RM does
20333 not have anything to say in this situation, and GNAT does not make any
20334 guarantee. The code generated may vary from target to target. GNAT will issue
20335 a warning in such a case:
20336
20337 @example
20338 Mem.A := 32;
20339 |
20340 >>> warning: access to non-atomic component of atomic array,
20341 may cause unexpected accesses to atomic object
20342 @end example
20343
20344 It is best to be explicit in this situation, by either declaring the
20345 components to be atomic if you want the byte store, or explicitly writing
20346 the full word access sequence if that is what the hardware requires.
20347 Alternatively, if the full word access sequence is required, GNAT also
20348 provides the pragma @code{Volatile_Full_Access} which can be used in lieu of
20349 pragma @code{Atomic} and will give the additional guarantee.
20350
20351 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
20352 @anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{296}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{297}
20353 @section Effect of Convention on Representation
20354
20355
20356 @geindex Convention
20357 @geindex effect on representation
20358
20359 Normally the specification of a foreign language convention for a type or
20360 an object has no effect on the chosen representation. In particular, the
20361 representation chosen for data in GNAT generally meets the standard system
20362 conventions, and for example records are laid out in a manner that is
20363 consistent with C. This means that specifying convention C (for example)
20364 has no effect.
20365
20366 There are four exceptions to this general rule:
20367
20368
20369 @itemize *
20370
20371 @item
20372 @emph{Convention Fortran and array subtypes}.
20373
20374 If pragma Convention Fortran is specified for an array subtype, then in
20375 accordance with the implementation advice in section 3.6.2(11) of the
20376 Ada Reference Manual, the array will be stored in a Fortran-compatible
20377 column-major manner, instead of the normal default row-major order.
20378
20379 @item
20380 @emph{Convention C and enumeration types}
20381
20382 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
20383 to accommodate all values of the type. For example, for the enumeration
20384 type declared by:
20385
20386 @example
20387 type Color is (Red, Green, Blue);
20388 @end example
20389
20390 8 bits is sufficient to store all values of the type, so by default, objects
20391 of type @code{Color} will be represented using 8 bits. However, normal C
20392 convention is to use 32 bits for all enum values in C, since enum values
20393 are essentially of type int. If pragma @code{Convention C} is specified for an
20394 Ada enumeration type, then the size is modified as necessary (usually to
20395 32 bits) to be consistent with the C convention for enum values.
20396
20397 Note that this treatment applies only to types. If Convention C is given for
20398 an enumeration object, where the enumeration type is not Convention C, then
20399 Object_Size bits are allocated. For example, for a normal enumeration type,
20400 with less than 256 elements, only 8 bits will be allocated for the object.
20401 Since this may be a surprise in terms of what C expects, GNAT will issue a
20402 warning in this situation. The warning can be suppressed by giving an explicit
20403 size clause specifying the desired size.
20404
20405 @item
20406 @emph{Convention C/Fortran and Boolean types}
20407
20408 In C, the usual convention for boolean values, that is values used for
20409 conditions, is that zero represents false, and nonzero values represent
20410 true. In Ada, the normal convention is that two specific values, typically
20411 0/1, are used to represent false/true respectively.
20412
20413 Fortran has a similar convention for @code{LOGICAL} values (any nonzero
20414 value represents true).
20415
20416 To accommodate the Fortran and C conventions, if a pragma Convention specifies
20417 C or Fortran convention for a derived Boolean, as in the following example:
20418
20419 @example
20420 type C_Switch is new Boolean;
20421 pragma Convention (C, C_Switch);
20422 @end example
20423
20424 then the GNAT generated code will treat any nonzero value as true. For truth
20425 values generated by GNAT, the conventional value 1 will be used for True, but
20426 when one of these values is read, any nonzero value is treated as True.
20427 @end itemize
20428
20429 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
20430 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{298}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{299}
20431 @section Conventions and Anonymous Access Types
20432
20433
20434 @geindex Anonymous access types
20435
20436 @geindex Convention for anonymous access types
20437
20438 The RM is not entirely clear on convention handling in a number of cases,
20439 and in particular, it is not clear on the convention to be given to
20440 anonymous access types in general, and in particular what is to be
20441 done for the case of anonymous access-to-subprogram.
20442
20443 In GNAT, we decide that if an explicit Convention is applied
20444 to an object or component, and its type is such an anonymous type,
20445 then the convention will apply to this anonymous type as well. This
20446 seems to make sense since it is anomolous in any case to have a
20447 different convention for an object and its type, and there is clearly
20448 no way to explicitly specify a convention for an anonymous type, since
20449 it doesn't have a name to specify!
20450
20451 Furthermore, we decide that if a convention is applied to a record type,
20452 then this convention is inherited by any of its components that are of an
20453 anonymous access type which do not have an explicitly specified convention.
20454
20455 The following program shows these conventions in action:
20456
20457 @example
20458 package ConvComp is
20459 type Foo is range 1 .. 10;
20460 type T1 is record
20461 A : access function (X : Foo) return Integer;
20462 B : Integer;
20463 end record;
20464 pragma Convention (C, T1);
20465
20466 type T2 is record
20467 A : access function (X : Foo) return Integer;
20468 pragma Convention (C, A);
20469 B : Integer;
20470 end record;
20471 pragma Convention (COBOL, T2);
20472
20473 type T3 is record
20474 A : access function (X : Foo) return Integer;
20475 pragma Convention (COBOL, A);
20476 B : Integer;
20477 end record;
20478 pragma Convention (C, T3);
20479
20480 type T4 is record
20481 A : access function (X : Foo) return Integer;
20482 B : Integer;
20483 end record;
20484 pragma Convention (COBOL, T4);
20485
20486 function F (X : Foo) return Integer;
20487 pragma Convention (C, F);
20488
20489 function F (X : Foo) return Integer is (13);
20490
20491 TV1 : T1 := (F'Access, 12); -- OK
20492 TV2 : T2 := (F'Access, 13); -- OK
20493
20494 TV3 : T3 := (F'Access, 13); -- ERROR
20495 |
20496 >>> subprogram "F" has wrong convention
20497 >>> does not match access to subprogram declared at line 17
20498 38. TV4 : T4 := (F'Access, 13); -- ERROR
20499 |
20500 >>> subprogram "F" has wrong convention
20501 >>> does not match access to subprogram declared at line 24
20502 39. end ConvComp;
20503 @end example
20504
20505 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
20506 @anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{29a}@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{29b}
20507 @section Determining the Representations chosen by GNAT
20508
20509
20510 @geindex Representation
20511 @geindex determination of
20512
20513 @geindex -gnatR (gcc)
20514
20515 Although the descriptions in this section are intended to be complete, it is
20516 often easier to simply experiment to see what GNAT accepts and what the
20517 effect is on the layout of types and objects.
20518
20519 As required by the Ada RM, if a representation clause is not accepted, then
20520 it must be rejected as illegal by the compiler. However, when a
20521 representation clause or pragma is accepted, there can still be questions
20522 of what the compiler actually does. For example, if a partial record
20523 representation clause specifies the location of some components and not
20524 others, then where are the non-specified components placed? Or if pragma
20525 @code{Pack} is used on a record, then exactly where are the resulting
20526 fields placed? The section on pragma @code{Pack} in this chapter can be
20527 used to answer the second question, but it is often easier to just see
20528 what the compiler does.
20529
20530 For this purpose, GNAT provides the option @emph{-gnatR}. If you compile
20531 with this option, then the compiler will output information on the actual
20532 representations chosen, in a format similar to source representation
20533 clauses. For example, if we compile the package:
20534
20535 @example
20536 package q is
20537 type r (x : boolean) is tagged record
20538 case x is
20539 when True => S : String (1 .. 100);
20540 when False => null;
20541 end case;
20542 end record;
20543
20544 type r2 is new r (false) with record
20545 y2 : integer;
20546 end record;
20547
20548 for r2 use record
20549 y2 at 16 range 0 .. 31;
20550 end record;
20551
20552 type x is record
20553 y : character;
20554 end record;
20555
20556 type x1 is array (1 .. 10) of x;
20557 for x1'component_size use 11;
20558
20559 type ia is access integer;
20560
20561 type Rb1 is array (1 .. 13) of Boolean;
20562 pragma Pack (rb1);
20563
20564 type Rb2 is array (1 .. 65) of Boolean;
20565 pragma Pack (rb2);
20566
20567 type x2 is record
20568 l1 : Boolean;
20569 l2 : Duration;
20570 l3 : Float;
20571 l4 : Boolean;
20572 l5 : Rb1;
20573 l6 : Rb2;
20574 end record;
20575 pragma Pack (x2);
20576 end q;
20577 @end example
20578
20579 using the switch @emph{-gnatR} we obtain the following output:
20580
20581 @example
20582 Representation information for unit q
20583 -------------------------------------
20584
20585 for r'Size use ??;
20586 for r'Alignment use 4;
20587 for r use record
20588 x at 4 range 0 .. 7;
20589 _tag at 0 range 0 .. 31;
20590 s at 5 range 0 .. 799;
20591 end record;
20592
20593 for r2'Size use 160;
20594 for r2'Alignment use 4;
20595 for r2 use record
20596 x at 4 range 0 .. 7;
20597 _tag at 0 range 0 .. 31;
20598 _parent at 0 range 0 .. 63;
20599 y2 at 16 range 0 .. 31;
20600 end record;
20601
20602 for x'Size use 8;
20603 for x'Alignment use 1;
20604 for x use record
20605 y at 0 range 0 .. 7;
20606 end record;
20607
20608 for x1'Size use 112;
20609 for x1'Alignment use 1;
20610 for x1'Component_Size use 11;
20611
20612 for rb1'Size use 13;
20613 for rb1'Alignment use 2;
20614 for rb1'Component_Size use 1;
20615
20616 for rb2'Size use 72;
20617 for rb2'Alignment use 1;
20618 for rb2'Component_Size use 1;
20619
20620 for x2'Size use 224;
20621 for x2'Alignment use 4;
20622 for x2 use record
20623 l1 at 0 range 0 .. 0;
20624 l2 at 0 range 1 .. 64;
20625 l3 at 12 range 0 .. 31;
20626 l4 at 16 range 0 .. 0;
20627 l5 at 16 range 1 .. 13;
20628 l6 at 18 range 0 .. 71;
20629 end record;
20630 @end example
20631
20632 The Size values are actually the Object_Size, i.e., the default size that
20633 will be allocated for objects of the type.
20634 The @code{??} size for type r indicates that we have a variant record, and the
20635 actual size of objects will depend on the discriminant value.
20636
20637 The Alignment values show the actual alignment chosen by the compiler
20638 for each record or array type.
20639
20640 The record representation clause for type r shows where all fields
20641 are placed, including the compiler generated tag field (whose location
20642 cannot be controlled by the programmer).
20643
20644 The record representation clause for the type extension r2 shows all the
20645 fields present, including the parent field, which is a copy of the fields
20646 of the parent type of r2, i.e., r1.
20647
20648 The component size and size clauses for types rb1 and rb2 show
20649 the exact effect of pragma @code{Pack} on these arrays, and the record
20650 representation clause for type x2 shows how pragma @cite{Pack} affects
20651 this record type.
20652
20653 In some cases, it may be useful to cut and paste the representation clauses
20654 generated by the compiler into the original source to fix and guarantee
20655 the actual representation to be used.
20656
20657 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
20658 @anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}@anchor{gnat_rm/standard_library_routines doc}@anchor{29c}@anchor{gnat_rm/standard_library_routines id1}@anchor{29d}
20659 @chapter Standard Library Routines
20660
20661
20662 The Ada Reference Manual contains in Annex A a full description of an
20663 extensive set of standard library routines that can be used in any Ada
20664 program, and which must be provided by all Ada compilers. They are
20665 analogous to the standard C library used by C programs.
20666
20667 GNAT implements all of the facilities described in annex A, and for most
20668 purposes the description in the Ada Reference Manual, or appropriate Ada
20669 text book, will be sufficient for making use of these facilities.
20670
20671 In the case of the input-output facilities,
20672 @ref{f,,The Implementation of Standard I/O},
20673 gives details on exactly how GNAT interfaces to the
20674 file system. For the remaining packages, the Ada Reference Manual
20675 should be sufficient. The following is a list of the packages included,
20676 together with a brief description of the functionality that is provided.
20677
20678 For completeness, references are included to other predefined library
20679 routines defined in other sections of the Ada Reference Manual (these are
20680 cross-indexed from Annex A). For further details see the relevant
20681 package declarations in the run-time library. In particular, a few units
20682 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
20683 and in this case the package declaration contains comments explaining why
20684 the unit is not implemented.
20685
20686
20687 @table @asis
20688
20689 @item @code{Ada} @emph{(A.2)}
20690
20691 This is a parent package for all the standard library packages. It is
20692 usually included implicitly in your program, and itself contains no
20693 useful data or routines.
20694
20695 @item @code{Ada.Assertions} @emph{(11.4.2)}
20696
20697 @code{Assertions} provides the @code{Assert} subprograms, and also
20698 the declaration of the @code{Assertion_Error} exception.
20699
20700 @item @code{Ada.Asynchronous_Task_Control} @emph{(D.11)}
20701
20702 @code{Asynchronous_Task_Control} provides low level facilities for task
20703 synchronization. It is typically not implemented. See package spec for details.
20704
20705 @item @code{Ada.Calendar} @emph{(9.6)}
20706
20707 @code{Calendar} provides time of day access, and routines for
20708 manipulating times and durations.
20709
20710 @item @code{Ada.Calendar.Arithmetic} @emph{(9.6.1)}
20711
20712 This package provides additional arithmetic
20713 operations for @code{Calendar}.
20714
20715 @item @code{Ada.Calendar.Formatting} @emph{(9.6.1)}
20716
20717 This package provides formatting operations for @code{Calendar}.
20718
20719 @item @code{Ada.Calendar.Time_Zones} @emph{(9.6.1)}
20720
20721 This package provides additional @code{Calendar} facilities
20722 for handling time zones.
20723
20724 @item @code{Ada.Characters} @emph{(A.3.1)}
20725
20726 This is a dummy parent package that contains no useful entities
20727
20728 @item @code{Ada.Characters.Conversions} @emph{(A.3.2)}
20729
20730 This package provides character conversion functions.
20731
20732 @item @code{Ada.Characters.Handling} @emph{(A.3.2)}
20733
20734 This package provides some basic character handling capabilities,
20735 including classification functions for classes of characters (e.g., test
20736 for letters, or digits).
20737
20738 @item @code{Ada.Characters.Latin_1} @emph{(A.3.3)}
20739
20740 This package includes a complete set of definitions of the characters
20741 that appear in type CHARACTER. It is useful for writing programs that
20742 will run in international environments. For example, if you want an
20743 upper case E with an acute accent in a string, it is often better to use
20744 the definition of @code{UC_E_Acute} in this package. Then your program
20745 will print in an understandable manner even if your environment does not
20746 support these extended characters.
20747
20748 @item @code{Ada.Command_Line} @emph{(A.15)}
20749
20750 This package provides access to the command line parameters and the name
20751 of the current program (analogous to the use of @code{argc} and @code{argv}
20752 in C), and also allows the exit status for the program to be set in a
20753 system-independent manner.
20754
20755 @item @code{Ada.Complex_Text_IO} @emph{(G.1.3)}
20756
20757 This package provides text input and output of complex numbers.
20758
20759 @item @code{Ada.Containers} @emph{(A.18.1)}
20760
20761 A top level package providing a few basic definitions used by all the
20762 following specific child packages that provide specific kinds of
20763 containers.
20764 @end table
20765
20766 @code{Ada.Containers.Bounded_Priority_Queues} @emph{(A.18.31)}
20767
20768 @code{Ada.Containers.Bounded_Synchronized_Queues} @emph{(A.18.29)}
20769
20770 @code{Ada.Containers.Doubly_Linked_Lists} @emph{(A.18.3)}
20771
20772 @code{Ada.Containers.Generic_Array_Sort} @emph{(A.18.26)}
20773
20774 @code{Ada.Containers.Generic_Constrained_Array_Sort} @emph{(A.18.26)}
20775
20776 @code{Ada.Containers.Generic_Sort} @emph{(A.18.26)}
20777
20778 @code{Ada.Containers.Hashed_Maps} @emph{(A.18.5)}
20779
20780 @code{Ada.Containers.Hashed_Sets} @emph{(A.18.8)}
20781
20782 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} @emph{(A.18.12)}
20783
20784 @code{Ada.Containers.Indefinite_Hashed_Maps} @emph{(A.18.13)}
20785
20786 @code{Ada.Containers.Indefinite_Hashed_Sets} @emph{(A.18.15)}
20787
20788 @code{Ada.Containers.Indefinite_Holders} @emph{(A.18.18)}
20789
20790 @code{Ada.Containers.Indefinite_Multiway_Trees} @emph{(A.18.17)}
20791
20792 @code{Ada.Containers.Indefinite_Ordered_Maps} @emph{(A.18.14)}
20793
20794 @code{Ada.Containers.Indefinite_Ordered_Sets} @emph{(A.18.16)}
20795
20796 @code{Ada.Containers.Indefinite_Vectors} @emph{(A.18.11)}
20797
20798 @code{Ada.Containers.Multiway_Trees} @emph{(A.18.10)}
20799
20800 @code{Ada.Containers.Ordered_Maps} @emph{(A.18.6)}
20801
20802 @code{Ada.Containers.Ordered_Sets} @emph{(A.18.9)}
20803
20804 @code{Ada.Containers.Synchronized_Queue_Interfaces} @emph{(A.18.27)}
20805
20806 @code{Ada.Containers.Unbounded_Priority_Queues} @emph{(A.18.30)}
20807
20808 @code{Ada.Containers.Unbounded_Synchronized_Queues} @emph{(A.18.28)}
20809
20810 @code{Ada.Containers.Vectors} @emph{(A.18.2)}
20811
20812
20813 @table @asis
20814
20815 @item @code{Ada.Directories} @emph{(A.16)}
20816
20817 This package provides operations on directories.
20818
20819 @item @code{Ada.Directories.Hierarchical_File_Names} @emph{(A.16.1)}
20820
20821 This package provides additional directory operations handling
20822 hiearchical file names.
20823
20824 @item @code{Ada.Directories.Information} @emph{(A.16)}
20825
20826 This is an implementation defined package for additional directory
20827 operations, which is not implemented in GNAT.
20828
20829 @item @code{Ada.Decimal} @emph{(F.2)}
20830
20831 This package provides constants describing the range of decimal numbers
20832 implemented, and also a decimal divide routine (analogous to the COBOL
20833 verb DIVIDE ... GIVING ... REMAINDER ...)
20834
20835 @item @code{Ada.Direct_IO} @emph{(A.8.4)}
20836
20837 This package provides input-output using a model of a set of records of
20838 fixed-length, containing an arbitrary definite Ada type, indexed by an
20839 integer record number.
20840
20841 @item @code{Ada.Dispatching} @emph{(D.2.1)}
20842
20843 A parent package containing definitions for task dispatching operations.
20844
20845 @item @code{Ada.Dispatching.EDF} @emph{(D.2.6)}
20846
20847 Not implemented in GNAT.
20848
20849 @item @code{Ada.Dispatching.Non_Preemptive} @emph{(D.2.4)}
20850
20851 Not implemented in GNAT.
20852
20853 @item @code{Ada.Dispatching.Round_Robin} @emph{(D.2.5)}
20854
20855 Not implemented in GNAT.
20856
20857 @item @code{Ada.Dynamic_Priorities} @emph{(D.5)}
20858
20859 This package allows the priorities of a task to be adjusted dynamically
20860 as the task is running.
20861
20862 @item @code{Ada.Environment_Variables} @emph{(A.17)}
20863
20864 This package provides facilities for accessing environment variables.
20865
20866 @item @code{Ada.Exceptions} @emph{(11.4.1)}
20867
20868 This package provides additional information on exceptions, and also
20869 contains facilities for treating exceptions as data objects, and raising
20870 exceptions with associated messages.
20871
20872 @item @code{Ada.Execution_Time} @emph{(D.14)}
20873
20874 This package provides CPU clock functionalities. It is not implemented on
20875 all targets (see package spec for details).
20876
20877 @item @code{Ada.Execution_Time.Group_Budgets} @emph{(D.14.2)}
20878
20879 Not implemented in GNAT.
20880
20881 @item @code{Ada.Execution_Time.Timers} @emph{(D.14.1)'}
20882
20883 Not implemented in GNAT.
20884
20885 @item @code{Ada.Finalization} @emph{(7.6)}
20886
20887 This package contains the declarations and subprograms to support the
20888 use of controlled types, providing for automatic initialization and
20889 finalization (analogous to the constructors and destructors of C++).
20890
20891 @item @code{Ada.Float_Text_IO} @emph{(A.10.9)}
20892
20893 A library level instantiation of Text_IO.Float_IO for type Float.
20894
20895 @item @code{Ada.Float_Wide_Text_IO} @emph{(A.10.9)}
20896
20897 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
20898
20899 @item @code{Ada.Float_Wide_Wide_Text_IO} @emph{(A.10.9)}
20900
20901 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
20902
20903 @item @code{Ada.Integer_Text_IO} @emph{(A.10.9)}
20904
20905 A library level instantiation of Text_IO.Integer_IO for type Integer.
20906
20907 @item @code{Ada.Integer_Wide_Text_IO} @emph{(A.10.9)}
20908
20909 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
20910
20911 @item @code{Ada.Integer_Wide_Wide_Text_IO} @emph{(A.10.9)}
20912
20913 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
20914
20915 @item @code{Ada.Interrupts} @emph{(C.3.2)}
20916
20917 This package provides facilities for interfacing to interrupts, which
20918 includes the set of signals or conditions that can be raised and
20919 recognized as interrupts.
20920
20921 @item @code{Ada.Interrupts.Names} @emph{(C.3.2)}
20922
20923 This package provides the set of interrupt names (actually signal
20924 or condition names) that can be handled by GNAT.
20925
20926 @item @code{Ada.IO_Exceptions} @emph{(A.13)}
20927
20928 This package defines the set of exceptions that can be raised by use of
20929 the standard IO packages.
20930
20931 @item @code{Ada.Iterator_Interfaces} @emph{(5.5.1)}
20932
20933 This package provides a generic interface to generalized iterators.
20934
20935 @item @code{Ada.Locales} @emph{(A.19)}
20936
20937 This package provides declarations providing information (Language
20938 and Country) about the current locale.
20939
20940 @item @code{Ada.Numerics}
20941
20942 This package contains some standard constants and exceptions used
20943 throughout the numerics packages. Note that the constants pi and e are
20944 defined here, and it is better to use these definitions than rolling
20945 your own.
20946
20947 @item @code{Ada.Numerics.Complex_Arrays} @emph{(G.3.2)}
20948
20949 Provides operations on arrays of complex numbers.
20950
20951 @item @code{Ada.Numerics.Complex_Elementary_Functions}
20952
20953 Provides the implementation of standard elementary functions (such as
20954 log and trigonometric functions) operating on complex numbers using the
20955 standard @code{Float} and the @code{Complex} and @code{Imaginary} types
20956 created by the package @code{Numerics.Complex_Types}.
20957
20958 @item @code{Ada.Numerics.Complex_Types}
20959
20960 This is a predefined instantiation of
20961 @code{Numerics.Generic_Complex_Types} using @code{Standard.Float} to
20962 build the type @code{Complex} and @code{Imaginary}.
20963
20964 @item @code{Ada.Numerics.Discrete_Random}
20965
20966 This generic package provides a random number generator suitable for generating
20967 uniformly distributed values of a specified discrete subtype.
20968
20969 @item @code{Ada.Numerics.Float_Random}
20970
20971 This package provides a random number generator suitable for generating
20972 uniformly distributed floating point values in the unit interval.
20973
20974 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
20975
20976 This is a generic version of the package that provides the
20977 implementation of standard elementary functions (such as log and
20978 trigonometric functions) for an arbitrary complex type.
20979
20980 The following predefined instantiations of this package are provided:
20981
20982
20983 @itemize *
20984
20985 @item
20986 @code{Short_Float}
20987
20988 @code{Ada.Numerics.Short_Complex_Elementary_Functions}
20989
20990 @item
20991 @code{Float}
20992
20993 @code{Ada.Numerics.Complex_Elementary_Functions}
20994
20995 @item
20996 @code{Long_Float}
20997
20998 @code{Ada.Numerics.Long_Complex_Elementary_Functions}
20999 @end itemize
21000
21001 @item @code{Ada.Numerics.Generic_Complex_Types}
21002
21003 This is a generic package that allows the creation of complex types,
21004 with associated complex arithmetic operations.
21005
21006 The following predefined instantiations of this package exist
21007
21008
21009 @itemize *
21010
21011 @item
21012 @code{Short_Float}
21013
21014 @code{Ada.Numerics.Short_Complex_Complex_Types}
21015
21016 @item
21017 @code{Float}
21018
21019 @code{Ada.Numerics.Complex_Complex_Types}
21020
21021 @item
21022 @code{Long_Float}
21023
21024 @code{Ada.Numerics.Long_Complex_Complex_Types}
21025 @end itemize
21026
21027 @item @code{Ada.Numerics.Generic_Elementary_Functions}
21028
21029 This is a generic package that provides the implementation of standard
21030 elementary functions (such as log an trigonometric functions) for an
21031 arbitrary float type.
21032
21033 The following predefined instantiations of this package exist
21034
21035
21036 @itemize *
21037
21038 @item
21039 @code{Short_Float}
21040
21041 @code{Ada.Numerics.Short_Elementary_Functions}
21042
21043 @item
21044 @code{Float}
21045
21046 @code{Ada.Numerics.Elementary_Functions}
21047
21048 @item
21049 @code{Long_Float}
21050
21051 @code{Ada.Numerics.Long_Elementary_Functions}
21052 @end itemize
21053
21054 @item @code{Ada.Numerics.Generic_Real_Arrays} @emph{(G.3.1)}
21055
21056 Generic operations on arrays of reals
21057
21058 @item @code{Ada.Numerics.Real_Arrays} @emph{(G.3.1)}
21059
21060 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
21061
21062 @item @code{Ada.Real_Time} @emph{(D.8)}
21063
21064 This package provides facilities similar to those of @code{Calendar}, but
21065 operating with a finer clock suitable for real time control. Note that
21066 annex D requires that there be no backward clock jumps, and GNAT generally
21067 guarantees this behavior, but of course if the external clock on which
21068 the GNAT runtime depends is deliberately reset by some external event,
21069 then such a backward jump may occur.
21070
21071 @item @code{Ada.Real_Time.Timing_Events} @emph{(D.15)}
21072
21073 Not implemented in GNAT.
21074
21075 @item @code{Ada.Sequential_IO} @emph{(A.8.1)}
21076
21077 This package provides input-output facilities for sequential files,
21078 which can contain a sequence of values of a single type, which can be
21079 any Ada type, including indefinite (unconstrained) types.
21080
21081 @item @code{Ada.Storage_IO} @emph{(A.9)}
21082
21083 This package provides a facility for mapping arbitrary Ada types to and
21084 from a storage buffer. It is primarily intended for the creation of new
21085 IO packages.
21086
21087 @item @code{Ada.Streams} @emph{(13.13.1)}
21088
21089 This is a generic package that provides the basic support for the
21090 concept of streams as used by the stream attributes (@code{Input},
21091 @code{Output}, @code{Read} and @code{Write}).
21092
21093 @item @code{Ada.Streams.Stream_IO} @emph{(A.12.1)}
21094
21095 This package is a specialization of the type @code{Streams} defined in
21096 package @code{Streams} together with a set of operations providing
21097 Stream_IO capability. The Stream_IO model permits both random and
21098 sequential access to a file which can contain an arbitrary set of values
21099 of one or more Ada types.
21100
21101 @item @code{Ada.Strings} @emph{(A.4.1)}
21102
21103 This package provides some basic constants used by the string handling
21104 packages.
21105
21106 @item @code{Ada.Strings.Bounded} @emph{(A.4.4)}
21107
21108 This package provides facilities for handling variable length
21109 strings. The bounded model requires a maximum length. It is thus
21110 somewhat more limited than the unbounded model, but avoids the use of
21111 dynamic allocation or finalization.
21112
21113 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} @emph{(A.4.10)}
21114
21115 Provides case-insensitive comparisons of bounded strings
21116
21117 @item @code{Ada.Strings.Bounded.Hash} @emph{(A.4.9)}
21118
21119 This package provides a generic hash function for bounded strings
21120
21121 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} @emph{(A.4.9)}
21122
21123 This package provides a generic hash function for bounded strings that
21124 converts the string to be hashed to lower case.
21125
21126 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} @emph{(A.4.10)}
21127
21128 This package provides a comparison function for bounded strings that works
21129 in a case insensitive manner by converting to lower case before the comparison.
21130
21131 @item @code{Ada.Strings.Fixed} @emph{(A.4.3)}
21132
21133 This package provides facilities for handling fixed length strings.
21134
21135 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} @emph{(A.4.10)}
21136
21137 This package provides an equality function for fixed strings that compares
21138 the strings after converting both to lower case.
21139
21140 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} @emph{(A.4.9)}
21141
21142 This package provides a case insensitive hash function for fixed strings that
21143 converts the string to lower case before computing the hash.
21144
21145 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} @emph{(A.4.10)}
21146
21147 This package provides a comparison function for fixed strings that works
21148 in a case insensitive manner by converting to lower case before the comparison.
21149
21150 @item @code{Ada.Strings.Hash} @emph{(A.4.9)}
21151
21152 This package provides a hash function for strings.
21153
21154 @item @code{Ada.Strings.Hash_Case_Insensitive} @emph{(A.4.9)}
21155
21156 This package provides a hash function for strings that is case insensitive.
21157 The string is converted to lower case before computing the hash.
21158
21159 @item @code{Ada.Strings.Less_Case_Insensitive} @emph{(A.4.10)}
21160
21161 This package provides a comparison function for\strings that works
21162 in a case insensitive manner by converting to lower case before the comparison.
21163
21164 @item @code{Ada.Strings.Maps} @emph{(A.4.2)}
21165
21166 This package provides facilities for handling character mappings and
21167 arbitrarily defined subsets of characters. For instance it is useful in
21168 defining specialized translation tables.
21169
21170 @item @code{Ada.Strings.Maps.Constants} @emph{(A.4.6)}
21171
21172 This package provides a standard set of predefined mappings and
21173 predefined character sets. For example, the standard upper to lower case
21174 conversion table is found in this package. Note that upper to lower case
21175 conversion is non-trivial if you want to take the entire set of
21176 characters, including extended characters like E with an acute accent,
21177 into account. You should use the mappings in this package (rather than
21178 adding 32 yourself) to do case mappings.
21179
21180 @item @code{Ada.Strings.Unbounded} @emph{(A.4.5)}
21181
21182 This package provides facilities for handling variable length
21183 strings. The unbounded model allows arbitrary length strings, but
21184 requires the use of dynamic allocation and finalization.
21185
21186 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} @emph{(A.4.10)}
21187
21188 Provides case-insensitive comparisons of unbounded strings
21189
21190 @item @code{Ada.Strings.Unbounded.Hash} @emph{(A.4.9)}
21191
21192 This package provides a generic hash function for unbounded strings
21193
21194 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} @emph{(A.4.9)}
21195
21196 This package provides a generic hash function for unbounded strings that
21197 converts the string to be hashed to lower case.
21198
21199 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} @emph{(A.4.10)}
21200
21201 This package provides a comparison function for unbounded strings that works
21202 in a case insensitive manner by converting to lower case before the comparison.
21203
21204 @item @code{Ada.Strings.UTF_Encoding} @emph{(A.4.11)}
21205
21206 This package provides basic definitions for dealing with UTF-encoded strings.
21207
21208 @item @code{Ada.Strings.UTF_Encoding.Conversions} @emph{(A.4.11)}
21209
21210 This package provides conversion functions for UTF-encoded strings.
21211 @end table
21212
21213 @code{Ada.Strings.UTF_Encoding.Strings} @emph{(A.4.11)}
21214
21215 @code{Ada.Strings.UTF_Encoding.Wide_Strings} @emph{(A.4.11)}
21216
21217
21218 @table @asis
21219
21220 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} @emph{(A.4.11)}
21221
21222 These packages provide facilities for handling UTF encodings for
21223 Strings, Wide_Strings and Wide_Wide_Strings.
21224 @end table
21225
21226 @code{Ada.Strings.Wide_Bounded} @emph{(A.4.7)}
21227
21228 @code{Ada.Strings.Wide_Fixed} @emph{(A.4.7)}
21229
21230 @code{Ada.Strings.Wide_Maps} @emph{(A.4.7)}
21231
21232
21233 @table @asis
21234
21235 @item @code{Ada.Strings.Wide_Unbounded} @emph{(A.4.7)}
21236
21237 These packages provide analogous capabilities to the corresponding
21238 packages without @code{Wide_} in the name, but operate with the types
21239 @code{Wide_String} and @code{Wide_Character} instead of @code{String}
21240 and @code{Character}. Versions of all the child packages are available.
21241 @end table
21242
21243 @code{Ada.Strings.Wide_Wide_Bounded} @emph{(A.4.7)}
21244
21245 @code{Ada.Strings.Wide_Wide_Fixed} @emph{(A.4.7)}
21246
21247 @code{Ada.Strings.Wide_Wide_Maps} @emph{(A.4.7)}
21248
21249
21250 @table @asis
21251
21252 @item @code{Ada.Strings.Wide_Wide_Unbounded} @emph{(A.4.7)}
21253
21254 These packages provide analogous capabilities to the corresponding
21255 packages without @code{Wide_} in the name, but operate with the types
21256 @code{Wide_Wide_String} and @code{Wide_Wide_Character} instead
21257 of @code{String} and @code{Character}.
21258
21259 @item @code{Ada.Synchronous_Barriers} @emph{(D.10.1)}
21260
21261 This package provides facilities for synchronizing tasks at a low level
21262 with barriers.
21263
21264 @item @code{Ada.Synchronous_Task_Control} @emph{(D.10)}
21265
21266 This package provides some standard facilities for controlling task
21267 communication in a synchronous manner.
21268
21269 @item @code{Ada.Synchronous_Task_Control.EDF} @emph{(D.10)}
21270
21271 Not implemented in GNAT.
21272
21273 @item @code{Ada.Tags}
21274
21275 This package contains definitions for manipulation of the tags of tagged
21276 values.
21277
21278 @item @code{Ada.Tags.Generic_Dispatching_Constructor} @emph{(3.9)}
21279
21280 This package provides a way of constructing tagged class-wide values given
21281 only the tag value.
21282
21283 @item @code{Ada.Task_Attributes} @emph{(C.7.2)}
21284
21285 This package provides the capability of associating arbitrary
21286 task-specific data with separate tasks.
21287
21288 @item @code{Ada.Task_Identifification} @emph{(C.7.1)}
21289
21290 This package provides capabilities for task identification.
21291
21292 @item @code{Ada.Task_Termination} @emph{(C.7.3)}
21293
21294 This package provides control over task termination.
21295
21296 @item @code{Ada.Text_IO}
21297
21298 This package provides basic text input-output capabilities for
21299 character, string and numeric data. The subpackages of this
21300 package are listed next. Note that although these are defined
21301 as subpackages in the RM, they are actually transparently
21302 implemented as child packages in GNAT, meaning that they
21303 are only loaded if needed.
21304
21305 @item @code{Ada.Text_IO.Decimal_IO}
21306
21307 Provides input-output facilities for decimal fixed-point types
21308
21309 @item @code{Ada.Text_IO.Enumeration_IO}
21310
21311 Provides input-output facilities for enumeration types.
21312
21313 @item @code{Ada.Text_IO.Fixed_IO}
21314
21315 Provides input-output facilities for ordinary fixed-point types.
21316
21317 @item @code{Ada.Text_IO.Float_IO}
21318
21319 Provides input-output facilities for float types. The following
21320 predefined instantiations of this generic package are available:
21321
21322
21323 @itemize *
21324
21325 @item
21326 @code{Short_Float}
21327
21328 @code{Short_Float_Text_IO}
21329
21330 @item
21331 @code{Float}
21332
21333 @code{Float_Text_IO}
21334
21335 @item
21336 @code{Long_Float}
21337
21338 @code{Long_Float_Text_IO}
21339 @end itemize
21340
21341 @item @code{Ada.Text_IO.Integer_IO}
21342
21343 Provides input-output facilities for integer types. The following
21344 predefined instantiations of this generic package are available:
21345
21346
21347 @itemize *
21348
21349 @item
21350 @code{Short_Short_Integer}
21351
21352 @code{Ada.Short_Short_Integer_Text_IO}
21353
21354 @item
21355 @code{Short_Integer}
21356
21357 @code{Ada.Short_Integer_Text_IO}
21358
21359 @item
21360 @code{Integer}
21361
21362 @code{Ada.Integer_Text_IO}
21363
21364 @item
21365 @code{Long_Integer}
21366
21367 @code{Ada.Long_Integer_Text_IO}
21368
21369 @item
21370 @code{Long_Long_Integer}
21371
21372 @code{Ada.Long_Long_Integer_Text_IO}
21373 @end itemize
21374
21375 @item @code{Ada.Text_IO.Modular_IO}
21376
21377 Provides input-output facilities for modular (unsigned) types.
21378
21379 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
21380
21381 Provides input-output facilities for bounded strings.
21382
21383 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
21384
21385 This package provides basic text input-output capabilities for complex
21386 data.
21387
21388 @item @code{Ada.Text_IO.Editing (F.3.3)}
21389
21390 This package contains routines for edited output, analogous to the use
21391 of pictures in COBOL. The picture formats used by this package are a
21392 close copy of the facility in COBOL.
21393
21394 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
21395
21396 This package provides a facility that allows Text_IO files to be treated
21397 as streams, so that the stream attributes can be used for writing
21398 arbitrary data, including binary data, to Text_IO files.
21399
21400 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
21401
21402 This package provides input-output facilities for unbounded strings.
21403
21404 @item @code{Ada.Unchecked_Conversion (13.9)}
21405
21406 This generic package allows arbitrary conversion from one type to
21407 another of the same size, providing for breaking the type safety in
21408 special circumstances.
21409
21410 If the types have the same Size (more accurately the same Value_Size),
21411 then the effect is simply to transfer the bits from the source to the
21412 target type without any modification. This usage is well defined, and
21413 for simple types whose representation is typically the same across
21414 all implementations, gives a portable method of performing such
21415 conversions.
21416
21417 If the types do not have the same size, then the result is implementation
21418 defined, and thus may be non-portable. The following describes how GNAT
21419 handles such unchecked conversion cases.
21420
21421 If the types are of different sizes, and are both discrete types, then
21422 the effect is of a normal type conversion without any constraint checking.
21423 In particular if the result type has a larger size, the result will be
21424 zero or sign extended. If the result type has a smaller size, the result
21425 will be truncated by ignoring high order bits.
21426
21427 If the types are of different sizes, and are not both discrete types,
21428 then the conversion works as though pointers were created to the source
21429 and target, and the pointer value is converted. The effect is that bits
21430 are copied from successive low order storage units and bits of the source
21431 up to the length of the target type.
21432
21433 A warning is issued if the lengths differ, since the effect in this
21434 case is implementation dependent, and the above behavior may not match
21435 that of some other compiler.
21436
21437 A pointer to one type may be converted to a pointer to another type using
21438 unchecked conversion. The only case in which the effect is undefined is
21439 when one or both pointers are pointers to unconstrained array types. In
21440 this case, the bounds information may get incorrectly transferred, and in
21441 particular, GNAT uses double size pointers for such types, and it is
21442 meaningless to convert between such pointer types. GNAT will issue a
21443 warning if the alignment of the target designated type is more strict
21444 than the alignment of the source designated type (since the result may
21445 be unaligned in this case).
21446
21447 A pointer other than a pointer to an unconstrained array type may be
21448 converted to and from System.Address. Such usage is common in Ada 83
21449 programs, but note that Ada.Address_To_Access_Conversions is the
21450 preferred method of performing such conversions in Ada 95 and Ada 2005.
21451 Neither
21452 unchecked conversion nor Ada.Address_To_Access_Conversions should be
21453 used in conjunction with pointers to unconstrained objects, since
21454 the bounds information cannot be handled correctly in this case.
21455
21456 @item @code{Ada.Unchecked_Deallocation} @emph{(13.11.2)}
21457
21458 This generic package allows explicit freeing of storage previously
21459 allocated by use of an allocator.
21460
21461 @item @code{Ada.Wide_Text_IO} @emph{(A.11)}
21462
21463 This package is similar to @code{Ada.Text_IO}, except that the external
21464 file supports wide character representations, and the internal types are
21465 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21466 and @code{String}. The corresponding set of nested packages and child
21467 packages are defined.
21468
21469 @item @code{Ada.Wide_Wide_Text_IO} @emph{(A.11)}
21470
21471 This package is similar to @code{Ada.Text_IO}, except that the external
21472 file supports wide character representations, and the internal types are
21473 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21474 and @code{String}. The corresponding set of nested packages and child
21475 packages are defined.
21476 @end table
21477
21478 For packages in Interfaces and System, all the RM defined packages are
21479 available in GNAT, see the Ada 2012 RM for full details.
21480
21481 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
21482 @anchor{gnat_rm/the_implementation_of_standard_i_o the-implementation-of-standard-i-o}@anchor{f}@anchor{gnat_rm/the_implementation_of_standard_i_o doc}@anchor{29e}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{29f}
21483 @chapter The Implementation of Standard I/O
21484
21485
21486 GNAT implements all the required input-output facilities described in
21487 A.6 through A.14. These sections of the Ada Reference Manual describe the
21488 required behavior of these packages from the Ada point of view, and if
21489 you are writing a portable Ada program that does not need to know the
21490 exact manner in which Ada maps to the outside world when it comes to
21491 reading or writing external files, then you do not need to read this
21492 chapter. As long as your files are all regular files (not pipes or
21493 devices), and as long as you write and read the files only from Ada, the
21494 description in the Ada Reference Manual is sufficient.
21495
21496 However, if you want to do input-output to pipes or other devices, such
21497 as the keyboard or screen, or if the files you are dealing with are
21498 either generated by some other language, or to be read by some other
21499 language, then you need to know more about the details of how the GNAT
21500 implementation of these input-output facilities behaves.
21501
21502 In this chapter we give a detailed description of exactly how GNAT
21503 interfaces to the file system. As always, the sources of the system are
21504 available to you for answering questions at an even more detailed level,
21505 but for most purposes the information in this chapter will suffice.
21506
21507 Another reason that you may need to know more about how input-output is
21508 implemented arises when you have a program written in mixed languages
21509 where, for example, files are shared between the C and Ada sections of
21510 the same program. GNAT provides some additional facilities, in the form
21511 of additional child library packages, that facilitate this sharing, and
21512 these additional facilities are also described in this chapter.
21513
21514 @menu
21515 * Standard I/O Packages::
21516 * FORM Strings::
21517 * Direct_IO::
21518 * Sequential_IO::
21519 * Text_IO::
21520 * Wide_Text_IO::
21521 * Wide_Wide_Text_IO::
21522 * Stream_IO::
21523 * Text Translation::
21524 * Shared Files::
21525 * Filenames encoding::
21526 * File content encoding::
21527 * Open Modes::
21528 * Operations on C Streams::
21529 * Interfacing to C Streams::
21530
21531 @end menu
21532
21533 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
21534 @anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{2a0}@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{2a1}
21535 @section Standard I/O Packages
21536
21537
21538 The Standard I/O packages described in Annex A for
21539
21540
21541 @itemize *
21542
21543 @item
21544 Ada.Text_IO
21545
21546 @item
21547 Ada.Text_IO.Complex_IO
21548
21549 @item
21550 Ada.Text_IO.Text_Streams
21551
21552 @item
21553 Ada.Wide_Text_IO
21554
21555 @item
21556 Ada.Wide_Text_IO.Complex_IO
21557
21558 @item
21559 Ada.Wide_Text_IO.Text_Streams
21560
21561 @item
21562 Ada.Wide_Wide_Text_IO
21563
21564 @item
21565 Ada.Wide_Wide_Text_IO.Complex_IO
21566
21567 @item
21568 Ada.Wide_Wide_Text_IO.Text_Streams
21569
21570 @item
21571 Ada.Stream_IO
21572
21573 @item
21574 Ada.Sequential_IO
21575
21576 @item
21577 Ada.Direct_IO
21578 @end itemize
21579
21580 are implemented using the C
21581 library streams facility; where
21582
21583
21584 @itemize *
21585
21586 @item
21587 All files are opened using @code{fopen}.
21588
21589 @item
21590 All input/output operations use @code{fread}/@cite{fwrite}.
21591 @end itemize
21592
21593 There is no internal buffering of any kind at the Ada library level. The only
21594 buffering is that provided at the system level in the implementation of the
21595 library routines that support streams. This facilitates shared use of these
21596 streams by mixed language programs. Note though that system level buffering is
21597 explicitly enabled at elaboration of the standard I/O packages and that can
21598 have an impact on mixed language programs, in particular those using I/O before
21599 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
21600 the Ada elaboration routine before performing any I/O or when impractical,
21601 flush the common I/O streams and in particular Standard_Output before
21602 elaborating the Ada code.
21603
21604 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
21605 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{2a2}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{2a3}
21606 @section FORM Strings
21607
21608
21609 The format of a FORM string in GNAT is:
21610
21611 @example
21612 "keyword=value,keyword=value,...,keyword=value"
21613 @end example
21614
21615 where letters may be in upper or lower case, and there are no spaces
21616 between values. The order of the entries is not important. Currently
21617 the following keywords defined.
21618
21619 @example
21620 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
21621 SHARED=[YES|NO]
21622 WCEM=[n|h|u|s|e|8|b]
21623 ENCODING=[UTF8|8BITS]
21624 @end example
21625
21626 The use of these parameters is described later in this section. If an
21627 unrecognized keyword appears in a form string, it is silently ignored
21628 and not considered invalid.
21629
21630 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
21631 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{2a4}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{2a5}
21632 @section Direct_IO
21633
21634
21635 Direct_IO can only be instantiated for definite types. This is a
21636 restriction of the Ada language, which means that the records are fixed
21637 length (the length being determined by @code{type'Size}, rounded
21638 up to the next storage unit boundary if necessary).
21639
21640 The records of a Direct_IO file are simply written to the file in index
21641 sequence, with the first record starting at offset zero, and subsequent
21642 records following. There is no control information of any kind. For
21643 example, if 32-bit integers are being written, each record takes
21644 4-bytes, so the record at index @code{K} starts at offset
21645 (@code{K}-1)*4.
21646
21647 There is no limit on the size of Direct_IO files, they are expanded as
21648 necessary to accommodate whatever records are written to the file.
21649
21650 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
21651 @anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{2a6}@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{2a7}
21652 @section Sequential_IO
21653
21654
21655 Sequential_IO may be instantiated with either a definite (constrained)
21656 or indefinite (unconstrained) type.
21657
21658 For the definite type case, the elements written to the file are simply
21659 the memory images of the data values with no control information of any
21660 kind. The resulting file should be read using the same type, no validity
21661 checking is performed on input.
21662
21663 For the indefinite type case, the elements written consist of two
21664 parts. First is the size of the data item, written as the memory image
21665 of a @code{Interfaces.C.size_t} value, followed by the memory image of
21666 the data value. The resulting file can only be read using the same
21667 (unconstrained) type. Normal assignment checks are performed on these
21668 read operations, and if these checks fail, @code{Data_Error} is
21669 raised. In particular, in the array case, the lengths must match, and in
21670 the variant record case, if the variable for a particular read operation
21671 is constrained, the discriminants must match.
21672
21673 Note that it is not possible to use Sequential_IO to write variable
21674 length array items, and then read the data back into different length
21675 arrays. For example, the following will raise @code{Data_Error}:
21676
21677 @example
21678 package IO is new Sequential_IO (String);
21679 F : IO.File_Type;
21680 S : String (1..4);
21681 ...
21682 IO.Create (F)
21683 IO.Write (F, "hello!")
21684 IO.Reset (F, Mode=>In_File);
21685 IO.Read (F, S);
21686 Put_Line (S);
21687 @end example
21688
21689 On some Ada implementations, this will print @code{hell}, but the program is
21690 clearly incorrect, since there is only one element in the file, and that
21691 element is the string @code{hello!}.
21692
21693 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
21694 using Stream_IO, and this is the preferred mechanism. In particular, the
21695 above program fragment rewritten to use Stream_IO will work correctly.
21696
21697 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
21698 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{2a8}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{2a9}
21699 @section Text_IO
21700
21701
21702 Text_IO files consist of a stream of characters containing the following
21703 special control characters:
21704
21705 @example
21706 LF (line feed, 16#0A#) Line Mark
21707 FF (form feed, 16#0C#) Page Mark
21708 @end example
21709
21710 A canonical Text_IO file is defined as one in which the following
21711 conditions are met:
21712
21713
21714 @itemize *
21715
21716 @item
21717 The character @code{LF} is used only as a line mark, i.e., to mark the end
21718 of the line.
21719
21720 @item
21721 The character @code{FF} is used only as a page mark, i.e., to mark the
21722 end of a page and consequently can appear only immediately following a
21723 @code{LF} (line mark) character.
21724
21725 @item
21726 The file ends with either @code{LF} (line mark) or @code{LF}-@cite{FF}
21727 (line mark, page mark). In the former case, the page mark is implicitly
21728 assumed to be present.
21729 @end itemize
21730
21731 A file written using Text_IO will be in canonical form provided that no
21732 explicit @code{LF} or @code{FF} characters are written using @code{Put}
21733 or @code{Put_Line}. There will be no @code{FF} character at the end of
21734 the file unless an explicit @code{New_Page} operation was performed
21735 before closing the file.
21736
21737 A canonical Text_IO file that is a regular file (i.e., not a device or a
21738 pipe) can be read using any of the routines in Text_IO. The
21739 semantics in this case will be exactly as defined in the Ada Reference
21740 Manual, and all the routines in Text_IO are fully implemented.
21741
21742 A text file that does not meet the requirements for a canonical Text_IO
21743 file has one of the following:
21744
21745
21746 @itemize *
21747
21748 @item
21749 The file contains @code{FF} characters not immediately following a
21750 @code{LF} character.
21751
21752 @item
21753 The file contains @code{LF} or @code{FF} characters written by
21754 @code{Put} or @code{Put_Line}, which are not logically considered to be
21755 line marks or page marks.
21756
21757 @item
21758 The file ends in a character other than @code{LF} or @code{FF},
21759 i.e., there is no explicit line mark or page mark at the end of the file.
21760 @end itemize
21761
21762 Text_IO can be used to read such non-standard text files but subprograms
21763 to do with line or page numbers do not have defined meanings. In
21764 particular, a @code{FF} character that does not follow a @code{LF}
21765 character may or may not be treated as a page mark from the point of
21766 view of page and line numbering. Every @code{LF} character is considered
21767 to end a line, and there is an implied @code{LF} character at the end of
21768 the file.
21769
21770 @menu
21771 * Stream Pointer Positioning::
21772 * Reading and Writing Non-Regular Files::
21773 * Get_Immediate::
21774 * Treating Text_IO Files as Streams::
21775 * Text_IO Extensions::
21776 * Text_IO Facilities for Unbounded Strings::
21777
21778 @end menu
21779
21780 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21781 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{2aa}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{2ab}
21782 @subsection Stream Pointer Positioning
21783
21784
21785 @code{Ada.Text_IO} has a definition of current position for a file that
21786 is being read. No internal buffering occurs in Text_IO, and usually the
21787 physical position in the stream used to implement the file corresponds
21788 to this logical position defined by Text_IO. There are two exceptions:
21789
21790
21791 @itemize *
21792
21793 @item
21794 After a call to @code{End_Of_Page} that returns @code{True}, the stream
21795 is positioned past the @code{LF} (line mark) that precedes the page
21796 mark. Text_IO maintains an internal flag so that subsequent read
21797 operations properly handle the logical position which is unchanged by
21798 the @code{End_Of_Page} call.
21799
21800 @item
21801 After a call to @code{End_Of_File} that returns @code{True}, if the
21802 Text_IO file was positioned before the line mark at the end of file
21803 before the call, then the logical position is unchanged, but the stream
21804 is physically positioned right at the end of file (past the line mark,
21805 and past a possible page mark following the line mark. Again Text_IO
21806 maintains internal flags so that subsequent read operations properly
21807 handle the logical position.
21808 @end itemize
21809
21810 These discrepancies have no effect on the observable behavior of
21811 Text_IO, but if a single Ada stream is shared between a C program and
21812 Ada program, or shared (using @code{shared=yes} in the form string)
21813 between two Ada files, then the difference may be observable in some
21814 situations.
21815
21816 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21817 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{2ac}@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{2ad}
21818 @subsection Reading and Writing Non-Regular Files
21819
21820
21821 A non-regular file is a device (such as a keyboard), or a pipe. Text_IO
21822 can be used for reading and writing. Writing is not affected and the
21823 sequence of characters output is identical to the normal file case, but
21824 for reading, the behavior of Text_IO is modified to avoid undesirable
21825 look-ahead as follows:
21826
21827 An input file that is not a regular file is considered to have no page
21828 marks. Any @code{Ascii.FF} characters (the character normally used for a
21829 page mark) appearing in the file are considered to be data
21830 characters. In particular:
21831
21832
21833 @itemize *
21834
21835 @item
21836 @code{Get_Line} and @code{Skip_Line} do not test for a page mark
21837 following a line mark. If a page mark appears, it will be treated as a
21838 data character.
21839
21840 @item
21841 This avoids the need to wait for an extra character to be typed or
21842 entered from the pipe to complete one of these operations.
21843
21844 @item
21845 @code{End_Of_Page} always returns @code{False}
21846
21847 @item
21848 @code{End_Of_File} will return @code{False} if there is a page mark at
21849 the end of the file.
21850 @end itemize
21851
21852 Output to non-regular files is the same as for regular files. Page marks
21853 may be written to non-regular files using @code{New_Page}, but as noted
21854 above they will not be treated as page marks on input if the output is
21855 piped to another Ada program.
21856
21857 Another important discrepancy when reading non-regular files is that the end
21858 of file indication is not 'sticky'. If an end of file is entered, e.g., by
21859 pressing the @code{EOT} key,
21860 then end of file
21861 is signaled once (i.e., the test @code{End_Of_File}
21862 will yield @code{True}, or a read will
21863 raise @code{End_Error}), but then reading can resume
21864 to read data past that end of
21865 file indication, until another end of file indication is entered.
21866
21867 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
21868 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{2ae}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2af}
21869 @subsection Get_Immediate
21870
21871
21872 @geindex Get_Immediate
21873
21874 Get_Immediate returns the next character (including control characters)
21875 from the input file. In particular, Get_Immediate will return LF or FF
21876 characters used as line marks or page marks. Such operations leave the
21877 file positioned past the control character, and it is thus not treated
21878 as having its normal function. This means that page, line and column
21879 counts after this kind of Get_Immediate call are set as though the mark
21880 did not occur. In the case where a Get_Immediate leaves the file
21881 positioned between the line mark and page mark (which is not normally
21882 possible), it is undefined whether the FF character will be treated as a
21883 page mark.
21884
21885 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
21886 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2b0}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2b1}
21887 @subsection Treating Text_IO Files as Streams
21888
21889
21890 @geindex Stream files
21891
21892 The package @code{Text_IO.Streams} allows a @code{Text_IO} file to be treated
21893 as a stream. Data written to a @code{Text_IO} file in this stream mode is
21894 binary data. If this binary data contains bytes 16#0A# (@code{LF}) or
21895 16#0C# (@code{FF}), the resulting file may have non-standard
21896 format. Similarly if read operations are used to read from a Text_IO
21897 file treated as a stream, then @code{LF} and @code{FF} characters may be
21898 skipped and the effect is similar to that described above for
21899 @code{Get_Immediate}.
21900
21901 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
21902 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2b2}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2b3}
21903 @subsection Text_IO Extensions
21904
21905
21906 @geindex Text_IO extensions
21907
21908 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
21909 to the standard @code{Text_IO} package:
21910
21911
21912 @itemize *
21913
21914 @item
21915 function File_Exists (Name : String) return Boolean;
21916 Determines if a file of the given name exists.
21917
21918 @item
21919 function Get_Line return String;
21920 Reads a string from the standard input file. The value returned is exactly
21921 the length of the line that was read.
21922
21923 @item
21924 function Get_Line (File : Ada.Text_IO.File_Type) return String;
21925 Similar, except that the parameter File specifies the file from which
21926 the string is to be read.
21927 @end itemize
21928
21929 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
21930 @anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2b4}@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2b5}
21931 @subsection Text_IO Facilities for Unbounded Strings
21932
21933
21934 @geindex Text_IO for unbounded strings
21935
21936 @geindex Unbounded_String
21937 @geindex Text_IO operations
21938
21939 The package @code{Ada.Strings.Unbounded.Text_IO}
21940 in library files @code{a-suteio.ads/adb} contains some GNAT-specific
21941 subprograms useful for Text_IO operations on unbounded strings:
21942
21943
21944 @itemize *
21945
21946 @item
21947 function Get_Line (File : File_Type) return Unbounded_String;
21948 Reads a line from the specified file
21949 and returns the result as an unbounded string.
21950
21951 @item
21952 procedure Put (File : File_Type; U : Unbounded_String);
21953 Writes the value of the given unbounded string to the specified file
21954 Similar to the effect of
21955 @code{Put (To_String (U))} except that an extra copy is avoided.
21956
21957 @item
21958 procedure Put_Line (File : File_Type; U : Unbounded_String);
21959 Writes the value of the given unbounded string to the specified file,
21960 followed by a @code{New_Line}.
21961 Similar to the effect of @code{Put_Line (To_String (U))} except
21962 that an extra copy is avoided.
21963 @end itemize
21964
21965 In the above procedures, @code{File} is of type @code{Ada.Text_IO.File_Type}
21966 and is optional. If the parameter is omitted, then the standard input or
21967 output file is referenced as appropriate.
21968
21969 The package @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
21970 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
21971 @code{Wide_Text_IO} functionality for unbounded wide strings.
21972
21973 The package @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
21974 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
21975 @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
21976
21977 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
21978 @anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2b6}@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2b7}
21979 @section Wide_Text_IO
21980
21981
21982 @code{Wide_Text_IO} is similar in most respects to Text_IO, except that
21983 both input and output files may contain special sequences that represent
21984 wide character values. The encoding scheme for a given file may be
21985 specified using a FORM parameter:
21986
21987 @example
21988 WCEM=`x`
21989 @end example
21990
21991 as part of the FORM string (WCEM = wide character encoding method),
21992 where @code{x} is one of the following characters
21993
21994
21995 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx}
21996 @headitem
21997
21998 Character
21999
22000 @tab
22001
22002 Encoding
22003
22004 @item
22005
22006 @emph{h}
22007
22008 @tab
22009
22010 Hex ESC encoding
22011
22012 @item
22013
22014 @emph{u}
22015
22016 @tab
22017
22018 Upper half encoding
22019
22020 @item
22021
22022 @emph{s}
22023
22024 @tab
22025
22026 Shift-JIS encoding
22027
22028 @item
22029
22030 @emph{e}
22031
22032 @tab
22033
22034 EUC Encoding
22035
22036 @item
22037
22038 @emph{8}
22039
22040 @tab
22041
22042 UTF-8 encoding
22043
22044 @item
22045
22046 @emph{b}
22047
22048 @tab
22049
22050 Brackets encoding
22051
22052 @end multitable
22053
22054
22055 The encoding methods match those that
22056 can be used in a source
22057 program, but there is no requirement that the encoding method used for
22058 the source program be the same as the encoding method used for files,
22059 and different files may use different encoding methods.
22060
22061 The default encoding method for the standard files, and for opened files
22062 for which no WCEM parameter is given in the FORM string matches the
22063 wide character encoding specified for the main program (the default
22064 being brackets encoding if no coding method was specified with -gnatW).
22065
22066
22067 @table @asis
22068
22069 @item @emph{Hex Coding}
22070
22071 In this encoding, a wide character is represented by a five character
22072 sequence:
22073 @end table
22074
22075 @example
22076 ESC a b c d
22077 @end example
22078
22079
22080 @quotation
22081
22082 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22083 characters (using upper case letters) of the wide character code. For
22084 example, ESC A345 is used to represent the wide character with code
22085 16#A345#. This scheme is compatible with use of the full
22086 @code{Wide_Character} set.
22087 @end quotation
22088
22089
22090 @table @asis
22091
22092 @item @emph{Upper Half Coding}
22093
22094 The wide character with encoding 16#abcd#, where the upper bit is on
22095 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
22096 16#cd#. The second byte may never be a format control character, but is
22097 not required to be in the upper half. This method can be also used for
22098 shift-JIS or EUC where the internal coding matches the external coding.
22099
22100 @item @emph{Shift JIS Coding}
22101
22102 A wide character is represented by a two character sequence 16#ab# and
22103 16#cd#, with the restrictions described for upper half encoding as
22104 described above. The internal character code is the corresponding JIS
22105 character according to the standard algorithm for Shift-JIS
22106 conversion. Only characters defined in the JIS code set table can be
22107 used with this encoding method.
22108
22109 @item @emph{EUC Coding}
22110
22111 A wide character is represented by a two character sequence 16#ab# and
22112 16#cd#, with both characters being in the upper half. The internal
22113 character code is the corresponding JIS character according to the EUC
22114 encoding algorithm. Only characters defined in the JIS code set table
22115 can be used with this encoding method.
22116
22117 @item @emph{UTF-8 Coding}
22118
22119 A wide character is represented using
22120 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22121 10646-1/Am.2. Depending on the character value, the representation
22122 is a one, two, or three byte sequence:
22123 @end table
22124
22125 @example
22126 16#0000#-16#007f#: 2#0xxxxxxx#
22127 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
22128 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22129 @end example
22130
22131
22132 @quotation
22133
22134 where the @code{xxx} bits correspond to the left-padded bits of the
22135 16-bit character value. Note that all lower half ASCII characters
22136 are represented as ASCII bytes and all upper half characters and
22137 other wide characters are represented as sequences of upper-half
22138 (The full UTF-8 scheme allows for encoding 31-bit characters as
22139 6-byte sequences, but in this implementation, all UTF-8 sequences
22140 of four or more bytes length will raise a Constraint_Error, as
22141 will all invalid UTF-8 sequences.)
22142 @end quotation
22143
22144
22145 @table @asis
22146
22147 @item @emph{Brackets Coding}
22148
22149 In this encoding, a wide character is represented by the following eight
22150 character sequence:
22151 @end table
22152
22153 @example
22154 [ " a b c d " ]
22155 @end example
22156
22157
22158 @quotation
22159
22160 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22161 characters (using uppercase letters) of the wide character code. For
22162 example, @code{["A345"]} is used to represent the wide character with code
22163 @code{16#A345#}.
22164 This scheme is compatible with use of the full Wide_Character set.
22165 On input, brackets coding can also be used for upper half characters,
22166 e.g., @code{["C1"]} for lower case a. However, on output, brackets notation
22167 is only used for wide characters with a code greater than @code{16#FF#}.
22168
22169 Note that brackets coding is not normally used in the context of
22170 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
22171 a portable way of encoding source files. In the context of Wide_Text_IO
22172 or Wide_Wide_Text_IO, it can only be used if the file does not contain
22173 any instance of the left bracket character other than to encode wide
22174 character values using the brackets encoding method. In practice it is
22175 expected that some standard wide character encoding method such
22176 as UTF-8 will be used for text input output.
22177
22178 If brackets notation is used, then any occurrence of a left bracket
22179 in the input file which is not the start of a valid wide character
22180 sequence will cause Constraint_Error to be raised. It is possible to
22181 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
22182 input will interpret this as a left bracket.
22183
22184 However, when a left bracket is output, it will be output as a left bracket
22185 and not as ["5B"]. We make this decision because for normal use of
22186 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
22187 brackets. For example, if we write:
22188
22189 @example
22190 Put_Line ("Start of output [first run]");
22191 @end example
22192
22193 we really do not want to have the left bracket in this message clobbered so
22194 that the output reads:
22195 @end quotation
22196
22197 @example
22198 Start of output ["5B"]first run]
22199 @end example
22200
22201
22202 @quotation
22203
22204 In practice brackets encoding is reasonably useful for normal Put_Line use
22205 since we won't get confused between left brackets and wide character
22206 sequences in the output. But for input, or when files are written out
22207 and read back in, it really makes better sense to use one of the standard
22208 encoding methods such as UTF-8.
22209 @end quotation
22210
22211 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
22212 not all wide character
22213 values can be represented. An attempt to output a character that cannot
22214 be represented using the encoding scheme for the file causes
22215 Constraint_Error to be raised. An invalid wide character sequence on
22216 input also causes Constraint_Error to be raised.
22217
22218 @menu
22219 * Stream Pointer Positioning: Stream Pointer Positioning<2>.
22220 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>.
22221
22222 @end menu
22223
22224 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
22225 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2b8}@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2b9}
22226 @subsection Stream Pointer Positioning
22227
22228
22229 @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22230 of stream pointer positioning (@ref{2a9,,Text_IO}). There is one additional
22231 case:
22232
22233 If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
22234 normal lower ASCII set (i.e., a character in the range:
22235
22236 @example
22237 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
22238 @end example
22239
22240 then although the logical position of the file pointer is unchanged by
22241 the @code{Look_Ahead} call, the stream is physically positioned past the
22242 wide character sequence. Again this is to avoid the need for buffering
22243 or backup, and all @code{Wide_Text_IO} routines check the internal
22244 indication that this situation has occurred so that this is not visible
22245 to a normal program using @code{Wide_Text_IO}. However, this discrepancy
22246 can be observed if the wide text file shares a stream with another file.
22247
22248 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
22249 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2ba}@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2bb}
22250 @subsection Reading and Writing Non-Regular Files
22251
22252
22253 As in the case of Text_IO, when a non-regular file is read, it is
22254 assumed that the file contains no page marks (any form characters are
22255 treated as data characters), and @code{End_Of_Page} always returns
22256 @code{False}. Similarly, the end of file indication is not sticky, so
22257 it is possible to read beyond an end of file.
22258
22259 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
22260 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2bc}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2bd}
22261 @section Wide_Wide_Text_IO
22262
22263
22264 @code{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
22265 both input and output files may contain special sequences that represent
22266 wide wide character values. The encoding scheme for a given file may be
22267 specified using a FORM parameter:
22268
22269 @example
22270 WCEM=`x`
22271 @end example
22272
22273 as part of the FORM string (WCEM = wide character encoding method),
22274 where @code{x} is one of the following characters
22275
22276
22277 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx}
22278 @headitem
22279
22280 Character
22281
22282 @tab
22283
22284 Encoding
22285
22286 @item
22287
22288 @emph{h}
22289
22290 @tab
22291
22292 Hex ESC encoding
22293
22294 @item
22295
22296 @emph{u}
22297
22298 @tab
22299
22300 Upper half encoding
22301
22302 @item
22303
22304 @emph{s}
22305
22306 @tab
22307
22308 Shift-JIS encoding
22309
22310 @item
22311
22312 @emph{e}
22313
22314 @tab
22315
22316 EUC Encoding
22317
22318 @item
22319
22320 @emph{8}
22321
22322 @tab
22323
22324 UTF-8 encoding
22325
22326 @item
22327
22328 @emph{b}
22329
22330 @tab
22331
22332 Brackets encoding
22333
22334 @end multitable
22335
22336
22337 The encoding methods match those that
22338 can be used in a source
22339 program, but there is no requirement that the encoding method used for
22340 the source program be the same as the encoding method used for files,
22341 and different files may use different encoding methods.
22342
22343 The default encoding method for the standard files, and for opened files
22344 for which no WCEM parameter is given in the FORM string matches the
22345 wide character encoding specified for the main program (the default
22346 being brackets encoding if no coding method was specified with -gnatW).
22347
22348
22349 @table @asis
22350
22351 @item @emph{UTF-8 Coding}
22352
22353 A wide character is represented using
22354 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22355 10646-1/Am.2. Depending on the character value, the representation
22356 is a one, two, three, or four byte sequence:
22357 @end table
22358
22359 @example
22360 16#000000#-16#00007f#: 2#0xxxxxxx#
22361 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
22362 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22363 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
22364 @end example
22365
22366
22367 @quotation
22368
22369 where the @code{xxx} bits correspond to the left-padded bits of the
22370 21-bit character value. Note that all lower half ASCII characters
22371 are represented as ASCII bytes and all upper half characters and
22372 other wide characters are represented as sequences of upper-half
22373 characters.
22374 @end quotation
22375
22376
22377 @table @asis
22378
22379 @item @emph{Brackets Coding}
22380
22381 In this encoding, a wide wide character is represented by the following eight
22382 character sequence if is in wide character range
22383 @end table
22384
22385 @example
22386 [ " a b c d " ]
22387 @end example
22388
22389
22390 @quotation
22391
22392 and by the following ten character sequence if not
22393 @end quotation
22394
22395 @example
22396 [ " a b c d e f " ]
22397 @end example
22398
22399
22400 @quotation
22401
22402 where @code{a}, @code{b}, @code{c}, @code{d}, @code{e}, and @code{f}
22403 are the four or six hexadecimal
22404 characters (using uppercase letters) of the wide wide character code. For
22405 example, @code{["01A345"]} is used to represent the wide wide character
22406 with code @code{16#01A345#}.
22407
22408 This scheme is compatible with use of the full Wide_Wide_Character set.
22409 On input, brackets coding can also be used for upper half characters,
22410 e.g., @code{["C1"]} for lower case a. However, on output, brackets notation
22411 is only used for wide characters with a code greater than @code{16#FF#}.
22412 @end quotation
22413
22414 If is also possible to use the other Wide_Character encoding methods,
22415 such as Shift-JIS, but the other schemes cannot support the full range
22416 of wide wide characters.
22417 An attempt to output a character that cannot
22418 be represented using the encoding scheme for the file causes
22419 Constraint_Error to be raised. An invalid wide character sequence on
22420 input also causes Constraint_Error to be raised.
22421
22422 @menu
22423 * Stream Pointer Positioning: Stream Pointer Positioning<3>.
22424 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>.
22425
22426 @end menu
22427
22428 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
22429 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2be}@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2bf}
22430 @subsection Stream Pointer Positioning
22431
22432
22433 @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22434 of stream pointer positioning (@ref{2a9,,Text_IO}). There is one additional
22435 case:
22436
22437 If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
22438 normal lower ASCII set (i.e., a character in the range:
22439
22440 @example
22441 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
22442 @end example
22443
22444 then although the logical position of the file pointer is unchanged by
22445 the @code{Look_Ahead} call, the stream is physically positioned past the
22446 wide character sequence. Again this is to avoid the need for buffering
22447 or backup, and all @code{Wide_Wide_Text_IO} routines check the internal
22448 indication that this situation has occurred so that this is not visible
22449 to a normal program using @code{Wide_Wide_Text_IO}. However, this discrepancy
22450 can be observed if the wide text file shares a stream with another file.
22451
22452 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
22453 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2c0}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2c1}
22454 @subsection Reading and Writing Non-Regular Files
22455
22456
22457 As in the case of Text_IO, when a non-regular file is read, it is
22458 assumed that the file contains no page marks (any form characters are
22459 treated as data characters), and @code{End_Of_Page} always returns
22460 @code{False}. Similarly, the end of file indication is not sticky, so
22461 it is possible to read beyond an end of file.
22462
22463 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
22464 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2c2}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2c3}
22465 @section Stream_IO
22466
22467
22468 A stream file is a sequence of bytes, where individual elements are
22469 written to the file as described in the Ada Reference Manual. The type
22470 @code{Stream_Element} is simply a byte. There are two ways to read or
22471 write a stream file.
22472
22473
22474 @itemize *
22475
22476 @item
22477 The operations @code{Read} and @code{Write} directly read or write a
22478 sequence of stream elements with no control information.
22479
22480 @item
22481 The stream attributes applied to a stream file transfer data in the
22482 manner described for stream attributes.
22483 @end itemize
22484
22485 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
22486 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2c4}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2c5}
22487 @section Text Translation
22488
22489
22490 @code{Text_Translation=xxx} may be used as the Form parameter
22491 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
22492 has no effect on Unix systems. Possible values are:
22493
22494
22495 @itemize *
22496
22497 @item
22498 @code{Yes} or @code{Text} is the default, which means to
22499 translate LF to/from CR/LF on Windows systems.
22500
22501 @code{No} disables this translation; i.e. it
22502 uses binary mode. For output files, @code{Text_Translation=No}
22503 may be used to create Unix-style files on
22504 Windows.
22505
22506 @item
22507 @code{wtext} translation enabled in Unicode mode.
22508 (corresponds to _O_WTEXT).
22509
22510 @item
22511 @code{u8text} translation enabled in Unicode UTF-8 mode.
22512 (corresponds to O_U8TEXT).
22513
22514 @item
22515 @code{u16text} translation enabled in Unicode UTF-16
22516 mode. (corresponds to_O_U16TEXT).
22517 @end itemize
22518
22519 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
22520 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2c6}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2c7}
22521 @section Shared Files
22522
22523
22524 Section A.14 of the Ada Reference Manual allows implementations to
22525 provide a wide variety of behavior if an attempt is made to access the
22526 same external file with two or more internal files.
22527
22528 To provide a full range of functionality, while at the same time
22529 minimizing the problems of portability caused by this implementation
22530 dependence, GNAT handles file sharing as follows:
22531
22532
22533 @itemize *
22534
22535 @item
22536 In the absence of a @code{shared=xxx} form parameter, an attempt
22537 to open two or more files with the same full name is considered an error
22538 and is not supported. The exception @code{Use_Error} will be
22539 raised. Note that a file that is not explicitly closed by the program
22540 remains open until the program terminates.
22541
22542 @item
22543 If the form parameter @code{shared=no} appears in the form string, the
22544 file can be opened or created with its own separate stream identifier,
22545 regardless of whether other files sharing the same external file are
22546 opened. The exact effect depends on how the C stream routines handle
22547 multiple accesses to the same external files using separate streams.
22548
22549 @item
22550 If the form parameter @code{shared=yes} appears in the form string for
22551 each of two or more files opened using the same full name, the same
22552 stream is shared between these files, and the semantics are as described
22553 in Ada Reference Manual, Section A.14.
22554 @end itemize
22555
22556 When a program that opens multiple files with the same name is ported
22557 from another Ada compiler to GNAT, the effect will be that
22558 @code{Use_Error} is raised.
22559
22560 The documentation of the original compiler and the documentation of the
22561 program should then be examined to determine if file sharing was
22562 expected, and @code{shared=xxx} parameters added to @code{Open}
22563 and @code{Create} calls as required.
22564
22565 When a program is ported from GNAT to some other Ada compiler, no
22566 special attention is required unless the @code{shared=xxx} form
22567 parameter is used in the program. In this case, you must examine the
22568 documentation of the new compiler to see if it supports the required
22569 file sharing semantics, and form strings modified appropriately. Of
22570 course it may be the case that the program cannot be ported if the
22571 target compiler does not support the required functionality. The best
22572 approach in writing portable code is to avoid file sharing (and hence
22573 the use of the @code{shared=xxx} parameter in the form string)
22574 completely.
22575
22576 One common use of file sharing in Ada 83 is the use of instantiations of
22577 Sequential_IO on the same file with different types, to achieve
22578 heterogeneous input-output. Although this approach will work in GNAT if
22579 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
22580 for this purpose (using the stream attributes)
22581
22582 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
22583 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2c8}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2c9}
22584 @section Filenames encoding
22585
22586
22587 An encoding form parameter can be used to specify the filename
22588 encoding @code{encoding=xxx}.
22589
22590
22591 @itemize *
22592
22593 @item
22594 If the form parameter @code{encoding=utf8} appears in the form string, the
22595 filename must be encoded in UTF-8.
22596
22597 @item
22598 If the form parameter @code{encoding=8bits} appears in the form
22599 string, the filename must be a standard 8bits string.
22600 @end itemize
22601
22602 In the absence of a @code{encoding=xxx} form parameter, the
22603 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
22604 variable. And if not set @code{utf8} is assumed.
22605
22606
22607 @table @asis
22608
22609 @item @emph{CP_ACP}
22610
22611 The current system Windows ANSI code page.
22612
22613 @item @emph{CP_UTF8}
22614
22615 UTF-8 encoding
22616 @end table
22617
22618 This encoding form parameter is only supported on the Windows
22619 platform. On the other Operating Systems the run-time is supporting
22620 UTF-8 natively.
22621
22622 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
22623 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2ca}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2cb}
22624 @section File content encoding
22625
22626
22627 For text files it is possible to specify the encoding to use. This is
22628 controlled by the by the @code{GNAT_CCS_ENCODING} environment
22629 variable. And if not set @code{TEXT} is assumed.
22630
22631 The possible values are those supported on Windows:
22632
22633
22634 @table @asis
22635
22636 @item @emph{TEXT}
22637
22638 Translated text mode
22639
22640 @item @emph{WTEXT}
22641
22642 Translated unicode encoding
22643
22644 @item @emph{U16TEXT}
22645
22646 Unicode 16-bit encoding
22647
22648 @item @emph{U8TEXT}
22649
22650 Unicode 8-bit encoding
22651 @end table
22652
22653 This encoding is only supported on the Windows platform.
22654
22655 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
22656 @anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2cc}@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2cd}
22657 @section Open Modes
22658
22659
22660 @code{Open} and @code{Create} calls result in a call to @code{fopen}
22661 using the mode shown in the following table:
22662
22663
22664 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx}
22665 @headitem
22666
22667 @code{Open} and @code{Create} Call Modes
22668
22669 @tab
22670
22671 @tab
22672
22673 @item
22674
22675 @tab
22676
22677 @strong{OPEN}
22678
22679 @tab
22680
22681 @strong{CREATE}
22682
22683 @item
22684
22685 Append_File
22686
22687 @tab
22688
22689 "r+"
22690
22691 @tab
22692
22693 "w+"
22694
22695 @item
22696
22697 In_File
22698
22699 @tab
22700
22701 "r"
22702
22703 @tab
22704
22705 "w+"
22706
22707 @item
22708
22709 Out_File (Direct_IO)
22710
22711 @tab
22712
22713 "r+"
22714
22715 @tab
22716
22717 "w"
22718
22719 @item
22720
22721 Out_File (all other cases)
22722
22723 @tab
22724
22725 "w"
22726
22727 @tab
22728
22729 "w"
22730
22731 @item
22732
22733 Inout_File
22734
22735 @tab
22736
22737 "r+"
22738
22739 @tab
22740
22741 "w+"
22742
22743 @end multitable
22744
22745
22746 If text file translation is required, then either @code{b} or @code{t}
22747 is added to the mode, depending on the setting of Text. Text file
22748 translation refers to the mapping of CR/LF sequences in an external file
22749 to LF characters internally. This mapping only occurs in DOS and
22750 DOS-like systems, and is not relevant to other systems.
22751
22752 A special case occurs with Stream_IO. As shown in the above table, the
22753 file is initially opened in @code{r} or @code{w} mode for the
22754 @code{In_File} and @code{Out_File} cases. If a @code{Set_Mode} operation
22755 subsequently requires switching from reading to writing or vice-versa,
22756 then the file is reopened in @code{r+} mode to permit the required operation.
22757
22758 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22759 @anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2ce}@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2cf}
22760 @section Operations on C Streams
22761
22762
22763 The package @code{Interfaces.C_Streams} provides an Ada program with direct
22764 access to the C library functions for operations on C streams:
22765
22766 @example
22767 package Interfaces.C_Streams is
22768 -- Note: the reason we do not use the types that are in
22769 -- Interfaces.C is that we want to avoid dragging in the
22770 -- code in this unit if possible.
22771 subtype chars is System.Address;
22772 -- Pointer to null-terminated array of characters
22773 subtype FILEs is System.Address;
22774 -- Corresponds to the C type FILE*
22775 subtype voids is System.Address;
22776 -- Corresponds to the C type void*
22777 subtype int is Integer;
22778 subtype long is Long_Integer;
22779 -- Note: the above types are subtypes deliberately, and it
22780 -- is part of this spec that the above correspondences are
22781 -- guaranteed. This means that it is legitimate to, for
22782 -- example, use Integer instead of int. We provide these
22783 -- synonyms for clarity, but in some cases it may be
22784 -- convenient to use the underlying types (for example to
22785 -- avoid an unnecessary dependency of a spec on the spec
22786 -- of this unit).
22787 type size_t is mod 2 ** Standard'Address_Size;
22788 NULL_Stream : constant FILEs;
22789 -- Value returned (NULL in C) to indicate an
22790 -- fdopen/fopen/tmpfile error
22791 ----------------------------------
22792 -- Constants Defined in stdio.h --
22793 ----------------------------------
22794 EOF : constant int;
22795 -- Used by a number of routines to indicate error or
22796 -- end of file
22797 IOFBF : constant int;
22798 IOLBF : constant int;
22799 IONBF : constant int;
22800 -- Used to indicate buffering mode for setvbuf call
22801 SEEK_CUR : constant int;
22802 SEEK_END : constant int;
22803 SEEK_SET : constant int;
22804 -- Used to indicate origin for fseek call
22805 function stdin return FILEs;
22806 function stdout return FILEs;
22807 function stderr return FILEs;
22808 -- Streams associated with standard files
22809 --------------------------
22810 -- Standard C functions --
22811 --------------------------
22812 -- The functions selected below are ones that are
22813 -- available in UNIX (but not necessarily in ANSI C).
22814 -- These are very thin interfaces
22815 -- which copy exactly the C headers. For more
22816 -- documentation on these functions, see the Microsoft C
22817 -- "Run-Time Library Reference" (Microsoft Press, 1990,
22818 -- ISBN 1-55615-225-6), which includes useful information
22819 -- on system compatibility.
22820 procedure clearerr (stream : FILEs);
22821 function fclose (stream : FILEs) return int;
22822 function fdopen (handle : int; mode : chars) return FILEs;
22823 function feof (stream : FILEs) return int;
22824 function ferror (stream : FILEs) return int;
22825 function fflush (stream : FILEs) return int;
22826 function fgetc (stream : FILEs) return int;
22827 function fgets (strng : chars; n : int; stream : FILEs)
22828 return chars;
22829 function fileno (stream : FILEs) return int;
22830 function fopen (filename : chars; Mode : chars)
22831 return FILEs;
22832 -- Note: to maintain target independence, use
22833 -- text_translation_required, a boolean variable defined in
22834 -- a-sysdep.c to deal with the target dependent text
22835 -- translation requirement. If this variable is set,
22836 -- then b/t should be appended to the standard mode
22837 -- argument to set the text translation mode off or on
22838 -- as required.
22839 function fputc (C : int; stream : FILEs) return int;
22840 function fputs (Strng : chars; Stream : FILEs) return int;
22841 function fread
22842 (buffer : voids;
22843 size : size_t;
22844 count : size_t;
22845 stream : FILEs)
22846 return size_t;
22847 function freopen
22848 (filename : chars;
22849 mode : chars;
22850 stream : FILEs)
22851 return FILEs;
22852 function fseek
22853 (stream : FILEs;
22854 offset : long;
22855 origin : int)
22856 return int;
22857 function ftell (stream : FILEs) return long;
22858 function fwrite
22859 (buffer : voids;
22860 size : size_t;
22861 count : size_t;
22862 stream : FILEs)
22863 return size_t;
22864 function isatty (handle : int) return int;
22865 procedure mktemp (template : chars);
22866 -- The return value (which is just a pointer to template)
22867 -- is discarded
22868 procedure rewind (stream : FILEs);
22869 function rmtmp return int;
22870 function setvbuf
22871 (stream : FILEs;
22872 buffer : chars;
22873 mode : int;
22874 size : size_t)
22875 return int;
22876
22877 function tmpfile return FILEs;
22878 function ungetc (c : int; stream : FILEs) return int;
22879 function unlink (filename : chars) return int;
22880 ---------------------
22881 -- Extra functions --
22882 ---------------------
22883 -- These functions supply slightly thicker bindings than
22884 -- those above. They are derived from functions in the
22885 -- C Run-Time Library, but may do a bit more work than
22886 -- just directly calling one of the Library functions.
22887 function is_regular_file (handle : int) return int;
22888 -- Tests if given handle is for a regular file (result 1)
22889 -- or for a non-regular file (pipe or device, result 0).
22890 ---------------------------------
22891 -- Control of Text/Binary Mode --
22892 ---------------------------------
22893 -- If text_translation_required is true, then the following
22894 -- functions may be used to dynamically switch a file from
22895 -- binary to text mode or vice versa. These functions have
22896 -- no effect if text_translation_required is false (i.e., in
22897 -- normal UNIX mode). Use fileno to get a stream handle.
22898 procedure set_binary_mode (handle : int);
22899 procedure set_text_mode (handle : int);
22900 ----------------------------
22901 -- Full Path Name support --
22902 ----------------------------
22903 procedure full_name (nam : chars; buffer : chars);
22904 -- Given a NUL terminated string representing a file
22905 -- name, returns in buffer a NUL terminated string
22906 -- representing the full path name for the file name.
22907 -- On systems where it is relevant the drive is also
22908 -- part of the full path name. It is the responsibility
22909 -- of the caller to pass an actual parameter for buffer
22910 -- that is big enough for any full path name. Use
22911 -- max_path_len given below as the size of buffer.
22912 max_path_len : integer;
22913 -- Maximum length of an allowable full path name on the
22914 -- system, including a terminating NUL character.
22915 end Interfaces.C_Streams;
22916 @end example
22917
22918 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
22919 @anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2d0}@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2d1}
22920 @section Interfacing to C Streams
22921
22922
22923 The packages in this section permit interfacing Ada files to C Stream
22924 operations.
22925
22926 @example
22927 with Interfaces.C_Streams;
22928 package Ada.Sequential_IO.C_Streams is
22929 function C_Stream (F : File_Type)
22930 return Interfaces.C_Streams.FILEs;
22931 procedure Open
22932 (File : in out File_Type;
22933 Mode : in File_Mode;
22934 C_Stream : in Interfaces.C_Streams.FILEs;
22935 Form : in String := "");
22936 end Ada.Sequential_IO.C_Streams;
22937
22938 with Interfaces.C_Streams;
22939 package Ada.Direct_IO.C_Streams is
22940 function C_Stream (F : File_Type)
22941 return Interfaces.C_Streams.FILEs;
22942 procedure Open
22943 (File : in out File_Type;
22944 Mode : in File_Mode;
22945 C_Stream : in Interfaces.C_Streams.FILEs;
22946 Form : in String := "");
22947 end Ada.Direct_IO.C_Streams;
22948
22949 with Interfaces.C_Streams;
22950 package Ada.Text_IO.C_Streams is
22951 function C_Stream (F : File_Type)
22952 return Interfaces.C_Streams.FILEs;
22953 procedure Open
22954 (File : in out File_Type;
22955 Mode : in File_Mode;
22956 C_Stream : in Interfaces.C_Streams.FILEs;
22957 Form : in String := "");
22958 end Ada.Text_IO.C_Streams;
22959
22960 with Interfaces.C_Streams;
22961 package Ada.Wide_Text_IO.C_Streams is
22962 function C_Stream (F : File_Type)
22963 return Interfaces.C_Streams.FILEs;
22964 procedure Open
22965 (File : in out File_Type;
22966 Mode : in File_Mode;
22967 C_Stream : in Interfaces.C_Streams.FILEs;
22968 Form : in String := "");
22969 end Ada.Wide_Text_IO.C_Streams;
22970
22971 with Interfaces.C_Streams;
22972 package Ada.Wide_Wide_Text_IO.C_Streams is
22973 function C_Stream (F : File_Type)
22974 return Interfaces.C_Streams.FILEs;
22975 procedure Open
22976 (File : in out File_Type;
22977 Mode : in File_Mode;
22978 C_Stream : in Interfaces.C_Streams.FILEs;
22979 Form : in String := "");
22980 end Ada.Wide_Wide_Text_IO.C_Streams;
22981
22982 with Interfaces.C_Streams;
22983 package Ada.Stream_IO.C_Streams is
22984 function C_Stream (F : File_Type)
22985 return Interfaces.C_Streams.FILEs;
22986 procedure Open
22987 (File : in out File_Type;
22988 Mode : in File_Mode;
22989 C_Stream : in Interfaces.C_Streams.FILEs;
22990 Form : in String := "");
22991 end Ada.Stream_IO.C_Streams;
22992 @end example
22993
22994 In each of these six packages, the @code{C_Stream} function obtains the
22995 @code{FILE} pointer from a currently opened Ada file. It is then
22996 possible to use the @code{Interfaces.C_Streams} package to operate on
22997 this stream, or the stream can be passed to a C program which can
22998 operate on it directly. Of course the program is responsible for
22999 ensuring that only appropriate sequences of operations are executed.
23000
23001 One particular use of relevance to an Ada program is that the
23002 @code{setvbuf} function can be used to control the buffering of the
23003 stream used by an Ada file. In the absence of such a call the standard
23004 default buffering is used.
23005
23006 The @code{Open} procedures in these packages open a file giving an
23007 existing C Stream instead of a file name. Typically this stream is
23008 imported from a C program, allowing an Ada file to operate on an
23009 existing C file.
23010
23011 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
23012 @anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}@anchor{gnat_rm/the_gnat_library doc}@anchor{2d2}@anchor{gnat_rm/the_gnat_library id1}@anchor{2d3}
23013 @chapter The GNAT Library
23014
23015
23016 The GNAT library contains a number of general and special purpose packages.
23017 It represents functionality that the GNAT developers have found useful, and
23018 which is made available to GNAT users. The packages described here are fully
23019 supported, and upwards compatibility will be maintained in future releases,
23020 so you can use these facilities with the confidence that the same functionality
23021 will be available in future releases.
23022
23023 The chapter here simply gives a brief summary of the facilities available.
23024 The full documentation is found in the spec file for the package. The full
23025 sources of these library packages, including both spec and body, are provided
23026 with all GNAT releases. For example, to find out the full specifications of
23027 the SPITBOL pattern matching capability, including a full tutorial and
23028 extensive examples, look in the @code{g-spipat.ads} file in the library.
23029
23030 For each entry here, the package name (as it would appear in a @code{with}
23031 clause) is given, followed by the name of the corresponding spec file in
23032 parentheses. The packages are children in four hierarchies, @code{Ada},
23033 @code{Interfaces}, @code{System}, and @code{GNAT}, the latter being a
23034 GNAT-specific hierarchy.
23035
23036 Note that an application program should only use packages in one of these
23037 four hierarchies if the package is defined in the Ada Reference Manual,
23038 or is listed in this section of the GNAT Programmers Reference Manual.
23039 All other units should be considered internal implementation units and
23040 should not be directly @code{with}ed by application code. The use of
23041 a @code{with} clause that references one of these internal implementation
23042 units makes an application potentially dependent on changes in versions
23043 of GNAT, and will generate a warning message.
23044
23045 @menu
23046 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads.
23047 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads.
23048 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads.
23049 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads.
23050 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads.
23051 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads.
23052 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads.
23053 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads.
23054 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads.
23055 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads.
23056 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads.
23057 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads.
23058 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads.
23059 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads.
23060 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads.
23061 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads.
23062 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads.
23063 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads.
23064 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads.
23065 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads.
23066 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads.
23067 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads.
23068 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads.
23069 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads.
23070 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads.
23071 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
23072 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
23073 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
23074 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
23075 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
23076 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
23077 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads.
23078 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads.
23079 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads.
23080 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads.
23081 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads.
23082 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads.
23083 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads.
23084 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads.
23085 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads.
23086 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads.
23087 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads.
23088 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads.
23089 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads.
23090 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads.
23091 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads.
23092 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads.
23093 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads.
23094 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads.
23095 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads.
23096 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads.
23097 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads.
23098 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads.
23099 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads.
23100 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads.
23101 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads.
23102 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads.
23103 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads.
23104 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads.
23105 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads.
23106 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads.
23107 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads.
23108 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads.
23109 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads.
23110 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads.
23111 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads.
23112 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads.
23113 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads.
23114 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads.
23115 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads.
23116 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads.
23117 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads.
23118 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads.
23119 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads.
23120 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads.
23121 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads.
23122 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads.
23123 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads.
23124 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads.
23125 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads.
23126 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads.
23127 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads.
23128 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads.
23129 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads.
23130 * GNAT.IO (g-io.ads): GNAT IO g-io ads.
23131 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads.
23132 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads.
23133 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads.
23134 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads.
23135 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads.
23136 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads.
23137 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads.
23138 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads.
23139 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads.
23140 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads.
23141 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads.
23142 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads.
23143 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads.
23144 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads.
23145 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads.
23146 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads.
23147 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads.
23148 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads.
23149 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads.
23150 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads.
23151 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads.
23152 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads.
23153 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads.
23154 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads.
23155 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads.
23156 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads.
23157 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads.
23158 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads.
23159 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads.
23160 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads.
23161 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads.
23162 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads.
23163 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads.
23164 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads.
23165 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads.
23166 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads.
23167 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads.
23168 * GNAT.Table (g-table.ads): GNAT Table g-table ads.
23169 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads.
23170 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads.
23171 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads.
23172 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads.
23173 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads.
23174 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads.
23175 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads.
23176 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads.
23177 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads.
23178 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads.
23179 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads.
23180 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads.
23181 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads.
23182 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads.
23183 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads.
23184 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads.
23185 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads.
23186 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads.
23187 * System.Assertions (s-assert.ads): System Assertions s-assert ads.
23188 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads.
23189 * System.Memory (s-memory.ads): System Memory s-memory ads.
23190 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads.
23191 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads.
23192 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads.
23193 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads.
23194 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads.
23195 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads.
23196 * System.Rident (s-rident.ads): System Rident s-rident ads.
23197 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads.
23198 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads.
23199 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads.
23200 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads.
23201
23202 @end menu
23203
23204 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
23205 @anchor{gnat_rm/the_gnat_library id2}@anchor{2d4}@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2d5}
23206 @section @code{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
23207
23208
23209 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
23210
23211 @geindex Latin_9 constants for Character
23212
23213 This child of @code{Ada.Characters}
23214 provides a set of definitions corresponding to those in the
23215 RM-defined package @code{Ada.Characters.Latin_1} but with the
23216 few modifications required for @code{Latin-9}
23217 The provision of such a package
23218 is specifically authorized by the Ada Reference Manual
23219 (RM A.3.3(27)).
23220
23221 @node Ada Characters Wide_Latin_1 a-cwila1 ads,Ada Characters Wide_Latin_9 a-cwila1 ads,Ada Characters Latin_9 a-chlat9 ads,The GNAT Library
23222 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2d6}@anchor{gnat_rm/the_gnat_library id3}@anchor{2d7}
23223 @section @code{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
23224
23225
23226 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
23227
23228 @geindex Latin_1 constants for Wide_Character
23229
23230 This child of @code{Ada.Characters}
23231 provides a set of definitions corresponding to those in the
23232 RM-defined package @code{Ada.Characters.Latin_1} but with the
23233 types of the constants being @code{Wide_Character}
23234 instead of @code{Character}. The provision of such a package
23235 is specifically authorized by the Ada Reference Manual
23236 (RM A.3.3(27)).
23237
23238 @node Ada Characters Wide_Latin_9 a-cwila1 ads,Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,The GNAT Library
23239 @anchor{gnat_rm/the_gnat_library id4}@anchor{2d8}@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila1-ads}@anchor{2d9}
23240 @section @code{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
23241
23242
23243 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
23244
23245 @geindex Latin_9 constants for Wide_Character
23246
23247 This child of @code{Ada.Characters}
23248 provides a set of definitions corresponding to those in the
23249 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23250 types of the constants being @code{Wide_Character}
23251 instead of @code{Character}. The provision of such a package
23252 is specifically authorized by the Ada Reference Manual
23253 (RM A.3.3(27)).
23254
23255 @node Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,Ada Characters Wide_Latin_9 a-cwila1 ads,The GNAT Library
23256 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2da}@anchor{gnat_rm/the_gnat_library id5}@anchor{2db}
23257 @section @code{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
23258
23259
23260 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
23261
23262 @geindex Latin_1 constants for Wide_Wide_Character
23263
23264 This child of @code{Ada.Characters}
23265 provides a set of definitions corresponding to those in the
23266 RM-defined package @code{Ada.Characters.Latin_1} but with the
23267 types of the constants being @code{Wide_Wide_Character}
23268 instead of @code{Character}. The provision of such a package
23269 is specifically authorized by the Ada Reference Manual
23270 (RM A.3.3(27)).
23271
23272 @node Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads,Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,The GNAT Library
23273 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2dc}@anchor{gnat_rm/the_gnat_library id6}@anchor{2dd}
23274 @section @code{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
23275
23276
23277 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
23278
23279 @geindex Latin_9 constants for Wide_Wide_Character
23280
23281 This child of @code{Ada.Characters}
23282 provides a set of definitions corresponding to those in the
23283 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23284 types of the constants being @code{Wide_Wide_Character}
23285 instead of @code{Character}. The provision of such a package
23286 is specifically authorized by the Ada Reference Manual
23287 (RM A.3.3(27)).
23288
23289 @node Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads,Ada Containers Formal_Hashed_Maps a-cfhama ads,Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,The GNAT Library
23290 @anchor{gnat_rm/the_gnat_library id7}@anchor{2de}@anchor{gnat_rm/the_gnat_library ada-containers-formal-doubly-linked-lists-a-cfdlli-ads}@anchor{2df}
23291 @section @code{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
23292
23293
23294 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
23295
23296 @geindex Formal container for doubly linked lists
23297
23298 This child of @code{Ada.Containers} defines a modified version of the
23299 Ada 2005 container for doubly linked lists, meant to facilitate formal
23300 verification of code using such containers. The specification of this
23301 unit is compatible with SPARK 2014.
23302
23303 Note that although this container was designed with formal verification
23304 in mind, it may well be generally useful in that it is a simplified more
23305 efficient version than the one defined in the standard. In particular it
23306 does not have the complex overhead required to detect cursor tampering.
23307
23308 @node Ada Containers Formal_Hashed_Maps a-cfhama ads,Ada Containers Formal_Hashed_Sets a-cfhase ads,Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads,The GNAT Library
23309 @anchor{gnat_rm/the_gnat_library id8}@anchor{2e0}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-maps-a-cfhama-ads}@anchor{2e1}
23310 @section @code{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
23311
23312
23313 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
23314
23315 @geindex Formal container for hashed maps
23316
23317 This child of @code{Ada.Containers} defines a modified version of the
23318 Ada 2005 container for hashed maps, meant to facilitate formal
23319 verification of code using such containers. The specification of this
23320 unit is compatible with SPARK 2014.
23321
23322 Note that although this container was designed with formal verification
23323 in mind, it may well be generally useful in that it is a simplified more
23324 efficient version than the one defined in the standard. In particular it
23325 does not have the complex overhead required to detect cursor tampering.
23326
23327 @node Ada Containers Formal_Hashed_Sets a-cfhase ads,Ada Containers Formal_Ordered_Maps a-cforma ads,Ada Containers Formal_Hashed_Maps a-cfhama ads,The GNAT Library
23328 @anchor{gnat_rm/the_gnat_library id9}@anchor{2e2}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-sets-a-cfhase-ads}@anchor{2e3}
23329 @section @code{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
23330
23331
23332 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
23333
23334 @geindex Formal container for hashed sets
23335
23336 This child of @code{Ada.Containers} defines a modified version of the
23337 Ada 2005 container for hashed sets, meant to facilitate formal
23338 verification of code using such containers. The specification of this
23339 unit is compatible with SPARK 2014.
23340
23341 Note that although this container was designed with formal verification
23342 in mind, it may well be generally useful in that it is a simplified more
23343 efficient version than the one defined in the standard. In particular it
23344 does not have the complex overhead required to detect cursor tampering.
23345
23346 @node Ada Containers Formal_Ordered_Maps a-cforma ads,Ada Containers Formal_Ordered_Sets a-cforse ads,Ada Containers Formal_Hashed_Sets a-cfhase ads,The GNAT Library
23347 @anchor{gnat_rm/the_gnat_library id10}@anchor{2e4}@anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-maps-a-cforma-ads}@anchor{2e5}
23348 @section @code{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
23349
23350
23351 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
23352
23353 @geindex Formal container for ordered maps
23354
23355 This child of @code{Ada.Containers} defines a modified version of the
23356 Ada 2005 container for ordered maps, meant to facilitate formal
23357 verification of code using such containers. The specification of this
23358 unit is compatible with SPARK 2014.
23359
23360 Note that although this container was designed with formal verification
23361 in mind, it may well be generally useful in that it is a simplified more
23362 efficient version than the one defined in the standard. In particular it
23363 does not have the complex overhead required to detect cursor tampering.
23364
23365 @node Ada Containers Formal_Ordered_Sets a-cforse ads,Ada Containers Formal_Vectors a-cofove ads,Ada Containers Formal_Ordered_Maps a-cforma ads,The GNAT Library
23366 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-sets-a-cforse-ads}@anchor{2e6}@anchor{gnat_rm/the_gnat_library id11}@anchor{2e7}
23367 @section @code{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
23368
23369
23370 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
23371
23372 @geindex Formal container for ordered sets
23373
23374 This child of @code{Ada.Containers} defines a modified version of the
23375 Ada 2005 container for ordered sets, meant to facilitate formal
23376 verification of code using such containers. The specification of this
23377 unit is compatible with SPARK 2014.
23378
23379 Note that although this container was designed with formal verification
23380 in mind, it may well be generally useful in that it is a simplified more
23381 efficient version than the one defined in the standard. In particular it
23382 does not have the complex overhead required to detect cursor tampering.
23383
23384 @node Ada Containers Formal_Vectors a-cofove ads,Ada Containers Formal_Indefinite_Vectors a-cfinve ads,Ada Containers Formal_Ordered_Sets a-cforse ads,The GNAT Library
23385 @anchor{gnat_rm/the_gnat_library id12}@anchor{2e8}@anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{2e9}
23386 @section @code{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
23387
23388
23389 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
23390
23391 @geindex Formal container for vectors
23392
23393 This child of @code{Ada.Containers} defines a modified version of the
23394 Ada 2005 container for vectors, meant to facilitate formal
23395 verification of code using such containers. The specification of this
23396 unit is compatible with SPARK 2014.
23397
23398 Note that although this container was designed with formal verification
23399 in mind, it may well be generally useful in that it is a simplified more
23400 efficient version than the one defined in the standard. In particular it
23401 does not have the complex overhead required to detect cursor tampering.
23402
23403 @node Ada Containers Formal_Indefinite_Vectors a-cfinve ads,Ada Containers Functional_Vectors a-cofuve ads,Ada Containers Formal_Vectors a-cofove ads,The GNAT Library
23404 @anchor{gnat_rm/the_gnat_library id13}@anchor{2ea}@anchor{gnat_rm/the_gnat_library ada-containers-formal-indefinite-vectors-a-cfinve-ads}@anchor{2eb}
23405 @section @code{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
23406
23407
23408 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
23409
23410 @geindex Formal container for vectors
23411
23412 This child of @code{Ada.Containers} defines a modified version of the
23413 Ada 2005 container for vectors of indefinite elements, meant to
23414 facilitate formal verification of code using such containers. The
23415 specification of this unit is compatible with SPARK 2014.
23416
23417 Note that although this container was designed with formal verification
23418 in mind, it may well be generally useful in that it is a simplified more
23419 efficient version than the one defined in the standard. In particular it
23420 does not have the complex overhead required to detect cursor tampering.
23421
23422 @node Ada Containers Functional_Vectors a-cofuve ads,Ada Containers Functional_Sets a-cofuse ads,Ada Containers Formal_Indefinite_Vectors a-cfinve ads,The GNAT Library
23423 @anchor{gnat_rm/the_gnat_library id14}@anchor{2ec}@anchor{gnat_rm/the_gnat_library ada-containers-functional-vectors-a-cofuve-ads}@anchor{2ed}
23424 @section @code{Ada.Containers.Functional_Vectors} (@code{a-cofuve.ads})
23425
23426
23427 @geindex Ada.Containers.Functional_Vectors (a-cofuve.ads)
23428
23429 @geindex Functional vectors
23430
23431 This child of @code{Ada.Containers} defines immutable vectors. These
23432 containers are unbounded and may contain indefinite elements. Furthermore, to
23433 be usable in every context, they are neither controlled nor limited. As they
23434 are functional, that is, no primitives are provided which would allow modifying
23435 an existing container, these containers can still be used safely.
23436
23437 Their API features functions creating new containers from existing ones.
23438 As a consequence, these containers are highly inefficient. They are also
23439 memory consuming, as the allocated memory is not reclaimed when the container
23440 is no longer referenced. Thus, they should in general be used in ghost code
23441 and annotations, so that they can be removed from the final executable. The
23442 specification of this unit is compatible with SPARK 2014.
23443
23444 @node Ada Containers Functional_Sets a-cofuse ads,Ada Containers Functional_Maps a-cofuma ads,Ada Containers Functional_Vectors a-cofuve ads,The GNAT Library
23445 @anchor{gnat_rm/the_gnat_library ada-containers-functional-sets-a-cofuse-ads}@anchor{2ee}@anchor{gnat_rm/the_gnat_library id15}@anchor{2ef}
23446 @section @code{Ada.Containers.Functional_Sets} (@code{a-cofuse.ads})
23447
23448
23449 @geindex Ada.Containers.Functional_Sets (a-cofuse.ads)
23450
23451 @geindex Functional sets
23452
23453 This child of @code{Ada.Containers} defines immutable sets. These containers are
23454 unbounded and may contain indefinite elements. Furthermore, to be usable in
23455 every context, they are neither controlled nor limited. As they are functional,
23456 that is, no primitives are provided which would allow modifying an existing
23457 container, these containers can still be used safely.
23458
23459 Their API features functions creating new containers from existing ones.
23460 As a consequence, these containers are highly inefficient. They are also
23461 memory consuming, as the allocated memory is not reclaimed when the container
23462 is no longer referenced. Thus, they should in general be used in ghost code
23463 and annotations, so that they can be removed from the final executable. The
23464 specification of this unit is compatible with SPARK 2014.
23465
23466 @node Ada Containers Functional_Maps a-cofuma ads,Ada Containers Bounded_Holders a-coboho ads,Ada Containers Functional_Sets a-cofuse ads,The GNAT Library
23467 @anchor{gnat_rm/the_gnat_library id16}@anchor{2f0}@anchor{gnat_rm/the_gnat_library ada-containers-functional-maps-a-cofuma-ads}@anchor{2f1}
23468 @section @code{Ada.Containers.Functional_Maps} (@code{a-cofuma.ads})
23469
23470
23471 @geindex Ada.Containers.Functional_Maps (a-cofuma.ads)
23472
23473 @geindex Functional maps
23474
23475 This child of @code{Ada.Containers} defines immutable maps. These containers are
23476 unbounded and may contain indefinite elements. Furthermore, to be usable in
23477 every context, they are neither controlled nor limited. As they are functional,
23478 that is, no primitives are provided which would allow modifying an existing
23479 container, these containers can still be used safely.
23480
23481 Their API features functions creating new containers from existing ones.
23482 As a consequence, these containers are highly inefficient. They are also
23483 memory consuming, as the allocated memory is not reclaimed when the container
23484 is no longer referenced. Thus, they should in general be used in ghost code
23485 and annotations, so that they can be removed from the final executable. The
23486 specification of this unit is compatible with SPARK 2014.
23487
23488 @node Ada Containers Bounded_Holders a-coboho ads,Ada Command_Line Environment a-colien ads,Ada Containers Functional_Maps a-cofuma ads,The GNAT Library
23489 @anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2f2}@anchor{gnat_rm/the_gnat_library id17}@anchor{2f3}
23490 @section @code{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
23491
23492
23493 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
23494
23495 @geindex Formal container for vectors
23496
23497 This child of @code{Ada.Containers} defines a modified version of
23498 Indefinite_Holders that avoids heap allocation.
23499
23500 @node Ada Command_Line Environment a-colien ads,Ada Command_Line Remove a-colire ads,Ada Containers Bounded_Holders a-coboho ads,The GNAT Library
23501 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2f4}@anchor{gnat_rm/the_gnat_library id18}@anchor{2f5}
23502 @section @code{Ada.Command_Line.Environment} (@code{a-colien.ads})
23503
23504
23505 @geindex Ada.Command_Line.Environment (a-colien.ads)
23506
23507 @geindex Environment entries
23508
23509 This child of @code{Ada.Command_Line}
23510 provides a mechanism for obtaining environment values on systems
23511 where this concept makes sense.
23512
23513 @node Ada Command_Line Remove a-colire ads,Ada Command_Line Response_File a-clrefi ads,Ada Command_Line Environment a-colien ads,The GNAT Library
23514 @anchor{gnat_rm/the_gnat_library id19}@anchor{2f6}@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2f7}
23515 @section @code{Ada.Command_Line.Remove} (@code{a-colire.ads})
23516
23517
23518 @geindex Ada.Command_Line.Remove (a-colire.ads)
23519
23520 @geindex Removing command line arguments
23521
23522 @geindex Command line
23523 @geindex argument removal
23524
23525 This child of @code{Ada.Command_Line}
23526 provides a mechanism for logically removing
23527 arguments from the argument list. Once removed, an argument is not visible
23528 to further calls on the subprograms in @code{Ada.Command_Line} will not
23529 see the removed argument.
23530
23531 @node Ada Command_Line Response_File a-clrefi ads,Ada Direct_IO C_Streams a-diocst ads,Ada Command_Line Remove a-colire ads,The GNAT Library
23532 @anchor{gnat_rm/the_gnat_library id20}@anchor{2f8}@anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2f9}
23533 @section @code{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
23534
23535
23536 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
23537
23538 @geindex Response file for command line
23539
23540 @geindex Command line
23541 @geindex response file
23542
23543 @geindex Command line
23544 @geindex handling long command lines
23545
23546 This child of @code{Ada.Command_Line} provides a mechanism facilities for
23547 getting command line arguments from a text file, called a "response file".
23548 Using a response file allow passing a set of arguments to an executable longer
23549 than the maximum allowed by the system on the command line.
23550
23551 @node Ada Direct_IO C_Streams a-diocst ads,Ada Exceptions Is_Null_Occurrence a-einuoc ads,Ada Command_Line Response_File a-clrefi ads,The GNAT Library
23552 @anchor{gnat_rm/the_gnat_library id21}@anchor{2fa}@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2fb}
23553 @section @code{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
23554
23555
23556 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
23557
23558 @geindex C Streams
23559 @geindex Interfacing with Direct_IO
23560
23561 This package provides subprograms that allow interfacing between
23562 C streams and @code{Direct_IO}. The stream identifier can be
23563 extracted from a file opened on the Ada side, and an Ada file
23564 can be constructed from a stream opened on the C side.
23565
23566 @node Ada Exceptions Is_Null_Occurrence a-einuoc ads,Ada Exceptions Last_Chance_Handler a-elchha ads,Ada Direct_IO C_Streams a-diocst ads,The GNAT Library
23567 @anchor{gnat_rm/the_gnat_library id22}@anchor{2fc}@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2fd}
23568 @section @code{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
23569
23570
23571 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
23572
23573 @geindex Null_Occurrence
23574 @geindex testing for
23575
23576 This child subprogram provides a way of testing for the null
23577 exception occurrence (@code{Null_Occurrence}) without raising
23578 an exception.
23579
23580 @node Ada Exceptions Last_Chance_Handler a-elchha ads,Ada Exceptions Traceback a-exctra ads,Ada Exceptions Is_Null_Occurrence a-einuoc ads,The GNAT Library
23581 @anchor{gnat_rm/the_gnat_library id23}@anchor{2fe}@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{2ff}
23582 @section @code{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
23583
23584
23585 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
23586
23587 @geindex Null_Occurrence
23588 @geindex testing for
23589
23590 This child subprogram is used for handling otherwise unhandled
23591 exceptions (hence the name last chance), and perform clean ups before
23592 terminating the program. Note that this subprogram never returns.
23593
23594 @node Ada Exceptions Traceback a-exctra ads,Ada Sequential_IO C_Streams a-siocst ads,Ada Exceptions Last_Chance_Handler a-elchha ads,The GNAT Library
23595 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{300}@anchor{gnat_rm/the_gnat_library id24}@anchor{301}
23596 @section @code{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
23597
23598
23599 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
23600
23601 @geindex Traceback for Exception Occurrence
23602
23603 This child package provides the subprogram (@code{Tracebacks}) to
23604 give a traceback array of addresses based on an exception
23605 occurrence.
23606
23607 @node Ada Sequential_IO C_Streams a-siocst ads,Ada Streams Stream_IO C_Streams a-ssicst ads,Ada Exceptions Traceback a-exctra ads,The GNAT Library
23608 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{302}@anchor{gnat_rm/the_gnat_library id25}@anchor{303}
23609 @section @code{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
23610
23611
23612 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
23613
23614 @geindex C Streams
23615 @geindex Interfacing with Sequential_IO
23616
23617 This package provides subprograms that allow interfacing between
23618 C streams and @code{Sequential_IO}. The stream identifier can be
23619 extracted from a file opened on the Ada side, and an Ada file
23620 can be constructed from a stream opened on the C side.
23621
23622 @node Ada Streams Stream_IO C_Streams a-ssicst ads,Ada Strings Unbounded Text_IO a-suteio ads,Ada Sequential_IO C_Streams a-siocst ads,The GNAT Library
23623 @anchor{gnat_rm/the_gnat_library id26}@anchor{304}@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{305}
23624 @section @code{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
23625
23626
23627 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
23628
23629 @geindex C Streams
23630 @geindex Interfacing with Stream_IO
23631
23632 This package provides subprograms that allow interfacing between
23633 C streams and @code{Stream_IO}. The stream identifier can be
23634 extracted from a file opened on the Ada side, and an Ada file
23635 can be constructed from a stream opened on the C side.
23636
23637 @node Ada Strings Unbounded Text_IO a-suteio ads,Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,Ada Streams Stream_IO C_Streams a-ssicst ads,The GNAT Library
23638 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{306}@anchor{gnat_rm/the_gnat_library id27}@anchor{307}
23639 @section @code{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
23640
23641
23642 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
23643
23644 @geindex Unbounded_String
23645 @geindex IO support
23646
23647 @geindex Text_IO
23648 @geindex extensions for unbounded strings
23649
23650 This package provides subprograms for Text_IO for unbounded
23651 strings, avoiding the necessity for an intermediate operation
23652 with ordinary strings.
23653
23654 @node Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,Ada Strings Unbounded Text_IO a-suteio ads,The GNAT Library
23655 @anchor{gnat_rm/the_gnat_library id28}@anchor{308}@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{309}
23656 @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
23657
23658
23659 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
23660
23661 @geindex Unbounded_Wide_String
23662 @geindex IO support
23663
23664 @geindex Text_IO
23665 @geindex extensions for unbounded wide strings
23666
23667 This package provides subprograms for Text_IO for unbounded
23668 wide strings, avoiding the necessity for an intermediate operation
23669 with ordinary wide strings.
23670
23671 @node Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,Ada Text_IO C_Streams a-tiocst ads,Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,The GNAT Library
23672 @anchor{gnat_rm/the_gnat_library id29}@anchor{30a}@anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{30b}
23673 @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
23674
23675
23676 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
23677
23678 @geindex Unbounded_Wide_Wide_String
23679 @geindex IO support
23680
23681 @geindex Text_IO
23682 @geindex extensions for unbounded wide wide strings
23683
23684 This package provides subprograms for Text_IO for unbounded
23685 wide wide strings, avoiding the necessity for an intermediate operation
23686 with ordinary wide wide strings.
23687
23688 @node Ada Text_IO C_Streams a-tiocst ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,The GNAT Library
23689 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{30c}@anchor{gnat_rm/the_gnat_library id30}@anchor{30d}
23690 @section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
23691
23692
23693 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
23694
23695 @geindex C Streams
23696 @geindex Interfacing with `@w{`}Text_IO`@w{`}
23697
23698 This package provides subprograms that allow interfacing between
23699 C streams and @code{Text_IO}. The stream identifier can be
23700 extracted from a file opened on the Ada side, and an Ada file
23701 can be constructed from a stream opened on the C side.
23702
23703 @node Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Wide_Characters Unicode a-wichun ads,Ada Text_IO C_Streams a-tiocst ads,The GNAT Library
23704 @anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{30e}@anchor{gnat_rm/the_gnat_library id31}@anchor{30f}
23705 @section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
23706
23707
23708 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
23709
23710 @geindex Text_IO resetting standard files
23711
23712 This procedure is used to reset the status of the standard files used
23713 by Ada.Text_IO. This is useful in a situation (such as a restart in an
23714 embedded application) where the status of the files may change during
23715 execution (for example a standard input file may be redefined to be
23716 interactive).
23717
23718 @node Ada Wide_Characters Unicode a-wichun ads,Ada Wide_Text_IO C_Streams a-wtcstr ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,The GNAT Library
23719 @anchor{gnat_rm/the_gnat_library id32}@anchor{310}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{311}
23720 @section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
23721
23722
23723 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
23724
23725 @geindex Unicode categorization
23726 @geindex Wide_Character
23727
23728 This package provides subprograms that allow categorization of
23729 Wide_Character values according to Unicode categories.
23730
23731 @node Ada Wide_Text_IO C_Streams a-wtcstr ads,Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,Ada Wide_Characters Unicode a-wichun ads,The GNAT Library
23732 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{312}@anchor{gnat_rm/the_gnat_library id33}@anchor{313}
23733 @section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
23734
23735
23736 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
23737
23738 @geindex C Streams
23739 @geindex Interfacing with `@w{`}Wide_Text_IO`@w{`}
23740
23741 This package provides subprograms that allow interfacing between
23742 C streams and @code{Wide_Text_IO}. The stream identifier can be
23743 extracted from a file opened on the Ada side, and an Ada file
23744 can be constructed from a stream opened on the C side.
23745
23746 @node Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,Ada Wide_Wide_Characters Unicode a-zchuni ads,Ada Wide_Text_IO C_Streams a-wtcstr ads,The GNAT Library
23747 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{314}@anchor{gnat_rm/the_gnat_library id34}@anchor{315}
23748 @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
23749
23750
23751 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
23752
23753 @geindex Wide_Text_IO resetting standard files
23754
23755 This procedure is used to reset the status of the standard files used
23756 by Ada.Wide_Text_IO. This is useful in a situation (such as a restart in an
23757 embedded application) where the status of the files may change during
23758 execution (for example a standard input file may be redefined to be
23759 interactive).
23760
23761 @node Ada Wide_Wide_Characters Unicode a-zchuni ads,Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,The GNAT Library
23762 @anchor{gnat_rm/the_gnat_library id35}@anchor{316}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{317}
23763 @section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
23764
23765
23766 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
23767
23768 @geindex Unicode categorization
23769 @geindex Wide_Wide_Character
23770
23771 This package provides subprograms that allow categorization of
23772 Wide_Wide_Character values according to Unicode categories.
23773
23774 @node Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,Ada Wide_Wide_Characters Unicode a-zchuni ads,The GNAT Library
23775 @anchor{gnat_rm/the_gnat_library id36}@anchor{318}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{319}
23776 @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
23777
23778
23779 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
23780
23781 @geindex C Streams
23782 @geindex Interfacing with `@w{`}Wide_Wide_Text_IO`@w{`}
23783
23784 This package provides subprograms that allow interfacing between
23785 C streams and @code{Wide_Wide_Text_IO}. The stream identifier can be
23786 extracted from a file opened on the Ada side, and an Ada file
23787 can be constructed from a stream opened on the C side.
23788
23789 @node Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,GNAT Altivec g-altive ads,Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,The GNAT Library
23790 @anchor{gnat_rm/the_gnat_library id37}@anchor{31a}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{31b}
23791 @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23792
23793
23794 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23795
23796 @geindex Wide_Wide_Text_IO resetting standard files
23797
23798 This procedure is used to reset the status of the standard files used
23799 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23800 restart in an embedded application) where the status of the files may
23801 change during execution (for example a standard input file may be
23802 redefined to be interactive).
23803
23804 @node GNAT Altivec g-altive ads,GNAT Altivec Conversions g-altcon ads,Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,The GNAT Library
23805 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{31c}@anchor{gnat_rm/the_gnat_library id38}@anchor{31d}
23806 @section @code{GNAT.Altivec} (@code{g-altive.ads})
23807
23808
23809 @geindex GNAT.Altivec (g-altive.ads)
23810
23811 @geindex AltiVec
23812
23813 This is the root package of the GNAT AltiVec binding. It provides
23814 definitions of constants and types common to all the versions of the
23815 binding.
23816
23817 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23818 @anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{31e}@anchor{gnat_rm/the_gnat_library id39}@anchor{31f}
23819 @section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23820
23821
23822 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23823
23824 @geindex AltiVec
23825
23826 This package provides the Vector/View conversion routines.
23827
23828 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23829 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{320}@anchor{gnat_rm/the_gnat_library id40}@anchor{321}
23830 @section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23831
23832
23833 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23834
23835 @geindex AltiVec
23836
23837 This package exposes the Ada interface to the AltiVec operations on
23838 vector objects. A soft emulation is included by default in the GNAT
23839 library. The hard binding is provided as a separate package. This unit
23840 is common to both bindings.
23841
23842 @node GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Vector_Views g-alvevi ads,GNAT Altivec Vector_Operations g-alveop ads,The GNAT Library
23843 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{322}@anchor{gnat_rm/the_gnat_library id41}@anchor{323}
23844 @section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23845
23846
23847 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23848
23849 @geindex AltiVec
23850
23851 This package exposes the various vector types part of the Ada binding
23852 to AltiVec facilities.
23853
23854 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23855 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{324}@anchor{gnat_rm/the_gnat_library id42}@anchor{325}
23856 @section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23857
23858
23859 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23860
23861 @geindex AltiVec
23862
23863 This package provides public 'View' data types from/to which private
23864 vector representations can be converted via
23865 GNAT.Altivec.Conversions. This allows convenient access to individual
23866 vector elements and provides a simple way to initialize vector
23867 objects.
23868
23869 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23870 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{326}@anchor{gnat_rm/the_gnat_library id43}@anchor{327}
23871 @section @code{GNAT.Array_Split} (@code{g-arrspl.ads})
23872
23873
23874 @geindex GNAT.Array_Split (g-arrspl.ads)
23875
23876 @geindex Array splitter
23877
23878 Useful array-manipulation routines: given a set of separators, split
23879 an array wherever the separators appear, and provide direct access
23880 to the resulting slices.
23881
23882 @node GNAT AWK g-awk ads,GNAT Bind_Environment g-binenv ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23883 @anchor{gnat_rm/the_gnat_library id44}@anchor{328}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{329}
23884 @section @code{GNAT.AWK} (@code{g-awk.ads})
23885
23886
23887 @geindex GNAT.AWK (g-awk.ads)
23888
23889 @geindex Parsing
23890
23891 @geindex AWK
23892
23893 Provides AWK-like parsing functions, with an easy interface for parsing one
23894 or more files containing formatted data. The file is viewed as a database
23895 where each record is a line and a field is a data element in this line.
23896
23897 @node GNAT Bind_Environment g-binenv ads,GNAT Branch_Prediction g-brapre ads,GNAT AWK g-awk ads,The GNAT Library
23898 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{32a}@anchor{gnat_rm/the_gnat_library id45}@anchor{32b}
23899 @section @code{GNAT.Bind_Environment} (@code{g-binenv.ads})
23900
23901
23902 @geindex GNAT.Bind_Environment (g-binenv.ads)
23903
23904 @geindex Bind environment
23905
23906 Provides access to key=value associations captured at bind time.
23907 These associations can be specified using the @code{-V} binder command
23908 line switch.
23909
23910 @node GNAT Branch_Prediction g-brapre ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
23911 @anchor{gnat_rm/the_gnat_library id46}@anchor{32c}@anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{32d}
23912 @section @code{GNAT.Branch_Prediction} (@code{g-brapre.ads})
23913
23914
23915 @geindex GNAT.Branch_Prediction (g-brapre.ads)
23916
23917 @geindex Branch Prediction
23918
23919 Provides routines giving hints to the branch predictor of the code generator.
23920
23921 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Branch_Prediction g-brapre ads,The GNAT Library
23922 @anchor{gnat_rm/the_gnat_library id47}@anchor{32e}@anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{32f}
23923 @section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
23924
23925
23926 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
23927
23928 @geindex Parsing
23929
23930 @geindex Bounded Buffers
23931
23932 Provides a concurrent generic bounded buffer abstraction. Instances are
23933 useful directly or as parts of the implementations of other abstractions,
23934 such as mailboxes.
23935
23936 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
23937 @anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{330}@anchor{gnat_rm/the_gnat_library id48}@anchor{331}
23938 @section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
23939
23940
23941 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
23942
23943 @geindex Parsing
23944
23945 @geindex Mailboxes
23946
23947 Provides a thread-safe asynchronous intertask mailbox communication facility.
23948
23949 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
23950 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{332}@anchor{gnat_rm/the_gnat_library id49}@anchor{333}
23951 @section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
23952
23953
23954 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
23955
23956 @geindex Sorting
23957
23958 @geindex Bubble sort
23959
23960 Provides a general implementation of bubble sort usable for sorting arbitrary
23961 data items. Exchange and comparison procedures are provided by passing
23962 access-to-procedure values.
23963
23964 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
23965 @anchor{gnat_rm/the_gnat_library id50}@anchor{334}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{335}
23966 @section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
23967
23968
23969 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
23970
23971 @geindex Sorting
23972
23973 @geindex Bubble sort
23974
23975 Provides a general implementation of bubble sort usable for sorting arbitrary
23976 data items. Move and comparison procedures are provided by passing
23977 access-to-procedure values. This is an older version, retained for
23978 compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
23979
23980 @node GNAT Bubble_Sort_G g-busorg ads,GNAT Byte_Order_Mark g-byorma ads,GNAT Bubble_Sort_A g-busora ads,The GNAT Library
23981 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{336}@anchor{gnat_rm/the_gnat_library id51}@anchor{337}
23982 @section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
23983
23984
23985 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
23986
23987 @geindex Sorting
23988
23989 @geindex Bubble sort
23990
23991 Similar to @code{Bubble_Sort_A} except that the move and sorting procedures
23992 are provided as generic parameters, this improves efficiency, especially
23993 if the procedures can be inlined, at the expense of duplicating code for
23994 multiple instantiations.
23995
23996 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
23997 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{338}@anchor{gnat_rm/the_gnat_library id52}@anchor{339}
23998 @section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
23999
24000
24001 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
24002
24003 @geindex UTF-8 representation
24004
24005 @geindex Wide characte representations
24006
24007 Provides a routine which given a string, reads the start of the string to
24008 see whether it is one of the standard byte order marks (BOM's) which signal
24009 the encoding of the string. The routine includes detection of special XML
24010 sequences for various UCS input formats.
24011
24012 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
24013 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{33a}@anchor{gnat_rm/the_gnat_library id53}@anchor{33b}
24014 @section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
24015
24016
24017 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
24018
24019 @geindex Byte swapping
24020
24021 @geindex Endianness
24022
24023 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
24024 Machine-specific implementations are available in some cases.
24025
24026 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
24027 @anchor{gnat_rm/the_gnat_library id54}@anchor{33c}@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{33d}
24028 @section @code{GNAT.Calendar} (@code{g-calend.ads})
24029
24030
24031 @geindex GNAT.Calendar (g-calend.ads)
24032
24033 @geindex Calendar
24034
24035 Extends the facilities provided by @code{Ada.Calendar} to include handling
24036 of days of the week, an extended @code{Split} and @code{Time_Of} capability.
24037 Also provides conversion of @code{Ada.Calendar.Time} values to and from the
24038 C @code{timeval} format.
24039
24040 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
24041 @anchor{gnat_rm/the_gnat_library id55}@anchor{33e}@anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{33f}
24042 @section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
24043
24044
24045 @geindex Calendar
24046
24047 @geindex Time
24048
24049 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
24050
24051 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
24052 @anchor{gnat_rm/the_gnat_library id56}@anchor{340}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{341}
24053 @section @code{GNAT.CRC32} (@code{g-crc32.ads})
24054
24055
24056 @geindex GNAT.CRC32 (g-crc32.ads)
24057
24058 @geindex CRC32
24059
24060 @geindex Cyclic Redundancy Check
24061
24062 This package implements the CRC-32 algorithm. For a full description
24063 of this algorithm see
24064 @emph{Computation of Cyclic Redundancy Checks via Table Look-Up},
24065 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
24066 Aug. 1988. Sarwate, D.V.
24067
24068 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
24069 @anchor{gnat_rm/the_gnat_library id57}@anchor{342}@anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{343}
24070 @section @code{GNAT.Case_Util} (@code{g-casuti.ads})
24071
24072
24073 @geindex GNAT.Case_Util (g-casuti.ads)
24074
24075 @geindex Casing utilities
24076
24077 @geindex Character handling (`@w{`}GNAT.Case_Util`@w{`})
24078
24079 A set of simple routines for handling upper and lower casing of strings
24080 without the overhead of the full casing tables
24081 in @code{Ada.Characters.Handling}.
24082
24083 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
24084 @anchor{gnat_rm/the_gnat_library id58}@anchor{344}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{345}
24085 @section @code{GNAT.CGI} (@code{g-cgi.ads})
24086
24087
24088 @geindex GNAT.CGI (g-cgi.ads)
24089
24090 @geindex CGI (Common Gateway Interface)
24091
24092 This is a package for interfacing a GNAT program with a Web server via the
24093 Common Gateway Interface (CGI). Basically this package parses the CGI
24094 parameters, which are a set of key/value pairs sent by the Web server. It
24095 builds a table whose index is the key and provides some services to deal
24096 with this table.
24097
24098 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
24099 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{346}@anchor{gnat_rm/the_gnat_library id59}@anchor{347}
24100 @section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
24101
24102
24103 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
24104
24105 @geindex CGI (Common Gateway Interface) cookie support
24106
24107 @geindex Cookie support in CGI
24108
24109 This is a package to interface a GNAT program with a Web server via the
24110 Common Gateway Interface (CGI). It exports services to deal with Web
24111 cookies (piece of information kept in the Web client software).
24112
24113 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
24114 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{348}@anchor{gnat_rm/the_gnat_library id60}@anchor{349}
24115 @section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads})
24116
24117
24118 @geindex GNAT.CGI.Debug (g-cgideb.ads)
24119
24120 @geindex CGI (Common Gateway Interface) debugging
24121
24122 This is a package to help debugging CGI (Common Gateway Interface)
24123 programs written in Ada.
24124
24125 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
24126 @anchor{gnat_rm/the_gnat_library id61}@anchor{34a}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{34b}
24127 @section @code{GNAT.Command_Line} (@code{g-comlin.ads})
24128
24129
24130 @geindex GNAT.Command_Line (g-comlin.ads)
24131
24132 @geindex Command line
24133
24134 Provides a high level interface to @code{Ada.Command_Line} facilities,
24135 including the ability to scan for named switches with optional parameters
24136 and expand file names using wildcard notations.
24137
24138 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
24139 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{34c}@anchor{gnat_rm/the_gnat_library id62}@anchor{34d}
24140 @section @code{GNAT.Compiler_Version} (@code{g-comver.ads})
24141
24142
24143 @geindex GNAT.Compiler_Version (g-comver.ads)
24144
24145 @geindex Compiler Version
24146
24147 @geindex Version
24148 @geindex of compiler
24149
24150 Provides a routine for obtaining the version of the compiler used to
24151 compile the program. More accurately this is the version of the binder
24152 used to bind the program (this will normally be the same as the version
24153 of the compiler if a consistent tool set is used to compile all units
24154 of a partition).
24155
24156 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
24157 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{34e}@anchor{gnat_rm/the_gnat_library id63}@anchor{34f}
24158 @section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
24159
24160
24161 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
24162
24163 @geindex Interrupt
24164
24165 Provides a simple interface to handle Ctrl-C keyboard events.
24166
24167 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
24168 @anchor{gnat_rm/the_gnat_library id64}@anchor{350}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{351}
24169 @section @code{GNAT.Current_Exception} (@code{g-curexc.ads})
24170
24171
24172 @geindex GNAT.Current_Exception (g-curexc.ads)
24173
24174 @geindex Current exception
24175
24176 @geindex Exception retrieval
24177
24178 Provides access to information on the current exception that has been raised
24179 without the need for using the Ada 95 / Ada 2005 exception choice parameter
24180 specification syntax.
24181 This is particularly useful in simulating typical facilities for
24182 obtaining information about exceptions provided by Ada 83 compilers.
24183
24184 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
24185 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{352}@anchor{gnat_rm/the_gnat_library id65}@anchor{353}
24186 @section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads})
24187
24188
24189 @geindex GNAT.Debug_Pools (g-debpoo.ads)
24190
24191 @geindex Debugging
24192
24193 @geindex Debug pools
24194
24195 @geindex Memory corruption debugging
24196
24197 Provide a debugging storage pools that helps tracking memory corruption
24198 problems.
24199 See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
24200
24201 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
24202 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{354}@anchor{gnat_rm/the_gnat_library id66}@anchor{355}
24203 @section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads})
24204
24205
24206 @geindex GNAT.Debug_Utilities (g-debuti.ads)
24207
24208 @geindex Debugging
24209
24210 Provides a few useful utilities for debugging purposes, including conversion
24211 to and from string images of address values. Supports both C and Ada formats
24212 for hexadecimal literals.
24213
24214 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
24215 @anchor{gnat_rm/the_gnat_library id67}@anchor{356}@anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{357}
24216 @section @code{GNAT.Decode_String} (@code{g-decstr.ads})
24217
24218
24219 @geindex GNAT.Decode_String (g-decstr.ads)
24220
24221 @geindex Decoding strings
24222
24223 @geindex String decoding
24224
24225 @geindex Wide character encoding
24226
24227 @geindex UTF-8
24228
24229 @geindex Unicode
24230
24231 A generic package providing routines for decoding wide character and wide wide
24232 character strings encoded as sequences of 8-bit characters using a specified
24233 encoding method. Includes validation routines, and also routines for stepping
24234 to next or previous encoded character in an encoded string.
24235 Useful in conjunction with Unicode character coding. Note there is a
24236 preinstantiation for UTF-8. See next entry.
24237
24238 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
24239 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{358}@anchor{gnat_rm/the_gnat_library id68}@anchor{359}
24240 @section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
24241
24242
24243 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
24244
24245 @geindex Decoding strings
24246
24247 @geindex Decoding UTF-8 strings
24248
24249 @geindex UTF-8 string decoding
24250
24251 @geindex Wide character decoding
24252
24253 @geindex UTF-8
24254
24255 @geindex Unicode
24256
24257 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
24258
24259 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
24260 @anchor{gnat_rm/the_gnat_library id69}@anchor{35a}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{35b}
24261 @section @code{GNAT.Directory_Operations} (@code{g-dirope.ads})
24262
24263
24264 @geindex GNAT.Directory_Operations (g-dirope.ads)
24265
24266 @geindex Directory operations
24267
24268 Provides a set of routines for manipulating directories, including changing
24269 the current directory, making new directories, and scanning the files in a
24270 directory.
24271
24272 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
24273 @anchor{gnat_rm/the_gnat_library id70}@anchor{35c}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{35d}
24274 @section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
24275
24276
24277 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
24278
24279 @geindex Directory operations iteration
24280
24281 A child unit of GNAT.Directory_Operations providing additional operations
24282 for iterating through directories.
24283
24284 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
24285 @anchor{gnat_rm/the_gnat_library id71}@anchor{35e}@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{35f}
24286 @section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
24287
24288
24289 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
24290
24291 @geindex Hash tables
24292
24293 A generic implementation of hash tables that can be used to hash arbitrary
24294 data. Provided in two forms, a simple form with built in hash functions,
24295 and a more complex form in which the hash function is supplied.
24296
24297 This package provides a facility similar to that of @code{GNAT.HTable},
24298 except that this package declares a type that can be used to define
24299 dynamic instances of the hash table, while an instantiation of
24300 @code{GNAT.HTable} creates a single instance of the hash table.
24301
24302 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
24303 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{360}@anchor{gnat_rm/the_gnat_library id72}@anchor{361}
24304 @section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
24305
24306
24307 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
24308
24309 @geindex Table implementation
24310
24311 @geindex Arrays
24312 @geindex extendable
24313
24314 A generic package providing a single dimension array abstraction where the
24315 length of the array can be dynamically modified.
24316
24317 This package provides a facility similar to that of @code{GNAT.Table},
24318 except that this package declares a type that can be used to define
24319 dynamic instances of the table, while an instantiation of
24320 @code{GNAT.Table} creates a single instance of the table type.
24321
24322 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
24323 @anchor{gnat_rm/the_gnat_library id73}@anchor{362}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{363}
24324 @section @code{GNAT.Encode_String} (@code{g-encstr.ads})
24325
24326
24327 @geindex GNAT.Encode_String (g-encstr.ads)
24328
24329 @geindex Encoding strings
24330
24331 @geindex String encoding
24332
24333 @geindex Wide character encoding
24334
24335 @geindex UTF-8
24336
24337 @geindex Unicode
24338
24339 A generic package providing routines for encoding wide character and wide
24340 wide character strings as sequences of 8-bit characters using a specified
24341 encoding method. Useful in conjunction with Unicode character coding.
24342 Note there is a preinstantiation for UTF-8. See next entry.
24343
24344 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
24345 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{364}@anchor{gnat_rm/the_gnat_library id74}@anchor{365}
24346 @section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
24347
24348
24349 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
24350
24351 @geindex Encoding strings
24352
24353 @geindex Encoding UTF-8 strings
24354
24355 @geindex UTF-8 string encoding
24356
24357 @geindex Wide character encoding
24358
24359 @geindex UTF-8
24360
24361 @geindex Unicode
24362
24363 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
24364
24365 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
24366 @anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{366}@anchor{gnat_rm/the_gnat_library id75}@anchor{367}
24367 @section @code{GNAT.Exception_Actions} (@code{g-excact.ads})
24368
24369
24370 @geindex GNAT.Exception_Actions (g-excact.ads)
24371
24372 @geindex Exception actions
24373
24374 Provides callbacks when an exception is raised. Callbacks can be registered
24375 for specific exceptions, or when any exception is raised. This
24376 can be used for instance to force a core dump to ease debugging.
24377
24378 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library
24379 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{368}@anchor{gnat_rm/the_gnat_library id76}@anchor{369}
24380 @section @code{GNAT.Exception_Traces} (@code{g-exctra.ads})
24381
24382
24383 @geindex GNAT.Exception_Traces (g-exctra.ads)
24384
24385 @geindex Exception traces
24386
24387 @geindex Debugging
24388
24389 Provides an interface allowing to control automatic output upon exception
24390 occurrences.
24391
24392 @node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
24393 @anchor{gnat_rm/the_gnat_library id77}@anchor{36a}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{36b}
24394 @section @code{GNAT.Exceptions} (@code{g-except.ads})
24395
24396
24397 @geindex GNAT.Exceptions (g-except.ads)
24398
24399 @geindex Exceptions
24400 @geindex Pure
24401
24402 @geindex Pure packages
24403 @geindex exceptions
24404
24405 Normally it is not possible to raise an exception with
24406 a message from a subprogram in a pure package, since the
24407 necessary types and subprograms are in @code{Ada.Exceptions}
24408 which is not a pure unit. @code{GNAT.Exceptions} provides a
24409 facility for getting around this limitation for a few
24410 predefined exceptions, and for example allow raising
24411 @code{Constraint_Error} with a message from a pure subprogram.
24412
24413 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library
24414 @anchor{gnat_rm/the_gnat_library id78}@anchor{36c}@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{36d}
24415 @section @code{GNAT.Expect} (@code{g-expect.ads})
24416
24417
24418 @geindex GNAT.Expect (g-expect.ads)
24419
24420 Provides a set of subprograms similar to what is available
24421 with the standard Tcl Expect tool.
24422 It allows you to easily spawn and communicate with an external process.
24423 You can send commands or inputs to the process, and compare the output
24424 with some expected regular expression. Currently @code{GNAT.Expect}
24425 is implemented on all native GNAT ports.
24426 It is not implemented for cross ports, and in particular is not
24427 implemented for VxWorks or LynxOS.
24428
24429 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
24430 @anchor{gnat_rm/the_gnat_library id79}@anchor{36e}@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{36f}
24431 @section @code{GNAT.Expect.TTY} (@code{g-exptty.ads})
24432
24433
24434 @geindex GNAT.Expect.TTY (g-exptty.ads)
24435
24436 As GNAT.Expect but using pseudo-terminal.
24437 Currently @code{GNAT.Expect.TTY} is implemented on all native GNAT
24438 ports. It is not implemented for cross ports, and
24439 in particular is not implemented for VxWorks or LynxOS.
24440
24441 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
24442 @anchor{gnat_rm/the_gnat_library id80}@anchor{370}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{371}
24443 @section @code{GNAT.Float_Control} (@code{g-flocon.ads})
24444
24445
24446 @geindex GNAT.Float_Control (g-flocon.ads)
24447
24448 @geindex Floating-Point Processor
24449
24450 Provides an interface for resetting the floating-point processor into the
24451 mode required for correct semantic operation in Ada. Some third party
24452 library calls may cause this mode to be modified, and the Reset procedure
24453 in this package can be used to reestablish the required mode.
24454
24455 @node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
24456 @anchor{gnat_rm/the_gnat_library id81}@anchor{372}@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{373}
24457 @section @code{GNAT.Formatted_String} (@code{g-forstr.ads})
24458
24459
24460 @geindex GNAT.Formatted_String (g-forstr.ads)
24461
24462 @geindex Formatted String
24463
24464 Provides support for C/C++ printf() formatted strings. The format is
24465 copied from the printf() routine and should therefore gives identical
24466 output. Some generic routines are provided to be able to use types
24467 derived from Integer, Float or enumerations as values for the
24468 formatted string.
24469
24470 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
24471 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{374}@anchor{gnat_rm/the_gnat_library id82}@anchor{375}
24472 @section @code{GNAT.Heap_Sort} (@code{g-heasor.ads})
24473
24474
24475 @geindex GNAT.Heap_Sort (g-heasor.ads)
24476
24477 @geindex Sorting
24478
24479 Provides a general implementation of heap sort usable for sorting arbitrary
24480 data items. Exchange and comparison procedures are provided by passing
24481 access-to-procedure values. The algorithm used is a modified heap sort
24482 that performs approximately N*log(N) comparisons in the worst case.
24483
24484 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
24485 @anchor{gnat_rm/the_gnat_library id83}@anchor{376}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{377}
24486 @section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
24487
24488
24489 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
24490
24491 @geindex Sorting
24492
24493 Provides a general implementation of heap sort usable for sorting arbitrary
24494 data items. Move and comparison procedures are provided by passing
24495 access-to-procedure values. The algorithm used is a modified heap sort
24496 that performs approximately N*log(N) comparisons in the worst case.
24497 This differs from @code{GNAT.Heap_Sort} in having a less convenient
24498 interface, but may be slightly more efficient.
24499
24500 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
24501 @anchor{gnat_rm/the_gnat_library id84}@anchor{378}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{379}
24502 @section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
24503
24504
24505 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
24506
24507 @geindex Sorting
24508
24509 Similar to @code{Heap_Sort_A} except that the move and sorting procedures
24510 are provided as generic parameters, this improves efficiency, especially
24511 if the procedures can be inlined, at the expense of duplicating code for
24512 multiple instantiations.
24513
24514 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
24515 @anchor{gnat_rm/the_gnat_library id85}@anchor{37a}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{37b}
24516 @section @code{GNAT.HTable} (@code{g-htable.ads})
24517
24518
24519 @geindex GNAT.HTable (g-htable.ads)
24520
24521 @geindex Hash tables
24522
24523 A generic implementation of hash tables that can be used to hash arbitrary
24524 data. Provides two approaches, one a simple static approach, and the other
24525 allowing arbitrary dynamic hash tables.
24526
24527 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
24528 @anchor{gnat_rm/the_gnat_library id86}@anchor{37c}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{37d}
24529 @section @code{GNAT.IO} (@code{g-io.ads})
24530
24531
24532 @geindex GNAT.IO (g-io.ads)
24533
24534 @geindex Simple I/O
24535
24536 @geindex Input/Output facilities
24537
24538 A simple preelaborable input-output package that provides a subset of
24539 simple Text_IO functions for reading characters and strings from
24540 Standard_Input, and writing characters, strings and integers to either
24541 Standard_Output or Standard_Error.
24542
24543 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
24544 @anchor{gnat_rm/the_gnat_library id87}@anchor{37e}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{37f}
24545 @section @code{GNAT.IO_Aux} (@code{g-io_aux.ads})
24546
24547
24548 @geindex GNAT.IO_Aux (g-io_aux.ads)
24549
24550 @geindex Text_IO
24551
24552 @geindex Input/Output facilities
24553
24554 Provides some auxiliary functions for use with Text_IO, including a test
24555 for whether a file exists, and functions for reading a line of text.
24556
24557 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
24558 @anchor{gnat_rm/the_gnat_library id88}@anchor{380}@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{381}
24559 @section @code{GNAT.Lock_Files} (@code{g-locfil.ads})
24560
24561
24562 @geindex GNAT.Lock_Files (g-locfil.ads)
24563
24564 @geindex File locking
24565
24566 @geindex Locking using files
24567
24568 Provides a general interface for using files as locks. Can be used for
24569 providing program level synchronization.
24570
24571 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
24572 @anchor{gnat_rm/the_gnat_library id89}@anchor{382}@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{383}
24573 @section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
24574
24575
24576 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
24577
24578 @geindex Random number generation
24579
24580 The original implementation of @code{Ada.Numerics.Discrete_Random}. Uses
24581 a modified version of the Blum-Blum-Shub generator.
24582
24583 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
24584 @anchor{gnat_rm/the_gnat_library id90}@anchor{384}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{385}
24585 @section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
24586
24587
24588 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
24589
24590 @geindex Random number generation
24591
24592 The original implementation of @code{Ada.Numerics.Float_Random}. Uses
24593 a modified version of the Blum-Blum-Shub generator.
24594
24595 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
24596 @anchor{gnat_rm/the_gnat_library id91}@anchor{386}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{387}
24597 @section @code{GNAT.MD5} (@code{g-md5.ads})
24598
24599
24600 @geindex GNAT.MD5 (g-md5.ads)
24601
24602 @geindex Message Digest MD5
24603
24604 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
24605 the HMAC-MD5 message authentication function as described in RFC 2104 and
24606 FIPS PUB 198.
24607
24608 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
24609 @anchor{gnat_rm/the_gnat_library id92}@anchor{388}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{389}
24610 @section @code{GNAT.Memory_Dump} (@code{g-memdum.ads})
24611
24612
24613 @geindex GNAT.Memory_Dump (g-memdum.ads)
24614
24615 @geindex Dump Memory
24616
24617 Provides a convenient routine for dumping raw memory to either the
24618 standard output or standard error files. Uses GNAT.IO for actual
24619 output.
24620
24621 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
24622 @anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{38a}@anchor{gnat_rm/the_gnat_library id93}@anchor{38b}
24623 @section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
24624
24625
24626 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
24627
24628 @geindex Exception
24629 @geindex obtaining most recent
24630
24631 Provides access to the most recently raised exception. Can be used for
24632 various logging purposes, including duplicating functionality of some
24633 Ada 83 implementation dependent extensions.
24634
24635 @node GNAT OS_Lib g-os_lib ads,GNAT Perfect_Hash_Generators g-pehage ads,GNAT Most_Recent_Exception g-moreex ads,The GNAT Library
24636 @anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{38c}@anchor{gnat_rm/the_gnat_library id94}@anchor{38d}
24637 @section @code{GNAT.OS_Lib} (@code{g-os_lib.ads})
24638
24639
24640 @geindex GNAT.OS_Lib (g-os_lib.ads)
24641
24642 @geindex Operating System interface
24643
24644 @geindex Spawn capability
24645
24646 Provides a range of target independent operating system interface functions,
24647 including time/date management, file operations, subprocess management,
24648 including a portable spawn procedure, and access to environment variables
24649 and error return codes.
24650
24651 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
24652 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{38e}@anchor{gnat_rm/the_gnat_library id95}@anchor{38f}
24653 @section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
24654
24655
24656 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
24657
24658 @geindex Hash functions
24659
24660 Provides a generator of static minimal perfect hash functions. No
24661 collisions occur and each item can be retrieved from the table in one
24662 probe (perfect property). The hash table size corresponds to the exact
24663 size of the key set and no larger (minimal property). The key set has to
24664 be know in advance (static property). The hash functions are also order
24665 preserving. If w2 is inserted after w1 in the generator, their
24666 hashcode are in the same order. These hashing functions are very
24667 convenient for use with realtime applications.
24668
24669 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
24670 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{390}@anchor{gnat_rm/the_gnat_library id96}@anchor{391}
24671 @section @code{GNAT.Random_Numbers} (@code{g-rannum.ads})
24672
24673
24674 @geindex GNAT.Random_Numbers (g-rannum.ads)
24675
24676 @geindex Random number generation
24677
24678 Provides random number capabilities which extend those available in the
24679 standard Ada library and are more convenient to use.
24680
24681 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
24682 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{259}@anchor{gnat_rm/the_gnat_library id97}@anchor{392}
24683 @section @code{GNAT.Regexp} (@code{g-regexp.ads})
24684
24685
24686 @geindex GNAT.Regexp (g-regexp.ads)
24687
24688 @geindex Regular expressions
24689
24690 @geindex Pattern matching
24691
24692 A simple implementation of regular expressions, using a subset of regular
24693 expression syntax copied from familiar Unix style utilities. This is the
24694 simplest of the three pattern matching packages provided, and is particularly
24695 suitable for 'file globbing' applications.
24696
24697 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
24698 @anchor{gnat_rm/the_gnat_library id98}@anchor{393}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{394}
24699 @section @code{GNAT.Registry} (@code{g-regist.ads})
24700
24701
24702 @geindex GNAT.Registry (g-regist.ads)
24703
24704 @geindex Windows Registry
24705
24706 This is a high level binding to the Windows registry. It is possible to
24707 do simple things like reading a key value, creating a new key. For full
24708 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
24709 package provided with the Win32Ada binding
24710
24711 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
24712 @anchor{gnat_rm/the_gnat_library id99}@anchor{395}@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{396}
24713 @section @code{GNAT.Regpat} (@code{g-regpat.ads})
24714
24715
24716 @geindex GNAT.Regpat (g-regpat.ads)
24717
24718 @geindex Regular expressions
24719
24720 @geindex Pattern matching
24721
24722 A complete implementation of Unix-style regular expression matching, copied
24723 from the original V7 style regular expression library written in C by
24724 Henry Spencer (and binary compatible with this C library).
24725
24726 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
24727 @anchor{gnat_rm/the_gnat_library id100}@anchor{397}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{398}
24728 @section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
24729
24730
24731 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
24732
24733 @geindex Rewrite data
24734
24735 A unit to rewrite on-the-fly string occurrences in a stream of
24736 data. The implementation has a very minimal memory footprint as the
24737 full content to be processed is not loaded into memory all at once. This makes
24738 this interface usable for large files or socket streams.
24739
24740 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
24741 @anchor{gnat_rm/the_gnat_library id101}@anchor{399}@anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{39a}
24742 @section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
24743
24744
24745 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
24746
24747 @geindex Secondary Stack Info
24748
24749 Provide the capability to query the high water mark of the current task's
24750 secondary stack.
24751
24752 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
24753 @anchor{gnat_rm/the_gnat_library id102}@anchor{39b}@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{39c}
24754 @section @code{GNAT.Semaphores} (@code{g-semaph.ads})
24755
24756
24757 @geindex GNAT.Semaphores (g-semaph.ads)
24758
24759 @geindex Semaphores
24760
24761 Provides classic counting and binary semaphores using protected types.
24762
24763 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
24764 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{39d}@anchor{gnat_rm/the_gnat_library id103}@anchor{39e}
24765 @section @code{GNAT.Serial_Communications} (@code{g-sercom.ads})
24766
24767
24768 @geindex GNAT.Serial_Communications (g-sercom.ads)
24769
24770 @geindex Serial_Communications
24771
24772 Provides a simple interface to send and receive data over a serial
24773 port. This is only supported on GNU/Linux and Windows.
24774
24775 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
24776 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{39f}@anchor{gnat_rm/the_gnat_library id104}@anchor{3a0}
24777 @section @code{GNAT.SHA1} (@code{g-sha1.ads})
24778
24779
24780 @geindex GNAT.SHA1 (g-sha1.ads)
24781
24782 @geindex Secure Hash Algorithm SHA-1
24783
24784 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
24785 and RFC 3174, and the HMAC-SHA1 message authentication function as described
24786 in RFC 2104 and FIPS PUB 198.
24787
24788 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
24789 @anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{3a1}@anchor{gnat_rm/the_gnat_library id105}@anchor{3a2}
24790 @section @code{GNAT.SHA224} (@code{g-sha224.ads})
24791
24792
24793 @geindex GNAT.SHA224 (g-sha224.ads)
24794
24795 @geindex Secure Hash Algorithm SHA-224
24796
24797 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24798 and the HMAC-SHA224 message authentication function as described
24799 in RFC 2104 and FIPS PUB 198.
24800
24801 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24802 @anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{3a3}@anchor{gnat_rm/the_gnat_library id106}@anchor{3a4}
24803 @section @code{GNAT.SHA256} (@code{g-sha256.ads})
24804
24805
24806 @geindex GNAT.SHA256 (g-sha256.ads)
24807
24808 @geindex Secure Hash Algorithm SHA-256
24809
24810 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24811 and the HMAC-SHA256 message authentication function as described
24812 in RFC 2104 and FIPS PUB 198.
24813
24814 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24815 @anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{3a5}@anchor{gnat_rm/the_gnat_library id107}@anchor{3a6}
24816 @section @code{GNAT.SHA384} (@code{g-sha384.ads})
24817
24818
24819 @geindex GNAT.SHA384 (g-sha384.ads)
24820
24821 @geindex Secure Hash Algorithm SHA-384
24822
24823 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24824 and the HMAC-SHA384 message authentication function as described
24825 in RFC 2104 and FIPS PUB 198.
24826
24827 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24828 @anchor{gnat_rm/the_gnat_library id108}@anchor{3a7}@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3a8}
24829 @section @code{GNAT.SHA512} (@code{g-sha512.ads})
24830
24831
24832 @geindex GNAT.SHA512 (g-sha512.ads)
24833
24834 @geindex Secure Hash Algorithm SHA-512
24835
24836 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24837 and the HMAC-SHA512 message authentication function as described
24838 in RFC 2104 and FIPS PUB 198.
24839
24840 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24841 @anchor{gnat_rm/the_gnat_library id109}@anchor{3a9}@anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3aa}
24842 @section @code{GNAT.Signals} (@code{g-signal.ads})
24843
24844
24845 @geindex GNAT.Signals (g-signal.ads)
24846
24847 @geindex Signals
24848
24849 Provides the ability to manipulate the blocked status of signals on supported
24850 targets.
24851
24852 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24853 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3ab}@anchor{gnat_rm/the_gnat_library id110}@anchor{3ac}
24854 @section @code{GNAT.Sockets} (@code{g-socket.ads})
24855
24856
24857 @geindex GNAT.Sockets (g-socket.ads)
24858
24859 @geindex Sockets
24860
24861 A high level and portable interface to develop sockets based applications.
24862 This package is based on the sockets thin binding found in
24863 @code{GNAT.Sockets.Thin}. Currently @code{GNAT.Sockets} is implemented
24864 on all native GNAT ports and on VxWorks cross prots. It is not implemented for
24865 the LynxOS cross port.
24866
24867 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
24868 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3ad}@anchor{gnat_rm/the_gnat_library id111}@anchor{3ae}
24869 @section @code{GNAT.Source_Info} (@code{g-souinf.ads})
24870
24871
24872 @geindex GNAT.Source_Info (g-souinf.ads)
24873
24874 @geindex Source Information
24875
24876 Provides subprograms that give access to source code information known at
24877 compile time, such as the current file name and line number. Also provides
24878 subprograms yielding the date and time of the current compilation (like the
24879 C macros @code{__DATE__} and @code{__TIME__})
24880
24881 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
24882 @anchor{gnat_rm/the_gnat_library id112}@anchor{3af}@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3b0}
24883 @section @code{GNAT.Spelling_Checker} (@code{g-speche.ads})
24884
24885
24886 @geindex GNAT.Spelling_Checker (g-speche.ads)
24887
24888 @geindex Spell checking
24889
24890 Provides a function for determining whether one string is a plausible
24891 near misspelling of another string.
24892
24893 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
24894 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3b1}@anchor{gnat_rm/the_gnat_library id113}@anchor{3b2}
24895 @section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
24896
24897
24898 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
24899
24900 @geindex Spell checking
24901
24902 Provides a generic function that can be instantiated with a string type for
24903 determining whether one string is a plausible near misspelling of another
24904 string.
24905
24906 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
24907 @anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3b3}@anchor{gnat_rm/the_gnat_library id114}@anchor{3b4}
24908 @section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
24909
24910
24911 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
24912
24913 @geindex SPITBOL pattern matching
24914
24915 @geindex Pattern matching
24916
24917 A complete implementation of SNOBOL4 style pattern matching. This is the
24918 most elaborate of the pattern matching packages provided. It fully duplicates
24919 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
24920 efficient algorithm developed by Robert Dewar for the SPITBOL system.
24921
24922 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
24923 @anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3b5}@anchor{gnat_rm/the_gnat_library id115}@anchor{3b6}
24924 @section @code{GNAT.Spitbol} (@code{g-spitbo.ads})
24925
24926
24927 @geindex GNAT.Spitbol (g-spitbo.ads)
24928
24929 @geindex SPITBOL interface
24930
24931 The top level package of the collection of SPITBOL-style functionality, this
24932 package provides basic SNOBOL4 string manipulation functions, such as
24933 Pad, Reverse, Trim, Substr capability, as well as a generic table function
24934 useful for constructing arbitrary mappings from strings in the style of
24935 the SNOBOL4 TABLE function.
24936
24937 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
24938 @anchor{gnat_rm/the_gnat_library id116}@anchor{3b7}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3b8}
24939 @section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
24940
24941
24942 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
24943
24944 @geindex Sets of strings
24945
24946 @geindex SPITBOL Tables
24947
24948 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24949 for type @code{Standard.Boolean}, giving an implementation of sets of
24950 string values.
24951
24952 @node GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol Table_VString g-sptavs ads,GNAT Spitbol Table_Boolean g-sptabo ads,The GNAT Library
24953 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3b9}@anchor{gnat_rm/the_gnat_library id117}@anchor{3ba}
24954 @section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
24955
24956
24957 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
24958
24959 @geindex Integer maps
24960
24961 @geindex Maps
24962
24963 @geindex SPITBOL Tables
24964
24965 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24966 for type @code{Standard.Integer}, giving an implementation of maps
24967 from string to integer values.
24968
24969 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
24970 @anchor{gnat_rm/the_gnat_library id118}@anchor{3bb}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3bc}
24971 @section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
24972
24973
24974 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
24975
24976 @geindex String maps
24977
24978 @geindex Maps
24979
24980 @geindex SPITBOL Tables
24981
24982 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table} for
24983 a variable length string type, giving an implementation of general
24984 maps from strings to strings.
24985
24986 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
24987 @anchor{gnat_rm/the_gnat_library id119}@anchor{3bd}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3be}
24988 @section @code{GNAT.SSE} (@code{g-sse.ads})
24989
24990
24991 @geindex GNAT.SSE (g-sse.ads)
24992
24993 Root of a set of units aimed at offering Ada bindings to a subset of
24994 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
24995 targets. It exposes vector component types together with a general
24996 introduction to the binding contents and use.
24997
24998 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
24999 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3bf}@anchor{gnat_rm/the_gnat_library id120}@anchor{3c0}
25000 @section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
25001
25002
25003 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
25004
25005 SSE vector types for use with SSE related intrinsics.
25006
25007 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
25008 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3c1}@anchor{gnat_rm/the_gnat_library id121}@anchor{3c2}
25009 @section @code{GNAT.String_Hash} (@code{g-strhas.ads})
25010
25011
25012 @geindex GNAT.String_Hash (g-strhas.ads)
25013
25014 @geindex Hash functions
25015
25016 Provides a generic hash function working on arrays of scalars. Both the scalar
25017 type and the hash result type are parameters.
25018
25019 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
25020 @anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3c3}@anchor{gnat_rm/the_gnat_library id122}@anchor{3c4}
25021 @section @code{GNAT.Strings} (@code{g-string.ads})
25022
25023
25024 @geindex GNAT.Strings (g-string.ads)
25025
25026 Common String access types and related subprograms. Basically it
25027 defines a string access and an array of string access types.
25028
25029 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
25030 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3c5}@anchor{gnat_rm/the_gnat_library id123}@anchor{3c6}
25031 @section @code{GNAT.String_Split} (@code{g-strspl.ads})
25032
25033
25034 @geindex GNAT.String_Split (g-strspl.ads)
25035
25036 @geindex String splitter
25037
25038 Useful string manipulation routines: given a set of separators, split
25039 a string wherever the separators appear, and provide direct access
25040 to the resulting slices. This package is instantiated from
25041 @code{GNAT.Array_Split}.
25042
25043 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
25044 @anchor{gnat_rm/the_gnat_library id124}@anchor{3c7}@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3c8}
25045 @section @code{GNAT.Table} (@code{g-table.ads})
25046
25047
25048 @geindex GNAT.Table (g-table.ads)
25049
25050 @geindex Table implementation
25051
25052 @geindex Arrays
25053 @geindex extendable
25054
25055 A generic package providing a single dimension array abstraction where the
25056 length of the array can be dynamically modified.
25057
25058 This package provides a facility similar to that of @code{GNAT.Dynamic_Tables},
25059 except that this package declares a single instance of the table type,
25060 while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
25061 used to define dynamic instances of the table.
25062
25063 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
25064 @anchor{gnat_rm/the_gnat_library id125}@anchor{3c9}@anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3ca}
25065 @section @code{GNAT.Task_Lock} (@code{g-tasloc.ads})
25066
25067
25068 @geindex GNAT.Task_Lock (g-tasloc.ads)
25069
25070 @geindex Task synchronization
25071
25072 @geindex Task locking
25073
25074 @geindex Locking
25075
25076 A very simple facility for locking and unlocking sections of code using a
25077 single global task lock. Appropriate for use in situations where contention
25078 between tasks is very rarely expected.
25079
25080 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
25081 @anchor{gnat_rm/the_gnat_library id126}@anchor{3cb}@anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3cc}
25082 @section @code{GNAT.Time_Stamp} (@code{g-timsta.ads})
25083
25084
25085 @geindex GNAT.Time_Stamp (g-timsta.ads)
25086
25087 @geindex Time stamp
25088
25089 @geindex Current time
25090
25091 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
25092 represents the current date and time in ISO 8601 format. This is a very simple
25093 routine with minimal code and there are no dependencies on any other unit.
25094
25095 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
25096 @anchor{gnat_rm/the_gnat_library id127}@anchor{3cd}@anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3ce}
25097 @section @code{GNAT.Threads} (@code{g-thread.ads})
25098
25099
25100 @geindex GNAT.Threads (g-thread.ads)
25101
25102 @geindex Foreign threads
25103
25104 @geindex Threads
25105 @geindex foreign
25106
25107 Provides facilities for dealing with foreign threads which need to be known
25108 by the GNAT run-time system. Consult the documentation of this package for
25109 further details if your program has threads that are created by a non-Ada
25110 environment which then accesses Ada code.
25111
25112 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
25113 @anchor{gnat_rm/the_gnat_library id128}@anchor{3cf}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3d0}
25114 @section @code{GNAT.Traceback} (@code{g-traceb.ads})
25115
25116
25117 @geindex GNAT.Traceback (g-traceb.ads)
25118
25119 @geindex Trace back facilities
25120
25121 Provides a facility for obtaining non-symbolic traceback information, useful
25122 in various debugging situations.
25123
25124 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
25125 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3d1}@anchor{gnat_rm/the_gnat_library id129}@anchor{3d2}
25126 @section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
25127
25128
25129 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
25130
25131 @geindex Trace back facilities
25132
25133 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
25134 @anchor{gnat_rm/the_gnat_library id130}@anchor{3d3}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3d4}
25135 @section @code{GNAT.UTF_32} (@code{g-table.ads})
25136
25137
25138 @geindex GNAT.UTF_32 (g-table.ads)
25139
25140 @geindex Wide character codes
25141
25142 This is a package intended to be used in conjunction with the
25143 @code{Wide_Character} type in Ada 95 and the
25144 @code{Wide_Wide_Character} type in Ada 2005 (available
25145 in @code{GNAT} in Ada 2005 mode). This package contains
25146 Unicode categorization routines, as well as lexical
25147 categorization routines corresponding to the Ada 2005
25148 lexical rules for identifiers and strings, and also a
25149 lower case to upper case fold routine corresponding to
25150 the Ada 2005 rules for identifier equivalence.
25151
25152 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
25153 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3d5}@anchor{gnat_rm/the_gnat_library id131}@anchor{3d6}
25154 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
25155
25156
25157 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
25158
25159 @geindex Spell checking
25160
25161 Provides a function for determining whether one wide wide string is a plausible
25162 near misspelling of another wide wide string, where the strings are represented
25163 using the UTF_32_String type defined in System.Wch_Cnv.
25164
25165 @node GNAT Wide_Spelling_Checker g-wispch ads,GNAT Wide_String_Split g-wistsp ads,GNAT Wide_Spelling_Checker g-u3spch ads,The GNAT Library
25166 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3d7}@anchor{gnat_rm/the_gnat_library id132}@anchor{3d8}
25167 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
25168
25169
25170 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
25171
25172 @geindex Spell checking
25173
25174 Provides a function for determining whether one wide string is a plausible
25175 near misspelling of another wide string.
25176
25177 @node GNAT Wide_String_Split g-wistsp ads,GNAT Wide_Wide_Spelling_Checker g-zspche ads,GNAT Wide_Spelling_Checker g-wispch ads,The GNAT Library
25178 @anchor{gnat_rm/the_gnat_library id133}@anchor{3d9}@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3da}
25179 @section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
25180
25181
25182 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
25183
25184 @geindex Wide_String splitter
25185
25186 Useful wide string manipulation routines: given a set of separators, split
25187 a wide string wherever the separators appear, and provide direct access
25188 to the resulting slices. This package is instantiated from
25189 @code{GNAT.Array_Split}.
25190
25191 @node GNAT Wide_Wide_Spelling_Checker g-zspche ads,GNAT Wide_Wide_String_Split g-zistsp ads,GNAT Wide_String_Split g-wistsp ads,The GNAT Library
25192 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3db}@anchor{gnat_rm/the_gnat_library id134}@anchor{3dc}
25193 @section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
25194
25195
25196 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
25197
25198 @geindex Spell checking
25199
25200 Provides a function for determining whether one wide wide string is a plausible
25201 near misspelling of another wide wide string.
25202
25203 @node GNAT Wide_Wide_String_Split g-zistsp ads,Interfaces C Extensions i-cexten ads,GNAT Wide_Wide_Spelling_Checker g-zspche ads,The GNAT Library
25204 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3dd}@anchor{gnat_rm/the_gnat_library id135}@anchor{3de}
25205 @section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
25206
25207
25208 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
25209
25210 @geindex Wide_Wide_String splitter
25211
25212 Useful wide wide string manipulation routines: given a set of separators, split
25213 a wide wide string wherever the separators appear, and provide direct access
25214 to the resulting slices. This package is instantiated from
25215 @code{GNAT.Array_Split}.
25216
25217 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
25218 @anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3df}@anchor{gnat_rm/the_gnat_library id136}@anchor{3e0}
25219 @section @code{Interfaces.C.Extensions} (@code{i-cexten.ads})
25220
25221
25222 @geindex Interfaces.C.Extensions (i-cexten.ads)
25223
25224 This package contains additional C-related definitions, intended
25225 for use with either manually or automatically generated bindings
25226 to C libraries.
25227
25228 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
25229 @anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3e1}@anchor{gnat_rm/the_gnat_library id137}@anchor{3e2}
25230 @section @code{Interfaces.C.Streams} (@code{i-cstrea.ads})
25231
25232
25233 @geindex Interfaces.C.Streams (i-cstrea.ads)
25234
25235 @geindex C streams
25236 @geindex interfacing
25237
25238 This package is a binding for the most commonly used operations
25239 on C streams.
25240
25241 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
25242 @anchor{gnat_rm/the_gnat_library id138}@anchor{3e3}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3e4}
25243 @section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
25244
25245
25246 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
25247
25248 @geindex IBM Packed Format
25249
25250 @geindex Packed Decimal
25251
25252 This package provides a set of routines for conversions to and
25253 from a packed decimal format compatible with that used on IBM
25254 mainframes.
25255
25256 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
25257 @anchor{gnat_rm/the_gnat_library id139}@anchor{3e5}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3e6}
25258 @section @code{Interfaces.VxWorks} (@code{i-vxwork.ads})
25259
25260
25261 @geindex Interfaces.VxWorks (i-vxwork.ads)
25262
25263 @geindex Interfacing to VxWorks
25264
25265 @geindex VxWorks
25266 @geindex interfacing
25267
25268 This package provides a limited binding to the VxWorks API.
25269 In particular, it interfaces with the
25270 VxWorks hardware interrupt facilities.
25271
25272 @node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
25273 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3e7}@anchor{gnat_rm/the_gnat_library id140}@anchor{3e8}
25274 @section @code{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads})
25275
25276
25277 @geindex Interfaces.VxWorks.Int_Connection (i-vxinco.ads)
25278
25279 @geindex Interfacing to VxWorks
25280
25281 @geindex VxWorks
25282 @geindex interfacing
25283
25284 This package provides a way for users to replace the use of
25285 intConnect() with a custom routine for installing interrupt
25286 handlers.
25287
25288 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library
25289 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3e9}@anchor{gnat_rm/the_gnat_library id141}@anchor{3ea}
25290 @section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
25291
25292
25293 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
25294
25295 @geindex Interfacing to VxWorks' I/O
25296
25297 @geindex VxWorks
25298 @geindex I/O interfacing
25299
25300 @geindex VxWorks
25301 @geindex Get_Immediate
25302
25303 @geindex Get_Immediate
25304 @geindex VxWorks
25305
25306 This package provides a binding to the ioctl (IO/Control)
25307 function of VxWorks, defining a set of option values and
25308 function codes. A particular use of this package is
25309 to enable the use of Get_Immediate under VxWorks.
25310
25311 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
25312 @anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3eb}@anchor{gnat_rm/the_gnat_library id142}@anchor{3ec}
25313 @section @code{System.Address_Image} (@code{s-addima.ads})
25314
25315
25316 @geindex System.Address_Image (s-addima.ads)
25317
25318 @geindex Address image
25319
25320 @geindex Image
25321 @geindex of an address
25322
25323 This function provides a useful debugging
25324 function that gives an (implementation dependent)
25325 string which identifies an address.
25326
25327 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
25328 @anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3ed}@anchor{gnat_rm/the_gnat_library id143}@anchor{3ee}
25329 @section @code{System.Assertions} (@code{s-assert.ads})
25330
25331
25332 @geindex System.Assertions (s-assert.ads)
25333
25334 @geindex Assertions
25335
25336 @geindex Assert_Failure
25337 @geindex exception
25338
25339 This package provides the declaration of the exception raised
25340 by an run-time assertion failure, as well as the routine that
25341 is used internally to raise this assertion.
25342
25343 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
25344 @anchor{gnat_rm/the_gnat_library id144}@anchor{3ef}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3f0}
25345 @section @code{System.Atomic_Counters} (@code{s-atocou.ads})
25346
25347
25348 @geindex System.Atomic_Counters (s-atocou.ads)
25349
25350 This package provides the declaration of an atomic counter type,
25351 together with efficient routines (using hardware
25352 synchronization primitives) for incrementing, decrementing,
25353 and testing of these counters. This package is implemented
25354 on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
25355 x86, and x86_64 platforms.
25356
25357 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
25358 @anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3f1}@anchor{gnat_rm/the_gnat_library id145}@anchor{3f2}
25359 @section @code{System.Memory} (@code{s-memory.ads})
25360
25361
25362 @geindex System.Memory (s-memory.ads)
25363
25364 @geindex Memory allocation
25365
25366 This package provides the interface to the low level routines used
25367 by the generated code for allocation and freeing storage for the
25368 default storage pool (analogous to the C routines malloc and free.
25369 It also provides a reallocation interface analogous to the C routine
25370 realloc. The body of this unit may be modified to provide alternative
25371 allocation mechanisms for the default pool, and in addition, direct
25372 calls to this unit may be made for low level allocation uses (for
25373 example see the body of @code{GNAT.Tables}).
25374
25375 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
25376 @anchor{gnat_rm/the_gnat_library id146}@anchor{3f3}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3f4}
25377 @section @code{System.Multiprocessors} (@code{s-multip.ads})
25378
25379
25380 @geindex System.Multiprocessors (s-multip.ads)
25381
25382 @geindex Multiprocessor interface
25383
25384 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25385 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25386 technically an implementation-defined addition).
25387
25388 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
25389 @anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3f5}@anchor{gnat_rm/the_gnat_library id147}@anchor{3f6}
25390 @section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
25391
25392
25393 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
25394
25395 @geindex Multiprocessor interface
25396
25397 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25398 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25399 technically an implementation-defined addition).
25400
25401 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
25402 @anchor{gnat_rm/the_gnat_library id148}@anchor{3f7}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3f8}
25403 @section @code{System.Partition_Interface} (@code{s-parint.ads})
25404
25405
25406 @geindex System.Partition_Interface (s-parint.ads)
25407
25408 @geindex Partition interfacing functions
25409
25410 This package provides facilities for partition interfacing. It
25411 is used primarily in a distribution context when using Annex E
25412 with @code{GLADE}.
25413
25414 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
25415 @anchor{gnat_rm/the_gnat_library id149}@anchor{3f9}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3fa}
25416 @section @code{System.Pool_Global} (@code{s-pooglo.ads})
25417
25418
25419 @geindex System.Pool_Global (s-pooglo.ads)
25420
25421 @geindex Storage pool
25422 @geindex global
25423
25424 @geindex Global storage pool
25425
25426 This package provides a storage pool that is equivalent to the default
25427 storage pool used for access types for which no pool is specifically
25428 declared. It uses malloc/free to allocate/free and does not attempt to
25429 do any automatic reclamation.
25430
25431 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
25432 @anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3fb}@anchor{gnat_rm/the_gnat_library id150}@anchor{3fc}
25433 @section @code{System.Pool_Local} (@code{s-pooloc.ads})
25434
25435
25436 @geindex System.Pool_Local (s-pooloc.ads)
25437
25438 @geindex Storage pool
25439 @geindex local
25440
25441 @geindex Local storage pool
25442
25443 This package provides a storage pool that is intended for use with locally
25444 defined access types. It uses malloc/free for allocate/free, and maintains
25445 a list of allocated blocks, so that all storage allocated for the pool can
25446 be freed automatically when the pool is finalized.
25447
25448 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
25449 @anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3fd}@anchor{gnat_rm/the_gnat_library id151}@anchor{3fe}
25450 @section @code{System.Restrictions} (@code{s-restri.ads})
25451
25452
25453 @geindex System.Restrictions (s-restri.ads)
25454
25455 @geindex Run-time restrictions access
25456
25457 This package provides facilities for accessing at run time
25458 the status of restrictions specified at compile time for
25459 the partition. Information is available both with regard
25460 to actual restrictions specified, and with regard to
25461 compiler determined information on which restrictions
25462 are violated by one or more packages in the partition.
25463
25464 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
25465 @anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3ff}@anchor{gnat_rm/the_gnat_library id152}@anchor{400}
25466 @section @code{System.Rident} (@code{s-rident.ads})
25467
25468
25469 @geindex System.Rident (s-rident.ads)
25470
25471 @geindex Restrictions definitions
25472
25473 This package provides definitions of the restrictions
25474 identifiers supported by GNAT, and also the format of
25475 the restrictions provided in package System.Restrictions.
25476 It is not normally necessary to @code{with} this generic package
25477 since the necessary instantiation is included in
25478 package System.Restrictions.
25479
25480 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
25481 @anchor{gnat_rm/the_gnat_library id153}@anchor{401}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{402}
25482 @section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads})
25483
25484
25485 @geindex System.Strings.Stream_Ops (s-ststop.ads)
25486
25487 @geindex Stream operations
25488
25489 @geindex String stream operations
25490
25491 This package provides a set of stream subprograms for standard string types.
25492 It is intended primarily to support implicit use of such subprograms when
25493 stream attributes are applied to string types, but the subprograms in this
25494 package can be used directly by application programs.
25495
25496 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
25497 @anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{403}@anchor{gnat_rm/the_gnat_library id154}@anchor{404}
25498 @section @code{System.Unsigned_Types} (@code{s-unstyp.ads})
25499
25500
25501 @geindex System.Unsigned_Types (s-unstyp.ads)
25502
25503 This package contains definitions of standard unsigned types that
25504 correspond in size to the standard signed types declared in Standard,
25505 and (unlike the types in Interfaces) have corresponding names. It
25506 also contains some related definitions for other specialized types
25507 used by the compiler in connection with packed array types.
25508
25509 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
25510 @anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{405}@anchor{gnat_rm/the_gnat_library id155}@anchor{406}
25511 @section @code{System.Wch_Cnv} (@code{s-wchcnv.ads})
25512
25513
25514 @geindex System.Wch_Cnv (s-wchcnv.ads)
25515
25516 @geindex Wide Character
25517 @geindex Representation
25518
25519 @geindex Wide String
25520 @geindex Conversion
25521
25522 @geindex Representation of wide characters
25523
25524 This package provides routines for converting between
25525 wide and wide wide characters and a representation as a value of type
25526 @code{Standard.String}, using a specified wide character
25527 encoding method. It uses definitions in
25528 package @code{System.Wch_Con}.
25529
25530 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
25531 @anchor{gnat_rm/the_gnat_library id156}@anchor{407}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{408}
25532 @section @code{System.Wch_Con} (@code{s-wchcon.ads})
25533
25534
25535 @geindex System.Wch_Con (s-wchcon.ads)
25536
25537 This package provides definitions and descriptions of
25538 the various methods used for encoding wide characters
25539 in ordinary strings. These definitions are used by
25540 the package @code{System.Wch_Cnv}.
25541
25542 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
25543 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{409}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{40a}
25544 @chapter Interfacing to Other Languages
25545
25546
25547 The facilities in Annex B of the Ada Reference Manual are fully
25548 implemented in GNAT, and in addition, a full interface to C++ is
25549 provided.
25550
25551 @menu
25552 * Interfacing to C::
25553 * Interfacing to C++::
25554 * Interfacing to COBOL::
25555 * Interfacing to Fortran::
25556 * Interfacing to non-GNAT Ada code::
25557
25558 @end menu
25559
25560 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
25561 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{40b}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{40c}
25562 @section Interfacing to C
25563
25564
25565 Interfacing to C with GNAT can use one of two approaches:
25566
25567
25568 @itemize *
25569
25570 @item
25571 The types in the package @code{Interfaces.C} may be used.
25572
25573 @item
25574 Standard Ada types may be used directly. This may be less portable to
25575 other compilers, but will work on all GNAT compilers, which guarantee
25576 correspondence between the C and Ada types.
25577 @end itemize
25578
25579 Pragma @code{Convention C} may be applied to Ada types, but mostly has no
25580 effect, since this is the default. The following table shows the
25581 correspondence between Ada scalar types and the corresponding C types.
25582
25583
25584 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
25585 @headitem
25586
25587 Ada Type
25588
25589 @tab
25590
25591 C Type
25592
25593 @item
25594
25595 @code{Integer}
25596
25597 @tab
25598
25599 @code{int}
25600
25601 @item
25602
25603 @code{Short_Integer}
25604
25605 @tab
25606
25607 @code{short}
25608
25609 @item
25610
25611 @code{Short_Short_Integer}
25612
25613 @tab
25614
25615 @code{signed char}
25616
25617 @item
25618
25619 @code{Long_Integer}
25620
25621 @tab
25622
25623 @code{long}
25624
25625 @item
25626
25627 @code{Long_Long_Integer}
25628
25629 @tab
25630
25631 @code{long long}
25632
25633 @item
25634
25635 @code{Short_Float}
25636
25637 @tab
25638
25639 @code{float}
25640
25641 @item
25642
25643 @code{Float}
25644
25645 @tab
25646
25647 @code{float}
25648
25649 @item
25650
25651 @code{Long_Float}
25652
25653 @tab
25654
25655 @code{double}
25656
25657 @item
25658
25659 @code{Long_Long_Float}
25660
25661 @tab
25662
25663 This is the longest floating-point type supported by the hardware.
25664
25665 @end multitable
25666
25667
25668 Additionally, there are the following general correspondences between Ada
25669 and C types:
25670
25671
25672 @itemize *
25673
25674 @item
25675 Ada enumeration types map to C enumeration types directly if pragma
25676 @code{Convention C} is specified, which causes them to have a length of
25677 32 bits, except for boolean types which map to C99 @code{bool} and for
25678 which the length is 8 bits.
25679 Without pragma @code{Convention C}, Ada enumeration types map to
25680 8, 16, or 32 bits (i.e., C types @code{signed char}, @code{short},
25681 @code{int}, respectively) depending on the number of values passed.
25682 This is the only case in which pragma @code{Convention C} affects the
25683 representation of an Ada type.
25684
25685 @item
25686 Ada access types map to C pointers, except for the case of pointers to
25687 unconstrained types in Ada, which have no direct C equivalent.
25688
25689 @item
25690 Ada arrays map directly to C arrays.
25691
25692 @item
25693 Ada records map directly to C structures.
25694
25695 @item
25696 Packed Ada records map to C structures where all members are bit fields
25697 of the length corresponding to the @code{type'Size} value in Ada.
25698 @end itemize
25699
25700 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
25701 @anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{40d}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{49}
25702 @section Interfacing to C++
25703
25704
25705 The interface to C++ makes use of the following pragmas, which are
25706 primarily intended to be constructed automatically using a binding generator
25707 tool, although it is possible to construct them by hand.
25708
25709 Using these pragmas it is possible to achieve complete
25710 inter-operability between Ada tagged types and C++ class definitions.
25711 See @ref{7,,Implementation Defined Pragmas}, for more details.
25712
25713
25714 @table @asis
25715
25716 @item @code{pragma CPP_Class ([Entity =>] @emph{LOCAL_NAME})}
25717
25718 The argument denotes an entity in the current declarative region that is
25719 declared as a tagged or untagged record type. It indicates that the type
25720 corresponds to an externally declared C++ class type, and is to be laid
25721 out the same way that C++ would lay out the type.
25722
25723 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
25724 for backward compatibility but its functionality is available
25725 using pragma @code{Import} with @code{Convention} = @code{CPP}.
25726
25727 @item @code{pragma CPP_Constructor ([Entity =>] @emph{LOCAL_NAME})}
25728
25729 This pragma identifies an imported function (imported in the usual way
25730 with pragma @code{Import}) as corresponding to a C++ constructor.
25731 @end table
25732
25733 A few restrictions are placed on the use of the @code{Access} attribute
25734 in conjunction with subprograms subject to convention @code{CPP}: the
25735 attribute may be used neither on primitive operations of a tagged
25736 record type with convention @code{CPP}, imported or not, nor on
25737 subprograms imported with pragma @code{CPP_Constructor}.
25738
25739 In addition, C++ exceptions are propagated and can be handled in an
25740 @code{others} choice of an exception handler. The corresponding Ada
25741 occurrence has no message, and the simple name of the exception identity
25742 contains @code{Foreign_Exception}. Finalization and awaiting dependent
25743 tasks works properly when such foreign exceptions are propagated.
25744
25745 It is also possible to import a C++ exception using the following syntax:
25746
25747 @example
25748 LOCAL_NAME : exception;
25749 pragma Import (Cpp,
25750 [Entity =>] LOCAL_NAME,
25751 [External_Name =>] static_string_EXPRESSION);
25752 @end example
25753
25754 The @code{External_Name} is the name of the C++ RTTI symbol. You can then
25755 cover a specific C++ exception in an exception handler.
25756
25757 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
25758 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{40e}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{40f}
25759 @section Interfacing to COBOL
25760
25761
25762 Interfacing to COBOL is achieved as described in section B.4 of
25763 the Ada Reference Manual.
25764
25765 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
25766 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{410}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{411}
25767 @section Interfacing to Fortran
25768
25769
25770 Interfacing to Fortran is achieved as described in section B.5 of the
25771 Ada Reference Manual. The pragma @code{Convention Fortran}, applied to a
25772 multi-dimensional array causes the array to be stored in column-major
25773 order as required for convenient interface to Fortran.
25774
25775 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
25776 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{412}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{413}
25777 @section Interfacing to non-GNAT Ada code
25778
25779
25780 It is possible to specify the convention @code{Ada} in a pragma
25781 @code{Import} or pragma @code{Export}. However this refers to
25782 the calling conventions used by GNAT, which may or may not be
25783 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
25784 compiler to allow interoperation.
25785
25786 If arguments types are kept simple, and if the foreign compiler generally
25787 follows system calling conventions, then it may be possible to integrate
25788 files compiled by other Ada compilers, provided that the elaboration
25789 issues are adequately addressed (for example by eliminating the
25790 need for any load time elaboration).
25791
25792 In particular, GNAT running on VMS is designed to
25793 be highly compatible with the DEC Ada 83 compiler, so this is one
25794 case in which it is possible to import foreign units of this type,
25795 provided that the data items passed are restricted to simple scalar
25796 values or simple record types without variants, or simple array
25797 types with fixed bounds.
25798
25799 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
25800 @anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{414}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{415}
25801 @chapter Specialized Needs Annexes
25802
25803
25804 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
25805 required in all implementations. However, as described in this chapter,
25806 GNAT implements all of these annexes:
25807
25808
25809 @table @asis
25810
25811 @item @emph{Systems Programming (Annex C)}
25812
25813 The Systems Programming Annex is fully implemented.
25814
25815 @item @emph{Real-Time Systems (Annex D)}
25816
25817 The Real-Time Systems Annex is fully implemented.
25818
25819 @item @emph{Distributed Systems (Annex E)}
25820
25821 Stub generation is fully implemented in the GNAT compiler. In addition,
25822 a complete compatible PCS is available as part of the GLADE system,
25823 a separate product. When the two
25824 products are used in conjunction, this annex is fully implemented.
25825
25826 @item @emph{Information Systems (Annex F)}
25827
25828 The Information Systems annex is fully implemented.
25829
25830 @item @emph{Numerics (Annex G)}
25831
25832 The Numerics Annex is fully implemented.
25833
25834 @item @emph{Safety and Security / High-Integrity Systems (Annex H)}
25835
25836 The Safety and Security Annex (termed the High-Integrity Systems Annex
25837 in Ada 2005) is fully implemented.
25838 @end table
25839
25840 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25841 @anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13}@anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{416}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{417}
25842 @chapter Implementation of Specific Ada Features
25843
25844
25845 This chapter describes the GNAT implementation of several Ada language
25846 facilities.
25847
25848 @menu
25849 * Machine Code Insertions::
25850 * GNAT Implementation of Tasking::
25851 * GNAT Implementation of Shared Passive Packages::
25852 * Code Generation for Array Aggregates::
25853 * The Size of Discriminated Records with Default Discriminants::
25854 * Strict Conformance to the Ada Reference Manual::
25855
25856 @end menu
25857
25858 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25859 @anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{16c}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{418}
25860 @section Machine Code Insertions
25861
25862
25863 @geindex Machine Code insertions
25864
25865 Package @code{Machine_Code} provides machine code support as described
25866 in the Ada Reference Manual in two separate forms:
25867
25868
25869 @itemize *
25870
25871 @item
25872 Machine code statements, consisting of qualified expressions that
25873 fit the requirements of RM section 13.8.
25874
25875 @item
25876 An intrinsic callable procedure, providing an alternative mechanism of
25877 including machine instructions in a subprogram.
25878 @end itemize
25879
25880 The two features are similar, and both are closely related to the mechanism
25881 provided by the asm instruction in the GNU C compiler. Full understanding
25882 and use of the facilities in this package requires understanding the asm
25883 instruction, see the section on Extended Asm in
25884 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
25885
25886 Calls to the function @code{Asm} and the procedure @code{Asm} have identical
25887 semantic restrictions and effects as described below. Both are provided so
25888 that the procedure call can be used as a statement, and the function call
25889 can be used to form a code_statement.
25890
25891 Consider this C @code{asm} instruction:
25892
25893 @example
25894 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
25895 @end example
25896
25897 The equivalent can be written for GNAT as:
25898
25899 @example
25900 Asm ("fsinx %1 %0",
25901 My_Float'Asm_Output ("=f", result),
25902 My_Float'Asm_Input ("f", angle));
25903 @end example
25904
25905 The first argument to @code{Asm} is the assembler template, and is
25906 identical to what is used in GNU C. This string must be a static
25907 expression. The second argument is the output operand list. It is
25908 either a single @code{Asm_Output} attribute reference, or a list of such
25909 references enclosed in parentheses (technically an array aggregate of
25910 such references).
25911
25912 The @code{Asm_Output} attribute denotes a function that takes two
25913 parameters. The first is a string, the second is the name of a variable
25914 of the type designated by the attribute prefix. The first (string)
25915 argument is required to be a static expression and designates the
25916 constraint (see the section on Constraints in
25917 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
25918 for the parameter; e.g., what kind of register is required. The second
25919 argument is the variable to be written or updated with the
25920 result. The possible values for constraint are the same as those used in
25921 the RTL, and are dependent on the configuration file used to build the
25922 GCC back end. If there are no output operands, then this argument may
25923 either be omitted, or explicitly given as @code{No_Output_Operands}.
25924 No support is provided for GNU C's symbolic names for output parameters.
25925
25926 The second argument of @code{my_float'Asm_Output} functions as
25927 though it were an @code{out} parameter, which is a little curious, but
25928 all names have the form of expressions, so there is no syntactic
25929 irregularity, even though normally functions would not be permitted
25930 @code{out} parameters. The third argument is the list of input
25931 operands. It is either a single @code{Asm_Input} attribute reference, or
25932 a list of such references enclosed in parentheses (technically an array
25933 aggregate of such references).
25934
25935 The @code{Asm_Input} attribute denotes a function that takes two
25936 parameters. The first is a string, the second is an expression of the
25937 type designated by the prefix. The first (string) argument is required
25938 to be a static expression, and is the constraint for the parameter,
25939 (e.g., what kind of register is required). The second argument is the
25940 value to be used as the input argument. The possible values for the
25941 constraint are the same as those used in the RTL, and are dependent on
25942 the configuration file used to built the GCC back end.
25943 No support is provided for GNU C's symbolic names for input parameters.
25944
25945 If there are no input operands, this argument may either be omitted, or
25946 explicitly given as @code{No_Input_Operands}. The fourth argument, not
25947 present in the above example, is a list of register names, called the
25948 @emph{clobber} argument. This argument, if given, must be a static string
25949 expression, and is a space or comma separated list of names of registers
25950 that must be considered destroyed as a result of the @code{Asm} call. If
25951 this argument is the null string (the default value), then the code
25952 generator assumes that no additional registers are destroyed.
25953 In addition to registers, the special clobbers @code{memory} and
25954 @code{cc} as described in the GNU C docs are both supported.
25955
25956 The fifth argument, not present in the above example, called the
25957 @emph{volatile} argument, is by default @code{False}. It can be set to
25958 the literal value @code{True} to indicate to the code generator that all
25959 optimizations with respect to the instruction specified should be
25960 suppressed, and in particular an instruction that has outputs
25961 will still be generated, even if none of the outputs are
25962 used. See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
25963 for the full description.
25964 Generally it is strongly advisable to use Volatile for any ASM statement
25965 that is missing either input or output operands or to avoid unwanted
25966 optimizations. A warning is generated if this advice is not followed.
25967
25968 No support is provided for GNU C's @code{asm goto} feature.
25969
25970 The @code{Asm} subprograms may be used in two ways. First the procedure
25971 forms can be used anywhere a procedure call would be valid, and
25972 correspond to what the RM calls 'intrinsic' routines. Such calls can
25973 be used to intersperse machine instructions with other Ada statements.
25974 Second, the function forms, which return a dummy value of the limited
25975 private type @code{Asm_Insn}, can be used in code statements, and indeed
25976 this is the only context where such calls are allowed. Code statements
25977 appear as aggregates of the form:
25978
25979 @example
25980 Asm_Insn'(Asm (...));
25981 Asm_Insn'(Asm_Volatile (...));
25982 @end example
25983
25984 In accordance with RM rules, such code statements are allowed only
25985 within subprograms whose entire body consists of such statements. It is
25986 not permissible to intermix such statements with other Ada statements.
25987
25988 Typically the form using intrinsic procedure calls is more convenient
25989 and more flexible. The code statement form is provided to meet the RM
25990 suggestion that such a facility should be made available. The following
25991 is the exact syntax of the call to @code{Asm}. As usual, if named notation
25992 is used, the arguments may be given in arbitrary order, following the
25993 normal rules for use of positional and named arguments:
25994
25995 @example
25996 ASM_CALL ::= Asm (
25997 [Template =>] static_string_EXPRESSION
25998 [,[Outputs =>] OUTPUT_OPERAND_LIST ]
25999 [,[Inputs =>] INPUT_OPERAND_LIST ]
26000 [,[Clobber =>] static_string_EXPRESSION ]
26001 [,[Volatile =>] static_boolean_EXPRESSION] )
26002
26003 OUTPUT_OPERAND_LIST ::=
26004 [PREFIX.]No_Output_Operands
26005 | OUTPUT_OPERAND_ATTRIBUTE
26006 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
26007
26008 OUTPUT_OPERAND_ATTRIBUTE ::=
26009 SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
26010
26011 INPUT_OPERAND_LIST ::=
26012 [PREFIX.]No_Input_Operands
26013 | INPUT_OPERAND_ATTRIBUTE
26014 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
26015
26016 INPUT_OPERAND_ATTRIBUTE ::=
26017 SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
26018 @end example
26019
26020 The identifiers @code{No_Input_Operands} and @code{No_Output_Operands}
26021 are declared in the package @code{Machine_Code} and must be referenced
26022 according to normal visibility rules. In particular if there is no
26023 @code{use} clause for this package, then appropriate package name
26024 qualification is required.
26025
26026 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
26027 @anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{419}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{41a}
26028 @section GNAT Implementation of Tasking
26029
26030
26031 This chapter outlines the basic GNAT approach to tasking (in particular,
26032 a multi-layered library for portability) and discusses issues related
26033 to compliance with the Real-Time Systems Annex.
26034
26035 @menu
26036 * Mapping Ada Tasks onto the Underlying Kernel Threads::
26037 * Ensuring Compliance with the Real-Time Annex::
26038 * Support for Locking Policies::
26039
26040 @end menu
26041
26042 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
26043 @anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{41b}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{41c}
26044 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
26045
26046
26047 GNAT's run-time support comprises two layers:
26048
26049
26050 @itemize *
26051
26052 @item
26053 GNARL (GNAT Run-time Layer)
26054
26055 @item
26056 GNULL (GNAT Low-level Library)
26057 @end itemize
26058
26059 In GNAT, Ada's tasking services rely on a platform and OS independent
26060 layer known as GNARL. This code is responsible for implementing the
26061 correct semantics of Ada's task creation, rendezvous, protected
26062 operations etc.
26063
26064 GNARL decomposes Ada's tasking semantics into simpler lower level
26065 operations such as create a thread, set the priority of a thread,
26066 yield, create a lock, lock/unlock, etc. The spec for these low-level
26067 operations constitutes GNULLI, the GNULL Interface. This interface is
26068 directly inspired from the POSIX real-time API.
26069
26070 If the underlying executive or OS implements the POSIX standard
26071 faithfully, the GNULL Interface maps as is to the services offered by
26072 the underlying kernel. Otherwise, some target dependent glue code maps
26073 the services offered by the underlying kernel to the semantics expected
26074 by GNARL.
26075
26076 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
26077 key point is that each Ada task is mapped on a thread in the underlying
26078 kernel. For example, in the case of VxWorks, one Ada task = one VxWorks task.
26079
26080 In addition Ada task priorities map onto the underlying thread priorities.
26081 Mapping Ada tasks onto the underlying kernel threads has several advantages:
26082
26083
26084 @itemize *
26085
26086 @item
26087 The underlying scheduler is used to schedule the Ada tasks. This
26088 makes Ada tasks as efficient as kernel threads from a scheduling
26089 standpoint.
26090
26091 @item
26092 Interaction with code written in C containing threads is eased
26093 since at the lowest level Ada tasks and C threads map onto the same
26094 underlying kernel concept.
26095
26096 @item
26097 When an Ada task is blocked during I/O the remaining Ada tasks are
26098 able to proceed.
26099
26100 @item
26101 On multiprocessor systems Ada tasks can execute in parallel.
26102 @end itemize
26103
26104 Some threads libraries offer a mechanism to fork a new process, with the
26105 child process duplicating the threads from the parent.
26106 GNAT does not
26107 support this functionality when the parent contains more than one task.
26108
26109 @geindex Forking a new process
26110
26111 @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
26112 @anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{41d}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{41e}
26113 @subsection Ensuring Compliance with the Real-Time Annex
26114
26115
26116 @geindex Real-Time Systems Annex compliance
26117
26118 Although mapping Ada tasks onto
26119 the underlying threads has significant advantages, it does create some
26120 complications when it comes to respecting the scheduling semantics
26121 specified in the real-time annex (Annex D).
26122
26123 For instance the Annex D requirement for the @code{FIFO_Within_Priorities}
26124 scheduling policy states:
26125
26126 @quotation
26127
26128 @emph{When the active priority of a ready task that is not running
26129 changes, or the setting of its base priority takes effect, the
26130 task is removed from the ready queue for its old active priority
26131 and is added at the tail of the ready queue for its new active
26132 priority, except in the case where the active priority is lowered
26133 due to the loss of inherited priority, in which case the task is
26134 added at the head of the ready queue for its new active priority.}
26135 @end quotation
26136
26137 While most kernels do put tasks at the end of the priority queue when
26138 a task changes its priority, (which respects the main
26139 FIFO_Within_Priorities requirement), almost none keep a thread at the
26140 beginning of its priority queue when its priority drops from the loss
26141 of inherited priority.
26142
26143 As a result most vendors have provided incomplete Annex D implementations.
26144
26145 The GNAT run-time, has a nice cooperative solution to this problem
26146 which ensures that accurate FIFO_Within_Priorities semantics are
26147 respected.
26148
26149 The principle is as follows. When an Ada task T is about to start
26150 running, it checks whether some other Ada task R with the same
26151 priority as T has been suspended due to the loss of priority
26152 inheritance. If this is the case, T yields and is placed at the end of
26153 its priority queue. When R arrives at the front of the queue it
26154 executes.
26155
26156 Note that this simple scheme preserves the relative order of the tasks
26157 that were ready to execute in the priority queue where R has been
26158 placed at the end.
26159
26160 @c Support_for_Locking_Policies
26161
26162 @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
26163 @anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{41f}
26164 @subsection Support for Locking Policies
26165
26166
26167 This section specifies which policies specified by pragma Locking_Policy
26168 are supported on which platforms.
26169
26170 GNAT supports the standard @code{Ceiling_Locking} policy, and the
26171 implementation defined @code{Inheritance_Locking} and
26172 @code{Concurrent_Readers_Locking} policies.
26173
26174 @code{Ceiling_Locking} is supported on all platforms if the operating system
26175 supports it. In particular, @code{Ceiling_Locking} is not supported on
26176 VxWorks.
26177 @code{Inheritance_Locking} is supported on
26178 Linux,
26179 Darwin (Mac OS X),
26180 LynxOS 178,
26181 and VxWorks.
26182 @code{Concurrent_Readers_Locking} is supported on Linux.
26183
26184 Notes about @code{Ceiling_Locking} on Linux:
26185 If the process is running as 'root', ceiling locking is used.
26186 If the capabilities facility is installed
26187 ("sudo apt-get --assume-yes install libcap-dev" on Ubuntu,
26188 for example),
26189 and the program is linked against that library
26190 ("-largs -lcap"),
26191 and the executable file has the cap_sys_nice capability
26192 ("sudo /sbin/setcap cap_sys_nice=ep executable_file_name"),
26193 then ceiling locking is used.
26194 Otherwise, the @code{Ceiling_Locking} policy is ignored.
26195
26196 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
26197 @anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{420}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{421}
26198 @section GNAT Implementation of Shared Passive Packages
26199
26200
26201 @geindex Shared passive packages
26202
26203 GNAT fully implements the
26204 @geindex pragma Shared_Passive
26205 pragma
26206 @code{Shared_Passive} for
26207 the purpose of designating shared passive packages.
26208 This allows the use of passive partitions in the
26209 context described in the Ada Reference Manual; i.e., for communication
26210 between separate partitions of a distributed application using the
26211 features in Annex E.
26212
26213 @geindex Annex E
26214
26215 @geindex Distribution Systems Annex
26216
26217 However, the implementation approach used by GNAT provides for more
26218 extensive usage as follows:
26219
26220
26221 @table @asis
26222
26223 @item @emph{Communication between separate programs}
26224
26225 This allows separate programs to access the data in passive
26226 partitions, using protected objects for synchronization where
26227 needed. The only requirement is that the two programs have a
26228 common shared file system. It is even possible for programs
26229 running on different machines with different architectures
26230 (e.g., different endianness) to communicate via the data in
26231 a passive partition.
26232
26233 @item @emph{Persistence between program runs}
26234
26235 The data in a passive package can persist from one run of a
26236 program to another, so that a later program sees the final
26237 values stored by a previous run of the same program.
26238 @end table
26239
26240 The implementation approach used is to store the data in files. A
26241 separate stream file is created for each object in the package, and
26242 an access to an object causes the corresponding file to be read or
26243 written.
26244
26245 @geindex SHARED_MEMORY_DIRECTORY environment variable
26246
26247 The environment variable @code{SHARED_MEMORY_DIRECTORY} should be
26248 set to the directory to be used for these files.
26249 The files in this directory
26250 have names that correspond to their fully qualified names. For
26251 example, if we have the package
26252
26253 @example
26254 package X is
26255 pragma Shared_Passive (X);
26256 Y : Integer;
26257 Z : Float;
26258 end X;
26259 @end example
26260
26261 and the environment variable is set to @code{/stemp/}, then the files created
26262 will have the names:
26263
26264 @example
26265 /stemp/x.y
26266 /stemp/x.z
26267 @end example
26268
26269 These files are created when a value is initially written to the object, and
26270 the files are retained until manually deleted. This provides the persistence
26271 semantics. If no file exists, it means that no partition has assigned a value
26272 to the variable; in this case the initial value declared in the package
26273 will be used. This model ensures that there are no issues in synchronizing
26274 the elaboration process, since elaboration of passive packages elaborates the
26275 initial values, but does not create the files.
26276
26277 The files are written using normal @code{Stream_IO} access.
26278 If you want to be able
26279 to communicate between programs or partitions running on different
26280 architectures, then you should use the XDR versions of the stream attribute
26281 routines, since these are architecture independent.
26282
26283 If active synchronization is required for access to the variables in the
26284 shared passive package, then as described in the Ada Reference Manual, the
26285 package may contain protected objects used for this purpose. In this case
26286 a lock file (whose name is @code{___lock} (three underscores)
26287 is created in the shared memory directory.
26288
26289 @geindex ___lock file (for shared passive packages)
26290
26291 This is used to provide the required locking
26292 semantics for proper protected object synchronization.
26293
26294 GNAT supports shared passive packages on all platforms
26295 except for OpenVMS.
26296
26297 @node Code Generation for Array Aggregates,The Size of Discriminated Records with Default Discriminants,GNAT Implementation of Shared Passive Packages,Implementation of Specific Ada Features
26298 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{422}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{423}
26299 @section Code Generation for Array Aggregates
26300
26301
26302 Aggregates have a rich syntax and allow the user to specify the values of
26303 complex data structures by means of a single construct. As a result, the
26304 code generated for aggregates can be quite complex and involve loops, case
26305 statements and multiple assignments. In the simplest cases, however, the
26306 compiler will recognize aggregates whose components and constraints are
26307 fully static, and in those cases the compiler will generate little or no
26308 executable code. The following is an outline of the code that GNAT generates
26309 for various aggregate constructs. For further details, you will find it
26310 useful to examine the output produced by the -gnatG flag to see the expanded
26311 source that is input to the code generator. You may also want to examine
26312 the assembly code generated at various levels of optimization.
26313
26314 The code generated for aggregates depends on the context, the component values,
26315 and the type. In the context of an object declaration the code generated is
26316 generally simpler than in the case of an assignment. As a general rule, static
26317 component values and static subtypes also lead to simpler code.
26318
26319 @menu
26320 * Static constant aggregates with static bounds::
26321 * Constant aggregates with unconstrained nominal types::
26322 * Aggregates with static bounds::
26323 * Aggregates with nonstatic bounds::
26324 * Aggregates in assignment statements::
26325
26326 @end menu
26327
26328 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
26329 @anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{424}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{425}
26330 @subsection Static constant aggregates with static bounds
26331
26332
26333 For the declarations:
26334
26335 @example
26336 type One_Dim is array (1..10) of integer;
26337 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
26338 @end example
26339
26340 GNAT generates no executable code: the constant ar0 is placed in static memory.
26341 The same is true for constant aggregates with named associations:
26342
26343 @example
26344 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
26345 Cr3 : constant One_Dim := (others => 7777);
26346 @end example
26347
26348 The same is true for multidimensional constant arrays such as:
26349
26350 @example
26351 type two_dim is array (1..3, 1..3) of integer;
26352 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
26353 @end example
26354
26355 The same is true for arrays of one-dimensional arrays: the following are
26356 static:
26357
26358 @example
26359 type ar1b is array (1..3) of boolean;
26360 type ar_ar is array (1..3) of ar1b;
26361 None : constant ar1b := (others => false); -- fully static
26362 None2 : constant ar_ar := (1..3 => None); -- fully static
26363 @end example
26364
26365 However, for multidimensional aggregates with named associations, GNAT will
26366 generate assignments and loops, even if all associations are static. The
26367 following two declarations generate a loop for the first dimension, and
26368 individual component assignments for the second dimension:
26369
26370 @example
26371 Zero1: constant two_dim := (1..3 => (1..3 => 0));
26372 Zero2: constant two_dim := (others => (others => 0));
26373 @end example
26374
26375 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
26376 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{426}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{427}
26377 @subsection Constant aggregates with unconstrained nominal types
26378
26379
26380 In such cases the aggregate itself establishes the subtype, so that
26381 associations with @code{others} cannot be used. GNAT determines the
26382 bounds for the actual subtype of the aggregate, and allocates the
26383 aggregate statically as well. No code is generated for the following:
26384
26385 @example
26386 type One_Unc is array (natural range <>) of integer;
26387 Cr_Unc : constant One_Unc := (12,24,36);
26388 @end example
26389
26390 @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
26391 @anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{428}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{429}
26392 @subsection Aggregates with static bounds
26393
26394
26395 In all previous examples the aggregate was the initial (and immutable) value
26396 of a constant. If the aggregate initializes a variable, then code is generated
26397 for it as a combination of individual assignments and loops over the target
26398 object. The declarations
26399
26400 @example
26401 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
26402 Cr_Var2 : One_Dim := (others > -1);
26403 @end example
26404
26405 generate the equivalent of
26406
26407 @example
26408 Cr_Var1 (1) := 2;
26409 Cr_Var1 (2) := 3;
26410 Cr_Var1 (3) := 5;
26411 Cr_Var1 (4) := 11;
26412
26413 for I in Cr_Var2'range loop
26414 Cr_Var2 (I) := -1;
26415 end loop;
26416 @end example
26417
26418 @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
26419 @anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{42a}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{42b}
26420 @subsection Aggregates with nonstatic bounds
26421
26422
26423 If the bounds of the aggregate are not statically compatible with the bounds
26424 of the nominal subtype of the target, then constraint checks have to be
26425 generated on the bounds. For a multidimensional array, constraint checks may
26426 have to be applied to sub-arrays individually, if they do not have statically
26427 compatible subtypes.
26428
26429 @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
26430 @anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{42c}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{42d}
26431 @subsection Aggregates in assignment statements
26432
26433
26434 In general, aggregate assignment requires the construction of a temporary,
26435 and a copy from the temporary to the target of the assignment. This is because
26436 it is not always possible to convert the assignment into a series of individual
26437 component assignments. For example, consider the simple case:
26438
26439 @example
26440 A := (A(2), A(1));
26441 @end example
26442
26443 This cannot be converted into:
26444
26445 @example
26446 A(1) := A(2);
26447 A(2) := A(1);
26448 @end example
26449
26450 So the aggregate has to be built first in a separate location, and then
26451 copied into the target. GNAT recognizes simple cases where this intermediate
26452 step is not required, and the assignments can be performed in place, directly
26453 into the target. The following sufficient criteria are applied:
26454
26455
26456 @itemize *
26457
26458 @item
26459 The bounds of the aggregate are static, and the associations are static.
26460
26461 @item
26462 The components of the aggregate are static constants, names of
26463 simple variables that are not renamings, or expressions not involving
26464 indexed components whose operands obey these rules.
26465 @end itemize
26466
26467 If any of these conditions are violated, the aggregate will be built in
26468 a temporary (created either by the front-end or the code generator) and then
26469 that temporary will be copied onto the target.
26470
26471 @node The Size of Discriminated Records with Default Discriminants,Strict Conformance to the Ada Reference Manual,Code Generation for Array Aggregates,Implementation of Specific Ada Features
26472 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{42e}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{42f}
26473 @section The Size of Discriminated Records with Default Discriminants
26474
26475
26476 If a discriminated type @code{T} has discriminants with default values, it is
26477 possible to declare an object of this type without providing an explicit
26478 constraint:
26479
26480 @example
26481 type Size is range 1..100;
26482
26483 type Rec (D : Size := 15) is record
26484 Name : String (1..D);
26485 end T;
26486
26487 Word : Rec;
26488 @end example
26489
26490 Such an object is said to be @emph{unconstrained}.
26491 The discriminant of the object
26492 can be modified by a full assignment to the object, as long as it preserves the
26493 relation between the value of the discriminant, and the value of the components
26494 that depend on it:
26495
26496 @example
26497 Word := (3, "yes");
26498
26499 Word := (5, "maybe");
26500
26501 Word := (5, "no"); -- raises Constraint_Error
26502 @end example
26503
26504 In order to support this behavior efficiently, an unconstrained object is
26505 given the maximum size that any value of the type requires. In the case
26506 above, @code{Word} has storage for the discriminant and for
26507 a @code{String} of length 100.
26508 It is important to note that unconstrained objects do not require dynamic
26509 allocation. It would be an improper implementation to place on the heap those
26510 components whose size depends on discriminants. (This improper implementation
26511 was used by some Ada83 compilers, where the @code{Name} component above
26512 would have
26513 been stored as a pointer to a dynamic string). Following the principle that
26514 dynamic storage management should never be introduced implicitly,
26515 an Ada compiler should reserve the full size for an unconstrained declared
26516 object, and place it on the stack.
26517
26518 This maximum size approach
26519 has been a source of surprise to some users, who expect the default
26520 values of the discriminants to determine the size reserved for an
26521 unconstrained object: "If the default is 15, why should the object occupy
26522 a larger size?"
26523 The answer, of course, is that the discriminant may be later modified,
26524 and its full range of values must be taken into account. This is why the
26525 declaration:
26526
26527 @example
26528 type Rec (D : Positive := 15) is record
26529 Name : String (1..D);
26530 end record;
26531
26532 Too_Large : Rec;
26533 @end example
26534
26535 is flagged by the compiler with a warning:
26536 an attempt to create @code{Too_Large} will raise @code{Storage_Error},
26537 because the required size includes @code{Positive'Last}
26538 bytes. As the first example indicates, the proper approach is to declare an
26539 index type of 'reasonable' range so that unconstrained objects are not too
26540 large.
26541
26542 One final wrinkle: if the object is declared to be @code{aliased}, or if it is
26543 created in the heap by means of an allocator, then it is @emph{not}
26544 unconstrained:
26545 it is constrained by the default values of the discriminants, and those values
26546 cannot be modified by full assignment. This is because in the presence of
26547 aliasing all views of the object (which may be manipulated by different tasks,
26548 say) must be consistent, so it is imperative that the object, once created,
26549 remain invariant.
26550
26551 @node Strict Conformance to the Ada Reference Manual,,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
26552 @anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{430}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{431}
26553 @section Strict Conformance to the Ada Reference Manual
26554
26555
26556 The dynamic semantics defined by the Ada Reference Manual impose a set of
26557 run-time checks to be generated. By default, the GNAT compiler will insert many
26558 run-time checks into the compiled code, including most of those required by the
26559 Ada Reference Manual. However, there are two checks that are not enabled in
26560 the default mode for efficiency reasons: checks for access before elaboration
26561 on subprogram calls, and stack overflow checking (most operating systems do not
26562 perform this check by default).
26563
26564 Strict conformance to the Ada Reference Manual can be achieved by adding two
26565 compiler options for dynamic checks for access-before-elaboration on subprogram
26566 calls and generic instantiations (@emph{-gnatE}), and stack overflow checking
26567 (@emph{-fstack-check}).
26568
26569 Note that the result of a floating point arithmetic operation in overflow and
26570 invalid situations, when the @code{Machine_Overflows} attribute of the result
26571 type is @code{False}, is to generate IEEE NaN and infinite values. This is the
26572 case for machines compliant with the IEEE floating-point standard, but on
26573 machines that are not fully compliant with this standard, such as Alpha, the
26574 @emph{-mieee} compiler flag must be used for achieving IEEE confirming
26575 behavior (although at the cost of a significant performance penalty), so
26576 infinite and NaN values are properly generated.
26577
26578 @node Implementation of Ada 2012 Features,Obsolescent Features,Implementation of Specific Ada Features,Top
26579 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{432}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{433}
26580 @chapter Implementation of Ada 2012 Features
26581
26582
26583 @geindex Ada 2012 implementation status
26584
26585 @geindex -gnat12 option (gcc)
26586
26587 @geindex pragma Ada_2012
26588
26589 @geindex configuration pragma Ada_2012
26590
26591 @geindex Ada_2012 configuration pragma
26592
26593 This chapter contains a complete list of Ada 2012 features that have been
26594 implemented.
26595 Generally, these features are only
26596 available if the @emph{-gnat12} (Ada 2012 features enabled) option is set,
26597 which is the default behavior,
26598 or if the configuration pragma @code{Ada_2012} is used.
26599
26600 However, new pragmas, attributes, and restrictions are
26601 unconditionally available, since the Ada 95 standard allows the addition of
26602 new pragmas, attributes, and restrictions (there are exceptions, which are
26603 documented in the individual descriptions), and also certain packages
26604 were made available in earlier versions of Ada.
26605
26606 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
26607 This date shows the implementation date of the feature. Any wavefront
26608 subsequent to this date will contain the indicated feature, as will any
26609 subsequent releases. A date of 0000-00-00 means that GNAT has always
26610 implemented the feature, or implemented it as soon as it appeared as a
26611 binding interpretation.
26612
26613 Each feature corresponds to an Ada Issue ('AI') approved by the Ada
26614 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
26615 The features are ordered based on the relevant sections of the Ada
26616 Reference Manual ("RM"). When a given AI relates to multiple points
26617 in the RM, the earliest is used.
26618
26619 A complete description of the AIs may be found in
26620 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
26621
26622 @geindex AI-0176 (Ada 2012 feature)
26623
26624
26625 @itemize *
26626
26627 @item
26628 @emph{AI-0176 Quantified expressions (2010-09-29)}
26629
26630 Both universally and existentially quantified expressions are implemented.
26631 They use the new syntax for iterators proposed in AI05-139-2, as well as
26632 the standard Ada loop syntax.
26633
26634 RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0)
26635 @end itemize
26636
26637 @geindex AI-0079 (Ada 2012 feature)
26638
26639
26640 @itemize *
26641
26642 @item
26643 @emph{AI-0079 Allow other_format characters in source (2010-07-10)}
26644
26645 Wide characters in the unicode category @emph{other_format} are now allowed in
26646 source programs between tokens, but not within a token such as an identifier.
26647
26648 RM References: 2.01 (4/2) 2.02 (7)
26649 @end itemize
26650
26651 @geindex AI-0091 (Ada 2012 feature)
26652
26653
26654 @itemize *
26655
26656 @item
26657 @emph{AI-0091 Do not allow other_format in identifiers (0000-00-00)}
26658
26659 Wide characters in the unicode category @emph{other_format} are not permitted
26660 within an identifier, since this can be a security problem. The error
26661 message for this case has been improved to be more specific, but GNAT has
26662 never allowed such characters to appear in identifiers.
26663
26664 RM References: 2.03 (3.1/2) 2.03 (4/2) 2.03 (5/2) 2.03 (5.1/2) 2.03 (5.2/2) 2.03 (5.3/2) 2.09 (2/2)
26665 @end itemize
26666
26667 @geindex AI-0100 (Ada 2012 feature)
26668
26669
26670 @itemize *
26671
26672 @item
26673 @emph{AI-0100 Placement of pragmas (2010-07-01)}
26674
26675 This AI is an earlier version of AI-163. It simplifies the rules
26676 for legal placement of pragmas. In the case of lists that allow pragmas, if
26677 the list may have no elements, then the list may consist solely of pragmas.
26678
26679 RM References: 2.08 (7)
26680 @end itemize
26681
26682 @geindex AI-0163 (Ada 2012 feature)
26683
26684
26685 @itemize *
26686
26687 @item
26688 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
26689
26690 A statement sequence may be composed entirely of pragmas. It is no longer
26691 necessary to add a dummy @code{null} statement to make the sequence legal.
26692
26693 RM References: 2.08 (7) 2.08 (16)
26694 @end itemize
26695
26696 @geindex AI-0080 (Ada 2012 feature)
26697
26698
26699 @itemize *
26700
26701 @item
26702 @emph{AI-0080 'View of' not needed if clear from context (0000-00-00)}
26703
26704 This is an editorial change only, described as non-testable in the AI.
26705
26706 RM References: 3.01 (7)
26707 @end itemize
26708
26709 @geindex AI-0183 (Ada 2012 feature)
26710
26711
26712 @itemize *
26713
26714 @item
26715 @emph{AI-0183 Aspect specifications (2010-08-16)}
26716
26717 Aspect specifications have been fully implemented except for pre and post-
26718 conditions, and type invariants, which have their own separate AI's. All
26719 forms of declarations listed in the AI are supported. The following is a
26720 list of the aspects supported (with GNAT implementation aspects marked)
26721 @end itemize
26722
26723
26724 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx}
26725 @headitem
26726
26727 Supported Aspect
26728
26729 @tab
26730
26731 Source
26732
26733 @item
26734
26735 @code{Ada_2005}
26736
26737 @tab
26738
26739 -- GNAT
26740
26741 @item
26742
26743 @code{Ada_2012}
26744
26745 @tab
26746
26747 -- GNAT
26748
26749 @item
26750
26751 @code{Address}
26752
26753 @tab
26754
26755 @item
26756
26757 @code{Alignment}
26758
26759 @tab
26760
26761 @item
26762
26763 @code{Atomic}
26764
26765 @tab
26766
26767 @item
26768
26769 @code{Atomic_Components}
26770
26771 @tab
26772
26773 @item
26774
26775 @code{Bit_Order}
26776
26777 @tab
26778
26779 @item
26780
26781 @code{Component_Size}
26782
26783 @tab
26784
26785 @item
26786
26787 @code{Contract_Cases}
26788
26789 @tab
26790
26791 -- GNAT
26792
26793 @item
26794
26795 @code{Discard_Names}
26796
26797 @tab
26798
26799 @item
26800
26801 @code{External_Tag}
26802
26803 @tab
26804
26805 @item
26806
26807 @code{Favor_Top_Level}
26808
26809 @tab
26810
26811 -- GNAT
26812
26813 @item
26814
26815 @code{Inline}
26816
26817 @tab
26818
26819 @item
26820
26821 @code{Inline_Always}
26822
26823 @tab
26824
26825 -- GNAT
26826
26827 @item
26828
26829 @code{Invariant}
26830
26831 @tab
26832
26833 -- GNAT
26834
26835 @item
26836
26837 @code{Machine_Radix}
26838
26839 @tab
26840
26841 @item
26842
26843 @code{No_Return}
26844
26845 @tab
26846
26847 @item
26848
26849 @code{Object_Size}
26850
26851 @tab
26852
26853 -- GNAT
26854
26855 @item
26856
26857 @code{Pack}
26858
26859 @tab
26860
26861 @item
26862
26863 @code{Persistent_BSS}
26864
26865 @tab
26866
26867 -- GNAT
26868
26869 @item
26870
26871 @code{Post}
26872
26873 @tab
26874
26875 @item
26876
26877 @code{Pre}
26878
26879 @tab
26880
26881 @item
26882
26883 @code{Predicate}
26884
26885 @tab
26886
26887 @item
26888
26889 @code{Preelaborable_Initialization}
26890
26891 @tab
26892
26893 @item
26894
26895 @code{Pure_Function}
26896
26897 @tab
26898
26899 -- GNAT
26900
26901 @item
26902
26903 @code{Remote_Access_Type}
26904
26905 @tab
26906
26907 -- GNAT
26908
26909 @item
26910
26911 @code{Shared}
26912
26913 @tab
26914
26915 -- GNAT
26916
26917 @item
26918
26919 @code{Size}
26920
26921 @tab
26922
26923 @item
26924
26925 @code{Storage_Pool}
26926
26927 @tab
26928
26929 @item
26930
26931 @code{Storage_Size}
26932
26933 @tab
26934
26935 @item
26936
26937 @code{Stream_Size}
26938
26939 @tab
26940
26941 @item
26942
26943 @code{Suppress}
26944
26945 @tab
26946
26947 @item
26948
26949 @code{Suppress_Debug_Info}
26950
26951 @tab
26952
26953 -- GNAT
26954
26955 @item
26956
26957 @code{Test_Case}
26958
26959 @tab
26960
26961 -- GNAT
26962
26963 @item
26964
26965 @code{Thread_Local_Storage}
26966
26967 @tab
26968
26969 -- GNAT
26970
26971 @item
26972
26973 @code{Type_Invariant}
26974
26975 @tab
26976
26977 @item
26978
26979 @code{Unchecked_Union}
26980
26981 @tab
26982
26983 @item
26984
26985 @code{Universal_Aliasing}
26986
26987 @tab
26988
26989 -- GNAT
26990
26991 @item
26992
26993 @code{Unmodified}
26994
26995 @tab
26996
26997 -- GNAT
26998
26999 @item
27000
27001 @code{Unreferenced}
27002
27003 @tab
27004
27005 -- GNAT
27006
27007 @item
27008
27009 @code{Unreferenced_Objects}
27010
27011 @tab
27012
27013 -- GNAT
27014
27015 @item
27016
27017 @code{Unsuppress}
27018
27019 @tab
27020
27021 @item
27022
27023 @code{Value_Size}
27024
27025 @tab
27026
27027 -- GNAT
27028
27029 @item
27030
27031 @code{Volatile}
27032
27033 @tab
27034
27035 @item
27036
27037 @code{Volatile_Components}
27038
27039 @tab
27040
27041 @item
27042
27043 @code{Warnings}
27044
27045 @tab
27046
27047 -- GNAT
27048
27049 @end multitable
27050
27051
27052 @quotation
27053
27054 Note that for aspects with an expression, e.g. @code{Size}, the expression is
27055 treated like a default expression (visibility is analyzed at the point of
27056 occurrence of the aspect, but evaluation of the expression occurs at the
27057 freeze point of the entity involved).
27058
27059 RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6)
27060 3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03
27061 (2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2)
27062 9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2)
27063 12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1)
27064 13.03.01 (0)
27065 @end quotation
27066
27067 @geindex AI-0128 (Ada 2012 feature)
27068
27069
27070 @itemize *
27071
27072 @item
27073 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
27074
27075 If an equality operator ("=") is declared for a type, then the implicitly
27076 declared inequality operator ("/=") is a primitive operation of the type.
27077 This is the only reasonable interpretation, and is the one always implemented
27078 by GNAT, but the RM was not entirely clear in making this point.
27079
27080 RM References: 3.02.03 (6) 6.06 (6)
27081 @end itemize
27082
27083 @geindex AI-0003 (Ada 2012 feature)
27084
27085
27086 @itemize *
27087
27088 @item
27089 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
27090
27091 In Ada 2012, a qualified expression is considered to be syntactically a name,
27092 meaning that constructs such as @code{A'(F(X)).B} are now legal. This is
27093 useful in disambiguating some cases of overloading.
27094
27095 RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3)
27096 5.04 (7)
27097 @end itemize
27098
27099 @geindex AI-0120 (Ada 2012 feature)
27100
27101
27102 @itemize *
27103
27104 @item
27105 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
27106
27107 This is an RM editorial change only. The section that lists objects that are
27108 constant failed to include the current instance of a protected object
27109 within a protected function. This has always been treated as a constant
27110 in GNAT.
27111
27112 RM References: 3.03 (21)
27113 @end itemize
27114
27115 @geindex AI-0008 (Ada 2012 feature)
27116
27117
27118 @itemize *
27119
27120 @item
27121 @emph{AI-0008 General access to constrained objects (0000-00-00)}
27122
27123 The wording in the RM implied that if you have a general access to a
27124 constrained object, it could be used to modify the discriminants. This was
27125 obviously not intended. @code{Constraint_Error} should be raised, and GNAT
27126 has always done so in this situation.
27127
27128 RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2)
27129 @end itemize
27130
27131 @geindex AI-0093 (Ada 2012 feature)
27132
27133
27134 @itemize *
27135
27136 @item
27137 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
27138
27139 This is an editorial change only, to make more widespread use of the Ada 2012
27140 'immutably limited'.
27141
27142 RM References: 3.03 (23.4/3)
27143 @end itemize
27144
27145 @geindex AI-0096 (Ada 2012 feature)
27146
27147
27148 @itemize *
27149
27150 @item
27151 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
27152
27153 In general it is illegal for a type derived from a formal limited type to be
27154 nonlimited. This AI makes an exception to this rule: derivation is legal
27155 if it appears in the private part of the generic, and the formal type is not
27156 tagged. If the type is tagged, the legality check must be applied to the
27157 private part of the package.
27158
27159 RM References: 3.04 (5.1/2) 6.02 (7)
27160 @end itemize
27161
27162 @geindex AI-0181 (Ada 2012 feature)
27163
27164
27165 @itemize *
27166
27167 @item
27168 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
27169
27170 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
27171 means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the
27172 @code{Image} and @code{Value} attributes for the character types. Strictly
27173 speaking this is an inconsistency with Ada 95, but in practice the use of
27174 these attributes is so obscure that it will not cause problems.
27175
27176 RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21)
27177 @end itemize
27178
27179 @geindex AI-0182 (Ada 2012 feature)
27180
27181
27182 @itemize *
27183
27184 @item
27185 @emph{AI-0182 Additional forms for} @code{Character'Value} @emph{(0000-00-00)}
27186
27187 This AI allows @code{Character'Value} to accept the string @code{'?'} where
27188 @code{?} is any character including non-graphic control characters. GNAT has
27189 always accepted such strings. It also allows strings such as
27190 @code{HEX_00000041} to be accepted, but GNAT does not take advantage of this
27191 permission and raises @code{Constraint_Error}, as is certainly still
27192 permitted.
27193
27194 RM References: 3.05 (56/2)
27195 @end itemize
27196
27197 @geindex AI-0214 (Ada 2012 feature)
27198
27199
27200 @itemize *
27201
27202 @item
27203 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
27204
27205 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
27206 to have default expressions by allowing them when the type is limited. It
27207 is often useful to define a default value for a discriminant even though
27208 it can't be changed by assignment.
27209
27210 RM References: 3.07 (9.1/2) 3.07.02 (3)
27211 @end itemize
27212
27213 @geindex AI-0102 (Ada 2012 feature)
27214
27215
27216 @itemize *
27217
27218 @item
27219 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
27220
27221 It is illegal to assign an anonymous access constant to an anonymous access
27222 variable. The RM did not have a clear rule to prevent this, but GNAT has
27223 always generated an error for this usage.
27224
27225 RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2)
27226 @end itemize
27227
27228 @geindex AI-0158 (Ada 2012 feature)
27229
27230
27231 @itemize *
27232
27233 @item
27234 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
27235
27236 This AI extends the syntax of membership tests to simplify complex conditions
27237 that can be expressed as membership in a subset of values of any type. It
27238 introduces syntax for a list of expressions that may be used in loop contexts
27239 as well.
27240
27241 RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27)
27242 @end itemize
27243
27244 @geindex AI-0173 (Ada 2012 feature)
27245
27246
27247 @itemize *
27248
27249 @item
27250 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
27251
27252 The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked
27253 with the tag of an abstract type, and @code{False} otherwise.
27254
27255 RM References: 3.09 (7.4/2) 3.09 (12.4/2)
27256 @end itemize
27257
27258 @geindex AI-0076 (Ada 2012 feature)
27259
27260
27261 @itemize *
27262
27263 @item
27264 @emph{AI-0076 function with controlling result (0000-00-00)}
27265
27266 This is an editorial change only. The RM defines calls with controlling
27267 results, but uses the term 'function with controlling result' without an
27268 explicit definition.
27269
27270 RM References: 3.09.02 (2/2)
27271 @end itemize
27272
27273 @geindex AI-0126 (Ada 2012 feature)
27274
27275
27276 @itemize *
27277
27278 @item
27279 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
27280
27281 This AI clarifies dispatching rules, and simply confirms that dispatching
27282 executes the operation of the parent type when there is no explicitly or
27283 implicitly declared operation for the descendant type. This has always been
27284 the case in all versions of GNAT.
27285
27286 RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2)
27287 @end itemize
27288
27289 @geindex AI-0097 (Ada 2012 feature)
27290
27291
27292 @itemize *
27293
27294 @item
27295 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
27296
27297 The RM as written implied that in some cases it was possible to create an
27298 object of an abstract type, by having an abstract extension inherit a non-
27299 abstract constructor from its parent type. This mistake has been corrected
27300 in GNAT and in the RM, and this construct is now illegal.
27301
27302 RM References: 3.09.03 (4/2)
27303 @end itemize
27304
27305 @geindex AI-0203 (Ada 2012 feature)
27306
27307
27308 @itemize *
27309
27310 @item
27311 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
27312
27313 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
27314 permitted such usage.
27315
27316 RM References: 3.09.03 (8/3)
27317 @end itemize
27318
27319 @geindex AI-0198 (Ada 2012 feature)
27320
27321
27322 @itemize *
27323
27324 @item
27325 @emph{AI-0198 Inheriting abstract operators (0000-00-00)}
27326
27327 This AI resolves a conflict between two rules involving inherited abstract
27328 operations and predefined operators. If a derived numeric type inherits
27329 an abstract operator, it overrides the predefined one. This interpretation
27330 was always the one implemented in GNAT.
27331
27332 RM References: 3.09.03 (4/3)
27333 @end itemize
27334
27335 @geindex AI-0073 (Ada 2012 feature)
27336
27337
27338 @itemize *
27339
27340 @item
27341 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
27342
27343 This AI covers a number of issues regarding returning abstract types. In
27344 particular generic functions cannot have abstract result types or access
27345 result types designated an abstract type. There are some other cases which
27346 are detailed in the AI. Note that this binding interpretation has not been
27347 retrofitted to operate before Ada 2012 mode, since it caused a significant
27348 number of regressions.
27349
27350 RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2)
27351 @end itemize
27352
27353 @geindex AI-0070 (Ada 2012 feature)
27354
27355
27356 @itemize *
27357
27358 @item
27359 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
27360
27361 This is an editorial change only, there are no testable consequences short of
27362 checking for the absence of generated code for an interface declaration.
27363
27364 RM References: 3.09.04 (18/2)
27365 @end itemize
27366
27367 @geindex AI-0208 (Ada 2012 feature)
27368
27369
27370 @itemize *
27371
27372 @item
27373 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
27374
27375 The wording in the Ada 2005 RM concerning characteristics of incomplete views
27376 was incorrect and implied that some programs intended to be legal were now
27377 illegal. GNAT had never considered such programs illegal, so it has always
27378 implemented the intent of this AI.
27379
27380 RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2)
27381 @end itemize
27382
27383 @geindex AI-0162 (Ada 2012 feature)
27384
27385
27386 @itemize *
27387
27388 @item
27389 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
27390
27391 Incomplete types are made more useful by allowing them to be completed by
27392 private types and private extensions.
27393
27394 RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2)
27395 @end itemize
27396
27397 @geindex AI-0098 (Ada 2012 feature)
27398
27399
27400 @itemize *
27401
27402 @item
27403 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
27404
27405 An unintentional omission in the RM implied some inconsistent restrictions on
27406 the use of anonymous access to subprogram values. These restrictions were not
27407 intentional, and have never been enforced by GNAT.
27408
27409 RM References: 3.10.01 (6) 3.10.01 (9.2/2)
27410 @end itemize
27411
27412 @geindex AI-0199 (Ada 2012 feature)
27413
27414
27415 @itemize *
27416
27417 @item
27418 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
27419
27420 A choice list in a record aggregate can include several components of
27421 (distinct) anonymous access types as long as they have matching designated
27422 subtypes.
27423
27424 RM References: 4.03.01 (16)
27425 @end itemize
27426
27427 @geindex AI-0220 (Ada 2012 feature)
27428
27429
27430 @itemize *
27431
27432 @item
27433 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
27434
27435 This AI addresses a wording problem in the RM that appears to permit some
27436 complex cases of aggregates with nonstatic discriminants. GNAT has always
27437 implemented the intended semantics.
27438
27439 RM References: 4.03.01 (17)
27440 @end itemize
27441
27442 @geindex AI-0147 (Ada 2012 feature)
27443
27444
27445 @itemize *
27446
27447 @item
27448 @emph{AI-0147 Conditional expressions (2009-03-29)}
27449
27450 Conditional expressions are permitted. The form of such an expression is:
27451
27452 @example
27453 (if expr then expr @{elsif expr then expr@} [else expr])
27454 @end example
27455
27456 The parentheses can be omitted in contexts where parentheses are present
27457 anyway, such as subprogram arguments and pragma arguments. If the @strong{else}
27458 clause is omitted, @strong{else} @emph{True} is assumed;
27459 thus @code{(if A then B)} is a way to conveniently represent
27460 @emph{(A implies B)} in standard logic.
27461
27462 RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2)
27463 4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2)
27464 @end itemize
27465
27466 @geindex AI-0037 (Ada 2012 feature)
27467
27468
27469 @itemize *
27470
27471 @item
27472 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
27473
27474 This AI confirms that an association of the form @code{Indx => <>} in an
27475 array aggregate must raise @code{Constraint_Error} if @code{Indx}
27476 is out of range. The RM specified a range check on other associations, but
27477 not when the value of the association was defaulted. GNAT has always inserted
27478 a constraint check on the index value.
27479
27480 RM References: 4.03.03 (29)
27481 @end itemize
27482
27483 @geindex AI-0123 (Ada 2012 feature)
27484
27485
27486 @itemize *
27487
27488 @item
27489 @emph{AI-0123 Composability of equality (2010-04-13)}
27490
27491 Equality of untagged record composes, so that the predefined equality for a
27492 composite type that includes a component of some untagged record type
27493 @code{R} uses the equality operation of @code{R} (which may be user-defined
27494 or predefined). This makes the behavior of untagged records identical to that
27495 of tagged types in this respect.
27496
27497 This change is an incompatibility with previous versions of Ada, but it
27498 corrects a non-uniformity that was often a source of confusion. Analysis of
27499 a large number of industrial programs indicates that in those rare cases
27500 where a composite type had an untagged record component with a user-defined
27501 equality, either there was no use of the composite equality, or else the code
27502 expected the same composability as for tagged types, and thus had a bug that
27503 would be fixed by this change.
27504
27505 RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24)
27506 8.05.04 (8)
27507 @end itemize
27508
27509 @geindex AI-0088 (Ada 2012 feature)
27510
27511
27512 @itemize *
27513
27514 @item
27515 @emph{AI-0088 The value of exponentiation (0000-00-00)}
27516
27517 This AI clarifies the equivalence rule given for the dynamic semantics of
27518 exponentiation: the value of the operation can be obtained by repeated
27519 multiplication, but the operation can be implemented otherwise (for example
27520 using the familiar divide-by-two-and-square algorithm, even if this is less
27521 accurate), and does not imply repeated reads of a volatile base.
27522
27523 RM References: 4.05.06 (11)
27524 @end itemize
27525
27526 @geindex AI-0188 (Ada 2012 feature)
27527
27528
27529 @itemize *
27530
27531 @item
27532 @emph{AI-0188 Case expressions (2010-01-09)}
27533
27534 Case expressions are permitted. This allows use of constructs such as:
27535
27536 @example
27537 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
27538 @end example
27539
27540 RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33)
27541 @end itemize
27542
27543 @geindex AI-0104 (Ada 2012 feature)
27544
27545
27546 @itemize *
27547
27548 @item
27549 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
27550
27551 The assignment @code{Ptr := new not null Some_Ptr;} will raise
27552 @code{Constraint_Error} because the default value of the allocated object is
27553 @strong{null}. This useless construct is illegal in Ada 2012.
27554
27555 RM References: 4.08 (2)
27556 @end itemize
27557
27558 @geindex AI-0157 (Ada 2012 feature)
27559
27560
27561 @itemize *
27562
27563 @item
27564 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
27565
27566 Allocation and Deallocation from an empty storage pool (i.e. allocation or
27567 deallocation of a pointer for which a static storage size clause of zero
27568 has been given) is now illegal and is detected as such. GNAT
27569 previously gave a warning but not an error.
27570
27571 RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17)
27572 @end itemize
27573
27574 @geindex AI-0179 (Ada 2012 feature)
27575
27576
27577 @itemize *
27578
27579 @item
27580 @emph{AI-0179 Statement not required after label (2010-04-10)}
27581
27582 It is not necessary to have a statement following a label, so a label
27583 can appear at the end of a statement sequence without the need for putting a
27584 null statement afterwards, but it is not allowable to have only labels and
27585 no real statements in a statement sequence.
27586
27587 RM References: 5.01 (2)
27588 @end itemize
27589
27590 @geindex AI-0139-2 (Ada 2012 feature)
27591
27592
27593 @itemize *
27594
27595 @item
27596 @emph{AI-0139-2 Syntactic sugar for iterators (2010-09-29)}
27597
27598 The new syntax for iterating over arrays and containers is now implemented.
27599 Iteration over containers is for now limited to read-only iterators. Only
27600 default iterators are supported, with the syntax: @code{for Elem of C}.
27601
27602 RM References: 5.05
27603 @end itemize
27604
27605 @geindex AI-0134 (Ada 2012 feature)
27606
27607
27608 @itemize *
27609
27610 @item
27611 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
27612
27613 For full conformance, the profiles of anonymous-access-to-subprogram
27614 parameters must match. GNAT has always enforced this rule.
27615
27616 RM References: 6.03.01 (18)
27617 @end itemize
27618
27619 @geindex AI-0207 (Ada 2012 feature)
27620
27621
27622 @itemize *
27623
27624 @item
27625 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
27626
27627 This AI confirms that access_to_constant indication must match for mode
27628 conformance. This was implemented in GNAT when the qualifier was originally
27629 introduced in Ada 2005.
27630
27631 RM References: 6.03.01 (16/2)
27632 @end itemize
27633
27634 @geindex AI-0046 (Ada 2012 feature)
27635
27636
27637 @itemize *
27638
27639 @item
27640 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
27641
27642 For full conformance, in the case of access parameters, the null exclusion
27643 must match (either both or neither must have @code{not null}).
27644
27645 RM References: 6.03.02 (18)
27646 @end itemize
27647
27648 @geindex AI-0118 (Ada 2012 feature)
27649
27650
27651 @itemize *
27652
27653 @item
27654 @emph{AI-0118 The association of parameter associations (0000-00-00)}
27655
27656 This AI clarifies the rules for named associations in subprogram calls and
27657 generic instantiations. The rules have been in place since Ada 83.
27658
27659 RM References: 6.04.01 (2) 12.03 (9)
27660 @end itemize
27661
27662 @geindex AI-0196 (Ada 2012 feature)
27663
27664
27665 @itemize *
27666
27667 @item
27668 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
27669
27670 Null exclusion checks are not made for @code{out} parameters when
27671 evaluating the actual parameters. GNAT has never generated these checks.
27672
27673 RM References: 6.04.01 (13)
27674 @end itemize
27675
27676 @geindex AI-0015 (Ada 2012 feature)
27677
27678
27679 @itemize *
27680
27681 @item
27682 @emph{AI-0015 Constant return objects (0000-00-00)}
27683
27684 The return object declared in an @emph{extended_return_statement} may be
27685 declared constant. This was always intended, and GNAT has always allowed it.
27686
27687 RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2)
27688 6.05 (5.7/2)
27689 @end itemize
27690
27691 @geindex AI-0032 (Ada 2012 feature)
27692
27693
27694 @itemize *
27695
27696 @item
27697 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
27698
27699 If a function returns a class-wide type, the object of an extended return
27700 statement can be declared with a specific type that is covered by the class-
27701 wide type. This has been implemented in GNAT since the introduction of
27702 extended returns. Note AI-0103 complements this AI by imposing matching
27703 rules for constrained return types.
27704
27705 RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2)
27706 6.05 (8/2)
27707 @end itemize
27708
27709 @geindex AI-0103 (Ada 2012 feature)
27710
27711
27712 @itemize *
27713
27714 @item
27715 @emph{AI-0103 Static matching for extended return (2010-07-23)}
27716
27717 If the return subtype of a function is an elementary type or a constrained
27718 type, the subtype indication in an extended return statement must match
27719 statically this return subtype.
27720
27721 RM References: 6.05 (5.2/2)
27722 @end itemize
27723
27724 @geindex AI-0058 (Ada 2012 feature)
27725
27726
27727 @itemize *
27728
27729 @item
27730 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
27731
27732 The RM had some incorrect wording implying wrong treatment of abnormal
27733 completion in an extended return. GNAT has always implemented the intended
27734 correct semantics as described by this AI.
27735
27736 RM References: 6.05 (22/2)
27737 @end itemize
27738
27739 @geindex AI-0050 (Ada 2012 feature)
27740
27741
27742 @itemize *
27743
27744 @item
27745 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
27746
27747 The implementation permissions for raising @code{Constraint_Error} early on a function call
27748 when it was clear an exception would be raised were over-permissive and allowed
27749 mishandling of discriminants in some cases. GNAT did
27750 not take advantage of these incorrect permissions in any case.
27751
27752 RM References: 6.05 (24/2)
27753 @end itemize
27754
27755 @geindex AI-0125 (Ada 2012 feature)
27756
27757
27758 @itemize *
27759
27760 @item
27761 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
27762
27763 In Ada 2012, the declaration of a primitive operation of a type extension
27764 or private extension can also override an inherited primitive that is not
27765 visible at the point of this declaration.
27766
27767 RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2)
27768 @end itemize
27769
27770 @geindex AI-0062 (Ada 2012 feature)
27771
27772
27773 @itemize *
27774
27775 @item
27776 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
27777
27778 A full constant may have a null exclusion even if its associated deferred
27779 constant does not. GNAT has always allowed this.
27780
27781 RM References: 7.04 (6/2) 7.04 (7.1/2)
27782 @end itemize
27783
27784 @geindex AI-0178 (Ada 2012 feature)
27785
27786
27787 @itemize *
27788
27789 @item
27790 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
27791
27792 This AI clarifies the role of incomplete views and plugs an omission in the
27793 RM. GNAT always correctly restricted the use of incomplete views and types.
27794
27795 RM References: 7.05 (3/2) 7.05 (6/2)
27796 @end itemize
27797
27798 @geindex AI-0087 (Ada 2012 feature)
27799
27800
27801 @itemize *
27802
27803 @item
27804 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
27805
27806 The actual for a formal nonlimited derived type cannot be limited. In
27807 particular, a formal derived type that extends a limited interface but which
27808 is not explicitly limited cannot be instantiated with a limited type.
27809
27810 RM References: 7.05 (5/2) 12.05.01 (5.1/2)
27811 @end itemize
27812
27813 @geindex AI-0099 (Ada 2012 feature)
27814
27815
27816 @itemize *
27817
27818 @item
27819 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
27820
27821 This AI clarifies that 'needs finalization' is part of dynamic semantics,
27822 and therefore depends on the run-time characteristics of an object (i.e. its
27823 tag) and not on its nominal type. As the AI indicates: "we do not expect
27824 this to affect any implementation'@w{'}.
27825
27826 RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2)
27827 @end itemize
27828
27829 @geindex AI-0064 (Ada 2012 feature)
27830
27831
27832 @itemize *
27833
27834 @item
27835 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
27836
27837 This is an editorial change only. The intended behavior is already checked
27838 by an existing ACATS test, which GNAT has always executed correctly.
27839
27840 RM References: 7.06.01 (17.1/1)
27841 @end itemize
27842
27843 @geindex AI-0026 (Ada 2012 feature)
27844
27845
27846 @itemize *
27847
27848 @item
27849 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
27850
27851 Record representation clauses concerning Unchecked_Union types cannot mention
27852 the discriminant of the type. The type of a component declared in the variant
27853 part of an Unchecked_Union cannot be controlled, have controlled components,
27854 nor have protected or task parts. If an Unchecked_Union type is declared
27855 within the body of a generic unit or its descendants, then the type of a
27856 component declared in the variant part cannot be a formal private type or a
27857 formal private extension declared within the same generic unit.
27858
27859 RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2)
27860 @end itemize
27861
27862 @geindex AI-0205 (Ada 2012 feature)
27863
27864
27865 @itemize *
27866
27867 @item
27868 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
27869
27870 This AI corrects a simple omission in the RM. Return objects have always
27871 been visible within an extended return statement.
27872
27873 RM References: 8.03 (17)
27874 @end itemize
27875
27876 @geindex AI-0042 (Ada 2012 feature)
27877
27878
27879 @itemize *
27880
27881 @item
27882 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
27883
27884 This AI fixes a wording gap in the RM. An operation of a synchronized
27885 interface can be implemented by a protected or task entry, but the abstract
27886 operation is not being overridden in the usual sense, and it must be stated
27887 separately that this implementation is legal. This has always been the case
27888 in GNAT.
27889
27890 RM References: 9.01 (9.2/2) 9.04 (11.1/2)
27891 @end itemize
27892
27893 @geindex AI-0030 (Ada 2012 feature)
27894
27895
27896 @itemize *
27897
27898 @item
27899 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
27900
27901 Requeue is permitted to a protected, synchronized or task interface primitive
27902 providing it is known that the overriding operation is an entry. Otherwise
27903 the requeue statement has the same effect as a procedure call. Use of pragma
27904 @code{Implemented} provides a way to impose a static requirement on the
27905 overriding operation by adhering to one of the implementation kinds: entry,
27906 protected procedure or any of the above.
27907
27908 RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5)
27909 9.05.04 (6) 9.05.04 (7) 9.05.04 (12)
27910 @end itemize
27911
27912 @geindex AI-0201 (Ada 2012 feature)
27913
27914
27915 @itemize *
27916
27917 @item
27918 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
27919
27920 If an Atomic object has a pragma @code{Pack} or a @code{Component_Size}
27921 attribute, then individual components may not be addressable by independent
27922 tasks. However, if the representation clause has no effect (is confirming),
27923 then independence is not compromised. Furthermore, in GNAT, specification of
27924 other appropriately addressable component sizes (e.g. 16 for 8-bit
27925 characters) also preserves independence. GNAT now gives very clear warnings
27926 both for the declaration of such a type, and for any assignment to its components.
27927
27928 RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2)
27929 @end itemize
27930
27931 @geindex AI-0009 (Ada 2012 feature)
27932
27933
27934 @itemize *
27935
27936 @item
27937 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
27938
27939 This AI introduces the new pragmas @code{Independent} and
27940 @code{Independent_Components},
27941 which control guaranteeing independence of access to objects and components.
27942 The AI also requires independence not unaffected by confirming rep clauses.
27943
27944 RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2)
27945 C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14)
27946 @end itemize
27947
27948 @geindex AI-0072 (Ada 2012 feature)
27949
27950
27951 @itemize *
27952
27953 @item
27954 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
27955
27956 This AI clarifies that task signalling for reading @code{'Terminated} only
27957 occurs if the result is True. GNAT semantics has always been consistent with
27958 this notion of task signalling.
27959
27960 RM References: 9.10 (6.1/1)
27961 @end itemize
27962
27963 @geindex AI-0108 (Ada 2012 feature)
27964
27965
27966 @itemize *
27967
27968 @item
27969 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
27970
27971 This AI confirms that an incomplete type from a limited view does not have
27972 discriminants. This has always been the case in GNAT.
27973
27974 RM References: 10.01.01 (12.3/2)
27975 @end itemize
27976
27977 @geindex AI-0129 (Ada 2012 feature)
27978
27979
27980 @itemize *
27981
27982 @item
27983 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
27984
27985 This AI clarifies the description of limited views: a limited view of a
27986 package includes only one view of a type that has an incomplete declaration
27987 and a full declaration (there is no possible ambiguity in a client package).
27988 This AI also fixes an omission: a nested package in the private part has no
27989 limited view. GNAT always implemented this correctly.
27990
27991 RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2)
27992 @end itemize
27993
27994 @geindex AI-0077 (Ada 2012 feature)
27995
27996
27997 @itemize *
27998
27999 @item
28000 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
28001
28002 This AI clarifies that a declaration does not include a context clause,
28003 and confirms that it is illegal to have a context in which both a limited
28004 and a nonlimited view of a package are accessible. Such double visibility
28005 was always rejected by GNAT.
28006
28007 RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2)
28008 @end itemize
28009
28010 @geindex AI-0122 (Ada 2012 feature)
28011
28012
28013 @itemize *
28014
28015 @item
28016 @emph{AI-0122 Private with and children of generics (0000-00-00)}
28017
28018 This AI clarifies the visibility of private children of generic units within
28019 instantiations of a parent. GNAT has always handled this correctly.
28020
28021 RM References: 10.01.02 (12/2)
28022 @end itemize
28023
28024 @geindex AI-0040 (Ada 2012 feature)
28025
28026
28027 @itemize *
28028
28029 @item
28030 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
28031
28032 This AI confirms that a limited with clause in a child unit cannot name
28033 an ancestor of the unit. This has always been checked in GNAT.
28034
28035 RM References: 10.01.02 (20/2)
28036 @end itemize
28037
28038 @geindex AI-0132 (Ada 2012 feature)
28039
28040
28041 @itemize *
28042
28043 @item
28044 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
28045
28046 This AI fills a gap in the description of library unit pragmas. The pragma
28047 clearly must apply to a library unit, even if it does not carry the name
28048 of the enclosing unit. GNAT has always enforced the required check.
28049
28050 RM References: 10.01.05 (7)
28051 @end itemize
28052
28053 @geindex AI-0034 (Ada 2012 feature)
28054
28055
28056 @itemize *
28057
28058 @item
28059 @emph{AI-0034 Categorization of limited views (0000-00-00)}
28060
28061 The RM makes certain limited with clauses illegal because of categorization
28062 considerations, when the corresponding normal with would be legal. This is
28063 not intended, and GNAT has always implemented the recommended behavior.
28064
28065 RM References: 10.02.01 (11/1) 10.02.01 (17/2)
28066 @end itemize
28067
28068 @geindex AI-0035 (Ada 2012 feature)
28069
28070
28071 @itemize *
28072
28073 @item
28074 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
28075
28076 This AI remedies some inconsistencies in the legality rules for Pure units.
28077 Derived access types are legal in a pure unit (on the assumption that the
28078 rule for a zero storage pool size has been enforced on the ancestor type).
28079 The rules are enforced in generic instances and in subunits. GNAT has always
28080 implemented the recommended behavior.
28081
28082 RM References: 10.02.01 (15.1/2) 10.02.01 (15.4/2) 10.02.01 (15.5/2) 10.02.01 (17/2)
28083 @end itemize
28084
28085 @geindex AI-0219 (Ada 2012 feature)
28086
28087
28088 @itemize *
28089
28090 @item
28091 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
28092
28093 This AI refines the rules for the cases with limited parameters which do not
28094 allow the implementations to omit 'redundant'. GNAT now properly conforms
28095 to the requirements of this binding interpretation.
28096
28097 RM References: 10.02.01 (18/2)
28098 @end itemize
28099
28100 @geindex AI-0043 (Ada 2012 feature)
28101
28102
28103 @itemize *
28104
28105 @item
28106 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
28107
28108 This AI covers various omissions in the RM regarding the raising of
28109 exceptions. GNAT has always implemented the intended semantics.
28110
28111 RM References: 11.04.01 (10.1/2) 11 (2)
28112 @end itemize
28113
28114 @geindex AI-0200 (Ada 2012 feature)
28115
28116
28117 @itemize *
28118
28119 @item
28120 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
28121
28122 This AI plugs a gap in the RM which appeared to allow some obviously intended
28123 illegal instantiations. GNAT has never allowed these instantiations.
28124
28125 RM References: 12.07 (16)
28126 @end itemize
28127
28128 @geindex AI-0112 (Ada 2012 feature)
28129
28130
28131 @itemize *
28132
28133 @item
28134 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
28135
28136 This AI concerns giving names to various representation aspects, but the
28137 practical effect is simply to make the use of duplicate
28138 @code{Atomic[_Components]},
28139 @code{Volatile[_Components]}, and
28140 @code{Independent[_Components]} pragmas illegal, and GNAT
28141 now performs this required check.
28142
28143 RM References: 13.01 (8)
28144 @end itemize
28145
28146 @geindex AI-0106 (Ada 2012 feature)
28147
28148
28149 @itemize *
28150
28151 @item
28152 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
28153
28154 The RM appeared to allow representation pragmas on generic formal parameters,
28155 but this was not intended, and GNAT has never permitted this usage.
28156
28157 RM References: 13.01 (9.1/1)
28158 @end itemize
28159
28160 @geindex AI-0012 (Ada 2012 feature)
28161
28162
28163 @itemize *
28164
28165 @item
28166 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
28167
28168 It is now illegal to give an inappropriate component size or a pragma
28169 @code{Pack} that attempts to change the component size in the case of atomic
28170 or aliased components. Previously GNAT ignored such an attempt with a
28171 warning.
28172
28173 RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21)
28174 @end itemize
28175
28176 @geindex AI-0039 (Ada 2012 feature)
28177
28178
28179 @itemize *
28180
28181 @item
28182 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
28183
28184 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
28185 for stream attributes, but these were never useful and are now illegal. GNAT
28186 has always regarded such expressions as illegal.
28187
28188 RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2)
28189 @end itemize
28190
28191 @geindex AI-0095 (Ada 2012 feature)
28192
28193
28194 @itemize *
28195
28196 @item
28197 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
28198
28199 The prefix of @code{'Address} cannot statically denote a subprogram with
28200 convention @code{Intrinsic}. The use of the @code{Address} attribute raises
28201 @code{Program_Error} if the prefix denotes a subprogram with convention
28202 @code{Intrinsic}.
28203
28204 RM References: 13.03 (11/1)
28205 @end itemize
28206
28207 @geindex AI-0116 (Ada 2012 feature)
28208
28209
28210 @itemize *
28211
28212 @item
28213 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
28214
28215 This AI requires that the alignment of a class-wide object be no greater
28216 than the alignment of any type in the class. GNAT has always followed this
28217 recommendation.
28218
28219 RM References: 13.03 (29) 13.11 (16)
28220 @end itemize
28221
28222 @geindex AI-0146 (Ada 2012 feature)
28223
28224
28225 @itemize *
28226
28227 @item
28228 @emph{AI-0146 Type invariants (2009-09-21)}
28229
28230 Type invariants may be specified for private types using the aspect notation.
28231 Aspect @code{Type_Invariant} may be specified for any private type,
28232 @code{Type_Invariant'Class} can
28233 only be specified for tagged types, and is inherited by any descendent of the
28234 tagged types. The invariant is a boolean expression that is tested for being
28235 true in the following situations: conversions to the private type, object
28236 declarations for the private type that are default initialized, and
28237 [@strong{in}] @strong{out}
28238 parameters and returned result on return from any primitive operation for
28239 the type that is visible to a client.
28240 GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and
28241 @code{Invariant'Class} for @code{Type_Invariant'Class}.
28242
28243 RM References: 13.03.03 (00)
28244 @end itemize
28245
28246 @geindex AI-0078 (Ada 2012 feature)
28247
28248
28249 @itemize *
28250
28251 @item
28252 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
28253
28254 In Ada 2012, compilers are required to support unchecked conversion where the
28255 target alignment is a multiple of the source alignment. GNAT always supported
28256 this case (and indeed all cases of differing alignments, doing copies where
28257 required if the alignment was reduced).
28258
28259 RM References: 13.09 (7)
28260 @end itemize
28261
28262 @geindex AI-0195 (Ada 2012 feature)
28263
28264
28265 @itemize *
28266
28267 @item
28268 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
28269
28270 The handling of invalid values is now designated to be implementation
28271 defined. This is a documentation change only, requiring Annex M in the GNAT
28272 Reference Manual to document this handling.
28273 In GNAT, checks for invalid values are made
28274 only when necessary to avoid erroneous behavior. Operations like assignments
28275 which cannot cause erroneous behavior ignore the possibility of invalid
28276 values and do not do a check. The date given above applies only to the
28277 documentation change, this behavior has always been implemented by GNAT.
28278
28279 RM References: 13.09.01 (10)
28280 @end itemize
28281
28282 @geindex AI-0193 (Ada 2012 feature)
28283
28284
28285 @itemize *
28286
28287 @item
28288 @emph{AI-0193 Alignment of allocators (2010-09-16)}
28289
28290 This AI introduces a new attribute @code{Max_Alignment_For_Allocation},
28291 analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead
28292 of size.
28293
28294 RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1)
28295 13.11.01 (2) 13.11.01 (3)
28296 @end itemize
28297
28298 @geindex AI-0177 (Ada 2012 feature)
28299
28300
28301 @itemize *
28302
28303 @item
28304 @emph{AI-0177 Parameterized expressions (2010-07-10)}
28305
28306 The new Ada 2012 notion of parameterized expressions is implemented. The form
28307 is:
28308
28309 @example
28310 function-specification is (expression)
28311 @end example
28312
28313 This is exactly equivalent to the
28314 corresponding function body that returns the expression, but it can appear
28315 in a package spec. Note that the expression must be parenthesized.
28316
28317 RM References: 13.11.01 (3/2)
28318 @end itemize
28319
28320 @geindex AI-0033 (Ada 2012 feature)
28321
28322
28323 @itemize *
28324
28325 @item
28326 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
28327
28328 Neither of these two pragmas may appear within a generic template, because
28329 the generic might be instantiated at other than the library level.
28330
28331 RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2)
28332 @end itemize
28333
28334 @geindex AI-0161 (Ada 2012 feature)
28335
28336
28337 @itemize *
28338
28339 @item
28340 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
28341
28342 A new restriction @code{No_Default_Stream_Attributes} prevents the use of any
28343 of the default stream attributes for elementary types. If this restriction is
28344 in force, then it is necessary to provide explicit subprograms for any
28345 stream attributes used.
28346
28347 RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2)
28348 @end itemize
28349
28350 @geindex AI-0194 (Ada 2012 feature)
28351
28352
28353 @itemize *
28354
28355 @item
28356 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
28357
28358 The @code{Stream_Size} attribute returns the default number of bits in the
28359 stream representation of the given type.
28360 This value is not affected by the presence
28361 of stream subprogram attributes for the type. GNAT has always implemented
28362 this interpretation.
28363
28364 RM References: 13.13.02 (1.2/2)
28365 @end itemize
28366
28367 @geindex AI-0109 (Ada 2012 feature)
28368
28369
28370 @itemize *
28371
28372 @item
28373 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
28374
28375 This AI is an editorial change only. It removes the need for a tag check
28376 that can never fail.
28377
28378 RM References: 13.13.02 (34/2)
28379 @end itemize
28380
28381 @geindex AI-0007 (Ada 2012 feature)
28382
28383
28384 @itemize *
28385
28386 @item
28387 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
28388
28389 The RM as written appeared to limit the possibilities of declaring read
28390 attribute procedures for private scalar types. This limitation was not
28391 intended, and has never been enforced by GNAT.
28392
28393 RM References: 13.13.02 (50/2) 13.13.02 (51/2)
28394 @end itemize
28395
28396 @geindex AI-0065 (Ada 2012 feature)
28397
28398
28399 @itemize *
28400
28401 @item
28402 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
28403
28404 This AI clarifies the fact that all remote access types support external
28405 streaming. This fixes an obvious oversight in the definition of the
28406 language, and GNAT always implemented the intended correct rules.
28407
28408 RM References: 13.13.02 (52/2)
28409 @end itemize
28410
28411 @geindex AI-0019 (Ada 2012 feature)
28412
28413
28414 @itemize *
28415
28416 @item
28417 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
28418
28419 The RM suggests that primitive subprograms of a specific tagged type are
28420 frozen when the tagged type is frozen. This would be an incompatible change
28421 and is not intended. GNAT has never attempted this kind of freezing and its
28422 behavior is consistent with the recommendation of this AI.
28423
28424 RM References: 13.14 (2) 13.14 (3/1) 13.14 (8.1/1) 13.14 (10) 13.14 (14) 13.14 (15.1/2)
28425 @end itemize
28426
28427 @geindex AI-0017 (Ada 2012 feature)
28428
28429
28430 @itemize *
28431
28432 @item
28433 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
28434
28435 So-called 'Taft-amendment types' (i.e., types that are completed in package
28436 bodies) are not frozen by the occurrence of bodies in the
28437 enclosing declarative part. GNAT always implemented this properly.
28438
28439 RM References: 13.14 (3/1)
28440 @end itemize
28441
28442 @geindex AI-0060 (Ada 2012 feature)
28443
28444
28445 @itemize *
28446
28447 @item
28448 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
28449
28450 This AI extends the definition of remote access types to include access
28451 to limited, synchronized, protected or task class-wide interface types.
28452 GNAT already implemented this extension.
28453
28454 RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18)
28455 @end itemize
28456
28457 @geindex AI-0114 (Ada 2012 feature)
28458
28459
28460 @itemize *
28461
28462 @item
28463 @emph{AI-0114 Classification of letters (0000-00-00)}
28464
28465 The code points 170 (@code{FEMININE ORDINAL INDICATOR}),
28466 181 (@code{MICRO SIGN}), and
28467 186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered
28468 lower case letters by Unicode.
28469 However, they are not allowed in identifiers, and they
28470 return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}.
28471 This behavior is consistent with that defined in Ada 95.
28472
28473 RM References: A.03.02 (59) A.04.06 (7)
28474 @end itemize
28475
28476 @geindex AI-0185 (Ada 2012 feature)
28477
28478
28479 @itemize *
28480
28481 @item
28482 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
28483
28484 Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide
28485 classification functions for @code{Wide_Character} and
28486 @code{Wide_Wide_Character}, as well as providing
28487 case folding routines for @code{Wide_[Wide_]Character} and
28488 @code{Wide_[Wide_]String}.
28489
28490 RM References: A.03.05 (0) A.03.06 (0)
28491 @end itemize
28492
28493 @geindex AI-0031 (Ada 2012 feature)
28494
28495
28496 @itemize *
28497
28498 @item
28499 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
28500
28501 A new version of @code{Find_Token} is added to all relevant string packages,
28502 with an extra parameter @code{From}. Instead of starting at the first
28503 character of the string, the search for a matching Token starts at the
28504 character indexed by the value of @code{From}.
28505 These procedures are available in all versions of Ada
28506 but if used in versions earlier than Ada 2012 they will generate a warning
28507 that an Ada 2012 subprogram is being used.
28508
28509 RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51)
28510 A.04.05 (46)
28511 @end itemize
28512
28513 @geindex AI-0056 (Ada 2012 feature)
28514
28515
28516 @itemize *
28517
28518 @item
28519 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
28520
28521 The wording in the Ada 2005 RM implied an incompatible handling of the
28522 @code{Index} functions, resulting in raising an exception instead of
28523 returning zero in some situations.
28524 This was not intended and has been corrected.
28525 GNAT always returned zero, and is thus consistent with this AI.
28526
28527 RM References: A.04.03 (56.2/2) A.04.03 (58.5/2)
28528 @end itemize
28529
28530 @geindex AI-0137 (Ada 2012 feature)
28531
28532
28533 @itemize *
28534
28535 @item
28536 @emph{AI-0137 String encoding package (2010-03-25)}
28537
28538 The packages @code{Ada.Strings.UTF_Encoding}, together with its child
28539 packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings},
28540 and @code{Wide_Wide_Strings} have been
28541 implemented. These packages (whose documentation can be found in the spec
28542 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
28543 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
28544 @code{String}, @code{Wide_String}, and @code{Wide_Wide_String}
28545 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
28546 UTF-16), as well as conversions between the different UTF encodings. With
28547 the exception of @code{Wide_Wide_Strings}, these packages are available in
28548 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
28549 The @code{Wide_Wide_Strings} package
28550 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
28551 mode since it uses @code{Wide_Wide_Character}).
28552
28553 RM References: A.04.11
28554 @end itemize
28555
28556 @geindex AI-0038 (Ada 2012 feature)
28557
28558
28559 @itemize *
28560
28561 @item
28562 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
28563
28564 These are minor errors in the description on three points. The intent on
28565 all these points has always been clear, and GNAT has always implemented the
28566 correct intended semantics.
28567
28568 RM References: A.10.05 (37) A.10.07 (8/1) A.10.07 (10) A.10.07 (12) A.10.08 (10) A.10.08 (24)
28569 @end itemize
28570
28571 @geindex AI-0044 (Ada 2012 feature)
28572
28573
28574 @itemize *
28575
28576 @item
28577 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
28578
28579 This AI places restrictions on allowed instantiations of generic containers.
28580 These restrictions are not checked by the compiler, so there is nothing to
28581 change in the implementation. This affects only the RM documentation.
28582
28583 RM References: A.18 (4/2) A.18.02 (231/2) A.18.03 (145/2) A.18.06 (56/2) A.18.08 (66/2) A.18.09 (79/2) A.18.26 (5/2) A.18.26 (9/2)
28584 @end itemize
28585
28586 @geindex AI-0127 (Ada 2012 feature)
28587
28588
28589 @itemize *
28590
28591 @item
28592 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
28593
28594 This package provides an interface for identifying the current locale.
28595
28596 RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06
28597 A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13
28598 @end itemize
28599
28600 @geindex AI-0002 (Ada 2012 feature)
28601
28602
28603 @itemize *
28604
28605 @item
28606 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
28607
28608 The compiler is not required to support exporting an Ada subprogram with
28609 convention C if there are parameters or a return type of an unconstrained
28610 array type (such as @code{String}). GNAT allows such declarations but
28611 generates warnings. It is possible, but complicated, to write the
28612 corresponding C code and certainly such code would be specific to GNAT and
28613 non-portable.
28614
28615 RM References: B.01 (17) B.03 (62) B.03 (71.1/2)
28616 @end itemize
28617
28618 @geindex AI05-0216 (Ada 2012 feature)
28619
28620
28621 @itemize *
28622
28623 @item
28624 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
28625
28626 It is clearly the intention that @code{No_Task_Hierarchy} is intended to
28627 forbid tasks declared locally within subprograms, or functions returning task
28628 objects, and that is the implementation that GNAT has always provided.
28629 However the language in the RM was not sufficiently clear on this point.
28630 Thus this is a documentation change in the RM only.
28631
28632 RM References: D.07 (3/3)
28633 @end itemize
28634
28635 @geindex AI-0211 (Ada 2012 feature)
28636
28637
28638 @itemize *
28639
28640 @item
28641 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
28642
28643 The restriction @code{No_Relative_Delays} forbids any calls to the subprogram
28644 @code{Ada.Real_Time.Timing_Events.Set_Handler}.
28645
28646 RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2)
28647 @end itemize
28648
28649 @geindex AI-0190 (Ada 2012 feature)
28650
28651
28652 @itemize *
28653
28654 @item
28655 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
28656
28657 This AI introduces a new pragma @code{Default_Storage_Pool}, which can be
28658 used to control storage pools globally.
28659 In particular, you can force every access
28660 type that is used for allocation (@strong{new}) to have an explicit storage pool,
28661 or you can declare a pool globally to be used for all access types that lack
28662 an explicit one.
28663
28664 RM References: D.07 (8)
28665 @end itemize
28666
28667 @geindex AI-0189 (Ada 2012 feature)
28668
28669
28670 @itemize *
28671
28672 @item
28673 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
28674
28675 This AI introduces a new restriction @code{No_Allocators_After_Elaboration},
28676 which says that no dynamic allocation will occur once elaboration is
28677 completed.
28678 In general this requires a run-time check, which is not required, and which
28679 GNAT does not attempt. But the static cases of allocators in a task body or
28680 in the body of the main program are detected and flagged at compile or bind
28681 time.
28682
28683 RM References: D.07 (19.1/2) H.04 (23.3/2)
28684 @end itemize
28685
28686 @geindex AI-0171 (Ada 2012 feature)
28687
28688
28689 @itemize *
28690
28691 @item
28692 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
28693
28694 A new package @code{System.Multiprocessors} is added, together with the
28695 definition of pragma @code{CPU} for controlling task affinity. A new no
28696 dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains},
28697 is added to the Ravenscar profile.
28698
28699 RM References: D.13.01 (4/2) D.16
28700 @end itemize
28701
28702 @geindex AI-0210 (Ada 2012 feature)
28703
28704
28705 @itemize *
28706
28707 @item
28708 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
28709
28710 This is a documentation only issue regarding wording of metric requirements,
28711 that does not affect the implementation of the compiler.
28712
28713 RM References: D.15 (24/2)
28714 @end itemize
28715
28716 @geindex AI-0206 (Ada 2012 feature)
28717
28718
28719 @itemize *
28720
28721 @item
28722 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
28723
28724 Remote types packages are now allowed to depend on preelaborated packages.
28725 This was formerly considered illegal.
28726
28727 RM References: E.02.02 (6)
28728 @end itemize
28729
28730 @geindex AI-0152 (Ada 2012 feature)
28731
28732
28733 @itemize *
28734
28735 @item
28736 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
28737
28738 Restriction @code{No_Anonymous_Allocators} prevents the use of allocators
28739 where the type of the returned value is an anonymous access type.
28740
28741 RM References: H.04 (8/1)
28742 @end itemize
28743
28744 @node Obsolescent Features,Compatibility and Porting Guide,Implementation of Ada 2012 Features,Top
28745 @anchor{gnat_rm/obsolescent_features id1}@anchor{434}@anchor{gnat_rm/obsolescent_features doc}@anchor{435}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
28746 @chapter Obsolescent Features
28747
28748
28749 This chapter describes features that are provided by GNAT, but are
28750 considered obsolescent since there are preferred ways of achieving
28751 the same effect. These features are provided solely for historical
28752 compatibility purposes.
28753
28754 @menu
28755 * pragma No_Run_Time::
28756 * pragma Ravenscar::
28757 * pragma Restricted_Run_Time::
28758 * pragma Task_Info::
28759 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads.
28760
28761 @end menu
28762
28763 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
28764 @anchor{gnat_rm/obsolescent_features id2}@anchor{436}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{437}
28765 @section pragma No_Run_Time
28766
28767
28768 The pragma @code{No_Run_Time} is used to achieve an affect similar
28769 to the use of the "Zero Foot Print" configurable run time, but without
28770 requiring a specially configured run time. The result of using this
28771 pragma, which must be used for all units in a partition, is to restrict
28772 the use of any language features requiring run-time support code. The
28773 preferred usage is to use an appropriately configured run-time that
28774 includes just those features that are to be made accessible.
28775
28776 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
28777 @anchor{gnat_rm/obsolescent_features id3}@anchor{438}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{439}
28778 @section pragma Ravenscar
28779
28780
28781 The pragma @code{Ravenscar} has exactly the same effect as pragma
28782 @code{Profile (Ravenscar)}. The latter usage is preferred since it
28783 is part of the new Ada 2005 standard.
28784
28785 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
28786 @anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{43a}@anchor{gnat_rm/obsolescent_features id4}@anchor{43b}
28787 @section pragma Restricted_Run_Time
28788
28789
28790 The pragma @code{Restricted_Run_Time} has exactly the same effect as
28791 pragma @code{Profile (Restricted)}. The latter usage is
28792 preferred since the Ada 2005 pragma @code{Profile} is intended for
28793 this kind of implementation dependent addition.
28794
28795 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
28796 @anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{43c}@anchor{gnat_rm/obsolescent_features id5}@anchor{43d}
28797 @section pragma Task_Info
28798
28799
28800 The functionality provided by pragma @code{Task_Info} is now part of the
28801 Ada language. The @code{CPU} aspect and the package
28802 @code{System.Multiprocessors} offer a less system-dependent way to specify
28803 task affinity or to query the number of processsors.
28804
28805 Syntax
28806
28807 @example
28808 pragma Task_Info (EXPRESSION);
28809 @end example
28810
28811 This pragma appears within a task definition (like pragma
28812 @code{Priority}) and applies to the task in which it appears. The
28813 argument must be of type @code{System.Task_Info.Task_Info_Type}.
28814 The @code{Task_Info} pragma provides system dependent control over
28815 aspects of tasking implementation, for example, the ability to map
28816 tasks to specific processors. For details on the facilities available
28817 for the version of GNAT that you are using, see the documentation
28818 in the spec of package System.Task_Info in the runtime
28819 library.
28820
28821 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
28822 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{43e}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{43f}
28823 @section package System.Task_Info (@code{s-tasinf.ads})
28824
28825
28826 This package provides target dependent functionality that is used
28827 to support the @code{Task_Info} pragma. The predefined Ada package
28828 @code{System.Multiprocessors} and the @code{CPU} aspect now provide a
28829 standard replacement for GNAT's @code{Task_Info} functionality.
28830
28831 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
28832 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{440}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{441}
28833 @chapter Compatibility and Porting Guide
28834
28835
28836 This chapter presents some guidelines for developing portable Ada code,
28837 describes the compatibility issues that may arise between
28838 GNAT and other Ada compilation systems (including those for Ada 83),
28839 and shows how GNAT can expedite porting
28840 applications developed in other Ada environments.
28841
28842 @menu
28843 * Writing Portable Fixed-Point Declarations::
28844 * Compatibility with Ada 83::
28845 * Compatibility between Ada 95 and Ada 2005::
28846 * Implementation-dependent characteristics::
28847 * Compatibility with Other Ada Systems::
28848 * Representation Clauses::
28849 * Compatibility with HP Ada 83::
28850
28851 @end menu
28852
28853 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
28854 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{442}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{443}
28855 @section Writing Portable Fixed-Point Declarations
28856
28857
28858 The Ada Reference Manual gives an implementation freedom to choose bounds
28859 that are narrower by @code{Small} from the given bounds.
28860 For example, if we write
28861
28862 @example
28863 type F1 is delta 1.0 range -128.0 .. +128.0;
28864 @end example
28865
28866 then the implementation is allowed to choose -128.0 .. +127.0 if it
28867 likes, but is not required to do so.
28868
28869 This leads to possible portability problems, so let's have a closer
28870 look at this, and figure out how to avoid these problems.
28871
28872 First, why does this freedom exist, and why would an implementation
28873 take advantage of it? To answer this, take a closer look at the type
28874 declaration for @code{F1} above. If the compiler uses the given bounds,
28875 it would need 9 bits to hold the largest positive value (and typically
28876 that means 16 bits on all machines). But if the implementation chooses
28877 the +127.0 bound then it can fit values of the type in 8 bits.
28878
28879 Why not make the user write +127.0 if that's what is wanted?
28880 The rationale is that if you are thinking of fixed point
28881 as a kind of 'poor man's floating-point', then you don't want
28882 to be thinking about the scaled integers that are used in its
28883 representation. Let's take another example:
28884
28885 @example
28886 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
28887 @end example
28888
28889 Looking at this declaration, it seems casually as though
28890 it should fit in 16 bits, but again that extra positive value
28891 +1.0 has the scaled integer equivalent of 2**15 which is one too
28892 big for signed 16 bits. The implementation can treat this as:
28893
28894 @example
28895 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
28896 @end example
28897
28898 and the Ada language design team felt that this was too annoying
28899 to require. We don't need to debate this decision at this point,
28900 since it is well established (the rule about narrowing the ranges
28901 dates to Ada 83).
28902
28903 But the important point is that an implementation is not required
28904 to do this narrowing, so we have a potential portability problem.
28905 We could imagine three types of implementation:
28906
28907
28908 @enumerate a
28909
28910 @item
28911 those that narrow the range automatically if they can figure
28912 out that the narrower range will allow storage in a smaller machine unit,
28913
28914 @item
28915 those that will narrow only if forced to by a @code{'Size} clause, and
28916
28917 @item
28918 those that will never narrow.
28919 @end enumerate
28920
28921 Now if we are language theoreticians, we can imagine a fourth
28922 approach: to narrow all the time, e.g. to treat
28923
28924 @example
28925 type F3 is delta 1.0 range -10.0 .. +23.0;
28926 @end example
28927
28928 as though it had been written:
28929
28930 @example
28931 type F3 is delta 1.0 range -9.0 .. +22.0;
28932 @end example
28933
28934 But although technically allowed, such a behavior would be hostile and silly,
28935 and no real compiler would do this. All real compilers will fall into one of
28936 the categories (a), (b) or (c) above.
28937
28938 So, how do you get the compiler to do what you want? The answer is give the
28939 actual bounds you want, and then use a @code{'Small} clause and a
28940 @code{'Size} clause to absolutely pin down what the compiler does.
28941 E.g., for @code{F2} above, we will write:
28942
28943 @example
28944 My_Small : constant := 2.0**(-15);
28945 My_First : constant := -1.0;
28946 My_Last : constant := +1.0 - My_Small;
28947
28948 type F2 is delta My_Small range My_First .. My_Last;
28949 @end example
28950
28951 and then add
28952
28953 @example
28954 for F2'Small use my_Small;
28955 for F2'Size use 16;
28956 @end example
28957
28958 In practice all compilers will do the same thing here and will give you
28959 what you want, so the above declarations are fully portable. If you really
28960 want to play language lawyer and guard against ludicrous behavior by the
28961 compiler you could add
28962
28963 @example
28964 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
28965 Test2 : constant := 1 / Boolean'Pos (F2'Last = My_Last);
28966 @end example
28967
28968 One or other or both are allowed to be illegal if the compiler is
28969 behaving in a silly manner, but at least the silly compiler will not
28970 get away with silently messing with your (very clear) intentions.
28971
28972 If you follow this scheme you will be guaranteed that your fixed-point
28973 types will be portable.
28974
28975 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
28976 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{444}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{445}
28977 @section Compatibility with Ada 83
28978
28979
28980 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
28981
28982 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
28983 are highly upwards compatible with Ada 83. In
28984 particular, the design intention was that the difficulties associated
28985 with moving from Ada 83 to later versions of the standard should be no greater
28986 than those that occur when moving from one Ada 83 system to another.
28987
28988 However, there are a number of points at which there are minor
28989 incompatibilities. The @cite{Ada 95 Annotated Reference Manual} contains
28990 full details of these issues as they relate to Ada 95,
28991 and should be consulted for a complete treatment.
28992 In practice the
28993 following subsections treat the most likely issues to be encountered.
28994
28995 @menu
28996 * Legal Ada 83 programs that are illegal in Ada 95::
28997 * More deterministic semantics::
28998 * Changed semantics::
28999 * Other language compatibility issues::
29000
29001 @end menu
29002
29003 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
29004 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{446}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{447}
29005 @subsection Legal Ada 83 programs that are illegal in Ada 95
29006
29007
29008 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
29009 Ada 95 and later versions of the standard:
29010
29011
29012 @itemize *
29013
29014 @item
29015 @emph{Character literals}
29016
29017 Some uses of character literals are ambiguous. Since Ada 95 has introduced
29018 @code{Wide_Character} as a new predefined character type, some uses of
29019 character literals that were legal in Ada 83 are illegal in Ada 95.
29020 For example:
29021
29022 @example
29023 for Char in 'A' .. 'Z' loop ... end loop;
29024 @end example
29025
29026 The problem is that 'A' and 'Z' could be from either
29027 @code{Character} or @code{Wide_Character}. The simplest correction
29028 is to make the type explicit; e.g.:
29029
29030 @example
29031 for Char in Character range 'A' .. 'Z' loop ... end loop;
29032 @end example
29033
29034 @item
29035 @emph{New reserved words}
29036
29037 The identifiers @code{abstract}, @code{aliased}, @code{protected},
29038 @code{requeue}, @code{tagged}, and @code{until} are reserved in Ada 95.
29039 Existing Ada 83 code using any of these identifiers must be edited to
29040 use some alternative name.
29041
29042 @item
29043 @emph{Freezing rules}
29044
29045 The rules in Ada 95 are slightly different with regard to the point at
29046 which entities are frozen, and representation pragmas and clauses are
29047 not permitted past the freeze point. This shows up most typically in
29048 the form of an error message complaining that a representation item
29049 appears too late, and the appropriate corrective action is to move
29050 the item nearer to the declaration of the entity to which it refers.
29051
29052 A particular case is that representation pragmas
29053 cannot be applied to a subprogram body. If necessary, a separate subprogram
29054 declaration must be introduced to which the pragma can be applied.
29055
29056 @item
29057 @emph{Optional bodies for library packages}
29058
29059 In Ada 83, a package that did not require a package body was nevertheless
29060 allowed to have one. This lead to certain surprises in compiling large
29061 systems (situations in which the body could be unexpectedly ignored by the
29062 binder). In Ada 95, if a package does not require a body then it is not
29063 permitted to have a body. To fix this problem, simply remove a redundant
29064 body if it is empty, or, if it is non-empty, introduce a dummy declaration
29065 into the spec that makes the body required. One approach is to add a private
29066 part to the package declaration (if necessary), and define a parameterless
29067 procedure called @code{Requires_Body}, which must then be given a dummy
29068 procedure body in the package body, which then becomes required.
29069 Another approach (assuming that this does not introduce elaboration
29070 circularities) is to add an @code{Elaborate_Body} pragma to the package spec,
29071 since one effect of this pragma is to require the presence of a package body.
29072
29073 @item
29074 @emph{Numeric_Error is the same exception as Constraint_Error}
29075
29076 In Ada 95, the exception @code{Numeric_Error} is a renaming of @code{Constraint_Error}.
29077 This means that it is illegal to have separate exception handlers for
29078 the two exceptions. The fix is simply to remove the handler for the
29079 @code{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
29080 @code{Constraint_Error} in place of @code{Numeric_Error} in all cases).
29081
29082 @item
29083 @emph{Indefinite subtypes in generics}
29084
29085 In Ada 83, it was permissible to pass an indefinite type (e.g, @code{String})
29086 as the actual for a generic formal private type, but then the instantiation
29087 would be illegal if there were any instances of declarations of variables
29088 of this type in the generic body. In Ada 95, to avoid this clear violation
29089 of the methodological principle known as the 'contract model',
29090 the generic declaration explicitly indicates whether
29091 or not such instantiations are permitted. If a generic formal parameter
29092 has explicit unknown discriminants, indicated by using @code{(<>)} after the
29093 subtype name, then it can be instantiated with indefinite types, but no
29094 stand-alone variables can be declared of this type. Any attempt to declare
29095 such a variable will result in an illegality at the time the generic is
29096 declared. If the @code{(<>)} notation is not used, then it is illegal
29097 to instantiate the generic with an indefinite type.
29098 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
29099 It will show up as a compile time error, and
29100 the fix is usually simply to add the @code{(<>)} to the generic declaration.
29101 @end itemize
29102
29103 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
29104 @anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{448}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{449}
29105 @subsection More deterministic semantics
29106
29107
29108
29109 @itemize *
29110
29111 @item
29112 @emph{Conversions}
29113
29114 Conversions from real types to integer types round away from 0. In Ada 83
29115 the conversion Integer(2.5) could deliver either 2 or 3 as its value. This
29116 implementation freedom was intended to support unbiased rounding in
29117 statistical applications, but in practice it interfered with portability.
29118 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
29119 is required. Numeric code may be affected by this change in semantics.
29120 Note, though, that this issue is no worse than already existed in Ada 83
29121 when porting code from one vendor to another.
29122
29123 @item
29124 @emph{Tasking}
29125
29126 The Real-Time Annex introduces a set of policies that define the behavior of
29127 features that were implementation dependent in Ada 83, such as the order in
29128 which open select branches are executed.
29129 @end itemize
29130
29131 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
29132 @anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{44a}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{44b}
29133 @subsection Changed semantics
29134
29135
29136 The worst kind of incompatibility is one where a program that is legal in
29137 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
29138 possible in Ada 83. Fortunately this is extremely rare, but the one
29139 situation that you should be alert to is the change in the predefined type
29140 @code{Character} from 7-bit ASCII to 8-bit Latin-1.
29141
29142 @quotation
29143
29144 @geindex Latin-1
29145 @end quotation
29146
29147
29148 @itemize *
29149
29150 @item
29151 @emph{Range of type `@w{`}Character`@w{`}}
29152
29153 The range of @code{Standard.Character} is now the full 256 characters
29154 of Latin-1, whereas in most Ada 83 implementations it was restricted
29155 to 128 characters. Although some of the effects of
29156 this change will be manifest in compile-time rejection of legal
29157 Ada 83 programs it is possible for a working Ada 83 program to have
29158 a different effect in Ada 95, one that was not permitted in Ada 83.
29159 As an example, the expression
29160 @code{Character'Pos(Character'Last)} returned @code{127} in Ada 83 and now
29161 delivers @code{255} as its value.
29162 In general, you should look at the logic of any
29163 character-processing Ada 83 program and see whether it needs to be adapted
29164 to work correctly with Latin-1. Note that the predefined Ada 95 API has a
29165 character handling package that may be relevant if code needs to be adapted
29166 to account for the additional Latin-1 elements.
29167 The desirable fix is to
29168 modify the program to accommodate the full character set, but in some cases
29169 it may be convenient to define a subtype or derived type of Character that
29170 covers only the restricted range.
29171 @end itemize
29172
29173 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
29174 @anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{44c}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{44d}
29175 @subsection Other language compatibility issues
29176
29177
29178
29179 @itemize *
29180
29181 @item
29182 @emph{-gnat83} switch
29183
29184 All implementations of GNAT provide a switch that causes GNAT to operate
29185 in Ada 83 mode. In this mode, some but not all compatibility problems
29186 of the type described above are handled automatically. For example, the
29187 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
29188 as identifiers as in Ada 83. However,
29189 in practice, it is usually advisable to make the necessary modifications
29190 to the program to remove the need for using this switch.
29191 See the @code{Compiling Different Versions of Ada} section in
29192 the @cite{GNAT User's Guide}.
29193
29194 @item
29195 Support for removed Ada 83 pragmas and attributes
29196
29197 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
29198 generally because they were replaced by other mechanisms. Ada 95 and Ada 2005
29199 compilers are allowed, but not required, to implement these missing
29200 elements. In contrast with some other compilers, GNAT implements all
29201 such pragmas and attributes, eliminating this compatibility concern. These
29202 include @code{pragma Interface} and the floating point type attributes
29203 (@code{Emax}, @code{Mantissa}, etc.), among other items.
29204 @end itemize
29205
29206 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
29207 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{44e}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{44f}
29208 @section Compatibility between Ada 95 and Ada 2005
29209
29210
29211 @geindex Compatibility between Ada 95 and Ada 2005
29212
29213 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
29214 a number of incompatibilities. Several are enumerated below;
29215 for a complete description please see the
29216 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
29217 @cite{Rationale for Ada 2005}.
29218
29219
29220 @itemize *
29221
29222 @item
29223 @emph{New reserved words.}
29224
29225 The words @code{interface}, @code{overriding} and @code{synchronized} are
29226 reserved in Ada 2005.
29227 A pre-Ada 2005 program that uses any of these as an identifier will be
29228 illegal.
29229
29230 @item
29231 @emph{New declarations in predefined packages.}
29232
29233 A number of packages in the predefined environment contain new declarations:
29234 @code{Ada.Exceptions}, @code{Ada.Real_Time}, @code{Ada.Strings},
29235 @code{Ada.Strings.Fixed}, @code{Ada.Strings.Bounded},
29236 @code{Ada.Strings.Unbounded}, @code{Ada.Strings.Wide_Fixed},
29237 @code{Ada.Strings.Wide_Bounded}, @code{Ada.Strings.Wide_Unbounded},
29238 @code{Ada.Tags}, @code{Ada.Text_IO}, and @code{Interfaces.C}.
29239 If an Ada 95 program does a @code{with} and @code{use} of any of these
29240 packages, the new declarations may cause name clashes.
29241
29242 @item
29243 @emph{Access parameters.}
29244
29245 A nondispatching subprogram with an access parameter cannot be renamed
29246 as a dispatching operation. This was permitted in Ada 95.
29247
29248 @item
29249 @emph{Access types, discriminants, and constraints.}
29250
29251 Rule changes in this area have led to some incompatibilities; for example,
29252 constrained subtypes of some access types are not permitted in Ada 2005.
29253
29254 @item
29255 @emph{Aggregates for limited types.}
29256
29257 The allowance of aggregates for limited types in Ada 2005 raises the
29258 possibility of ambiguities in legal Ada 95 programs, since additional types
29259 now need to be considered in expression resolution.
29260
29261 @item
29262 @emph{Fixed-point multiplication and division.}
29263
29264 Certain expressions involving '*' or '/' for a fixed-point type, which
29265 were legal in Ada 95 and invoked the predefined versions of these operations,
29266 are now ambiguous.
29267 The ambiguity may be resolved either by applying a type conversion to the
29268 expression, or by explicitly invoking the operation from package
29269 @code{Standard}.
29270
29271 @item
29272 @emph{Return-by-reference types.}
29273
29274 The Ada 95 return-by-reference mechanism has been removed. Instead, the user
29275 can declare a function returning a value from an anonymous access type.
29276 @end itemize
29277
29278 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
29279 @anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{450}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{451}
29280 @section Implementation-dependent characteristics
29281
29282
29283 Although the Ada language defines the semantics of each construct as
29284 precisely as practical, in some situations (for example for reasons of
29285 efficiency, or where the effect is heavily dependent on the host or target
29286 platform) the implementation is allowed some freedom. In porting Ada 83
29287 code to GNAT, you need to be aware of whether / how the existing code
29288 exercised such implementation dependencies. Such characteristics fall into
29289 several categories, and GNAT offers specific support in assisting the
29290 transition from certain Ada 83 compilers.
29291
29292 @menu
29293 * Implementation-defined pragmas::
29294 * Implementation-defined attributes::
29295 * Libraries::
29296 * Elaboration order::
29297 * Target-specific aspects::
29298
29299 @end menu
29300
29301 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
29302 @anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{452}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{453}
29303 @subsection Implementation-defined pragmas
29304
29305
29306 Ada compilers are allowed to supplement the language-defined pragmas, and
29307 these are a potential source of non-portability. All GNAT-defined pragmas
29308 are described in @ref{7,,Implementation Defined Pragmas},
29309 and these include several that are specifically
29310 intended to correspond to other vendors' Ada 83 pragmas.
29311 For migrating from VADS, the pragma @code{Use_VADS_Size} may be useful.
29312 For compatibility with HP Ada 83, GNAT supplies the pragmas
29313 @code{Extend_System}, @code{Ident}, @code{Inline_Generic},
29314 @code{Interface_Name}, @code{Passive}, @code{Suppress_All},
29315 and @code{Volatile}.
29316 Other relevant pragmas include @code{External} and @code{Link_With}.
29317 Some vendor-specific
29318 Ada 83 pragmas (@code{Share_Generic}, @code{Subtitle}, and @code{Title}) are
29319 recognized, thus
29320 avoiding compiler rejection of units that contain such pragmas; they are not
29321 relevant in a GNAT context and hence are not otherwise implemented.
29322
29323 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
29324 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{454}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{455}
29325 @subsection Implementation-defined attributes
29326
29327
29328 Analogous to pragmas, the set of attributes may be extended by an
29329 implementation. All GNAT-defined attributes are described in
29330 @ref{8,,Implementation Defined Attributes},
29331 and these include several that are specifically intended
29332 to correspond to other vendors' Ada 83 attributes. For migrating from VADS,
29333 the attribute @code{VADS_Size} may be useful. For compatibility with HP
29334 Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
29335 @code{Type_Class}.
29336
29337 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
29338 @anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{456}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{457}
29339 @subsection Libraries
29340
29341
29342 Vendors may supply libraries to supplement the standard Ada API. If Ada 83
29343 code uses vendor-specific libraries then there are several ways to manage
29344 this in Ada 95 and later versions of the standard:
29345
29346
29347 @itemize *
29348
29349 @item
29350 If the source code for the libraries (specs and bodies) are
29351 available, then the libraries can be migrated in the same way as the
29352 application.
29353
29354 @item
29355 If the source code for the specs but not the bodies are
29356 available, then you can reimplement the bodies.
29357
29358 @item
29359 Some features introduced by Ada 95 obviate the need for library support. For
29360 example most Ada 83 vendors supplied a package for unsigned integers. The
29361 Ada 95 modular type feature is the preferred way to handle this need, so
29362 instead of migrating or reimplementing the unsigned integer package it may
29363 be preferable to retrofit the application using modular types.
29364 @end itemize
29365
29366 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
29367 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{458}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{459}
29368 @subsection Elaboration order
29369
29370
29371 The implementation can choose any elaboration order consistent with the unit
29372 dependency relationship. This freedom means that some orders can result in
29373 Program_Error being raised due to an 'Access Before Elaboration': an attempt
29374 to invoke a subprogram before its body has been elaborated, or to instantiate
29375 a generic before the generic body has been elaborated. By default GNAT
29376 attempts to choose a safe order (one that will not encounter access before
29377 elaboration problems) by implicitly inserting @code{Elaborate} or
29378 @code{Elaborate_All} pragmas where
29379 needed. However, this can lead to the creation of elaboration circularities
29380 and a resulting rejection of the program by gnatbind. This issue is
29381 thoroughly described in the @emph{Elaboration Order Handling in GNAT} appendix
29382 in the @cite{GNAT User's Guide}.
29383 In brief, there are several
29384 ways to deal with this situation:
29385
29386
29387 @itemize *
29388
29389 @item
29390 Modify the program to eliminate the circularities, e.g., by moving
29391 elaboration-time code into explicitly-invoked procedures
29392
29393 @item
29394 Constrain the elaboration order by including explicit @code{Elaborate_Body} or
29395 @code{Elaborate} pragmas, and then inhibit the generation of implicit
29396 @code{Elaborate_All}
29397 pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally
29398 (by selectively suppressing elaboration checks via pragma
29399 @code{Suppress(Elaboration_Check)} when it is safe to do so).
29400 @end itemize
29401
29402 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
29403 @anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{45a}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{45b}
29404 @subsection Target-specific aspects
29405
29406
29407 Low-level applications need to deal with machine addresses, data
29408 representations, interfacing with assembler code, and similar issues. If
29409 such an Ada 83 application is being ported to different target hardware (for
29410 example where the byte endianness has changed) then you will need to
29411 carefully examine the program logic; the porting effort will heavily depend
29412 on the robustness of the original design. Moreover, Ada 95 (and thus
29413 Ada 2005 and Ada 2012) are sometimes
29414 incompatible with typical Ada 83 compiler practices regarding implicit
29415 packing, the meaning of the Size attribute, and the size of access values.
29416 GNAT's approach to these issues is described in @ref{45c,,Representation Clauses}.
29417
29418 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
29419 @anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{45d}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{45e}
29420 @section Compatibility with Other Ada Systems
29421
29422
29423 If programs avoid the use of implementation dependent and
29424 implementation defined features, as documented in the
29425 @cite{Ada Reference Manual}, there should be a high degree of portability between
29426 GNAT and other Ada systems. The following are specific items which
29427 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
29428 compilers, but do not affect porting code to GNAT.
29429 (As of January 2007, GNAT is the only compiler available for Ada 2005;
29430 the following issues may or may not arise for Ada 2005 programs
29431 when other compilers appear.)
29432
29433
29434 @itemize *
29435
29436 @item
29437 @emph{Ada 83 Pragmas and Attributes}
29438
29439 Ada 95 compilers are allowed, but not required, to implement the missing
29440 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
29441 GNAT implements all such pragmas and attributes, eliminating this as
29442 a compatibility concern, but some other Ada 95 compilers reject these
29443 pragmas and attributes.
29444
29445 @item
29446 @emph{Specialized Needs Annexes}
29447
29448 GNAT implements the full set of special needs annexes. At the
29449 current time, it is the only Ada 95 compiler to do so. This means that
29450 programs making use of these features may not be portable to other Ada
29451 95 compilation systems.
29452
29453 @item
29454 @emph{Representation Clauses}
29455
29456 Some other Ada 95 compilers implement only the minimal set of
29457 representation clauses required by the Ada 95 reference manual. GNAT goes
29458 far beyond this minimal set, as described in the next section.
29459 @end itemize
29460
29461 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
29462 @anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{45c}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{45f}
29463 @section Representation Clauses
29464
29465
29466 The Ada 83 reference manual was quite vague in describing both the minimal
29467 required implementation of representation clauses, and also their precise
29468 effects. Ada 95 (and thus also Ada 2005) are much more explicit, but the
29469 minimal set of capabilities required is still quite limited.
29470
29471 GNAT implements the full required set of capabilities in
29472 Ada 95 and Ada 2005, but also goes much further, and in particular
29473 an effort has been made to be compatible with existing Ada 83 usage to the
29474 greatest extent possible.
29475
29476 A few cases exist in which Ada 83 compiler behavior is incompatible with
29477 the requirements in Ada 95 (and thus also Ada 2005). These are instances of
29478 intentional or accidental dependence on specific implementation dependent
29479 characteristics of these Ada 83 compilers. The following is a list of
29480 the cases most likely to arise in existing Ada 83 code.
29481
29482
29483 @itemize *
29484
29485 @item
29486 @emph{Implicit Packing}
29487
29488 Some Ada 83 compilers allowed a Size specification to cause implicit
29489 packing of an array or record. This could cause expensive implicit
29490 conversions for change of representation in the presence of derived
29491 types, and the Ada design intends to avoid this possibility.
29492 Subsequent AI's were issued to make it clear that such implicit
29493 change of representation in response to a Size clause is inadvisable,
29494 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
29495 Reference Manuals as implementation advice that is followed by GNAT.
29496 The problem will show up as an error
29497 message rejecting the size clause. The fix is simply to provide
29498 the explicit pragma @code{Pack}, or for more fine tuned control, provide
29499 a Component_Size clause.
29500
29501 @item
29502 @emph{Meaning of Size Attribute}
29503
29504 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
29505 the minimal number of bits required to hold values of the type. For example,
29506 on a 32-bit machine, the size of @code{Natural} will typically be 31 and not
29507 32 (since no sign bit is required). Some Ada 83 compilers gave 31, and
29508 some 32 in this situation. This problem will usually show up as a compile
29509 time error, but not always. It is a good idea to check all uses of the
29510 'Size attribute when porting Ada 83 code. The GNAT specific attribute
29511 Object_Size can provide a useful way of duplicating the behavior of
29512 some Ada 83 compiler systems.
29513
29514 @item
29515 @emph{Size of Access Types}
29516
29517 A common assumption in Ada 83 code is that an access type is in fact a pointer,
29518 and that therefore it will be the same size as a System.Address value. This
29519 assumption is true for GNAT in most cases with one exception. For the case of
29520 a pointer to an unconstrained array type (where the bounds may vary from one
29521 value of the access type to another), the default is to use a 'fat pointer',
29522 which is represented as two separate pointers, one to the bounds, and one to
29523 the array. This representation has a number of advantages, including improved
29524 efficiency. However, it may cause some difficulties in porting existing Ada 83
29525 code which makes the assumption that, for example, pointers fit in 32 bits on
29526 a machine with 32-bit addressing.
29527
29528 To get around this problem, GNAT also permits the use of 'thin pointers' for
29529 access types in this case (where the designated type is an unconstrained array
29530 type). These thin pointers are indeed the same size as a System.Address value.
29531 To specify a thin pointer, use a size clause for the type, for example:
29532
29533 @example
29534 type X is access all String;
29535 for X'Size use Standard'Address_Size;
29536 @end example
29537
29538 which will cause the type X to be represented using a single pointer.
29539 When using this representation, the bounds are right behind the array.
29540 This representation is slightly less efficient, and does not allow quite
29541 such flexibility in the use of foreign pointers or in using the
29542 Unrestricted_Access attribute to create pointers to non-aliased objects.
29543 But for any standard portable use of the access type it will work in
29544 a functionally correct manner and allow porting of existing code.
29545 Note that another way of forcing a thin pointer representation
29546 is to use a component size clause for the element size in an array,
29547 or a record representation clause for an access field in a record.
29548
29549 See the documentation of Unrestricted_Access in the GNAT RM for a
29550 full discussion of possible problems using this attribute in conjunction
29551 with thin pointers.
29552 @end itemize
29553
29554 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
29555 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{460}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{461}
29556 @section Compatibility with HP Ada 83
29557
29558
29559 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
29560 of them can sensibly be implemented. The description of pragmas in
29561 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
29562 applicable to GNAT.
29563
29564
29565 @itemize *
29566
29567 @item
29568 @emph{Default floating-point representation}
29569
29570 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
29571 it is VMS format.
29572
29573 @item
29574 @emph{System}
29575
29576 the package System in GNAT exactly corresponds to the definition in the
29577 Ada 95 reference manual, which means that it excludes many of the
29578 HP Ada 83 extensions. However, a separate package Aux_DEC is provided
29579 that contains the additional definitions, and a special pragma,
29580 Extend_System allows this package to be treated transparently as an
29581 extension of package System.
29582 @end itemize
29583
29584 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
29585 @anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{462}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{463}
29586 @chapter GNU Free Documentation License
29587
29588
29589 Version 1.3, 3 November 2008
29590
29591 Copyright 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc
29592 @indicateurl{http://fsf.org/}
29593
29594 Everyone is permitted to copy and distribute verbatim copies of this
29595 license document, but changing it is not allowed.
29596
29597 @strong{Preamble}
29598
29599 The purpose of this License is to make a manual, textbook, or other
29600 functional and useful document "free" in the sense of freedom: to
29601 assure everyone the effective freedom to copy and redistribute it,
29602 with or without modifying it, either commercially or noncommercially.
29603 Secondarily, this License preserves for the author and publisher a way
29604 to get credit for their work, while not being considered responsible
29605 for modifications made by others.
29606
29607 This License is a kind of "copyleft", which means that derivative
29608 works of the document must themselves be free in the same sense. It
29609 complements the GNU General Public License, which is a copyleft
29610 license designed for free software.
29611
29612 We have designed this License in order to use it for manuals for free
29613 software, because free software needs free documentation: a free
29614 program should come with manuals providing the same freedoms that the
29615 software does. But this License is not limited to software manuals;
29616 it can be used for any textual work, regardless of subject matter or
29617 whether it is published as a printed book. We recommend this License
29618 principally for works whose purpose is instruction or reference.
29619
29620 @strong{1. APPLICABILITY AND DEFINITIONS}
29621
29622 This License applies to any manual or other work, in any medium, that
29623 contains a notice placed by the copyright holder saying it can be
29624 distributed under the terms of this License. Such a notice grants a
29625 world-wide, royalty-free license, unlimited in duration, to use that
29626 work under the conditions stated herein. The @strong{Document}, below,
29627 refers to any such manual or work. Any member of the public is a
29628 licensee, and is addressed as "@strong{you}". You accept the license if you
29629 copy, modify or distribute the work in a way requiring permission
29630 under copyright law.
29631
29632 A "@strong{Modified Version}" of the Document means any work containing the
29633 Document or a portion of it, either copied verbatim, or with
29634 modifications and/or translated into another language.
29635
29636 A "@strong{Secondary Section}" is a named appendix or a front-matter section of
29637 the Document that deals exclusively with the relationship of the
29638 publishers or authors of the Document to the Document's overall subject
29639 (or to related matters) and contains nothing that could fall directly
29640 within that overall subject. (Thus, if the Document is in part a
29641 textbook of mathematics, a Secondary Section may not explain any
29642 mathematics.) The relationship could be a matter of historical
29643 connection with the subject or with related matters, or of legal,
29644 commercial, philosophical, ethical or political position regarding
29645 them.
29646
29647 The "@strong{Invariant Sections}" are certain Secondary Sections whose titles
29648 are designated, as being those of Invariant Sections, in the notice
29649 that says that the Document is released under this License. If a
29650 section does not fit the above definition of Secondary then it is not
29651 allowed to be designated as Invariant. The Document may contain zero
29652 Invariant Sections. If the Document does not identify any Invariant
29653 Sections then there are none.
29654
29655 The "@strong{Cover Texts}" are certain short passages of text that are listed,
29656 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
29657 the Document is released under this License. A Front-Cover Text may
29658 be at most 5 words, and a Back-Cover Text may be at most 25 words.
29659
29660 A "@strong{Transparent}" copy of the Document means a machine-readable copy,
29661 represented in a format whose specification is available to the
29662 general public, that is suitable for revising the document
29663 straightforwardly with generic text editors or (for images composed of
29664 pixels) generic paint programs or (for drawings) some widely available
29665 drawing editor, and that is suitable for input to text formatters or
29666 for automatic translation to a variety of formats suitable for input
29667 to text formatters. A copy made in an otherwise Transparent file
29668 format whose markup, or absence of markup, has been arranged to thwart
29669 or discourage subsequent modification by readers is not Transparent.
29670 An image format is not Transparent if used for any substantial amount
29671 of text. A copy that is not "Transparent" is called @strong{Opaque}.
29672
29673 Examples of suitable formats for Transparent copies include plain
29674 ASCII without markup, Texinfo input format, LaTeX input format, SGML
29675 or XML using a publicly available DTD, and standard-conforming simple
29676 HTML, PostScript or PDF designed for human modification. Examples of
29677 transparent image formats include PNG, XCF and JPG. Opaque formats
29678 include proprietary formats that can be read and edited only by
29679 proprietary word processors, SGML or XML for which the DTD and/or
29680 processing tools are not generally available, and the
29681 machine-generated HTML, PostScript or PDF produced by some word
29682 processors for output purposes only.
29683
29684 The "@strong{Title Page}" means, for a printed book, the title page itself,
29685 plus such following pages as are needed to hold, legibly, the material
29686 this License requires to appear in the title page. For works in
29687 formats which do not have any title page as such, "Title Page" means
29688 the text near the most prominent appearance of the work's title,
29689 preceding the beginning of the body of the text.
29690
29691 The "@strong{publisher}" means any person or entity that distributes
29692 copies of the Document to the public.
29693
29694 A section "@strong{Entitled XYZ}" means a named subunit of the Document whose
29695 title either is precisely XYZ or contains XYZ in parentheses following
29696 text that translates XYZ in another language. (Here XYZ stands for a
29697 specific section name mentioned below, such as "@strong{Acknowledgements}",
29698 "@strong{Dedications}", "@strong{Endorsements}", or "@strong{History}".)
29699 To "@strong{Preserve the Title}"
29700 of such a section when you modify the Document means that it remains a
29701 section "Entitled XYZ" according to this definition.
29702
29703 The Document may include Warranty Disclaimers next to the notice which
29704 states that this License applies to the Document. These Warranty
29705 Disclaimers are considered to be included by reference in this
29706 License, but only as regards disclaiming warranties: any other
29707 implication that these Warranty Disclaimers may have is void and has
29708 no effect on the meaning of this License.
29709
29710 @strong{2. VERBATIM COPYING}
29711
29712 You may copy and distribute the Document in any medium, either
29713 commercially or noncommercially, provided that this License, the
29714 copyright notices, and the license notice saying this License applies
29715 to the Document are reproduced in all copies, and that you add no other
29716 conditions whatsoever to those of this License. You may not use
29717 technical measures to obstruct or control the reading or further
29718 copying of the copies you make or distribute. However, you may accept
29719 compensation in exchange for copies. If you distribute a large enough
29720 number of copies you must also follow the conditions in section 3.
29721
29722 You may also lend copies, under the same conditions stated above, and
29723 you may publicly display copies.
29724
29725 @strong{3. COPYING IN QUANTITY}
29726
29727 If you publish printed copies (or copies in media that commonly have
29728 printed covers) of the Document, numbering more than 100, and the
29729 Document's license notice requires Cover Texts, you must enclose the
29730 copies in covers that carry, clearly and legibly, all these Cover
29731 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
29732 the back cover. Both covers must also clearly and legibly identify
29733 you as the publisher of these copies. The front cover must present
29734 the full title with all words of the title equally prominent and
29735 visible. You may add other material on the covers in addition.
29736 Copying with changes limited to the covers, as long as they preserve
29737 the title of the Document and satisfy these conditions, can be treated
29738 as verbatim copying in other respects.
29739
29740 If the required texts for either cover are too voluminous to fit
29741 legibly, you should put the first ones listed (as many as fit
29742 reasonably) on the actual cover, and continue the rest onto adjacent
29743 pages.
29744
29745 If you publish or distribute Opaque copies of the Document numbering
29746 more than 100, you must either include a machine-readable Transparent
29747 copy along with each Opaque copy, or state in or with each Opaque copy
29748 a computer-network location from which the general network-using
29749 public has access to download using public-standard network protocols
29750 a complete Transparent copy of the Document, free of added material.
29751 If you use the latter option, you must take reasonably prudent steps,
29752 when you begin distribution of Opaque copies in quantity, to ensure
29753 that this Transparent copy will remain thus accessible at the stated
29754 location until at least one year after the last time you distribute an
29755 Opaque copy (directly or through your agents or retailers) of that
29756 edition to the public.
29757
29758 It is requested, but not required, that you contact the authors of the
29759 Document well before redistributing any large number of copies, to give
29760 them a chance to provide you with an updated version of the Document.
29761
29762 @strong{4. MODIFICATIONS}
29763
29764 You may copy and distribute a Modified Version of the Document under
29765 the conditions of sections 2 and 3 above, provided that you release
29766 the Modified Version under precisely this License, with the Modified
29767 Version filling the role of the Document, thus licensing distribution
29768 and modification of the Modified Version to whoever possesses a copy
29769 of it. In addition, you must do these things in the Modified Version:
29770
29771
29772 @enumerate A
29773
29774 @item
29775 Use in the Title Page (and on the covers, if any) a title distinct
29776 from that of the Document, and from those of previous versions
29777 (which should, if there were any, be listed in the History section
29778 of the Document). You may use the same title as a previous version
29779 if the original publisher of that version gives permission.
29780
29781 @item
29782 List on the Title Page, as authors, one or more persons or entities
29783 responsible for authorship of the modifications in the Modified
29784 Version, together with at least five of the principal authors of the
29785 Document (all of its principal authors, if it has fewer than five),
29786 unless they release you from this requirement.
29787
29788 @item
29789 State on the Title page the name of the publisher of the
29790 Modified Version, as the publisher.
29791
29792 @item
29793 Preserve all the copyright notices of the Document.
29794
29795 @item
29796 Add an appropriate copyright notice for your modifications
29797 adjacent to the other copyright notices.
29798
29799 @item
29800 Include, immediately after the copyright notices, a license notice
29801 giving the public permission to use the Modified Version under the
29802 terms of this License, in the form shown in the Addendum below.
29803
29804 @item
29805 Preserve in that license notice the full lists of Invariant Sections
29806 and required Cover Texts given in the Document's license notice.
29807
29808 @item
29809 Include an unaltered copy of this License.
29810
29811 @item
29812 Preserve the section Entitled "History", Preserve its Title, and add
29813 to it an item stating at least the title, year, new authors, and
29814 publisher of the Modified Version as given on the Title Page. If
29815 there is no section Entitled "History" in the Document, create one
29816 stating the title, year, authors, and publisher of the Document as
29817 given on its Title Page, then add an item describing the Modified
29818 Version as stated in the previous sentence.
29819
29820 @item
29821 Preserve the network location, if any, given in the Document for
29822 public access to a Transparent copy of the Document, and likewise
29823 the network locations given in the Document for previous versions
29824 it was based on. These may be placed in the "History" section.
29825 You may omit a network location for a work that was published at
29826 least four years before the Document itself, or if the original
29827 publisher of the version it refers to gives permission.
29828
29829 @item
29830 For any section Entitled "Acknowledgements" or "Dedications",
29831 Preserve the Title of the section, and preserve in the section all
29832 the substance and tone of each of the contributor acknowledgements
29833 and/or dedications given therein.
29834
29835 @item
29836 Preserve all the Invariant Sections of the Document,
29837 unaltered in their text and in their titles. Section numbers
29838 or the equivalent are not considered part of the section titles.
29839
29840 @item
29841 Delete any section Entitled "Endorsements". Such a section
29842 may not be included in the Modified Version.
29843
29844 @item
29845 Do not retitle any existing section to be Entitled "Endorsements"
29846 or to conflict in title with any Invariant Section.
29847
29848 @item
29849 Preserve any Warranty Disclaimers.
29850 @end enumerate
29851
29852 If the Modified Version includes new front-matter sections or
29853 appendices that qualify as Secondary Sections and contain no material
29854 copied from the Document, you may at your option designate some or all
29855 of these sections as invariant. To do this, add their titles to the
29856 list of Invariant Sections in the Modified Version's license notice.
29857 These titles must be distinct from any other section titles.
29858
29859 You may add a section Entitled "Endorsements", provided it contains
29860 nothing but endorsements of your Modified Version by various
29861 parties---for example, statements of peer review or that the text has
29862 been approved by an organization as the authoritative definition of a
29863 standard.
29864
29865 You may add a passage of up to five words as a Front-Cover Text, and a
29866 passage of up to 25 words as a Back-Cover Text, to the end of the list
29867 of Cover Texts in the Modified Version. Only one passage of
29868 Front-Cover Text and one of Back-Cover Text may be added by (or
29869 through arrangements made by) any one entity. If the Document already
29870 includes a cover text for the same cover, previously added by you or
29871 by arrangement made by the same entity you are acting on behalf of,
29872 you may not add another; but you may replace the old one, on explicit
29873 permission from the previous publisher that added the old one.
29874
29875 The author(s) and publisher(s) of the Document do not by this License
29876 give permission to use their names for publicity for or to assert or
29877 imply endorsement of any Modified Version.
29878
29879 @strong{5. COMBINING DOCUMENTS}
29880
29881 You may combine the Document with other documents released under this
29882 License, under the terms defined in section 4 above for modified
29883 versions, provided that you include in the combination all of the
29884 Invariant Sections of all of the original documents, unmodified, and
29885 list them all as Invariant Sections of your combined work in its
29886 license notice, and that you preserve all their Warranty Disclaimers.
29887
29888 The combined work need only contain one copy of this License, and
29889 multiple identical Invariant Sections may be replaced with a single
29890 copy. If there are multiple Invariant Sections with the same name but
29891 different contents, make the title of each such section unique by
29892 adding at the end of it, in parentheses, the name of the original
29893 author or publisher of that section if known, or else a unique number.
29894 Make the same adjustment to the section titles in the list of
29895 Invariant Sections in the license notice of the combined work.
29896
29897 In the combination, you must combine any sections Entitled "History"
29898 in the various original documents, forming one section Entitled
29899 "History"; likewise combine any sections Entitled "Acknowledgements",
29900 and any sections Entitled "Dedications". You must delete all sections
29901 Entitled "Endorsements".
29902
29903 @strong{6. COLLECTIONS OF DOCUMENTS}
29904
29905 You may make a collection consisting of the Document and other documents
29906 released under this License, and replace the individual copies of this
29907 License in the various documents with a single copy that is included in
29908 the collection, provided that you follow the rules of this License for
29909 verbatim copying of each of the documents in all other respects.
29910
29911 You may extract a single document from such a collection, and distribute
29912 it individually under this License, provided you insert a copy of this
29913 License into the extracted document, and follow this License in all
29914 other respects regarding verbatim copying of that document.
29915
29916 @strong{7. AGGREGATION WITH INDEPENDENT WORKS}
29917
29918 A compilation of the Document or its derivatives with other separate
29919 and independent documents or works, in or on a volume of a storage or
29920 distribution medium, is called an "aggregate" if the copyright
29921 resulting from the compilation is not used to limit the legal rights
29922 of the compilation's users beyond what the individual works permit.
29923 When the Document is included in an aggregate, this License does not
29924 apply to the other works in the aggregate which are not themselves
29925 derivative works of the Document.
29926
29927 If the Cover Text requirement of section 3 is applicable to these
29928 copies of the Document, then if the Document is less than one half of
29929 the entire aggregate, the Document's Cover Texts may be placed on
29930 covers that bracket the Document within the aggregate, or the
29931 electronic equivalent of covers if the Document is in electronic form.
29932 Otherwise they must appear on printed covers that bracket the whole
29933 aggregate.
29934
29935 @strong{8. TRANSLATION}
29936
29937 Translation is considered a kind of modification, so you may
29938 distribute translations of the Document under the terms of section 4.
29939 Replacing Invariant Sections with translations requires special
29940 permission from their copyright holders, but you may include
29941 translations of some or all Invariant Sections in addition to the
29942 original versions of these Invariant Sections. You may include a
29943 translation of this License, and all the license notices in the
29944 Document, and any Warranty Disclaimers, provided that you also include
29945 the original English version of this License and the original versions
29946 of those notices and disclaimers. In case of a disagreement between
29947 the translation and the original version of this License or a notice
29948 or disclaimer, the original version will prevail.
29949
29950 If a section in the Document is Entitled "Acknowledgements",
29951 "Dedications", or "History", the requirement (section 4) to Preserve
29952 its Title (section 1) will typically require changing the actual
29953 title.
29954
29955 @strong{9. TERMINATION}
29956
29957 You may not copy, modify, sublicense, or distribute the Document
29958 except as expressly provided under this License. Any attempt
29959 otherwise to copy, modify, sublicense, or distribute it is void, and
29960 will automatically terminate your rights under this License.
29961
29962 However, if you cease all violation of this License, then your license
29963 from a particular copyright holder is reinstated (a) provisionally,
29964 unless and until the copyright holder explicitly and finally
29965 terminates your license, and (b) permanently, if the copyright holder
29966 fails to notify you of the violation by some reasonable means prior to
29967 60 days after the cessation.
29968
29969 Moreover, your license from a particular copyright holder is
29970 reinstated permanently if the copyright holder notifies you of the
29971 violation by some reasonable means, this is the first time you have
29972 received notice of violation of this License (for any work) from that
29973 copyright holder, and you cure the violation prior to 30 days after
29974 your receipt of the notice.
29975
29976 Termination of your rights under this section does not terminate the
29977 licenses of parties who have received copies or rights from you under
29978 this License. If your rights have been terminated and not permanently
29979 reinstated, receipt of a copy of some or all of the same material does
29980 not give you any rights to use it.
29981
29982 @strong{10. FUTURE REVISIONS OF THIS LICENSE}
29983
29984 The Free Software Foundation may publish new, revised versions
29985 of the GNU Free Documentation License from time to time. Such new
29986 versions will be similar in spirit to the present version, but may
29987 differ in detail to address new problems or concerns. See
29988 @indicateurl{http://www.gnu.org/copyleft/}.
29989
29990 Each version of the License is given a distinguishing version number.
29991 If the Document specifies that a particular numbered version of this
29992 License "or any later version" applies to it, you have the option of
29993 following the terms and conditions either of that specified version or
29994 of any later version that has been published (not as a draft) by the
29995 Free Software Foundation. If the Document does not specify a version
29996 number of this License, you may choose any version ever published (not
29997 as a draft) by the Free Software Foundation. If the Document
29998 specifies that a proxy can decide which future versions of this
29999 License can be used, that proxy's public statement of acceptance of a
30000 version permanently authorizes you to choose that version for the
30001 Document.
30002
30003 @strong{11. RELICENSING}
30004
30005 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
30006 World Wide Web server that publishes copyrightable works and also
30007 provides prominent facilities for anybody to edit those works. A
30008 public wiki that anybody can edit is an example of such a server. A
30009 "Massive Multiauthor Collaboration" (or "MMC") contained in the
30010 site means any set of copyrightable works thus published on the MMC
30011 site.
30012
30013 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
30014 license published by Creative Commons Corporation, a not-for-profit
30015 corporation with a principal place of business in San Francisco,
30016 California, as well as future copyleft versions of that license
30017 published by that same organization.
30018
30019 "Incorporate" means to publish or republish a Document, in whole or
30020 in part, as part of another Document.
30021
30022 An MMC is "eligible for relicensing" if it is licensed under this
30023 License, and if all works that were first published under this License
30024 somewhere other than this MMC, and subsequently incorporated in whole
30025 or in part into the MMC, (1) had no cover texts or invariant sections,
30026 and (2) were thus incorporated prior to November 1, 2008.
30027
30028 The operator of an MMC Site may republish an MMC contained in the site
30029 under CC-BY-SA on the same site at any time before August 1, 2009,
30030 provided the MMC is eligible for relicensing.
30031
30032 @strong{ADDENDUM: How to use this License for your documents}
30033
30034 To use this License in a document you have written, include a copy of
30035 the License in the document and put the following copyright and
30036 license notices just after the title page:
30037
30038 @quotation
30039
30040 Copyright © YEAR YOUR NAME.
30041 Permission is granted to copy, distribute and/or modify this document
30042 under the terms of the GNU Free Documentation License, Version 1.3
30043 or any later version published by the Free Software Foundation;
30044 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
30045 A copy of the license is included in the section entitled "GNU
30046 Free Documentation License".
30047 @end quotation
30048
30049 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
30050 replace the "with ... Texts." line with this:
30051
30052 @quotation
30053
30054 with the Invariant Sections being LIST THEIR TITLES, with the
30055 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
30056 @end quotation
30057
30058 If you have Invariant Sections without Cover Texts, or some other
30059 combination of the three, merge those two alternatives to suit the
30060 situation.
30061
30062 If your document contains nontrivial examples of program code, we
30063 recommend releasing these examples in parallel under your choice of
30064 free software license, such as the GNU General Public License,
30065 to permit their use in free software.
30066
30067 @node Index,,GNU Free Documentation License,Top
30068 @unnumbered Index
30069
30070
30071 @printindex ge
30072
30073
30074 @c %**end of body
30075 @bye