1 \input texinfo @c -*-texinfo-*-
3 @setfilename gnat_rm.info
4 @documentencoding UTF-8
6 @*Generated by Sphinx 1.4.6.@*
8 @settitle GNAT Reference Manual
13 @dircategory GNU Ada Tools
15 * gnat_rm: (gnat_rm.info). gnat_rm
18 @definfoenclose strong,`,'
19 @definfoenclose emph,`,'
24 GNAT Reference Manual , Sep 14, 2019
28 Copyright @copyright{} 2008-2019, Free Software Foundation
34 @title GNAT Reference Manual
39 @c %** start of user preamble
41 @c %** end of user preamble
45 @top GNAT Reference Manual
50 @anchor{gnat_rm doc}@anchor{0}
51 @emph{GNAT, The GNU Ada Development Environment}
54 @include gcc-common.texi
55 GCC version @value{version-GCC}@*
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}.
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::
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::
88 --- The Detailed Node Listing ---
92 * What This Reference Manual Contains::
94 * Related Information::
96 Implementation Defined Pragmas
98 * Pragma Abort_Defer::
99 * Pragma Abstract_State::
100 * Pragma Acc_Parallel::
102 * Pragma Acc_Kernels::
110 * Pragma Aggregate_Individually_Assign::
111 * Pragma Allow_Integer_Address::
114 * Pragma Assert_And_Cut::
115 * Pragma Assertion_Policy::
117 * Pragma Assume_No_Invalid_Values::
118 * Pragma Async_Readers::
119 * Pragma Async_Writers::
120 * Pragma Attribute_Definition::
121 * Pragma C_Pass_By_Copy::
123 * Pragma Check_Float_Overflow::
124 * Pragma Check_Name::
125 * Pragma Check_Policy::
127 * Pragma Common_Object::
128 * Pragma Compile_Time_Error::
129 * Pragma Compile_Time_Warning::
130 * Pragma Compiler_Unit::
131 * Pragma Compiler_Unit_Warning::
132 * Pragma Complete_Representation::
133 * Pragma Complex_Representation::
134 * Pragma Component_Alignment::
135 * Pragma Constant_After_Elaboration::
136 * Pragma Contract_Cases::
137 * Pragma Convention_Identifier::
139 * Pragma CPP_Constructor::
140 * Pragma CPP_Virtual::
141 * Pragma CPP_Vtable::
143 * Pragma Deadline_Floor::
144 * Pragma Default_Initial_Condition::
146 * Pragma Debug_Policy::
147 * Pragma Default_Scalar_Storage_Order::
148 * Pragma Default_Storage_Pool::
150 * Pragma Detect_Blocking::
151 * Pragma Disable_Atomic_Synchronization::
152 * Pragma Dispatching_Domain::
153 * Pragma Effective_Reads::
154 * Pragma Effective_Writes::
155 * Pragma Elaboration_Checks::
157 * Pragma Enable_Atomic_Synchronization::
158 * Pragma Export_Function::
159 * Pragma Export_Object::
160 * Pragma Export_Procedure::
161 * Pragma Export_Value::
162 * Pragma Export_Valued_Procedure::
163 * Pragma Extend_System::
164 * Pragma Extensions_Allowed::
165 * Pragma Extensions_Visible::
167 * Pragma External_Name_Casing::
169 * Pragma Favor_Top_Level::
170 * Pragma Finalize_Storage_Only::
171 * Pragma Float_Representation::
175 * Pragma Ignore_Pragma::
176 * Pragma Implementation_Defined::
177 * Pragma Implemented::
178 * Pragma Implicit_Packing::
179 * Pragma Import_Function::
180 * Pragma Import_Object::
181 * Pragma Import_Procedure::
182 * Pragma Import_Valued_Procedure::
183 * Pragma Independent::
184 * Pragma Independent_Components::
185 * Pragma Initial_Condition::
186 * Pragma Initialize_Scalars::
187 * Pragma Initializes::
188 * Pragma Inline_Always::
189 * Pragma Inline_Generic::
191 * Pragma Interface_Name::
192 * Pragma Interrupt_Handler::
193 * Pragma Interrupt_State::
195 * Pragma Keep_Names::
198 * Pragma Linker_Alias::
199 * Pragma Linker_Constructor::
200 * Pragma Linker_Destructor::
201 * Pragma Linker_Section::
203 * Pragma Loop_Invariant::
204 * Pragma Loop_Optimize::
205 * Pragma Loop_Variant::
206 * Pragma Machine_Attribute::
208 * Pragma Main_Storage::
209 * Pragma Max_Queue_Length::
211 * Pragma No_Caching::
212 * Pragma No_Component_Reordering::
213 * Pragma No_Elaboration_Code_All::
214 * Pragma No_Heap_Finalization::
217 * Pragma No_Strict_Aliasing::
218 * Pragma No_Tagged_Streams::
219 * Pragma Normalize_Scalars::
220 * Pragma Obsolescent::
221 * Pragma Optimize_Alignment::
223 * Pragma Overflow_Mode::
224 * Pragma Overriding_Renamings::
225 * Pragma Partition_Elaboration_Policy::
228 * Pragma Persistent_BSS::
231 * Pragma Postcondition::
232 * Pragma Post_Class::
233 * Pragma Rename_Pragma::
235 * Pragma Precondition::
237 * Pragma Predicate_Failure::
238 * Pragma Preelaborable_Initialization::
239 * Pragma Prefix_Exception_Messages::
241 * Pragma Priority_Specific_Dispatching::
243 * Pragma Profile_Warnings::
244 * Pragma Propagate_Exceptions::
245 * Pragma Provide_Shift_Operators::
246 * Pragma Psect_Object::
247 * Pragma Pure_Function::
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::
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::
274 * Pragma Suppress_All::
275 * Pragma Suppress_Debug_Info::
276 * Pragma Suppress_Exception_Locations::
277 * Pragma Suppress_Initialization::
279 * Pragma Task_Storage::
281 * Pragma Thread_Local_Storage::
282 * Pragma Time_Slice::
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::
298 * Pragma Validity_Checks::
300 * Pragma Volatile_Full_Access::
301 * Pragma Volatile_Function::
302 * Pragma Warning_As_Error::
304 * Pragma Weak_External::
305 * Pragma Wide_Character_Encoding::
307 Implementation Defined Aspects
309 * Aspect Abstract_State::
311 * Aspect Async_Readers::
312 * Aspect Async_Writers::
313 * Aspect Constant_After_Elaboration::
314 * Aspect Contract_Cases::
316 * Aspect Default_Initial_Condition::
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::
326 * Aspect Initial_Condition::
327 * Aspect Initializes::
328 * Aspect Inline_Always::
330 * Aspect Invariant'Class::
332 * Aspect Linker_Section::
334 * Aspect Max_Queue_Length::
335 * Aspect No_Caching::
336 * Aspect No_Elaboration_Code_All::
338 * Aspect No_Tagged_Streams::
339 * Aspect Object_Size::
340 * Aspect Obsolescent::
342 * Aspect Persistent_BSS::
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::
353 * Aspect Simple_Storage_Pool::
354 * Aspect Simple_Storage_Pool_Type::
355 * Aspect SPARK_Mode::
356 * Aspect Suppress_Debug_Info::
357 * Aspect Suppress_Initialization::
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::
370 Implementation Defined Attributes
372 * Attribute Abort_Signal::
373 * Attribute Address_Size::
374 * Attribute Asm_Input::
375 * Attribute Asm_Output::
376 * Attribute Atomic_Always_Lock_Free::
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::
385 * Attribute Descriptor_Size::
386 * Attribute Elaborated::
387 * Attribute Elab_Body::
388 * Attribute Elab_Spec::
389 * Attribute Elab_Subp_Body::
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::
402 * Attribute Integer_Value::
403 * Attribute Invalid_Value::
404 * Attribute Iterable::
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::
416 * Attribute Passed_By_Reference::
417 * Attribute Pool_Address::
418 * Attribute Range_Length::
419 * Attribute Restriction_Set::
421 * Attribute Safe_Emax::
422 * Attribute Safe_Large::
423 * Attribute Safe_Small::
424 * Attribute Scalar_Storage_Order::
425 * Attribute Simple_Storage_Pool::
427 * Attribute Storage_Unit::
428 * Attribute Stub_Type::
429 * Attribute System_Allocator_Alignment::
430 * Attribute Target_Name::
431 * Attribute To_Address::
433 * Attribute Type_Class::
434 * Attribute Type_Key::
435 * Attribute TypeCode::
436 * Attribute Unconstrained_Array::
437 * Attribute Universal_Literal_String::
438 * Attribute Unrestricted_Access::
440 * Attribute Valid_Scalars::
441 * Attribute VADS_Size::
442 * Attribute Value_Size::
443 * Attribute Wchar_T_Size::
444 * Attribute Word_Size::
446 Standard and Implementation Defined Restrictions
448 * Partition-Wide Restrictions::
449 * Program Unit Level Restrictions::
451 Partition-Wide Restrictions
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::
461 * No_Abort_Statements::
462 * No_Access_Parameter_Allocators::
463 * No_Access_Subprograms::
465 * No_Anonymous_Allocators::
466 * No_Asynchronous_Control::
469 * No_Default_Initialization::
472 * No_Direct_Boolean_Operators::
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::
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::
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::
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::
513 * No_Task_Allocators::
514 * No_Task_At_Interrupt_Priority::
515 * No_Task_Attributes_Package::
516 * No_Task_Hierarchy::
517 * No_Task_Termination::
519 * No_Terminate_Alternatives::
520 * No_Unchecked_Access::
521 * No_Unchecked_Conversion::
522 * No_Unchecked_Deallocation::
526 * Static_Priorities::
527 * Static_Storage_Size::
529 Program Unit Level Restrictions
531 * No_Elaboration_Code::
532 * No_Dynamic_Sized_Objects::
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::
547 Implementation Advice
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.
614 Intrinsic Subprograms
616 * Intrinsic Operators::
617 * Compilation_ISO_Date::
621 * Exception_Information::
622 * Exception_Message::
626 * Shifts and Rotates::
629 Representation Clauses and Pragmas
631 * Alignment 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::
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::
651 The Implementation of Standard I/O
653 * Standard I/O Packages::
659 * Wide_Wide_Text_IO::
663 * Filenames encoding::
664 * File content encoding::
666 * Operations on C Streams::
667 * Interfacing to C Streams::
671 * Stream Pointer Positioning::
672 * Reading and Writing Non-Regular Files::
674 * Treating Text_IO Files as Streams::
675 * Text_IO Extensions::
676 * Text_IO Facilities for Unbounded Strings::
680 * Stream Pointer Positioning: Stream Pointer Positioning<2>.
681 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>.
685 * Stream Pointer Positioning: Stream Pointer Positioning<3>.
686 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>.
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.
846 Interfacing to Other Languages
849 * Interfacing to C++::
850 * Interfacing to COBOL::
851 * Interfacing to Fortran::
852 * Interfacing to non-GNAT Ada code::
854 Implementation of Specific Ada Features
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::
863 GNAT Implementation of Tasking
865 * Mapping Ada Tasks onto the Underlying Kernel Threads::
866 * Ensuring Compliance with the Real-Time Annex::
867 * Support for Locking Policies::
869 Code Generation for Array Aggregates
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::
879 * pragma No_Run_Time::
881 * pragma Restricted_Run_Time::
883 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads.
885 Compatibility and Porting Guide
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::
895 Compatibility with Ada 83
897 * Legal Ada 83 programs that are illegal in Ada 95::
898 * More deterministic semantics::
899 * Changed semantics::
900 * Other language compatibility issues::
902 Implementation-dependent characteristics
904 * Implementation-defined pragmas::
905 * Implementation-defined attributes::
907 * Elaboration order::
908 * Target-specific aspects::
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
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.
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.
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.
940 @geindex Implementation-dependent features
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.
950 * What This Reference Manual Contains::
952 * Related Information::
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
961 This reference manual contains the following chapters:
967 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
968 pragmas, which can be used to extend and enhance the functionality of the
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.
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.
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.
988 @ref{b,,Implementation Defined Characteristics}, provides a guide to
989 minimizing implementation dependent features.
992 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
993 implemented by GNAT, and how they can be imported into user
994 application programs.
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.
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.
1007 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
1008 implementation of the input-output facilities.
1011 @ref{10,,The GNAT Library}, is a catalog of packages that complement
1012 the Ada predefined library.
1015 @ref{11,,Interfacing to Other Languages}, describes how programs
1016 written in Ada using GNAT can be interfaced to other programming
1020 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
1021 of the specialized needs annexes.
1024 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1025 to GNAT's implementation of machine code insertions, tasking, and several
1029 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1030 GNAT implementation of the Ada 2012 language standard.
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.
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.
1046 @ref{1,,GNU Free Documentation License} contains the license for this document.
1049 @geindex Ada 95 Language Reference Manual
1051 @geindex Ada 2005 Language Reference Manual
1053 This reference manual assumes a basic familiarity with the Ada 95 language, as
1055 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1056 It does not require knowledge of the new features introduced by Ada 2005 or
1058 All three reference manuals are included in the GNAT documentation
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
1066 @geindex Conventions
1067 @geindex typographical
1069 @geindex Typographical conventions
1071 Following are examples of the typographical and graphic conventions used
1078 @code{Functions}, @code{utility program names}, @code{standard names},
1094 [optional information or parameters]
1097 Examples are described by text
1100 and then shown this way.
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.
1108 @node Related Information,,Conventions,About This Guide
1109 @anchor{gnat_rm/about_this_guide related-information}@anchor{18}
1110 @section Related Information
1113 See the following documents for further information on GNAT:
1119 @cite{GNAT User's Guide for Native Platforms},
1120 which provides information on how to use the
1121 GNAT development environment.
1124 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
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.
1133 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
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.
1141 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1144 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1145 which contains specific information on compatibility between GNAT and
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
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
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.
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.
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.
1175 * Pragma Abort_Defer::
1176 * Pragma Abstract_State::
1177 * Pragma Acc_Parallel::
1179 * Pragma Acc_Kernels::
1187 * Pragma Aggregate_Individually_Assign::
1188 * Pragma Allow_Integer_Address::
1191 * Pragma Assert_And_Cut::
1192 * Pragma Assertion_Policy::
1194 * Pragma Assume_No_Invalid_Values::
1195 * Pragma Async_Readers::
1196 * Pragma Async_Writers::
1197 * Pragma Attribute_Definition::
1198 * Pragma C_Pass_By_Copy::
1200 * Pragma Check_Float_Overflow::
1201 * Pragma Check_Name::
1202 * Pragma Check_Policy::
1204 * Pragma Common_Object::
1205 * Pragma Compile_Time_Error::
1206 * Pragma Compile_Time_Warning::
1207 * Pragma Compiler_Unit::
1208 * Pragma Compiler_Unit_Warning::
1209 * Pragma Complete_Representation::
1210 * Pragma Complex_Representation::
1211 * Pragma Component_Alignment::
1212 * Pragma Constant_After_Elaboration::
1213 * Pragma Contract_Cases::
1214 * Pragma Convention_Identifier::
1215 * Pragma CPP_Class::
1216 * Pragma CPP_Constructor::
1217 * Pragma CPP_Virtual::
1218 * Pragma CPP_Vtable::
1220 * Pragma Deadline_Floor::
1221 * Pragma Default_Initial_Condition::
1223 * Pragma Debug_Policy::
1224 * Pragma Default_Scalar_Storage_Order::
1225 * Pragma Default_Storage_Pool::
1227 * Pragma Detect_Blocking::
1228 * Pragma Disable_Atomic_Synchronization::
1229 * Pragma Dispatching_Domain::
1230 * Pragma Effective_Reads::
1231 * Pragma Effective_Writes::
1232 * Pragma Elaboration_Checks::
1233 * Pragma Eliminate::
1234 * Pragma Enable_Atomic_Synchronization::
1235 * Pragma Export_Function::
1236 * Pragma Export_Object::
1237 * Pragma Export_Procedure::
1238 * Pragma Export_Value::
1239 * Pragma Export_Valued_Procedure::
1240 * Pragma Extend_System::
1241 * Pragma Extensions_Allowed::
1242 * Pragma Extensions_Visible::
1244 * Pragma External_Name_Casing::
1245 * Pragma Fast_Math::
1246 * Pragma Favor_Top_Level::
1247 * Pragma Finalize_Storage_Only::
1248 * Pragma Float_Representation::
1252 * Pragma Ignore_Pragma::
1253 * Pragma Implementation_Defined::
1254 * Pragma Implemented::
1255 * Pragma Implicit_Packing::
1256 * Pragma Import_Function::
1257 * Pragma Import_Object::
1258 * Pragma Import_Procedure::
1259 * Pragma Import_Valued_Procedure::
1260 * Pragma Independent::
1261 * Pragma Independent_Components::
1262 * Pragma Initial_Condition::
1263 * Pragma Initialize_Scalars::
1264 * Pragma Initializes::
1265 * Pragma Inline_Always::
1266 * Pragma Inline_Generic::
1267 * Pragma Interface::
1268 * Pragma Interface_Name::
1269 * Pragma Interrupt_Handler::
1270 * Pragma Interrupt_State::
1271 * Pragma Invariant::
1272 * Pragma Keep_Names::
1274 * Pragma Link_With::
1275 * Pragma Linker_Alias::
1276 * Pragma Linker_Constructor::
1277 * Pragma Linker_Destructor::
1278 * Pragma Linker_Section::
1279 * Pragma Lock_Free::
1280 * Pragma Loop_Invariant::
1281 * Pragma Loop_Optimize::
1282 * Pragma Loop_Variant::
1283 * Pragma Machine_Attribute::
1285 * Pragma Main_Storage::
1286 * Pragma Max_Queue_Length::
1288 * Pragma No_Caching::
1289 * Pragma No_Component_Reordering::
1290 * Pragma No_Elaboration_Code_All::
1291 * Pragma No_Heap_Finalization::
1292 * Pragma No_Inline::
1293 * Pragma No_Return::
1294 * Pragma No_Strict_Aliasing::
1295 * Pragma No_Tagged_Streams::
1296 * Pragma Normalize_Scalars::
1297 * Pragma Obsolescent::
1298 * Pragma Optimize_Alignment::
1300 * Pragma Overflow_Mode::
1301 * Pragma Overriding_Renamings::
1302 * Pragma Partition_Elaboration_Policy::
1305 * Pragma Persistent_BSS::
1308 * Pragma Postcondition::
1309 * Pragma Post_Class::
1310 * Pragma Rename_Pragma::
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::
1320 * Pragma Profile_Warnings::
1321 * Pragma Propagate_Exceptions::
1322 * Pragma Provide_Shift_Operators::
1323 * Pragma Psect_Object::
1324 * Pragma Pure_Function::
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::
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::
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::
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::
1375 * Pragma Validity_Checks::
1377 * Pragma Volatile_Full_Access::
1378 * Pragma Volatile_Function::
1379 * Pragma Warning_As_Error::
1381 * Pragma Weak_External::
1382 * Pragma Wide_Character_Encoding::
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
1391 @geindex Deferring aborts
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
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
1413 pragma Abstract_State (ABSTRACT_STATE_LIST);
1415 ABSTRACT_STATE_LIST ::=
1417 | STATE_NAME_WITH_OPTIONS
1418 | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1420 STATE_NAME_WITH_OPTIONS ::=
1422 | (STATE_NAME with OPTION_LIST)
1424 OPTION_LIST ::= OPTION @{, OPTION@}
1430 SIMPLE_OPTION ::= Ghost | Synchronous
1432 NAME_VALUE_OPTION ::=
1433 Part_Of => ABSTRACT_STATE
1434 | External [=> EXTERNAL_PROPERTY_LIST]
1436 EXTERNAL_PROPERTY_LIST ::=
1438 | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
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
1447 STATE_NAME ::= defining_identifier
1449 ABSTRACT_STATE ::= name
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.
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
1463 pragma Acc_Parallel [( ACC_PARALLEL_CLAUSE [, ACC_PARALLEL_CLAUSE... ])];
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
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
1483 REDUCTION_RECORD ::=
1485 | "*" => IDENTIFIERS
1486 | "min" => IDENTIFIERS
1487 | "max" => IDENTIFIERS
1488 | "or" => IDENTIFIERS
1489 | "and" => IDENTIFIERS
1493 | (IDENTIFIER, IDENTIFIERS)
1496 | integer_EXPRESSION
1497 | (integer_EXPRESSION, INTEGERS)
1500 Requires the @code{-fopenacc} flag.
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
1506 For more information about the effect of the clauses, see the OpenAcc
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
1517 pragma Acc_Loop [( ACC_LOOP_CLAUSE [, ACC_LOOP_CLAUSE... ])];
1521 | Collapse => INTEGER_LITERAL
1522 | Gang [=> GANG_ARG]
1524 | Private => IDENTIFIERS
1525 | Reduction => (REDUCTION_RECORD)
1527 | Tile => SIZE_EXPRESSION
1528 | Vector [=> integer_EXPRESSION]
1529 | Worker [=> integer_EXPRESSION]
1533 | Static => SIZE_EXPRESSION
1537 | integer_EXPRESSION
1540 Requires the @code{-fopenacc} flag.
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.
1546 For more information about the effect of the clauses, see the OpenAcc
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
1557 pragma Acc_Kernels [( ACC_KERNELS_CLAUSE [, ACC_KERNELS_CLAUSE...])];
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
1567 | Device_Ptr => IDENTIFIERS
1568 | Num_Gangs => integer_EXPRESSION
1569 | Num_Workers => integer_EXPRESSION
1570 | Present => IDENTIFIERS
1571 | Vector_Length => integer_EXPRESSION
1576 | (IDENTIFIER, IDENTIFIERS)
1579 | integer_EXPRESSION
1580 | (integer_EXPRESSION, INTEGERS)
1583 Requires the @code{-fopenacc} flag.
1585 Equivalent to the kernels directive of the OpenAcc standard. This pragma should
1588 For more information about the effect of the clauses, see the OpenAcc
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
1599 pragma Acc_Data ([ ACC_DATA_CLAUSE [, ACC_DATA_CLAUSE...]]);
1603 | Copy_In => IDENTIFIERS
1604 | Copy_Out => IDENTIFIERS
1605 | Create => IDENTIFIERS
1606 | Device_Ptr => IDENTIFIERS
1607 | Present => IDENTIFIERS
1610 Requires the @code{-fopenacc} flag.
1612 Equivalent to the @code{data} directive of the OpenAcc standard. This pragma
1613 should be placed in loops.
1615 For more information about the effect of the clauses, see the OpenAcc
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
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.
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
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
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.
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
1675 pragma Ada_05 (local_NAME);
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.
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.
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
1706 This configuration pragma is a synonym for pragma Ada_05 and has the
1707 same syntax and effect.
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
1718 pragma Ada_12 (local_NAME);
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.
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.
1740 @node Pragma Ada_2012,Pragma Aggregate_Individually_Assign,Pragma Ada_12,Implementation Defined Pragmas
1741 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{27}
1742 @section Pragma Ada_2012
1751 This configuration pragma is a synonym for pragma Ada_12 and has the
1752 same syntax and effect.
1754 @node Pragma Aggregate_Individually_Assign,Pragma Allow_Integer_Address,Pragma Ada_2012,Implementation Defined Pragmas
1755 @anchor{gnat_rm/implementation_defined_pragmas pragma-aggregate-individually-assign}@anchor{28}
1756 @section Pragma Aggregate_Individually_Assign
1762 pragma Aggregate_Individually_Assign;
1765 Where possible, GNAT will store the binary representation of a record aggregate
1766 in memory for space and performance reasons. This configuration pragma changes
1767 this behavior so that record aggregates are instead always converted into
1768 individual assignment statements.
1770 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Aggregate_Individually_Assign,Implementation Defined Pragmas
1771 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{29}
1772 @section Pragma Allow_Integer_Address
1778 pragma Allow_Integer_Address;
1781 In almost all versions of GNAT, @code{System.Address} is a private
1782 type in accordance with the implementation advice in the RM. This
1783 means that integer values,
1784 in particular integer literals, are not allowed as address values.
1785 If the configuration pragma
1786 @code{Allow_Integer_Address} is given, then integer expressions may
1787 be used anywhere a value of type @code{System.Address} is required.
1788 The effect is to introduce an implicit unchecked conversion from the
1789 integer value to type @code{System.Address}. The reverse case of using
1790 an address where an integer type is required is handled analogously.
1791 The following example compiles without errors:
1794 pragma Allow_Integer_Address;
1795 with System; use System;
1796 package AddrAsInt is
1799 for X'Address use 16#1240#;
1800 for Y use at 16#3230#;
1801 m : Address := 16#4000#;
1802 n : constant Address := 4000;
1803 p : constant Address := Address (X + Y);
1804 v : Integer := y'Address;
1805 w : constant Integer := Integer (Y'Address);
1806 type R is new integer;
1809 for Z'Address use RR;
1813 Note that pragma @code{Allow_Integer_Address} is ignored if @code{System.Address}
1814 is not a private type. In implementations of @code{GNAT} where
1815 System.Address is a visible integer type,
1816 this pragma serves no purpose but is ignored
1817 rather than rejected to allow common sets of sources to be used
1818 in the two situations.
1820 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1821 @anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{2a}@anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{2b}
1822 @section Pragma Annotate
1828 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1830 ARG ::= NAME | EXPRESSION
1833 This pragma is used to annotate programs. IDENTIFIER identifies
1834 the type of annotation. GNAT verifies that it is an identifier, but does
1835 not otherwise analyze it. The second optional identifier is also left
1836 unanalyzed, and by convention is used to control the action of the tool to
1837 which the annotation is addressed. The remaining ARG arguments
1838 can be either string literals or more generally expressions.
1839 String literals are assumed to be either of type
1840 @code{Standard.String} or else @code{Wide_String} or @code{Wide_Wide_String}
1841 depending on the character literals they contain.
1842 All other kinds of arguments are analyzed as expressions, and must be
1843 unambiguous. The last argument if present must have the identifier
1844 @code{Entity} and GNAT verifies that a local name is given.
1846 The analyzed pragma is retained in the tree, but not otherwise processed
1847 by any part of the GNAT compiler, except to generate corresponding note
1848 lines in the generated ALI file. For the format of these note lines, see
1849 the compiler source file lib-writ.ads. This pragma is intended for use by
1850 external tools, including ASIS. The use of pragma Annotate does not
1851 affect the compilation process in any way. This pragma may be used as
1852 a configuration pragma.
1854 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1855 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{2c}
1856 @section Pragma Assert
1864 [, string_EXPRESSION]);
1867 The effect of this pragma depends on whether the corresponding command
1868 line switch is set to activate assertions. The pragma expands into code
1869 equivalent to the following:
1872 if assertions-enabled then
1873 if not boolean_EXPRESSION then
1874 System.Assertions.Raise_Assert_Failure
1875 (string_EXPRESSION);
1880 The string argument, if given, is the message that will be associated
1881 with the exception occurrence if the exception is raised. If no second
1882 argument is given, the default message is @code{file}:@code{nnn},
1883 where @code{file} is the name of the source file containing the assert,
1884 and @code{nnn} is the line number of the assert.
1886 Note that, as with the @code{if} statement to which it is equivalent, the
1887 type of the expression is either @code{Standard.Boolean}, or any type derived
1888 from this standard type.
1890 Assert checks can be either checked or ignored. By default they are ignored.
1891 They will be checked if either the command line switch @emph{-gnata} is
1892 used, or if an @code{Assertion_Policy} or @code{Check_Policy} pragma is used
1893 to enable @code{Assert_Checks}.
1895 If assertions are ignored, then there
1896 is no run-time effect (and in particular, any side effects from the
1897 expression will not occur at run time). (The expression is still
1898 analyzed at compile time, and may cause types to be frozen if they are
1899 mentioned here for the first time).
1901 If assertions are checked, then the given expression is tested, and if
1902 it is @code{False} then @code{System.Assertions.Raise_Assert_Failure} is called
1903 which results in the raising of @code{Assert_Failure} with the given message.
1905 You should generally avoid side effects in the expression arguments of
1906 this pragma, because these side effects will turn on and off with the
1907 setting of the assertions mode, resulting in assertions that have an
1908 effect on the program. However, the expressions are analyzed for
1909 semantic correctness whether or not assertions are enabled, so turning
1910 assertions on and off cannot affect the legality of a program.
1912 Note that the implementation defined policy @code{DISABLE}, given in a
1913 pragma @code{Assertion_Policy}, can be used to suppress this semantic analysis.
1915 Note: this is a standard language-defined pragma in versions
1916 of Ada from 2005 on. In GNAT, it is implemented in all versions
1917 of Ada, and the DISABLE policy is an implementation-defined
1920 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1921 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{2d}
1922 @section Pragma Assert_And_Cut
1928 pragma Assert_And_Cut (
1930 [, string_EXPRESSION]);
1933 The effect of this pragma is identical to that of pragma @code{Assert},
1934 except that in an @code{Assertion_Policy} pragma, the identifier
1935 @code{Assert_And_Cut} is used to control whether it is ignored or checked
1938 The intention is that this be used within a subprogram when the
1939 given test expresion sums up all the work done so far in the
1940 subprogram, so that the rest of the subprogram can be verified
1941 (informally or formally) using only the entry preconditions,
1942 and the expression in this pragma. This allows dividing up
1943 a subprogram into sections for the purposes of testing or
1944 formal verification. The pragma also serves as useful
1947 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1948 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{2e}
1949 @section Pragma Assertion_Policy
1955 pragma Assertion_Policy (CHECK | DISABLE | IGNORE | SUPPRESSIBLE);
1957 pragma Assertion_Policy (
1958 ASSERTION_KIND => POLICY_IDENTIFIER
1959 @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1961 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1963 RM_ASSERTION_KIND ::= Assert |
1971 Type_Invariant'Class
1973 ID_ASSERTION_KIND ::= Assertions |
1987 Statement_Assertions
1989 POLICY_IDENTIFIER ::= Check | Disable | Ignore | Suppressible
1992 This is a standard Ada 2012 pragma that is available as an
1993 implementation-defined pragma in earlier versions of Ada.
1994 The assertion kinds @code{RM_ASSERTION_KIND} are those defined in
1995 the Ada standard. The assertion kinds @code{ID_ASSERTION_KIND}
1996 are implementation defined additions recognized by the GNAT compiler.
1998 The pragma applies in both cases to pragmas and aspects with matching
1999 names, e.g. @code{Pre} applies to the Pre aspect, and @code{Precondition}
2000 applies to both the @code{Precondition} pragma
2001 and the aspect @code{Precondition}. Note that the identifiers for
2002 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
2003 Pre_Class and Post_Class), since these pragmas are intended to be
2004 identical to the corresponding aspects).
2006 If the policy is @code{CHECK}, then assertions are enabled, i.e.
2007 the corresponding pragma or aspect is activated.
2008 If the policy is @code{IGNORE}, then assertions are ignored, i.e.
2009 the corresponding pragma or aspect is deactivated.
2010 This pragma overrides the effect of the @emph{-gnata} switch on the
2012 If the policy is @code{SUPPRESSIBLE}, then assertions are enabled by default,
2013 however, if the @emph{-gnatp} switch is specified all assertions are ignored.
2015 The implementation defined policy @code{DISABLE} is like
2016 @code{IGNORE} except that it completely disables semantic
2017 checking of the corresponding pragma or aspect. This is
2018 useful when the pragma or aspect argument references subprograms
2019 in a with'ed package which is replaced by a dummy package
2020 for the final build.
2022 The implementation defined assertion kind @code{Assertions} applies to all
2023 assertion kinds. The form with no assertion kind given implies this
2024 choice, so it applies to all assertion kinds (RM defined, and
2025 implementation defined).
2027 The implementation defined assertion kind @code{Statement_Assertions}
2028 applies to @code{Assert}, @code{Assert_And_Cut},
2029 @code{Assume}, @code{Loop_Invariant}, and @code{Loop_Variant}.
2031 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
2032 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2f}
2033 @section Pragma Assume
2041 [, string_EXPRESSION]);
2044 The effect of this pragma is identical to that of pragma @code{Assert},
2045 except that in an @code{Assertion_Policy} pragma, the identifier
2046 @code{Assume} is used to control whether it is ignored or checked
2049 The intention is that this be used for assumptions about the
2050 external environment. So you cannot expect to verify formally
2051 or informally that the condition is met, this must be
2052 established by examining things outside the program itself.
2053 For example, we may have code that depends on the size of
2054 @code{Long_Long_Integer} being at least 64. So we could write:
2057 pragma Assume (Long_Long_Integer'Size >= 64);
2060 This assumption cannot be proved from the program itself,
2061 but it acts as a useful run-time check that the assumption
2062 is met, and documents the need to ensure that it is met by
2063 reference to information outside the program.
2065 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
2066 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{30}
2067 @section Pragma Assume_No_Invalid_Values
2070 @geindex Invalid representations
2072 @geindex Invalid values
2077 pragma Assume_No_Invalid_Values (On | Off);
2080 This is a configuration pragma that controls the assumptions made by the
2081 compiler about the occurrence of invalid representations (invalid values)
2084 The default behavior (corresponding to an Off argument for this pragma), is
2085 to assume that values may in general be invalid unless the compiler can
2086 prove they are valid. Consider the following example:
2089 V1 : Integer range 1 .. 10;
2090 V2 : Integer range 11 .. 20;
2092 for J in V2 .. V1 loop
2097 if V1 and V2 have valid values, then the loop is known at compile
2098 time not to execute since the lower bound must be greater than the
2099 upper bound. However in default mode, no such assumption is made,
2100 and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
2101 is given, the compiler will assume that any occurrence of a variable
2102 other than in an explicit @code{'Valid} test always has a valid
2103 value, and the loop above will be optimized away.
2105 The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
2106 you know your code is free of uninitialized variables and other
2107 possible sources of invalid representations, and may result in
2108 more efficient code. A program that accesses an invalid representation
2109 with this pragma in effect is erroneous, so no guarantees can be made
2112 It is peculiar though permissible to use this pragma in conjunction
2113 with validity checking (-gnatVa). In such cases, accessing invalid
2114 values will generally give an exception, though formally the program
2115 is erroneous so there are no guarantees that this will always be the
2116 case, and it is recommended that these two options not be used together.
2118 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
2119 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{31}@anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{32}
2120 @section Pragma Async_Readers
2126 pragma Async_Readers [ (boolean_EXPRESSION) ];
2129 For the semantics of this pragma, see the entry for aspect @code{Async_Readers} in
2130 the SPARK 2014 Reference Manual, section 7.1.2.
2132 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
2133 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{33}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{34}
2134 @section Pragma Async_Writers
2140 pragma Async_Writers [ (boolean_EXPRESSION) ];
2143 For the semantics of this pragma, see the entry for aspect @code{Async_Writers} in
2144 the SPARK 2014 Reference Manual, section 7.1.2.
2146 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
2147 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{35}
2148 @section Pragma Attribute_Definition
2154 pragma Attribute_Definition
2155 ([Attribute =>] ATTRIBUTE_DESIGNATOR,
2156 [Entity =>] LOCAL_NAME,
2157 [Expression =>] EXPRESSION | NAME);
2160 If @code{Attribute} is a known attribute name, this pragma is equivalent to
2161 the attribute definition clause:
2164 for Entity'Attribute use Expression;
2167 If @code{Attribute} is not a recognized attribute name, the pragma is
2168 ignored, and a warning is emitted. This allows source
2169 code to be written that takes advantage of some new attribute, while remaining
2170 compilable with earlier compilers.
2172 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
2173 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{36}
2174 @section Pragma C_Pass_By_Copy
2177 @geindex Passing by copy
2182 pragma C_Pass_By_Copy
2183 ([Max_Size =>] static_integer_EXPRESSION);
2186 Normally the default mechanism for passing C convention records to C
2187 convention subprograms is to pass them by reference, as suggested by RM
2188 B.3(69). Use the configuration pragma @code{C_Pass_By_Copy} to change
2189 this default, by requiring that record formal parameters be passed by
2190 copy if all of the following conditions are met:
2196 The size of the record type does not exceed the value specified for
2200 The record type has @code{Convention C}.
2203 The formal parameter has this record type, and the subprogram has a
2204 foreign (non-Ada) convention.
2207 If these conditions are met the argument is passed by copy; i.e., in a
2208 manner consistent with what C expects if the corresponding formal in the
2209 C prototype is a struct (rather than a pointer to a struct).
2211 You can also pass records by copy by specifying the convention
2212 @code{C_Pass_By_Copy} for the record type, or by using the extended
2213 @code{Import} and @code{Export} pragmas, which allow specification of
2214 passing mechanisms on a parameter by parameter basis.
2216 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2217 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{37}
2218 @section Pragma Check
2223 @geindex Named assertions
2229 [Name =>] CHECK_KIND,
2230 [Check =>] Boolean_EXPRESSION
2231 [, [Message =>] string_EXPRESSION] );
2233 CHECK_KIND ::= IDENTIFIER |
2236 Type_Invariant'Class |
2240 This pragma is similar to the predefined pragma @code{Assert} except that an
2241 extra identifier argument is present. In conjunction with pragma
2242 @code{Check_Policy}, this can be used to define groups of assertions that can
2243 be independently controlled. The identifier @code{Assertion} is special, it
2244 refers to the normal set of pragma @code{Assert} statements.
2246 Checks introduced by this pragma are normally deactivated by default. They can
2247 be activated either by the command line option @emph{-gnata}, which turns on
2248 all checks, or individually controlled using pragma @code{Check_Policy}.
2250 The identifiers @code{Assertions} and @code{Statement_Assertions} are not
2251 permitted as check kinds, since this would cause confusion with the use
2252 of these identifiers in @code{Assertion_Policy} and @code{Check_Policy}
2253 pragmas, where they are used to refer to sets of assertions.
2255 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2256 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{38}
2257 @section Pragma Check_Float_Overflow
2260 @geindex Floating-point overflow
2265 pragma Check_Float_Overflow;
2268 In Ada, the predefined floating-point types (@code{Short_Float},
2269 @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
2270 defined to be @emph{unconstrained}. This means that even though each
2271 has a well-defined base range, an operation that delivers a result
2272 outside this base range is not required to raise an exception.
2273 This implementation permission accommodates the notion
2274 of infinities in IEEE floating-point, and corresponds to the
2275 efficient execution mode on most machines. GNAT will not raise
2276 overflow exceptions on these machines; instead it will generate
2277 infinities and NaN's as defined in the IEEE standard.
2279 Generating infinities, although efficient, is not always desirable.
2280 Often the preferable approach is to check for overflow, even at the
2281 (perhaps considerable) expense of run-time performance.
2282 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
2283 range constraints -- and indeed such a subtype
2284 can have the same base range as its base type. For example:
2287 subtype My_Float is Float range Float'Range;
2290 Here @code{My_Float} has the same range as
2291 @code{Float} but is constrained, so operations on
2292 @code{My_Float} values will be checked for overflow
2295 This style will achieve the desired goal, but
2296 it is often more convenient to be able to simply use
2297 the standard predefined floating-point types as long
2298 as overflow checking could be guaranteed.
2299 The @code{Check_Float_Overflow}
2300 configuration pragma achieves this effect. If a unit is compiled
2301 subject to this configuration pragma, then all operations
2302 on predefined floating-point types including operations on
2303 base types of these floating-point types will be treated as
2304 though those types were constrained, and overflow checks
2305 will be generated. The @code{Constraint_Error}
2306 exception is raised if the result is out of range.
2308 This mode can also be set by use of the compiler
2309 switch @emph{-gnateF}.
2311 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2312 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{39}
2313 @section Pragma Check_Name
2316 @geindex Defining check names
2318 @geindex Check names
2324 pragma Check_Name (check_name_IDENTIFIER);
2327 This is a configuration pragma that defines a new implementation
2328 defined check name (unless IDENTIFIER matches one of the predefined
2329 check names, in which case the pragma has no effect). Check names
2330 are global to a partition, so if two or more configuration pragmas
2331 are present in a partition mentioning the same name, only one new
2332 check name is introduced.
2334 An implementation defined check name introduced with this pragma may
2335 be used in only three contexts: @code{pragma Suppress},
2336 @code{pragma Unsuppress},
2337 and as the prefix of a @code{Check_Name'Enabled} attribute reference. For
2338 any of these three cases, the check name must be visible. A check
2339 name is visible if it is in the configuration pragmas applying to
2340 the current unit, or if it appears at the start of any unit that
2341 is part of the dependency set of the current unit (e.g., units that
2342 are mentioned in @code{with} clauses).
2344 Check names introduced by this pragma are subject to control by compiler
2345 switches (in particular -gnatp) in the usual manner.
2347 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2348 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{3a}
2349 @section Pragma Check_Policy
2352 @geindex Controlling assertions
2357 @geindex Check pragma control
2359 @geindex Named assertions
2365 ([Name =>] CHECK_KIND,
2366 [Policy =>] POLICY_IDENTIFIER);
2368 pragma Check_Policy (
2369 CHECK_KIND => POLICY_IDENTIFIER
2370 @{, CHECK_KIND => POLICY_IDENTIFIER@});
2372 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2374 CHECK_KIND ::= IDENTIFIER |
2377 Type_Invariant'Class |
2380 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2381 avoids confusion between the two possible syntax forms for this pragma.
2383 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2386 This pragma is used to set the checking policy for assertions (specified
2387 by aspects or pragmas), the @code{Debug} pragma, or additional checks
2388 to be checked using the @code{Check} pragma. It may appear either as
2389 a configuration pragma, or within a declarative part of package. In the
2390 latter case, it applies from the point where it appears to the end of
2391 the declarative region (like pragma @code{Suppress}).
2393 The @code{Check_Policy} pragma is similar to the
2394 predefined @code{Assertion_Policy} pragma,
2395 and if the check kind corresponds to one of the assertion kinds that
2396 are allowed by @code{Assertion_Policy}, then the effect is identical.
2398 If the first argument is Debug, then the policy applies to Debug pragmas,
2399 disabling their effect if the policy is @code{OFF}, @code{DISABLE}, or
2400 @code{IGNORE}, and allowing them to execute with normal semantics if
2401 the policy is @code{ON} or @code{CHECK}. In addition if the policy is
2402 @code{DISABLE}, then the procedure call in @code{Debug} pragmas will
2403 be totally ignored and not analyzed semantically.
2405 Finally the first argument may be some other identifier than the above
2406 possibilities, in which case it controls a set of named assertions
2407 that can be checked using pragma @code{Check}. For example, if the pragma:
2410 pragma Check_Policy (Critical_Error, OFF);
2413 is given, then subsequent @code{Check} pragmas whose first argument is also
2414 @code{Critical_Error} will be disabled.
2416 The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
2417 to turn on corresponding checks. The default for a set of checks for which no
2418 @code{Check_Policy} is given is @code{OFF} unless the compiler switch
2419 @emph{-gnata} is given, which turns on all checks by default.
2421 The check policy settings @code{CHECK} and @code{IGNORE} are recognized
2422 as synonyms for @code{ON} and @code{OFF}. These synonyms are provided for
2423 compatibility with the standard @code{Assertion_Policy} pragma. The check
2424 policy setting @code{DISABLE} causes the second argument of a corresponding
2425 @code{Check} pragma to be completely ignored and not analyzed.
2427 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2428 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{3b}
2429 @section Pragma Comment
2435 pragma Comment (static_string_EXPRESSION);
2438 This is almost identical in effect to pragma @code{Ident}. It allows the
2439 placement of a comment into the object file and hence into the
2440 executable file if the operating system permits such usage. The
2441 difference is that @code{Comment}, unlike @code{Ident}, has
2442 no limitations on placement of the pragma (it can be placed
2443 anywhere in the main source unit), and if more than one pragma
2444 is used, all comments are retained.
2446 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2447 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{3c}
2448 @section Pragma Common_Object
2454 pragma Common_Object (
2455 [Internal =>] LOCAL_NAME
2456 [, [External =>] EXTERNAL_SYMBOL]
2457 [, [Size =>] EXTERNAL_SYMBOL] );
2461 | static_string_EXPRESSION
2464 This pragma enables the shared use of variables stored in overlaid
2465 linker areas corresponding to the use of @code{COMMON}
2466 in Fortran. The single
2467 object @code{LOCAL_NAME} is assigned to the area designated by
2468 the @code{External} argument.
2469 You may define a record to correspond to a series
2470 of fields. The @code{Size} argument
2471 is syntax checked in GNAT, but otherwise ignored.
2473 @code{Common_Object} is not supported on all platforms. If no
2474 support is available, then the code generator will issue a message
2475 indicating that the necessary attribute for implementation of this
2476 pragma is not available.
2478 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2479 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{3d}
2480 @section Pragma Compile_Time_Error
2486 pragma Compile_Time_Error
2487 (boolean_EXPRESSION, static_string_EXPRESSION);
2490 This pragma can be used to generate additional compile time
2492 is particularly useful in generics, where errors can be issued for
2493 specific problematic instantiations. The first parameter is a boolean
2494 expression. The pragma is effective only if the value of this expression
2495 is known at compile time, and has the value True. The set of expressions
2496 whose values are known at compile time includes all static boolean
2497 expressions, and also other values which the compiler can determine
2498 at compile time (e.g., the size of a record type set by an explicit
2499 size representation clause, or the value of a variable which was
2500 initialized to a constant and is known not to have been modified).
2501 If these conditions are met, an error message is generated using
2502 the value given as the second argument. This string value may contain
2503 embedded ASCII.LF characters to break the message into multiple lines.
2505 @node Pragma Compile_Time_Warning,Pragma Compiler_Unit,Pragma Compile_Time_Error,Implementation Defined Pragmas
2506 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{3e}
2507 @section Pragma Compile_Time_Warning
2513 pragma Compile_Time_Warning
2514 (boolean_EXPRESSION, static_string_EXPRESSION);
2517 Same as pragma Compile_Time_Error, except a warning is issued instead
2518 of an error message. Note that if this pragma is used in a package that
2519 is with'ed by a client, the client will get the warning even though it
2520 is issued by a with'ed package (normally warnings in with'ed units are
2521 suppressed, but this is a special exception to that rule).
2523 One typical use is within a generic where compile time known characteristics
2524 of formal parameters are tested, and warnings given appropriately. Another use
2525 with a first parameter of True is to warn a client about use of a package,
2526 for example that it is not fully implemented.
2528 @node Pragma Compiler_Unit,Pragma Compiler_Unit_Warning,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2529 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit}@anchor{3f}
2530 @section Pragma Compiler_Unit
2536 pragma Compiler_Unit;
2539 This pragma is obsolete. It is equivalent to Compiler_Unit_Warning. It is
2540 retained so that old versions of the GNAT run-time that use this pragma can
2541 be compiled with newer versions of the compiler.
2543 @node Pragma Compiler_Unit_Warning,Pragma Complete_Representation,Pragma Compiler_Unit,Implementation Defined Pragmas
2544 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit-warning}@anchor{40}
2545 @section Pragma Compiler_Unit_Warning
2551 pragma Compiler_Unit_Warning;
2554 This pragma is intended only for internal use in the GNAT run-time library.
2555 It indicates that the unit is used as part of the compiler build. The effect
2556 is to generate warnings for the use of constructs (for example, conditional
2557 expressions) that would cause trouble when bootstrapping using an older
2558 version of GNAT. For the exact list of restrictions, see the compiler sources
2559 and references to Check_Compiler_Unit.
2561 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compiler_Unit_Warning,Implementation Defined Pragmas
2562 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{41}
2563 @section Pragma Complete_Representation
2569 pragma Complete_Representation;
2572 This pragma must appear immediately within a record representation
2573 clause. Typical placements are before the first component clause
2574 or after the last component clause. The effect is to give an error
2575 message if any component is missing a component clause. This pragma
2576 may be used to ensure that a record representation clause is
2577 complete, and that this invariant is maintained if fields are
2578 added to the record in the future.
2580 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2581 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{42}
2582 @section Pragma Complex_Representation
2588 pragma Complex_Representation
2589 ([Entity =>] LOCAL_NAME);
2592 The @code{Entity} argument must be the name of a record type which has
2593 two fields of the same floating-point type. The effect of this pragma is
2594 to force gcc to use the special internal complex representation form for
2595 this record, which may be more efficient. Note that this may result in
2596 the code for this type not conforming to standard ABI (application
2597 binary interface) requirements for the handling of record types. For
2598 example, in some environments, there is a requirement for passing
2599 records by pointer, and the use of this pragma may result in passing
2600 this type in floating-point registers.
2602 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2603 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{43}
2604 @section Pragma Component_Alignment
2607 @geindex Alignments of components
2609 @geindex Pragma Component_Alignment
2614 pragma Component_Alignment (
2615 [Form =>] ALIGNMENT_CHOICE
2616 [, [Name =>] type_LOCAL_NAME]);
2618 ALIGNMENT_CHOICE ::=
2625 Specifies the alignment of components in array or record types.
2626 The meaning of the @code{Form} argument is as follows:
2630 @geindex Component_Size (in pragma Component_Alignment)
2636 @item @emph{Component_Size}
2638 Aligns scalar components and subcomponents of the array or record type
2639 on boundaries appropriate to their inherent size (naturally
2640 aligned). For example, 1-byte components are aligned on byte boundaries,
2641 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2642 integer components are aligned on 4-byte boundaries and so on. These
2643 alignment rules correspond to the normal rules for C compilers on all
2644 machines except the VAX.
2646 @geindex Component_Size_4 (in pragma Component_Alignment)
2648 @item @emph{Component_Size_4}
2650 Naturally aligns components with a size of four or fewer
2651 bytes. Components that are larger than 4 bytes are placed on the next
2654 @geindex Storage_Unit (in pragma Component_Alignment)
2656 @item @emph{Storage_Unit}
2658 Specifies that array or record components are byte aligned, i.e.,
2659 aligned on boundaries determined by the value of the constant
2660 @code{System.Storage_Unit}.
2662 @geindex Default (in pragma Component_Alignment)
2664 @item @emph{Default}
2666 Specifies that array or record components are aligned on default
2667 boundaries, appropriate to the underlying hardware or operating system or
2668 both. The @code{Default} choice is the same as @code{Component_Size} (natural
2672 If the @code{Name} parameter is present, @code{type_LOCAL_NAME} must
2673 refer to a local record or array type, and the specified alignment
2674 choice applies to the specified type. The use of
2675 @code{Component_Alignment} together with a pragma @code{Pack} causes the
2676 @code{Component_Alignment} pragma to be ignored. The use of
2677 @code{Component_Alignment} together with a record representation clause
2678 is only effective for fields not specified by the representation clause.
2680 If the @code{Name} parameter is absent, the pragma can be used as either
2681 a configuration pragma, in which case it applies to one or more units in
2682 accordance with the normal rules for configuration pragmas, or it can be
2683 used within a declarative part, in which case it applies to types that
2684 are declared within this declarative part, or within any nested scope
2685 within this declarative part. In either case it specifies the alignment
2686 to be applied to any record or array type which has otherwise standard
2689 If the alignment for a record or array type is not specified (using
2690 pragma @code{Pack}, pragma @code{Component_Alignment}, or a record rep
2691 clause), the GNAT uses the default alignment as described previously.
2693 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2694 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{44}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{45}
2695 @section Pragma Constant_After_Elaboration
2701 pragma Constant_After_Elaboration [ (boolean_EXPRESSION) ];
2704 For the semantics of this pragma, see the entry for aspect
2705 @code{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2707 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2708 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{46}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{47}
2709 @section Pragma Contract_Cases
2712 @geindex Contract cases
2717 pragma Contract_Cases ((CONTRACT_CASE @{, CONTRACT_CASE));
2719 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2721 CASE_GUARD ::= boolean_EXPRESSION | others
2723 CONSEQUENCE ::= boolean_EXPRESSION
2726 The @code{Contract_Cases} pragma allows defining fine-grain specifications
2727 that can complement or replace the contract given by a precondition and a
2728 postcondition. Additionally, the @code{Contract_Cases} pragma can be used
2729 by testing and formal verification tools. The compiler checks its validity and,
2730 depending on the assertion policy at the point of declaration of the pragma,
2731 it may insert a check in the executable. For code generation, the contract
2735 pragma Contract_Cases (
2743 C1 : constant Boolean := Cond1; -- evaluated at subprogram entry
2744 C2 : constant Boolean := Cond2; -- evaluated at subprogram entry
2745 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2746 pragma Postcondition (if C1 then Pred1);
2747 pragma Postcondition (if C2 then Pred2);
2750 The precondition ensures that one and only one of the case guards is
2751 satisfied on entry to the subprogram.
2752 The postcondition ensures that for the case guard that was True on entry,
2753 the corrresponding consequence is True on exit. Other consequence expressions
2756 A precondition @code{P} and postcondition @code{Q} can also be
2757 expressed as contract cases:
2760 pragma Contract_Cases (P => Q);
2763 The placement and visibility rules for @code{Contract_Cases} pragmas are
2764 identical to those described for preconditions and postconditions.
2766 The compiler checks that boolean expressions given in case guards and
2767 consequences are valid, where the rules for case guards are the same as
2768 the rule for an expression in @code{Precondition} and the rules for
2769 consequences are the same as the rule for an expression in
2770 @code{Postcondition}. In particular, attributes @code{'Old} and
2771 @code{'Result} can only be used within consequence expressions.
2772 The case guard for the last contract case may be @code{others}, to denote
2773 any case not captured by the previous cases. The
2774 following is an example of use within a package spec:
2777 package Math_Functions is
2779 function Sqrt (Arg : Float) return Float;
2780 pragma Contract_Cases (((Arg in 0.0 .. 99.0) => Sqrt'Result < 10.0,
2781 Arg >= 100.0 => Sqrt'Result >= 10.0,
2782 others => Sqrt'Result = 0.0));
2787 The meaning of contract cases is that only one case should apply at each
2788 call, as determined by the corresponding case guard evaluating to True,
2789 and that the consequence for this case should hold when the subprogram
2792 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2793 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{48}
2794 @section Pragma Convention_Identifier
2797 @geindex Conventions
2803 pragma Convention_Identifier (
2804 [Name =>] IDENTIFIER,
2805 [Convention =>] convention_IDENTIFIER);
2808 This pragma provides a mechanism for supplying synonyms for existing
2809 convention identifiers. The @code{Name} identifier can subsequently
2810 be used as a synonym for the given convention in other pragmas (including
2811 for example pragma @code{Import} or another @code{Convention_Identifier}
2812 pragma). As an example of the use of this, suppose you had legacy code
2813 which used Fortran77 as the identifier for Fortran. Then the pragma:
2816 pragma Convention_Identifier (Fortran77, Fortran);
2819 would allow the use of the convention identifier @code{Fortran77} in
2820 subsequent code, avoiding the need to modify the sources. As another
2821 example, you could use this to parameterize convention requirements
2822 according to systems. Suppose you needed to use @code{Stdcall} on
2823 windows systems, and @code{C} on some other system, then you could
2824 define a convention identifier @code{Library} and use a single
2825 @code{Convention_Identifier} pragma to specify which convention
2826 would be used system-wide.
2828 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2829 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{49}
2830 @section Pragma CPP_Class
2833 @geindex Interfacing with C++
2838 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2841 The argument denotes an entity in the current declarative region that is
2842 declared as a record type. It indicates that the type corresponds to an
2843 externally declared C++ class type, and is to be laid out the same way
2844 that C++ would lay out the type. If the C++ class has virtual primitives
2845 then the record must be declared as a tagged record type.
2847 Types for which @code{CPP_Class} is specified do not have assignment or
2848 equality operators defined (such operations can be imported or declared
2849 as subprograms as required). Initialization is allowed only by constructor
2850 functions (see pragma @code{CPP_Constructor}). Such types are implicitly
2851 limited if not explicitly declared as limited or derived from a limited
2852 type, and an error is issued in that case.
2854 See @ref{4a,,Interfacing to C++} for related information.
2856 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
2857 for backward compatibility but its functionality is available
2858 using pragma @code{Import} with @code{Convention} = @code{CPP}.
2860 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2861 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{4b}
2862 @section Pragma CPP_Constructor
2865 @geindex Interfacing with C++
2870 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2871 [, [External_Name =>] static_string_EXPRESSION ]
2872 [, [Link_Name =>] static_string_EXPRESSION ]);
2875 This pragma identifies an imported function (imported in the usual way
2876 with pragma @code{Import}) as corresponding to a C++ constructor. If
2877 @code{External_Name} and @code{Link_Name} are not specified then the
2878 @code{Entity} argument is a name that must have been previously mentioned
2879 in a pragma @code{Import} with @code{Convention} = @code{CPP}. Such name
2880 must be of one of the following forms:
2886 @strong{function} @code{Fname} @strong{return} T`
2889 @strong{function} @code{Fname} @strong{return} T'Class
2892 @strong{function} @code{Fname} (...) @strong{return} T`
2895 @strong{function} @code{Fname} (...) @strong{return} T'Class
2898 where @code{T} is a limited record type imported from C++ with pragma
2899 @code{Import} and @code{Convention} = @code{CPP}.
2901 The first two forms import the default constructor, used when an object
2902 of type @code{T} is created on the Ada side with no explicit constructor.
2903 The latter two forms cover all the non-default constructors of the type.
2904 See the GNAT User's Guide for details.
2906 If no constructors are imported, it is impossible to create any objects
2907 on the Ada side and the type is implicitly declared abstract.
2909 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
2910 using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
2912 See @ref{4a,,Interfacing to C++} for more related information.
2914 Note: The use of functions returning class-wide types for constructors is
2915 currently obsolete. They are supported for backward compatibility. The
2916 use of functions returning the type T leave the Ada sources more clear
2917 because the imported C++ constructors always return an object of type T;
2918 that is, they never return an object whose type is a descendant of type T.
2920 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2921 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{4c}
2922 @section Pragma CPP_Virtual
2925 @geindex Interfacing to C++
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 is retained for compatibility
2930 purposes. It used to be required to ensure compoatibility with C++, but
2931 is no longer required for that purpose because GNAT generates
2932 the same object layout as the G++ compiler by default.
2934 See @ref{4a,,Interfacing to C++} for related information.
2936 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2937 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{4d}
2938 @section Pragma CPP_Vtable
2941 @geindex Interfacing with C++
2943 This pragma is now obsolete and, other than generating a warning if warnings
2944 on obsolescent features are enabled, is completely ignored.
2945 It used to be required to ensure compatibility with C++, but
2946 is no longer required for that purpose because GNAT generates
2947 the same object layout as the G++ compiler by default.
2949 See @ref{4a,,Interfacing to C++} for related information.
2951 @node Pragma CPU,Pragma Deadline_Floor,Pragma CPP_Vtable,Implementation Defined Pragmas
2952 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{4e}
2959 pragma CPU (EXPRESSION);
2962 This pragma is standard in Ada 2012, but is available in all earlier
2963 versions of Ada as an implementation-defined pragma.
2964 See Ada 2012 Reference Manual for details.
2966 @node Pragma Deadline_Floor,Pragma Default_Initial_Condition,Pragma CPU,Implementation Defined Pragmas
2967 @anchor{gnat_rm/implementation_defined_pragmas pragma-deadline-floor}@anchor{4f}
2968 @section Pragma Deadline_Floor
2974 pragma Deadline_Floor (time_span_EXPRESSION);
2977 This pragma applies only to protected types and specifies the floor
2978 deadline inherited by a task when the task enters a protected object.
2979 It is effective only when the EDF scheduling policy is used.
2981 @node Pragma Default_Initial_Condition,Pragma Debug,Pragma Deadline_Floor,Implementation Defined Pragmas
2982 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{50}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{51}
2983 @section Pragma Default_Initial_Condition
2989 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2992 For the semantics of this pragma, see the entry for aspect
2993 @code{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2995 @node Pragma Debug,Pragma Debug_Policy,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2996 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{52}
2997 @section Pragma Debug
3003 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
3005 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
3007 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
3010 The procedure call argument has the syntactic form of an expression, meeting
3011 the syntactic requirements for pragmas.
3013 If debug pragmas are not enabled or if the condition is present and evaluates
3014 to False, this pragma has no effect. If debug pragmas are enabled, the
3015 semantics of the pragma is exactly equivalent to the procedure call statement
3016 corresponding to the argument with a terminating semicolon. Pragmas are
3017 permitted in sequences of declarations, so you can use pragma @code{Debug} to
3018 intersperse calls to debug procedures in the middle of declarations. Debug
3019 pragmas can be enabled either by use of the command line switch @emph{-gnata}
3020 or by use of the pragma @code{Check_Policy} with a first argument of
3023 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
3024 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{53}
3025 @section Pragma Debug_Policy
3031 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
3034 This pragma is equivalent to a corresponding @code{Check_Policy} pragma
3035 with a first argument of @code{Debug}. It is retained for historical
3036 compatibility reasons.
3038 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
3039 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{54}
3040 @section Pragma Default_Scalar_Storage_Order
3043 @geindex Default_Scalar_Storage_Order
3045 @geindex Scalar_Storage_Order
3050 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
3053 Normally if no explicit @code{Scalar_Storage_Order} is given for a record
3054 type or array type, then the scalar storage order defaults to the ordinary
3055 default for the target. But this default may be overridden using this pragma.
3056 The pragma may appear as a configuration pragma, or locally within a package
3057 spec or declarative part. In the latter case, it applies to all subsequent
3058 types declared within that package spec or declarative part.
3060 The following example shows the use of this pragma:
3063 pragma Default_Scalar_Storage_Order (High_Order_First);
3064 with System; use System;
3073 for L2'Scalar_Storage_Order use Low_Order_First;
3082 pragma Default_Scalar_Storage_Order (Low_Order_First);
3089 type H4a is new Inner.L4;
3097 In this example record types with names starting with @emph{L} have @cite{Low_Order_First} scalar
3098 storage order, and record types with names starting with @emph{H} have @code{High_Order_First}.
3099 Note that in the case of @code{H4a}, the order is not inherited
3100 from the parent type. Only an explicitly set @code{Scalar_Storage_Order}
3101 gets inherited on type derivation.
3103 If this pragma is used as a configuration pragma which appears within a
3104 configuration pragma file (as opposed to appearing explicitly at the start
3105 of a single unit), then the binder will require that all units in a partition
3106 be compiled in a similar manner, other than run-time units, which are not
3107 affected by this pragma. Note that the use of this form is discouraged because
3108 it may significantly degrade the run-time performance of the software, instead
3109 the default scalar storage order ought to be changed only on a local basis.
3111 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
3112 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{55}
3113 @section Pragma Default_Storage_Pool
3116 @geindex Default_Storage_Pool
3121 pragma Default_Storage_Pool (storage_pool_NAME | null);
3124 This pragma is standard in Ada 2012, but is available in all earlier
3125 versions of Ada as an implementation-defined pragma.
3126 See Ada 2012 Reference Manual for details.
3128 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
3129 @anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{56}@anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{57}
3130 @section Pragma Depends
3136 pragma Depends (DEPENDENCY_RELATION);
3138 DEPENDENCY_RELATION ::=
3140 | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
3142 DEPENDENCY_CLAUSE ::=
3143 OUTPUT_LIST =>[+] INPUT_LIST
3144 | NULL_DEPENDENCY_CLAUSE
3146 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
3148 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
3150 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
3152 OUTPUT ::= NAME | FUNCTION_RESULT
3155 where FUNCTION_RESULT is a function Result attribute_reference
3158 For the semantics of this pragma, see the entry for aspect @code{Depends} in the
3159 SPARK 2014 Reference Manual, section 6.1.5.
3161 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
3162 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{58}
3163 @section Pragma Detect_Blocking
3169 pragma Detect_Blocking;
3172 This is a standard pragma in Ada 2005, that is available in all earlier
3173 versions of Ada as an implementation-defined pragma.
3175 This is a configuration pragma that forces the detection of potentially
3176 blocking operations within a protected operation, and to raise Program_Error
3179 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
3180 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{59}
3181 @section Pragma Disable_Atomic_Synchronization
3184 @geindex Atomic Synchronization
3189 pragma Disable_Atomic_Synchronization [(Entity)];
3192 Ada requires that accesses (reads or writes) of an atomic variable be
3193 regarded as synchronization points in the case of multiple tasks.
3194 Particularly in the case of multi-processors this may require special
3195 handling, e.g. the generation of memory barriers. This capability may
3196 be turned off using this pragma in cases where it is known not to be
3199 The placement and scope rules for this pragma are the same as those
3200 for @code{pragma Suppress}. In particular it can be used as a
3201 configuration pragma, or in a declaration sequence where it applies
3202 till the end of the scope. If an @code{Entity} argument is present,
3203 the action applies only to that entity.
3205 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
3206 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{5a}
3207 @section Pragma Dispatching_Domain
3213 pragma Dispatching_Domain (EXPRESSION);
3216 This pragma is standard in Ada 2012, but is available in all earlier
3217 versions of Ada as an implementation-defined pragma.
3218 See Ada 2012 Reference Manual for details.
3220 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
3221 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{5b}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{5c}
3222 @section Pragma Effective_Reads
3228 pragma Effective_Reads [ (boolean_EXPRESSION) ];
3231 For the semantics of this pragma, see the entry for aspect @code{Effective_Reads} in
3232 the SPARK 2014 Reference Manual, section 7.1.2.
3234 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3235 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{5d}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{5e}
3236 @section Pragma Effective_Writes
3242 pragma Effective_Writes [ (boolean_EXPRESSION) ];
3245 For the semantics of this pragma, see the entry for aspect @code{Effective_Writes}
3246 in the SPARK 2014 Reference Manual, section 7.1.2.
3248 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3249 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{5f}
3250 @section Pragma Elaboration_Checks
3253 @geindex Elaboration control
3258 pragma Elaboration_Checks (Dynamic | Static);
3261 This is a configuration pragma which specifies the elaboration model to be
3262 used during compilation. For more information on the elaboration models of
3263 GNAT, consult the chapter on elaboration order handling in the @emph{GNAT User's
3266 The pragma may appear in the following contexts:
3272 Configuration pragmas file
3275 Prior to the context clauses of a compilation unit's initial declaration
3278 Any other placement of the pragma will result in a warning and the effects of
3279 the offending pragma will be ignored.
3281 If the pragma argument is @code{Dynamic}, then the dynamic elaboration model is in
3282 effect. If the pragma argument is @code{Static}, then the static elaboration model
3285 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3286 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{60}
3287 @section Pragma Eliminate
3290 @geindex Elimination of unused subprograms
3296 [ Unit_Name => ] IDENTIFIER | SELECTED_COMPONENT ,
3297 [ Entity => ] IDENTIFIER |
3298 SELECTED_COMPONENT |
3300 [, Source_Location => SOURCE_TRACE ] );
3302 SOURCE_TRACE ::= STRING_LITERAL
3305 This pragma indicates that the given entity is not used in the program to be
3306 compiled and built, thus allowing the compiler to
3307 eliminate the code or data associated with the named entity. Any reference to
3308 an eliminated entity causes a compile-time or link-time error.
3310 The pragma has the following semantics, where @code{U} is the unit specified by
3311 the @code{Unit_Name} argument and @code{E} is the entity specified by the @code{Entity}
3318 @code{E} must be a subprogram that is explicitly declared either:
3320 o Within @code{U}, or
3322 o Within a generic package that is instantiated in @code{U}, or
3324 o As an instance of generic subprogram instantiated in @code{U}.
3326 Otherwise the pragma is ignored.
3329 If @code{E} is overloaded within @code{U} then, in the absence of a
3330 @code{Source_Location} argument, all overloadings are eliminated.
3333 If @code{E} is overloaded within @code{U} and only some overloadings
3334 are to be eliminated, then each overloading to be eliminated
3335 must be specified in a corresponding pragma @code{Eliminate}
3336 with a @code{Source_Location} argument identifying the line where the
3337 declaration appears, as described below.
3340 If @code{E} is declared as the result of a generic instantiation, then
3341 a @code{Source_Location} argument is needed, as described below
3344 Pragma @code{Eliminate} allows a program to be compiled in a system-independent
3345 manner, so that unused entities are eliminated but without
3346 needing to modify the source text. Normally the required set of
3347 @code{Eliminate} pragmas is constructed automatically using the @code{gnatelim} tool.
3349 Any source file change that removes, splits, or
3350 adds lines may make the set of @code{Eliminate} pragmas invalid because their
3351 @code{Source_Location} argument values may get out of date.
3353 Pragma @code{Eliminate} may be used where the referenced entity is a dispatching
3354 operation. In this case all the subprograms to which the given operation can
3355 dispatch are considered to be unused (are never called as a result of a direct
3356 or a dispatching call).
3358 The string literal given for the source location specifies the line number
3359 of the declaration of the entity, using the following syntax for @code{SOURCE_TRACE}:
3362 SOURCE_TRACE ::= SOURCE_REFERENCE [ LBRACKET SOURCE_TRACE RBRACKET ]
3367 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3369 LINE_NUMBER ::= DIGIT @{DIGIT@}
3372 Spaces around the colon in a @code{SOURCE_REFERENCE} are optional.
3374 The source trace that is given as the @code{Source_Location} must obey the
3375 following rules (or else the pragma is ignored), where @code{U} is
3376 the unit @code{U} specified by the @code{Unit_Name} argument and @code{E} is the
3377 subprogram specified by the @code{Entity} argument:
3383 @code{FILE_NAME} is the short name (with no directory
3384 information) of the Ada source file for @code{U}, using the required syntax
3385 for the underlying file system (e.g. case is significant if the underlying
3386 operating system is case sensitive).
3387 If @code{U} is a package and @code{E} is a subprogram declared in the package
3388 specification and its full declaration appears in the package body,
3389 then the relevant source file is the one for the package specification;
3390 analogously if @code{U} is a generic package.
3393 If @code{E} is not declared in a generic instantiation (this includes
3394 generic subprogram instances), the source trace includes only one source
3395 line reference. @code{LINE_NUMBER} gives the line number of the occurrence
3396 of the declaration of @code{E} within the source file (as a decimal literal
3397 without an exponent or point).
3400 If @code{E} is declared by a generic instantiation, its source trace
3401 (from left to right) starts with the source location of the
3402 declaration of @code{E} in the generic unit and ends with the source
3403 location of the instantiation, given in square brackets. This approach is
3404 applied recursively with nested instantiations: the rightmost (nested
3405 most deeply in square brackets) element of the source trace is the location
3406 of the outermost instantiation, and the leftmost element (that is, outside
3407 of any square brackets) is the location of the declaration of @code{E} in
3416 pragma Eliminate (Pkg0, Proc);
3417 -- Eliminate (all overloadings of) Proc in Pkg0
3419 pragma Eliminate (Pkg1, Proc,
3420 Source_Location => "pkg1.ads:8");
3421 -- Eliminate overloading of Proc at line 8 in pkg1.ads
3423 -- Assume the following file contents:
3426 -- 2: type T is private;
3427 -- 3: package Gen_Pkg is
3428 -- 4: procedure Proc(N : T);
3434 -- 2: procedure Q is
3435 -- 3: package Inst_Pkg is new Gen_Pkg(Integer);
3436 -- ... -- No calls on Inst_Pkg.Proc
3439 -- The following pragma eliminates Inst_Pkg.Proc from Q
3440 pragma Eliminate (Q, Proc,
3441 Source_Location => "gen_pkg.ads:4[q.adb:3]");
3445 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3446 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{61}
3447 @section Pragma Enable_Atomic_Synchronization
3450 @geindex Atomic Synchronization
3455 pragma Enable_Atomic_Synchronization [(Entity)];
3458 Ada requires that accesses (reads or writes) of an atomic variable be
3459 regarded as synchronization points in the case of multiple tasks.
3460 Particularly in the case of multi-processors this may require special
3461 handling, e.g. the generation of memory barriers. This synchronization
3462 is performed by default, but can be turned off using
3463 @code{pragma Disable_Atomic_Synchronization}. The
3464 @code{Enable_Atomic_Synchronization} pragma can be used to turn
3467 The placement and scope rules for this pragma are the same as those
3468 for @code{pragma Unsuppress}. In particular it can be used as a
3469 configuration pragma, or in a declaration sequence where it applies
3470 till the end of the scope. If an @code{Entity} argument is present,
3471 the action applies only to that entity.
3473 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3474 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{62}
3475 @section Pragma Export_Function
3478 @geindex Argument passing mechanisms
3483 pragma Export_Function (
3484 [Internal =>] LOCAL_NAME
3485 [, [External =>] EXTERNAL_SYMBOL]
3486 [, [Parameter_Types =>] PARAMETER_TYPES]
3487 [, [Result_Type =>] result_SUBTYPE_MARK]
3488 [, [Mechanism =>] MECHANISM]
3489 [, [Result_Mechanism =>] MECHANISM_NAME]);
3493 | static_string_EXPRESSION
3498 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3502 | subtype_Name ' Access
3506 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3508 MECHANISM_ASSOCIATION ::=
3509 [formal_parameter_NAME =>] MECHANISM_NAME
3511 MECHANISM_NAME ::= Value | Reference
3514 Use this pragma to make a function externally callable and optionally
3515 provide information on mechanisms to be used for passing parameter and
3516 result values. We recommend, for the purposes of improving portability,
3517 this pragma always be used in conjunction with a separate pragma
3518 @code{Export}, which must precede the pragma @code{Export_Function}.
3519 GNAT does not require a separate pragma @code{Export}, but if none is
3520 present, @code{Convention Ada} is assumed, which is usually
3521 not what is wanted, so it is usually appropriate to use this
3522 pragma in conjunction with a @code{Export} or @code{Convention}
3523 pragma that specifies the desired foreign convention.
3524 Pragma @code{Export_Function}
3525 (and @code{Export}, if present) must appear in the same declarative
3526 region as the function to which they apply.
3528 The @code{internal_name} must uniquely designate the function to which the
3529 pragma applies. If more than one function name exists of this name in
3530 the declarative part you must use the @code{Parameter_Types} and
3531 @code{Result_Type} parameters to achieve the required
3532 unique designation. The @cite{subtype_mark}s in these parameters must
3533 exactly match the subtypes in the corresponding function specification,
3534 using positional notation to match parameters with subtype marks.
3535 The form with an @code{'Access} attribute can be used to match an
3536 anonymous access parameter.
3538 @geindex Suppressing external name
3540 Special treatment is given if the EXTERNAL is an explicit null
3541 string or a static string expressions that evaluates to the null
3542 string. In this case, no external name is generated. This form
3543 still allows the specification of parameter mechanisms.
3545 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3546 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{63}
3547 @section Pragma Export_Object
3553 pragma Export_Object
3554 [Internal =>] LOCAL_NAME
3555 [, [External =>] EXTERNAL_SYMBOL]
3556 [, [Size =>] EXTERNAL_SYMBOL]
3560 | static_string_EXPRESSION
3563 This pragma designates an object as exported, and apart from the
3564 extended rules for external symbols, is identical in effect to the use of
3565 the normal @code{Export} pragma applied to an object. You may use a
3566 separate Export pragma (and you probably should from the point of view
3567 of portability), but it is not required. @code{Size} is syntax checked,
3568 but otherwise ignored by GNAT.
3570 @node Pragma Export_Procedure,Pragma Export_Value,Pragma Export_Object,Implementation Defined Pragmas
3571 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{64}
3572 @section Pragma Export_Procedure
3578 pragma Export_Procedure (
3579 [Internal =>] LOCAL_NAME
3580 [, [External =>] EXTERNAL_SYMBOL]
3581 [, [Parameter_Types =>] PARAMETER_TYPES]
3582 [, [Mechanism =>] MECHANISM]);
3586 | static_string_EXPRESSION
3591 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3595 | subtype_Name ' Access
3599 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3601 MECHANISM_ASSOCIATION ::=
3602 [formal_parameter_NAME =>] MECHANISM_NAME
3604 MECHANISM_NAME ::= Value | Reference
3607 This pragma is identical to @code{Export_Function} except that it
3608 applies to a procedure rather than a function and the parameters
3609 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
3610 GNAT does not require a separate pragma @code{Export}, but if none is
3611 present, @code{Convention Ada} is assumed, which is usually
3612 not what is wanted, so it is usually appropriate to use this
3613 pragma in conjunction with a @code{Export} or @code{Convention}
3614 pragma that specifies the desired foreign convention.
3616 @geindex Suppressing external name
3618 Special treatment is given if the EXTERNAL is an explicit null
3619 string or a static string expressions that evaluates to the null
3620 string. In this case, no external name is generated. This form
3621 still allows the specification of parameter mechanisms.
3623 @node Pragma Export_Value,Pragma Export_Valued_Procedure,Pragma Export_Procedure,Implementation Defined Pragmas
3624 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-value}@anchor{65}
3625 @section Pragma Export_Value
3631 pragma Export_Value (
3632 [Value =>] static_integer_EXPRESSION,
3633 [Link_Name =>] static_string_EXPRESSION);
3636 This pragma serves to export a static integer value for external use.
3637 The first argument specifies the value to be exported. The Link_Name
3638 argument specifies the symbolic name to be associated with the integer
3639 value. This pragma is useful for defining a named static value in Ada
3640 that can be referenced in assembly language units to be linked with
3641 the application. This pragma is currently supported only for the
3642 AAMP target and is ignored for other targets.
3644 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Value,Implementation Defined Pragmas
3645 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{66}
3646 @section Pragma Export_Valued_Procedure
3652 pragma Export_Valued_Procedure (
3653 [Internal =>] LOCAL_NAME
3654 [, [External =>] EXTERNAL_SYMBOL]
3655 [, [Parameter_Types =>] PARAMETER_TYPES]
3656 [, [Mechanism =>] MECHANISM]);
3660 | static_string_EXPRESSION
3665 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3669 | subtype_Name ' Access
3673 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3675 MECHANISM_ASSOCIATION ::=
3676 [formal_parameter_NAME =>] MECHANISM_NAME
3678 MECHANISM_NAME ::= Value | Reference
3681 This pragma is identical to @code{Export_Procedure} except that the
3682 first parameter of @code{LOCAL_NAME}, which must be present, must be of
3683 mode @code{out}, and externally the subprogram is treated as a function
3684 with this parameter as the result of the function. GNAT provides for
3685 this capability to allow the use of @code{out} and @code{in out}
3686 parameters in interfacing to external functions (which are not permitted
3688 GNAT does not require a separate pragma @code{Export}, but if none is
3689 present, @code{Convention Ada} is assumed, which is almost certainly
3690 not what is wanted since the whole point of this pragma is to interface
3691 with foreign language functions, so it is usually appropriate to use this
3692 pragma in conjunction with a @code{Export} or @code{Convention}
3693 pragma that specifies the desired foreign convention.
3695 @geindex Suppressing external name
3697 Special treatment is given if the EXTERNAL is an explicit null
3698 string or a static string expressions that evaluates to the null
3699 string. In this case, no external name is generated. This form
3700 still allows the specification of parameter mechanisms.
3702 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3703 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{67}
3704 @section Pragma Extend_System
3715 pragma Extend_System ([Name =>] IDENTIFIER);
3718 This pragma is used to provide backwards compatibility with other
3719 implementations that extend the facilities of package @code{System}. In
3720 GNAT, @code{System} contains only the definitions that are present in
3721 the Ada RM. However, other implementations, notably the DEC Ada 83
3722 implementation, provide many extensions to package @code{System}.
3724 For each such implementation accommodated by this pragma, GNAT provides a
3725 package @code{Aux_@emph{xxx}}, e.g., @code{Aux_DEC} for the DEC Ada 83
3726 implementation, which provides the required additional definitions. You
3727 can use this package in two ways. You can @code{with} it in the normal
3728 way and access entities either by selection or using a @code{use}
3729 clause. In this case no special processing is required.
3731 However, if existing code contains references such as
3732 @code{System.@emph{xxx}} where @emph{xxx} is an entity in the extended
3733 definitions provided in package @code{System}, you may use this pragma
3734 to extend visibility in @code{System} in a non-standard way that
3735 provides greater compatibility with the existing code. Pragma
3736 @code{Extend_System} is a configuration pragma whose single argument is
3737 the name of the package containing the extended definition
3738 (e.g., @code{Aux_DEC} for the DEC Ada case). A unit compiled under
3739 control of this pragma will be processed using special visibility
3740 processing that looks in package @code{System.Aux_@emph{xxx}} where
3741 @code{Aux_@emph{xxx}} is the pragma argument for any entity referenced in
3742 package @code{System}, but not found in package @code{System}.
3744 You can use this pragma either to access a predefined @code{System}
3745 extension supplied with the compiler, for example @code{Aux_DEC} or
3746 you can construct your own extension unit following the above
3747 definition. Note that such a package is a child of @code{System}
3748 and thus is considered part of the implementation.
3749 To compile it you will have to use the @emph{-gnatg} switch
3750 for compiling System units, as explained in the
3753 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3754 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{68}
3755 @section Pragma Extensions_Allowed
3758 @geindex Ada Extensions
3760 @geindex GNAT Extensions
3765 pragma Extensions_Allowed (On | Off);
3768 This configuration pragma enables or disables the implementation
3769 extension mode (the use of Off as a parameter cancels the effect
3770 of the @emph{-gnatX} command switch).
3772 In extension mode, the latest version of the Ada language is
3773 implemented (currently Ada 2012), and in addition a small number
3774 of GNAT specific extensions are recognized as follows:
3779 @item @emph{Constrained attribute for generic objects}
3781 The @code{Constrained} attribute is permitted for objects of
3782 generic types. The result indicates if the corresponding actual
3786 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3787 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{69}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{6a}
3788 @section Pragma Extensions_Visible
3794 pragma Extensions_Visible [ (boolean_EXPRESSION) ];
3797 For the semantics of this pragma, see the entry for aspect @code{Extensions_Visible}
3798 in the SPARK 2014 Reference Manual, section 6.1.7.
3800 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3801 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{6b}
3802 @section Pragma External
3809 [ Convention =>] convention_IDENTIFIER,
3810 [ Entity =>] LOCAL_NAME
3811 [, [External_Name =>] static_string_EXPRESSION ]
3812 [, [Link_Name =>] static_string_EXPRESSION ]);
3815 This pragma is identical in syntax and semantics to pragma
3816 @code{Export} as defined in the Ada Reference Manual. It is
3817 provided for compatibility with some Ada 83 compilers that
3818 used this pragma for exactly the same purposes as pragma
3819 @code{Export} before the latter was standardized.
3821 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3822 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{6c}
3823 @section Pragma External_Name_Casing
3826 @geindex Dec Ada 83 casing compatibility
3828 @geindex External Names
3831 @geindex Casing of External names
3836 pragma External_Name_Casing (
3837 Uppercase | Lowercase
3838 [, Uppercase | Lowercase | As_Is]);
3841 This pragma provides control over the casing of external names associated
3842 with Import and Export pragmas. There are two cases to consider:
3848 Implicit external names
3850 Implicit external names are derived from identifiers. The most common case
3851 arises when a standard Ada Import or Export pragma is used with only two
3855 pragma Import (C, C_Routine);
3858 Since Ada is a case-insensitive language, the spelling of the identifier in
3859 the Ada source program does not provide any information on the desired
3860 casing of the external name, and so a convention is needed. In GNAT the
3861 default treatment is that such names are converted to all lower case
3862 letters. This corresponds to the normal C style in many environments.
3863 The first argument of pragma @code{External_Name_Casing} can be used to
3864 control this treatment. If @code{Uppercase} is specified, then the name
3865 will be forced to all uppercase letters. If @code{Lowercase} is specified,
3866 then the normal default of all lower case letters will be used.
3868 This same implicit treatment is also used in the case of extended DEC Ada 83
3869 compatible Import and Export pragmas where an external name is explicitly
3870 specified using an identifier rather than a string.
3873 Explicit external names
3875 Explicit external names are given as string literals. The most common case
3876 arises when a standard Ada Import or Export pragma is used with three
3880 pragma Import (C, C_Routine, "C_routine");
3883 In this case, the string literal normally provides the exact casing required
3884 for the external name. The second argument of pragma
3885 @code{External_Name_Casing} may be used to modify this behavior.
3886 If @code{Uppercase} is specified, then the name
3887 will be forced to all uppercase letters. If @code{Lowercase} is specified,
3888 then the name will be forced to all lowercase letters. A specification of
3889 @code{As_Is} provides the normal default behavior in which the casing is
3890 taken from the string provided.
3893 This pragma may appear anywhere that a pragma is valid. In particular, it
3894 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3895 case it applies to all subsequent compilations, or it can be used as a program
3896 unit pragma, in which case it only applies to the current unit, or it can
3897 be used more locally to control individual Import/Export pragmas.
3899 It was primarily intended for use with OpenVMS systems, where many
3900 compilers convert all symbols to upper case by default. For interfacing to
3901 such compilers (e.g., the DEC C compiler), it may be convenient to use
3905 pragma External_Name_Casing (Uppercase, Uppercase);
3908 to enforce the upper casing of all external symbols.
3910 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3911 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{6d}
3912 @section Pragma Fast_Math
3921 This is a configuration pragma which activates a mode in which speed is
3922 considered more important for floating-point operations than absolutely
3923 accurate adherence to the requirements of the standard. Currently the
3924 following operations are affected:
3929 @item @emph{Complex Multiplication}
3931 The normal simple formula for complex multiplication can result in intermediate
3932 overflows for numbers near the end of the range. The Ada standard requires that
3933 this situation be detected and corrected by scaling, but in Fast_Math mode such
3934 cases will simply result in overflow. Note that to take advantage of this you
3935 must instantiate your own version of @code{Ada.Numerics.Generic_Complex_Types}
3936 under control of the pragma, rather than use the preinstantiated versions.
3939 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3940 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{6e}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{6f}
3941 @section Pragma Favor_Top_Level
3947 pragma Favor_Top_Level (type_NAME);
3950 The argument of pragma @code{Favor_Top_Level} must be a named access-to-subprogram
3951 type. This pragma is an efficiency hint to the compiler, regarding the use of
3952 @code{'Access} or @code{'Unrestricted_Access} on nested (non-library-level) subprograms.
3953 The pragma means that nested subprograms are not used with this type, or are
3954 rare, so that the generated code should be efficient in the top-level case.
3955 When this pragma is used, dynamically generated trampolines may be used on some
3956 targets for nested subprograms. See restriction @code{No_Implicit_Dynamic_Code}.
3958 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3959 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{70}
3960 @section Pragma Finalize_Storage_Only
3966 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3969 The argument of pragma @code{Finalize_Storage_Only} must denote a local type which
3970 is derived from @code{Ada.Finalization.Controlled} or @code{Limited_Controlled}. The
3971 pragma suppresses the call to @code{Finalize} for declared library-level objects
3972 of the argument type. This is mostly useful for types where finalization is
3973 only used to deal with storage reclamation since in most environments it is
3974 not necessary to reclaim memory just before terminating execution, hence the
3975 name. Note that this pragma does not suppress Finalize calls for library-level
3976 heap-allocated objects (see pragma @code{No_Heap_Finalization}).
3978 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3979 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{71}
3980 @section Pragma Float_Representation
3986 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3988 FLOAT_REP ::= VAX_Float | IEEE_Float
3991 In the one argument form, this pragma is a configuration pragma which
3992 allows control over the internal representation chosen for the predefined
3993 floating point types declared in the packages @code{Standard} and
3994 @code{System}. This pragma is only provided for compatibility and has no effect.
3996 The two argument form specifies the representation to be used for
3997 the specified floating-point type. The argument must
3998 be @code{IEEE_Float} to specify the use of IEEE format, as follows:
4004 For a digits value of 6, 32-bit IEEE short format will be used.
4007 For a digits value of 15, 64-bit IEEE long format will be used.
4010 No other value of digits is permitted.
4013 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
4014 @anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{72}@anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{73}
4015 @section Pragma Ghost
4021 pragma Ghost [ (boolean_EXPRESSION) ];
4024 For the semantics of this pragma, see the entry for aspect @code{Ghost} in the SPARK
4025 2014 Reference Manual, section 6.9.
4027 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
4028 @anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{74}@anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{75}
4029 @section Pragma Global
4035 pragma Global (GLOBAL_SPECIFICATION);
4037 GLOBAL_SPECIFICATION ::=
4040 | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
4042 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
4044 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
4045 GLOBAL_LIST ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
4046 GLOBAL_ITEM ::= NAME
4049 For the semantics of this pragma, see the entry for aspect @code{Global} in the
4050 SPARK 2014 Reference Manual, section 6.1.4.
4052 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
4053 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{76}
4054 @section Pragma Ident
4060 pragma Ident (static_string_EXPRESSION);
4063 This pragma is identical in effect to pragma @code{Comment}. It is provided
4064 for compatibility with other Ada compilers providing this pragma.
4066 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
4067 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{77}
4068 @section Pragma Ignore_Pragma
4074 pragma Ignore_Pragma (pragma_IDENTIFIER);
4077 This is a configuration pragma
4078 that takes a single argument that is a simple identifier. Any subsequent
4079 use of a pragma whose pragma identifier matches this argument will be
4080 silently ignored. This may be useful when legacy code or code intended
4081 for compilation with some other compiler contains pragmas that match the
4082 name, but not the exact implementation, of a GNAT pragma. The use of this
4083 pragma allows such pragmas to be ignored, which may be useful in CodePeer
4084 mode, or during porting of legacy code.
4086 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
4087 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{78}
4088 @section Pragma Implementation_Defined
4094 pragma Implementation_Defined (local_NAME);
4097 This pragma marks a previously declared entity as implementation-defined.
4098 For an overloaded entity, applies to the most recent homonym.
4101 pragma Implementation_Defined;
4104 The form with no arguments appears anywhere within a scope, most
4105 typically a package spec, and indicates that all entities that are
4106 defined within the package spec are Implementation_Defined.
4108 This pragma is used within the GNAT runtime library to identify
4109 implementation-defined entities introduced in language-defined units,
4110 for the purpose of implementing the No_Implementation_Identifiers
4113 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
4114 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{79}
4115 @section Pragma Implemented
4121 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
4123 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
4126 This is an Ada 2012 representation pragma which applies to protected, task
4127 and synchronized interface primitives. The use of pragma Implemented provides
4128 a way to impose a static requirement on the overriding operation by adhering
4129 to one of the three implementation kinds: entry, protected procedure or any of
4130 the above. This pragma is available in all earlier versions of Ada as an
4131 implementation-defined pragma.
4134 type Synch_Iface is synchronized interface;
4135 procedure Prim_Op (Obj : in out Iface) is abstract;
4136 pragma Implemented (Prim_Op, By_Protected_Procedure);
4138 protected type Prot_1 is new Synch_Iface with
4139 procedure Prim_Op; -- Legal
4142 protected type Prot_2 is new Synch_Iface with
4143 entry Prim_Op; -- Illegal
4146 task type Task_Typ is new Synch_Iface with
4147 entry Prim_Op; -- Illegal
4151 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
4152 Implemented determines the runtime behavior of the requeue. Implementation kind
4153 By_Entry guarantees that the action of requeueing will proceed from an entry to
4154 another entry. Implementation kind By_Protected_Procedure transforms the
4155 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
4156 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
4157 the target's overriding subprogram kind.
4159 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
4160 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{7a}
4161 @section Pragma Implicit_Packing
4164 @geindex Rational Profile
4169 pragma Implicit_Packing;
4172 This is a configuration pragma that requests implicit packing for packed
4173 arrays for which a size clause is given but no explicit pragma Pack or
4174 specification of Component_Size is present. It also applies to records
4175 where no record representation clause is present. Consider this example:
4178 type R is array (0 .. 7) of Boolean;
4182 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
4183 does not change the layout of a composite object. So the Size clause in the
4184 above example is normally rejected, since the default layout of the array uses
4185 8-bit components, and thus the array requires a minimum of 64 bits.
4187 If this declaration is compiled in a region of code covered by an occurrence
4188 of the configuration pragma Implicit_Packing, then the Size clause in this
4189 and similar examples will cause implicit packing and thus be accepted. For
4190 this implicit packing to occur, the type in question must be an array of small
4191 components whose size is known at compile time, and the Size clause must
4192 specify the exact size that corresponds to the number of elements in the array
4193 multiplied by the size in bits of the component type (both single and
4194 multi-dimensioned arrays can be controlled with this pragma).
4196 @geindex Array packing
4198 Similarly, the following example shows the use in the record case
4202 a, b, c, d, e, f, g, h : boolean;
4208 Without a pragma Pack, each Boolean field requires 8 bits, so the
4209 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
4210 sufficient. The use of pragma Implicit_Packing allows this record
4211 declaration to compile without an explicit pragma Pack.
4213 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
4214 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{7b}
4215 @section Pragma Import_Function
4221 pragma Import_Function (
4222 [Internal =>] LOCAL_NAME,
4223 [, [External =>] EXTERNAL_SYMBOL]
4224 [, [Parameter_Types =>] PARAMETER_TYPES]
4225 [, [Result_Type =>] SUBTYPE_MARK]
4226 [, [Mechanism =>] MECHANISM]
4227 [, [Result_Mechanism =>] MECHANISM_NAME]);
4231 | static_string_EXPRESSION
4235 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4239 | subtype_Name ' Access
4243 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4245 MECHANISM_ASSOCIATION ::=
4246 [formal_parameter_NAME =>] MECHANISM_NAME
4253 This pragma is used in conjunction with a pragma @code{Import} to
4254 specify additional information for an imported function. The pragma
4255 @code{Import} (or equivalent pragma @code{Interface}) must precede the
4256 @code{Import_Function} pragma and both must appear in the same
4257 declarative part as the function specification.
4259 The @code{Internal} argument must uniquely designate
4260 the function to which the
4261 pragma applies. If more than one function name exists of this name in
4262 the declarative part you must use the @code{Parameter_Types} and
4263 @code{Result_Type} parameters to achieve the required unique
4264 designation. Subtype marks in these parameters must exactly match the
4265 subtypes in the corresponding function specification, using positional
4266 notation to match parameters with subtype marks.
4267 The form with an @code{'Access} attribute can be used to match an
4268 anonymous access parameter.
4270 You may optionally use the @code{Mechanism} and @code{Result_Mechanism}
4271 parameters to specify passing mechanisms for the
4272 parameters and result. If you specify a single mechanism name, it
4273 applies to all parameters. Otherwise you may specify a mechanism on a
4274 parameter by parameter basis using either positional or named
4275 notation. If the mechanism is not specified, the default mechanism
4278 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
4279 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{7c}
4280 @section Pragma Import_Object
4286 pragma Import_Object
4287 [Internal =>] LOCAL_NAME
4288 [, [External =>] EXTERNAL_SYMBOL]
4289 [, [Size =>] EXTERNAL_SYMBOL]);
4293 | static_string_EXPRESSION
4296 This pragma designates an object as imported, and apart from the
4297 extended rules for external symbols, is identical in effect to the use of
4298 the normal @code{Import} pragma applied to an object. Unlike the
4299 subprogram case, you need not use a separate @code{Import} pragma,
4300 although you may do so (and probably should do so from a portability
4301 point of view). @code{size} is syntax checked, but otherwise ignored by
4304 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
4305 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{7d}
4306 @section Pragma Import_Procedure
4312 pragma Import_Procedure (
4313 [Internal =>] LOCAL_NAME
4314 [, [External =>] EXTERNAL_SYMBOL]
4315 [, [Parameter_Types =>] PARAMETER_TYPES]
4316 [, [Mechanism =>] MECHANISM]);
4320 | static_string_EXPRESSION
4324 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4328 | subtype_Name ' Access
4332 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4334 MECHANISM_ASSOCIATION ::=
4335 [formal_parameter_NAME =>] MECHANISM_NAME
4337 MECHANISM_NAME ::= Value | Reference
4340 This pragma is identical to @code{Import_Function} except that it
4341 applies to a procedure rather than a function and the parameters
4342 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
4344 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4345 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{7e}
4346 @section Pragma Import_Valued_Procedure
4352 pragma Import_Valued_Procedure (
4353 [Internal =>] LOCAL_NAME
4354 [, [External =>] EXTERNAL_SYMBOL]
4355 [, [Parameter_Types =>] PARAMETER_TYPES]
4356 [, [Mechanism =>] MECHANISM]);
4360 | static_string_EXPRESSION
4364 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4368 | subtype_Name ' Access
4372 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4374 MECHANISM_ASSOCIATION ::=
4375 [formal_parameter_NAME =>] MECHANISM_NAME
4377 MECHANISM_NAME ::= Value | Reference
4380 This pragma is identical to @code{Import_Procedure} except that the
4381 first parameter of @code{LOCAL_NAME}, which must be present, must be of
4382 mode @code{out}, and externally the subprogram is treated as a function
4383 with this parameter as the result of the function. The purpose of this
4384 capability is to allow the use of @code{out} and @code{in out}
4385 parameters in interfacing to external functions (which are not permitted
4386 in Ada functions). You may optionally use the @code{Mechanism}
4387 parameters to specify passing mechanisms for the parameters.
4388 If you specify a single mechanism name, it applies to all parameters.
4389 Otherwise you may specify a mechanism on a parameter by parameter
4390 basis using either positional or named notation. If the mechanism is not
4391 specified, the default mechanism is used.
4393 Note that it is important to use this pragma in conjunction with a separate
4394 pragma Import that specifies the desired convention, since otherwise the
4395 default convention is Ada, which is almost certainly not what is required.
4397 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4398 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{7f}
4399 @section Pragma Independent
4405 pragma Independent (Local_NAME);
4408 This pragma is standard in Ada 2012 mode (which also provides an aspect
4409 of the same name). It is also available as an implementation-defined
4410 pragma in all earlier versions. It specifies that the
4411 designated object or all objects of the designated type must be
4412 independently addressable. This means that separate tasks can safely
4413 manipulate such objects. For example, if two components of a record are
4414 independent, then two separate tasks may access these two components.
4416 constraints on the representation of the object (for instance prohibiting
4419 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4420 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{80}
4421 @section Pragma Independent_Components
4427 pragma Independent_Components (Local_NAME);
4430 This pragma is standard in Ada 2012 mode (which also provides an aspect
4431 of the same name). It is also available as an implementation-defined
4432 pragma in all earlier versions. It specifies that the components of the
4433 designated object, or the components of each object of the designated
4435 independently addressable. This means that separate tasks can safely
4436 manipulate separate components in the composite object. This may place
4437 constraints on the representation of the object (for instance prohibiting
4440 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4441 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{81}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{82}
4442 @section Pragma Initial_Condition
4448 pragma Initial_Condition (boolean_EXPRESSION);
4451 For the semantics of this pragma, see the entry for aspect @code{Initial_Condition}
4452 in the SPARK 2014 Reference Manual, section 7.1.6.
4454 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4455 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{83}
4456 @section Pragma Initialize_Scalars
4459 @geindex debugging with Initialize_Scalars
4464 pragma Initialize_Scalars
4465 [ ( TYPE_VALUE_PAIR @{, TYPE_VALUE_PAIR@} ) ];
4468 SCALAR_TYPE => static_EXPRESSION
4485 This pragma is similar to @code{Normalize_Scalars} conceptually but has two
4486 important differences.
4488 First, there is no requirement for the pragma to be used uniformly in all units
4489 of a partition. In particular, it is fine to use this just for some or all of
4490 the application units of a partition, without needing to recompile the run-time
4491 library. In the case where some units are compiled with the pragma, and some
4492 without, then a declaration of a variable where the type is defined in package
4493 Standard or is locally declared will always be subject to initialization, as
4494 will any declaration of a scalar variable. For composite variables, whether the
4495 variable is initialized may also depend on whether the package in which the
4496 type of the variable is declared is compiled with the pragma.
4498 The other important difference is that the programmer can control the value
4499 used for initializing scalar objects. This effect can be achieved in several
4506 At compile time, the programmer can specify the invalid value for a
4507 particular family of scalar types using the optional arguments of the pragma.
4509 The compile-time approach is intended to optimize the generated code for the
4510 pragma, by possibly using fast operations such as @code{memset}.
4513 At bind time, the programmer has several options:
4519 Initialization with invalid values (similar to Normalize_Scalars, though
4520 for Initialize_Scalars it is not always possible to determine the invalid
4521 values in complex cases like signed component fields with nonstandard
4525 Initialization with high values.
4528 Initialization with low values.
4531 Initialization with a specific bit pattern.
4534 See the GNAT User's Guide for binder options for specifying these cases.
4536 The bind-time approach is intended to provide fast turnaround for testing
4537 with different values, without having to recompile the program.
4540 At execution time, the programmer can speify the invalid values using an
4541 environment variable. See the GNAT User's Guide for details.
4543 The execution-time approach is intended to provide fast turnaround for
4544 testing with different values, without having to recompile and rebind the
4548 Note that pragma @code{Initialize_Scalars} is particularly useful in conjunction
4549 with the enhanced validity checking that is now provided in GNAT, which checks
4550 for invalid values under more conditions. Using this feature (see description
4551 of the @emph{-gnatV} flag in the GNAT User's Guide) in conjunction with pragma
4552 @code{Initialize_Scalars} provides a powerful new tool to assist in the detection
4553 of problems caused by uninitialized variables.
4555 Note: the use of @code{Initialize_Scalars} has a fairly extensive effect on the
4556 generated code. This may cause your code to be substantially larger. It may
4557 also cause an increase in the amount of stack required, so it is probably a
4558 good idea to turn on stack checking (see description of stack checking in the
4559 GNAT User's Guide) when using this pragma.
4561 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4562 @anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{84}@anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{85}
4563 @section Pragma Initializes
4569 pragma Initializes (INITIALIZATION_LIST);
4571 INITIALIZATION_LIST ::=
4573 | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4575 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4580 | (INPUT @{, INPUT@})
4585 For the semantics of this pragma, see the entry for aspect @code{Initializes} in the
4586 SPARK 2014 Reference Manual, section 7.1.5.
4588 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4589 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{86}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{87}
4590 @section Pragma Inline_Always
4596 pragma Inline_Always (NAME [, NAME]);
4599 Similar to pragma @code{Inline} except that inlining is unconditional.
4600 Inline_Always instructs the compiler to inline every direct call to the
4601 subprogram or else to emit a compilation error, independently of any
4602 option, in particular @emph{-gnatn} or @emph{-gnatN} or the optimization level.
4603 It is an error to take the address or access of @code{NAME}. It is also an error to
4604 apply this pragma to a primitive operation of a tagged type. Thanks to such
4605 restrictions, the compiler is allowed to remove the out-of-line body of @code{NAME}.
4607 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4608 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{88}
4609 @section Pragma Inline_Generic
4615 pragma Inline_Generic (GNAME @{, GNAME@});
4617 GNAME ::= generic_unit_NAME | generic_instance_NAME
4620 This pragma is provided for compatibility with Dec Ada 83. It has
4621 no effect in GNAT (which always inlines generics), other
4622 than to check that the given names are all names of generic units or
4625 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4626 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{89}
4627 @section Pragma Interface
4634 [Convention =>] convention_identifier,
4635 [Entity =>] local_NAME
4636 [, [External_Name =>] static_string_expression]
4637 [, [Link_Name =>] static_string_expression]);
4640 This pragma is identical in syntax and semantics to
4641 the standard Ada pragma @code{Import}. It is provided for compatibility
4642 with Ada 83. The definition is upwards compatible both with pragma
4643 @code{Interface} as defined in the Ada 83 Reference Manual, and also
4644 with some extended implementations of this pragma in certain Ada 83
4645 implementations. The only difference between pragma @code{Interface}
4646 and pragma @code{Import} is that there is special circuitry to allow
4647 both pragmas to appear for the same subprogram entity (normally it
4648 is illegal to have multiple @code{Import} pragmas. This is useful in
4649 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4652 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4653 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{8a}
4654 @section Pragma Interface_Name
4660 pragma Interface_Name (
4661 [Entity =>] LOCAL_NAME
4662 [, [External_Name =>] static_string_EXPRESSION]
4663 [, [Link_Name =>] static_string_EXPRESSION]);
4666 This pragma provides an alternative way of specifying the interface name
4667 for an interfaced subprogram, and is provided for compatibility with Ada
4668 83 compilers that use the pragma for this purpose. You must provide at
4669 least one of @code{External_Name} or @code{Link_Name}.
4671 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4672 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{8b}
4673 @section Pragma Interrupt_Handler
4679 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4682 This program unit pragma is supported for parameterless protected procedures
4683 as described in Annex C of the Ada Reference Manual. On the AAMP target
4684 the pragma can also be specified for nonprotected parameterless procedures
4685 that are declared at the library level (which includes procedures
4686 declared at the top level of a library package). In the case of AAMP,
4687 when this pragma is applied to a nonprotected procedure, the instruction
4688 @code{IERET} is generated for returns from the procedure, enabling
4689 maskable interrupts, in place of the normal return instruction.
4691 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4692 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{8c}
4693 @section Pragma Interrupt_State
4699 pragma Interrupt_State
4701 [State =>] SYSTEM | RUNTIME | USER);
4704 Normally certain interrupts are reserved to the implementation. Any attempt
4705 to attach an interrupt causes Program_Error to be raised, as described in
4706 RM C.3.2(22). A typical example is the @code{SIGINT} interrupt used in
4707 many systems for an @code{Ctrl-C} interrupt. Normally this interrupt is
4708 reserved to the implementation, so that @code{Ctrl-C} can be used to
4709 interrupt execution. Additionally, signals such as @code{SIGSEGV},
4710 @code{SIGABRT}, @code{SIGFPE} and @code{SIGILL} are often mapped to specific
4711 Ada exceptions, or used to implement run-time functions such as the
4712 @code{abort} statement and stack overflow checking.
4714 Pragma @code{Interrupt_State} provides a general mechanism for overriding
4715 such uses of interrupts. It subsumes the functionality of pragma
4716 @code{Unreserve_All_Interrupts}. Pragma @code{Interrupt_State} is not
4717 available on Windows. On all other platforms than VxWorks,
4718 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4719 and may be used to mark interrupts required by the board support package
4722 Interrupts can be in one of three states:
4730 The interrupt is reserved (no Ada handler can be installed), and the
4731 Ada run-time may not install a handler. As a result you are guaranteed
4732 standard system default action if this interrupt is raised. This also allows
4733 installing a low level handler via C APIs such as sigaction(), outside
4739 The interrupt is reserved (no Ada handler can be installed). The run time
4740 is allowed to install a handler for internal control purposes, but is
4741 not required to do so.
4746 The interrupt is unreserved. The user may install an Ada handler via
4747 Ada.Interrupts and pragma Interrupt_Handler or Attach_Handler to provide
4751 These states are the allowed values of the @code{State} parameter of the
4752 pragma. The @code{Name} parameter is a value of the type
4753 @code{Ada.Interrupts.Interrupt_ID}. Typically, it is a name declared in
4754 @code{Ada.Interrupts.Names}.
4756 This is a configuration pragma, and the binder will check that there
4757 are no inconsistencies between different units in a partition in how a
4758 given interrupt is specified. It may appear anywhere a pragma is legal.
4760 The effect is to move the interrupt to the specified state.
4762 By declaring interrupts to be SYSTEM, you guarantee the standard system
4763 action, such as a core dump.
4765 By declaring interrupts to be USER, you guarantee that you can install
4768 Note that certain signals on many operating systems cannot be caught and
4769 handled by applications. In such cases, the pragma is ignored. See the
4770 operating system documentation, or the value of the array @code{Reserved}
4771 declared in the spec of package @code{System.OS_Interface}.
4773 Overriding the default state of signals used by the Ada runtime may interfere
4774 with an application's runtime behavior in the cases of the synchronous signals,
4775 and in the case of the signal used to implement the @code{abort} statement.
4777 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupt_State,Implementation Defined Pragmas
4778 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{8d}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{8e}
4779 @section Pragma Invariant
4786 ([Entity =>] private_type_LOCAL_NAME,
4787 [Check =>] EXPRESSION
4788 [,[Message =>] String_Expression]);
4791 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4792 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4793 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4794 requires the use of the aspect syntax, which is not available except in 2012
4795 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4796 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4797 note that the aspect Invariant is a synonym in GNAT for the aspect
4798 Type_Invariant, but there is no pragma Type_Invariant.
4800 The pragma must appear within the visible part of the package specification,
4801 after the type to which its Entity argument appears. As with the Invariant
4802 aspect, the Check expression is not analyzed until the end of the visible
4803 part of the package, so it may contain forward references. The Message
4804 argument, if present, provides the exception message used if the invariant
4805 is violated. If no Message parameter is provided, a default message that
4806 identifies the line on which the pragma appears is used.
4808 It is permissible to have multiple Invariants for the same type entity, in
4809 which case they are and'ed together. It is permissible to use this pragma
4810 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4811 invariant pragma for the same entity.
4813 For further details on the use of this pragma, see the Ada 2012 documentation
4814 of the Type_Invariant aspect.
4816 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4817 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{8f}
4818 @section Pragma Keep_Names
4824 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4827 The @code{LOCAL_NAME} argument
4828 must refer to an enumeration first subtype
4829 in the current declarative part. The effect is to retain the enumeration
4830 literal names for use by @code{Image} and @code{Value} even if a global
4831 @code{Discard_Names} pragma applies. This is useful when you want to
4832 generally suppress enumeration literal names and for example you therefore
4833 use a @code{Discard_Names} pragma in the @code{gnat.adc} file, but you
4834 want to retain the names for specific enumeration types.
4836 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4837 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{90}
4838 @section Pragma License
4841 @geindex License checking
4846 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4849 This pragma is provided to allow automated checking for appropriate license
4850 conditions with respect to the standard and modified GPL. A pragma
4851 @code{License}, which is a configuration pragma that typically appears at
4852 the start of a source file or in a separate @code{gnat.adc} file, specifies
4853 the licensing conditions of a unit as follows:
4860 This is used for a unit that can be freely used with no license restrictions.
4861 Examples of such units are public domain units, and units from the Ada
4866 This is used for a unit that is licensed under the unmodified GPL, and which
4867 therefore cannot be @code{with}ed by a restricted unit.
4871 This is used for a unit licensed under the GNAT modified GPL that includes
4872 a special exception paragraph that specifically permits the inclusion of
4873 the unit in programs without requiring the entire program to be released
4878 This is used for a unit that is restricted in that it is not permitted to
4879 depend on units that are licensed under the GPL. Typical examples are
4880 proprietary code that is to be released under more restrictive license
4881 conditions. Note that restricted units are permitted to @code{with} units
4882 which are licensed under the modified GPL (this is the whole point of the
4886 Normally a unit with no @code{License} pragma is considered to have an
4887 unknown license, and no checking is done. However, standard GNAT headers
4888 are recognized, and license information is derived from them as follows.
4890 A GNAT license header starts with a line containing 78 hyphens. The following
4891 comment text is searched for the appearance of any of the following strings.
4893 If the string 'GNU General Public License' is found, then the unit is assumed
4894 to have GPL license, unless the string 'As a special exception' follows, in
4895 which case the license is assumed to be modified GPL.
4897 If one of the strings
4898 'This specification is adapted from the Ada Semantic Interface' or
4899 'This specification is derived from the Ada Reference Manual' is found
4900 then the unit is assumed to be unrestricted.
4902 These default actions means that a program with a restricted license pragma
4903 will automatically get warnings if a GPL unit is inappropriately
4904 @code{with}ed. For example, the program:
4909 procedure Secret_Stuff is
4914 if compiled with pragma @code{License} (@code{Restricted}) in a
4915 @code{gnat.adc} file will generate the warning:
4920 >>> license of withed unit "Sem_Ch3" is incompatible
4922 2. with GNAT.Sockets;
4923 3. procedure Secret_Stuff is
4926 Here we get a warning on @code{Sem_Ch3} since it is part of the GNAT
4927 compiler and is licensed under the
4928 GPL, but no warning for @code{GNAT.Sockets} which is part of the GNAT
4929 run time, and is therefore licensed under the modified GPL.
4931 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4932 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{91}
4933 @section Pragma Link_With
4939 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4942 This pragma is provided for compatibility with certain Ada 83 compilers.
4943 It has exactly the same effect as pragma @code{Linker_Options} except
4944 that spaces occurring within one of the string expressions are treated
4945 as separators. For example, in the following case:
4948 pragma Link_With ("-labc -ldef");
4951 results in passing the strings @code{-labc} and @code{-ldef} as two
4952 separate arguments to the linker. In addition pragma Link_With allows
4953 multiple arguments, with the same effect as successive pragmas.
4955 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4956 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{92}
4957 @section Pragma Linker_Alias
4963 pragma Linker_Alias (
4964 [Entity =>] LOCAL_NAME,
4965 [Target =>] static_string_EXPRESSION);
4968 @code{LOCAL_NAME} must refer to an object that is declared at the library
4969 level. This pragma establishes the given entity as a linker alias for the
4970 given target. It is equivalent to @code{__attribute__((alias))} in GNU C
4971 and causes @code{LOCAL_NAME} to be emitted as an alias for the symbol
4972 @code{static_string_EXPRESSION} in the object file, that is to say no space
4973 is reserved for @code{LOCAL_NAME} by the assembler and it will be resolved
4974 to the same address as @code{static_string_EXPRESSION} by the linker.
4976 The actual linker name for the target must be used (e.g., the fully
4977 encoded name with qualification in Ada, or the mangled name in C++),
4978 or it must be declared using the C convention with @code{pragma Import}
4979 or @code{pragma Export}.
4981 Not all target machines support this pragma. On some of them it is accepted
4982 only if @code{pragma Weak_External} has been applied to @code{LOCAL_NAME}.
4985 -- Example of the use of pragma Linker_Alias
4989 pragma Export (C, i);
4991 new_name_for_i : Integer;
4992 pragma Linker_Alias (new_name_for_i, "i");
4996 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4997 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{93}
4998 @section Pragma Linker_Constructor
5004 pragma Linker_Constructor (procedure_LOCAL_NAME);
5007 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
5008 is declared at the library level. A procedure to which this pragma is
5009 applied will be treated as an initialization routine by the linker.
5010 It is equivalent to @code{__attribute__((constructor))} in GNU C and
5011 causes @code{procedure_LOCAL_NAME} to be invoked before the entry point
5012 of the executable is called (or immediately after the shared library is
5013 loaded if the procedure is linked in a shared library), in particular
5014 before the Ada run-time environment is set up.
5016 Because of these specific contexts, the set of operations such a procedure
5017 can perform is very limited and the type of objects it can manipulate is
5018 essentially restricted to the elementary types. In particular, it must only
5019 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
5021 This pragma is used by GNAT to implement auto-initialization of shared Stand
5022 Alone Libraries, which provides a related capability without the restrictions
5023 listed above. Where possible, the use of Stand Alone Libraries is preferable
5024 to the use of this pragma.
5026 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
5027 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{94}
5028 @section Pragma Linker_Destructor
5034 pragma Linker_Destructor (procedure_LOCAL_NAME);
5037 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
5038 is declared at the library level. A procedure to which this pragma is
5039 applied will be treated as a finalization routine by the linker.
5040 It is equivalent to @code{__attribute__((destructor))} in GNU C and
5041 causes @code{procedure_LOCAL_NAME} to be invoked after the entry point
5042 of the executable has exited (or immediately before the shared library
5043 is unloaded if the procedure is linked in a shared library), in particular
5044 after the Ada run-time environment is shut down.
5046 See @code{pragma Linker_Constructor} for the set of restrictions that apply
5047 because of these specific contexts.
5049 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
5050 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{95}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{96}
5051 @section Pragma Linker_Section
5057 pragma Linker_Section (
5058 [Entity =>] LOCAL_NAME,
5059 [Section =>] static_string_EXPRESSION);
5062 @code{LOCAL_NAME} must refer to an object, type, or subprogram that is
5063 declared at the library level. This pragma specifies the name of the
5064 linker section for the given entity. It is equivalent to
5065 @code{__attribute__((section))} in GNU C and causes @code{LOCAL_NAME} to
5066 be placed in the @code{static_string_EXPRESSION} section of the
5067 executable (assuming the linker doesn't rename the section).
5068 GNAT also provides an implementation defined aspect of the same name.
5070 In the case of specifying this aspect for a type, the effect is to
5071 specify the corresponding section for all library-level objects of
5072 the type that do not have an explicit linker section set. Note that
5073 this only applies to whole objects, not to components of composite objects.
5075 In the case of a subprogram, the linker section applies to all previously
5076 declared matching overloaded subprograms in the current declarative part
5077 which do not already have a linker section assigned. The linker section
5078 aspect is useful in this case for specifying different linker sections
5079 for different elements of such an overloaded set.
5081 Note that an empty string specifies that no linker section is specified.
5082 This is not quite the same as omitting the pragma or aspect, since it
5083 can be used to specify that one element of an overloaded set of subprograms
5084 has the default linker section, or that one object of a type for which a
5085 linker section is specified should has the default linker section.
5087 The compiler normally places library-level entities in standard sections
5088 depending on the class: procedures and functions generally go in the
5089 @code{.text} section, initialized variables in the @code{.data} section
5090 and uninitialized variables in the @code{.bss} section.
5092 Other, special sections may exist on given target machines to map special
5093 hardware, for example I/O ports or flash memory. This pragma is a means to
5094 defer the final layout of the executable to the linker, thus fully working
5095 at the symbolic level with the compiler.
5097 Some file formats do not support arbitrary sections so not all target
5098 machines support this pragma. The use of this pragma may cause a program
5099 execution to be erroneous if it is used to place an entity into an
5100 inappropriate section (e.g., a modified variable into the @code{.text}
5101 section). See also @code{pragma Persistent_BSS}.
5104 -- Example of the use of pragma Linker_Section
5108 pragma Volatile (Port_A);
5109 pragma Linker_Section (Port_A, ".bss.port_a");
5112 pragma Volatile (Port_B);
5113 pragma Linker_Section (Port_B, ".bss.port_b");
5115 type Port_Type is new Integer with Linker_Section => ".bss";
5116 PA : Port_Type with Linker_Section => ".bss.PA";
5117 PB : Port_Type; -- ends up in linker section ".bss"
5119 procedure Q with Linker_Section => "Qsection";
5123 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
5124 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{97}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{98}
5125 @section Pragma Lock_Free
5129 This pragma may be specified for protected types or objects. It specifies that
5130 the implementation of protected operations must be implemented without locks.
5131 Compilation fails if the compiler cannot generate lock-free code for the
5134 The current conditions required to support this pragma are:
5140 Protected type declarations may not contain entries
5143 Protected subprogram declarations may not have nonelementary parameters
5146 In addition, each protected subprogram body must satisfy:
5152 May reference only one protected component
5155 May not reference nonconstant entities outside the protected subprogram
5159 May not contain address representation items, allocators, or quantified
5163 May not contain delay, goto, loop, or procedure-call statements.
5166 May not contain exported and imported entities
5169 May not dereferenced access values
5172 Function calls and attribute references must be static
5175 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
5176 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{99}
5177 @section Pragma Loop_Invariant
5183 pragma Loop_Invariant ( boolean_EXPRESSION );
5186 The effect of this pragma is similar to that of pragma @code{Assert},
5187 except that in an @code{Assertion_Policy} pragma, the identifier
5188 @code{Loop_Invariant} is used to control whether it is ignored or checked
5191 @code{Loop_Invariant} can only appear as one of the items in the sequence
5192 of statements of a loop body, or nested inside block statements that
5193 appear in the sequence of statements of a loop body.
5194 The intention is that it be used to
5195 represent a "loop invariant" assertion, i.e. something that is true each
5196 time through the loop, and which can be used to show that the loop is
5197 achieving its purpose.
5199 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5200 apply to the same loop should be grouped in the same sequence of
5203 To aid in writing such invariants, the special attribute @code{Loop_Entry}
5204 may be used to refer to the value of an expression on entry to the loop. This
5205 attribute can only be used within the expression of a @code{Loop_Invariant}
5206 pragma. For full details, see documentation of attribute @code{Loop_Entry}.
5208 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
5209 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{9a}
5210 @section Pragma Loop_Optimize
5216 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
5218 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
5221 This pragma must appear immediately within a loop statement. It allows the
5222 programmer to specify optimization hints for the enclosing loop. The hints
5223 are not mutually exclusive and can be freely mixed, but not all combinations
5224 will yield a sensible outcome.
5226 There are five supported optimization hints for a loop:
5234 The programmer asserts that there are no loop-carried dependencies
5235 which would prevent consecutive iterations of the loop from being
5236 executed simultaneously.
5241 The loop must not be unrolled. This is a strong hint: the compiler will not
5242 unroll a loop marked with this hint.
5247 The loop should be unrolled. This is a weak hint: the compiler will try to
5248 apply unrolling to this loop preferably to other optimizations, notably
5249 vectorization, but there is no guarantee that the loop will be unrolled.
5254 The loop must not be vectorized. This is a strong hint: the compiler will not
5255 vectorize a loop marked with this hint.
5260 The loop should be vectorized. This is a weak hint: the compiler will try to
5261 apply vectorization to this loop preferably to other optimizations, notably
5262 unrolling, but there is no guarantee that the loop will be vectorized.
5265 These hints do not remove the need to pass the appropriate switches to the
5266 compiler in order to enable the relevant optimizations, that is to say
5267 @emph{-funroll-loops} for unrolling and @emph{-ftree-vectorize} for
5270 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
5271 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{9b}
5272 @section Pragma Loop_Variant
5278 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
5279 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
5280 CHANGE_DIRECTION ::= Increases | Decreases
5283 @code{Loop_Variant} can only appear as one of the items in the sequence
5284 of statements of a loop body, or nested inside block statements that
5285 appear in the sequence of statements of a loop body.
5286 It allows the specification of quantities which must always
5287 decrease or increase in successive iterations of the loop. In its simplest
5288 form, just one expression is specified, whose value must increase or decrease
5289 on each iteration of the loop.
5291 In a more complex form, multiple arguments can be given which are intepreted
5292 in a nesting lexicographic manner. For example:
5295 pragma Loop_Variant (Increases => X, Decreases => Y);
5298 specifies that each time through the loop either X increases, or X stays
5299 the same and Y decreases. A @code{Loop_Variant} pragma ensures that the
5300 loop is making progress. It can be useful in helping to show informally
5301 or prove formally that the loop always terminates.
5303 @code{Loop_Variant} is an assertion whose effect can be controlled using
5304 an @code{Assertion_Policy} with a check name of @code{Loop_Variant}. The
5305 policy can be @code{Check} to enable the loop variant check, @code{Ignore}
5306 to ignore the check (in which case the pragma has no effect on the program),
5307 or @code{Disable} in which case the pragma is not even checked for correct
5310 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5311 apply to the same loop should be grouped in the same sequence of
5314 The @code{Loop_Entry} attribute may be used within the expressions of the
5315 @code{Loop_Variant} pragma to refer to values on entry to the loop.
5317 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
5318 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{9c}
5319 @section Pragma Machine_Attribute
5325 pragma Machine_Attribute (
5326 [Entity =>] LOCAL_NAME,
5327 [Attribute_Name =>] static_string_EXPRESSION
5328 [, [Info =>] static_EXPRESSION @{, static_EXPRESSION@}] );
5331 Machine-dependent attributes can be specified for types and/or
5332 declarations. This pragma is semantically equivalent to
5333 @code{__attribute__((@emph{attribute_name}))} (if @code{info} is not
5334 specified) or @code{__attribute__((@emph{attribute_name(info})))}
5335 or @code{__attribute__((@emph{attribute_name(info,...})))} in GNU C,
5336 where @emph{attribute_name} is recognized by the compiler middle-end
5337 or the @code{TARGET_ATTRIBUTE_TABLE} machine specific macro. Note
5338 that a string literal for the optional parameter @code{info} or the
5339 following ones is transformed by default into an identifier,
5340 which may make this pragma unusable for some attributes.
5341 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
5343 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
5344 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{9d}
5345 @section Pragma Main
5352 (MAIN_OPTION [, MAIN_OPTION]);
5355 [Stack_Size =>] static_integer_EXPRESSION
5356 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
5357 | [Time_Slicing_Enabled =>] static_boolean_EXPRESSION
5360 This pragma is provided for compatibility with OpenVMS VAX Systems. It has
5361 no effect in GNAT, other than being syntax checked.
5363 @node Pragma Main_Storage,Pragma Max_Queue_Length,Pragma Main,Implementation Defined Pragmas
5364 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{9e}
5365 @section Pragma Main_Storage
5372 (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
5374 MAIN_STORAGE_OPTION ::=
5375 [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
5376 | [TOP_GUARD =>] static_SIMPLE_EXPRESSION
5379 This pragma is provided for compatibility with OpenVMS VAX Systems. It has
5380 no effect in GNAT, other than being syntax checked.
5382 @node Pragma Max_Queue_Length,Pragma No_Body,Pragma Main_Storage,Implementation Defined Pragmas
5383 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{9f}@anchor{gnat_rm/implementation_defined_pragmas pragma-max-queue-length}@anchor{a0}
5384 @section Pragma Max_Queue_Length
5390 pragma Max_Entry_Queue (static_integer_EXPRESSION);
5393 This pragma is used to specify the maximum callers per entry queue for
5394 individual protected entries and entry families. It accepts a single
5395 integer (-1 or more) as a parameter and must appear after the declaration of an
5398 A value of -1 represents no additional restriction on queue length.
5400 @node Pragma No_Body,Pragma No_Caching,Pragma Max_Queue_Length,Implementation Defined Pragmas
5401 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{a1}
5402 @section Pragma No_Body
5411 There are a number of cases in which a package spec does not require a body,
5412 and in fact a body is not permitted. GNAT will not permit the spec to be
5413 compiled if there is a body around. The pragma No_Body allows you to provide
5414 a body file, even in a case where no body is allowed. The body file must
5415 contain only comments and a single No_Body pragma. This is recognized by
5416 the compiler as indicating that no body is logically present.
5418 This is particularly useful during maintenance when a package is modified in
5419 such a way that a body needed before is no longer needed. The provision of a
5420 dummy body with a No_Body pragma ensures that there is no interference from
5421 earlier versions of the package body.
5423 @node Pragma No_Caching,Pragma No_Component_Reordering,Pragma No_Body,Implementation Defined Pragmas
5424 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-caching}@anchor{a2}@anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{a3}
5425 @section Pragma No_Caching
5431 pragma No_Caching [ (boolean_EXPRESSION) ];
5434 For the semantics of this pragma, see the entry for aspect @code{No_Caching} in
5435 the SPARK 2014 Reference Manual, section 7.1.2.
5437 @node Pragma No_Component_Reordering,Pragma No_Elaboration_Code_All,Pragma No_Caching,Implementation Defined Pragmas
5438 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-component-reordering}@anchor{a4}
5439 @section Pragma No_Component_Reordering
5445 pragma No_Component_Reordering [([Entity =>] type_LOCAL_NAME)];
5448 @code{type_LOCAL_NAME} must refer to a record type declaration in the current
5449 declarative part. The effect is to preclude any reordering of components
5450 for the layout of the record, i.e. the record is laid out by the compiler
5451 in the order in which the components are declared textually. The form with
5452 no argument is a configuration pragma which applies to all record types
5453 declared in units to which the pragma applies and there is a requirement
5454 that this pragma be used consistently within a partition.
5456 @node Pragma No_Elaboration_Code_All,Pragma No_Heap_Finalization,Pragma No_Component_Reordering,Implementation Defined Pragmas
5457 @anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a5}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{a6}
5458 @section Pragma No_Elaboration_Code_All
5464 pragma No_Elaboration_Code_All [(program_unit_NAME)];
5467 This is a program unit pragma (there is also an equivalent aspect of the
5468 same name) that establishes the restriction @code{No_Elaboration_Code} for
5469 the current unit and any extended main source units (body and subunits).
5470 It also has the effect of enforcing a transitive application of this
5471 aspect, so that if any unit is implicitly or explicitly with'ed by the
5472 current unit, it must also have the No_Elaboration_Code_All aspect set.
5473 It may be applied to package or subprogram specs or their generic versions.
5475 @node Pragma No_Heap_Finalization,Pragma No_Inline,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5476 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-heap-finalization}@anchor{a7}
5477 @section Pragma No_Heap_Finalization
5483 pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ];
5486 Pragma @code{No_Heap_Finalization} may be used as a configuration pragma or as a
5487 type-specific pragma.
5489 In its configuration form, the pragma must appear within a configuration file
5490 such as gnat.adc, without an argument. The pragma suppresses the call to
5491 @code{Finalize} for heap-allocated objects created through library-level named
5492 access-to-object types in cases where the designated type requires finalization
5495 In its type-specific form, the argument of the pragma must denote a
5496 library-level named access-to-object type. The pragma suppresses the call to
5497 @code{Finalize} for heap-allocated objects created through the specific access type
5498 in cases where the designated type requires finalization actions.
5500 It is still possible to finalize such heap-allocated objects by explicitly
5503 A library-level named access-to-object type declared within a generic unit will
5504 lose its @code{No_Heap_Finalization} pragma when the corresponding instance does not
5505 appear at the library level.
5507 @node Pragma No_Inline,Pragma No_Return,Pragma No_Heap_Finalization,Implementation Defined Pragmas
5508 @anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{a8}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{a9}
5509 @section Pragma No_Inline
5515 pragma No_Inline (NAME @{, NAME@});
5518 This pragma suppresses inlining for the callable entity or the instances of
5519 the generic subprogram designated by @code{NAME}, including inlining that
5520 results from the use of pragma @code{Inline}. This pragma is always active,
5521 in particular it is not subject to the use of option @emph{-gnatn} or
5522 @emph{-gnatN}. It is illegal to specify both pragma @code{No_Inline} and
5523 pragma @code{Inline_Always} for the same @code{NAME}.
5525 @node Pragma No_Return,Pragma No_Strict_Aliasing,Pragma No_Inline,Implementation Defined Pragmas
5526 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{aa}
5527 @section Pragma No_Return
5533 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5536 Each @code{procedure_LOCAL_NAME} argument must refer to one or more procedure
5537 declarations in the current declarative part. A procedure to which this
5538 pragma is applied may not contain any explicit @code{return} statements.
5539 In addition, if the procedure contains any implicit returns from falling
5540 off the end of a statement sequence, then execution of that implicit
5541 return will cause Program_Error to be raised.
5543 One use of this pragma is to identify procedures whose only purpose is to raise
5544 an exception. Another use of this pragma is to suppress incorrect warnings
5545 about missing returns in functions, where the last statement of a function
5546 statement sequence is a call to such a procedure.
5548 Note that in Ada 2005 mode, this pragma is part of the language. It is
5549 available in all earlier versions of Ada as an implementation-defined
5552 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Return,Implementation Defined Pragmas
5553 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{ab}
5554 @section Pragma No_Strict_Aliasing
5560 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5563 @code{type_LOCAL_NAME} must refer to an access type
5564 declaration in the current declarative part. The effect is to inhibit
5565 strict aliasing optimization for the given type. The form with no
5566 arguments is a configuration pragma which applies to all access types
5567 declared in units to which the pragma applies. For a detailed
5568 description of the strict aliasing optimization, and the situations
5569 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5570 in the @cite{GNAT User's Guide}.
5572 This pragma currently has no effects on access to unconstrained array types.
5574 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5575 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{ac}@anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{ad}
5576 @section Pragma No_Tagged_Streams
5582 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5585 Normally when a tagged type is introduced using a full type declaration,
5586 part of the processing includes generating stream access routines to be
5587 used by stream attributes referencing the type (or one of its subtypes
5588 or derived types). This can involve the generation of significant amounts
5589 of code which is wasted space if stream routines are not needed for the
5592 The @code{No_Tagged_Streams} pragma causes the generation of these stream
5593 routines to be skipped, and any attempt to use stream operations on
5594 types subject to this pragma will be statically rejected as illegal.
5596 There are two forms of the pragma. The form with no arguments must appear
5597 in a declarative sequence or in the declarations of a package spec. This
5598 pragma affects all subsequent root tagged types declared in the declaration
5599 sequence, and specifies that no stream routines be generated. The form with
5600 an argument (for which there is also a corresponding aspect) specifies a
5601 single root tagged type for which stream routines are not to be generated.
5603 Once the pragma has been given for a particular root tagged type, all subtypes
5604 and derived types of this type inherit the pragma automatically, so the effect
5605 applies to a complete hierarchy (this is necessary to deal with the class-wide
5606 dispatching versions of the stream routines).
5608 When pragmas @code{Discard_Names} and @code{No_Tagged_Streams} are simultaneously
5609 applied to a tagged type its Expanded_Name and External_Tag are initialized
5610 with empty strings. This is useful to avoid exposing entity names at binary
5611 level but has a negative impact on the debuggability of tagged types.
5613 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5614 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{ae}
5615 @section Pragma Normalize_Scalars
5621 pragma Normalize_Scalars;
5624 This is a language defined pragma which is fully implemented in GNAT. The
5625 effect is to cause all scalar objects that are not otherwise initialized
5626 to be initialized. The initial values are implementation dependent and
5632 @item @emph{Standard.Character}
5634 Objects whose root type is Standard.Character are initialized to
5635 Character'Last unless the subtype range excludes NUL (in which case
5636 NUL is used). This choice will always generate an invalid value if
5639 @item @emph{Standard.Wide_Character}
5641 Objects whose root type is Standard.Wide_Character are initialized to
5642 Wide_Character'Last unless the subtype range excludes NUL (in which case
5643 NUL is used). This choice will always generate an invalid value if
5646 @item @emph{Standard.Wide_Wide_Character}
5648 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5649 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5650 which case NUL is used). This choice will always generate an invalid value if
5653 @item @emph{Integer types}
5655 Objects of an integer type are treated differently depending on whether
5656 negative values are present in the subtype. If no negative values are
5657 present, then all one bits is used as the initial value except in the
5658 special case where zero is excluded from the subtype, in which case
5659 all zero bits are used. This choice will always generate an invalid
5660 value if one exists.
5662 For subtypes with negative values present, the largest negative number
5663 is used, except in the unusual case where this largest negative number
5664 is in the subtype, and the largest positive number is not, in which case
5665 the largest positive value is used. This choice will always generate
5666 an invalid value if one exists.
5668 @item @emph{Floating-Point Types}
5670 Objects of all floating-point types are initialized to all 1-bits. For
5671 standard IEEE format, this corresponds to a NaN (not a number) which is
5672 indeed an invalid value.
5674 @item @emph{Fixed-Point Types}
5676 Objects of all fixed-point types are treated as described above for integers,
5677 with the rules applying to the underlying integer value used to represent
5678 the fixed-point value.
5680 @item @emph{Modular types}
5682 Objects of a modular type are initialized to all one bits, except in
5683 the special case where zero is excluded from the subtype, in which
5684 case all zero bits are used. This choice will always generate an
5685 invalid value if one exists.
5687 @item @emph{Enumeration types}
5689 Objects of an enumeration type are initialized to all one-bits, i.e., to
5690 the value @code{2 ** typ'Size - 1} unless the subtype excludes the literal
5691 whose Pos value is zero, in which case a code of zero is used. This choice
5692 will always generate an invalid value if one exists.
5695 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5696 @anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{af}@anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{b0}
5697 @section Pragma Obsolescent
5705 pragma Obsolescent (
5706 [Message =>] static_string_EXPRESSION
5707 [,[Version =>] Ada_05]]);
5709 pragma Obsolescent (
5711 [,[Message =>] static_string_EXPRESSION
5712 [,[Version =>] Ada_05]] );
5715 This pragma can occur immediately following a declaration of an entity,
5716 including the case of a record component. If no Entity argument is present,
5717 then this declaration is the one to which the pragma applies. If an Entity
5718 parameter is present, it must either match the name of the entity in this
5719 declaration, or alternatively, the pragma can immediately follow an enumeration
5720 type declaration, where the Entity argument names one of the enumeration
5723 This pragma is used to indicate that the named entity
5724 is considered obsolescent and should not be used. Typically this is
5725 used when an API must be modified by eventually removing or modifying
5726 existing subprograms or other entities. The pragma can be used at an
5727 intermediate stage when the entity is still present, but will be
5730 The effect of this pragma is to output a warning message on a reference to
5731 an entity thus marked that the subprogram is obsolescent if the appropriate
5732 warning option in the compiler is activated. If the @code{Message} parameter is
5733 present, then a second warning message is given containing this text. In
5734 addition, a reference to the entity is considered to be a violation of pragma
5735 @code{Restrictions (No_Obsolescent_Features)}.
5737 This pragma can also be used as a program unit pragma for a package,
5738 in which case the entity name is the name of the package, and the
5739 pragma indicates that the entire package is considered
5740 obsolescent. In this case a client @code{with}ing such a package
5741 violates the restriction, and the @code{with} clause is
5742 flagged with warnings if the warning option is set.
5744 If the @code{Version} parameter is present (which must be exactly
5745 the identifier @code{Ada_05}, no other argument is allowed), then the
5746 indication of obsolescence applies only when compiling in Ada 2005
5747 mode. This is primarily intended for dealing with the situations
5748 in the predefined library where subprograms or packages
5749 have become defined as obsolescent in Ada 2005
5750 (e.g., in @code{Ada.Characters.Handling}), but may be used anywhere.
5752 The following examples show typical uses of this pragma:
5756 pragma Obsolescent (p, Message => "use pp instead of p");
5761 pragma Obsolescent ("use q2new instead");
5763 type R is new integer;
5766 Message => "use RR in Ada 2005",
5776 type E is (a, bc, 'd', quack);
5777 pragma Obsolescent (Entity => bc)
5778 pragma Obsolescent (Entity => 'd')
5781 (a, b : character) return character;
5782 pragma Obsolescent (Entity => "+");
5786 Note that, as for all pragmas, if you use a pragma argument identifier,
5787 then all subsequent parameters must also use a pragma argument identifier.
5788 So if you specify @code{Entity =>} for the @code{Entity} argument, and a @code{Message}
5789 argument is present, it must be preceded by @code{Message =>}.
5791 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5792 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{b1}
5793 @section Pragma Optimize_Alignment
5797 @geindex default settings
5802 pragma Optimize_Alignment (TIME | SPACE | OFF);
5805 This is a configuration pragma which affects the choice of default alignments
5806 for types and objects where no alignment is explicitly specified. There is a
5807 time/space trade-off in the selection of these values. Large alignments result
5808 in more efficient code, at the expense of larger data space, since sizes have
5809 to be increased to match these alignments. Smaller alignments save space, but
5810 the access code is slower. The normal choice of default alignments for types
5811 and individual alignment promotions for objects (which is what you get if you
5812 do not use this pragma, or if you use an argument of OFF), tries to balance
5813 these two requirements.
5815 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5816 First any packed record is given an alignment of 1. Second, if a size is given
5817 for the type, then the alignment is chosen to avoid increasing this size. For
5829 In the default mode, this type gets an alignment of 4, so that access to the
5830 Integer field X are efficient. But this means that objects of the type end up
5831 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5832 allowed to be bigger than the size of the type, but it can waste space if for
5833 example fields of type R appear in an enclosing record. If the above type is
5834 compiled in @code{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5836 However, there is one case in which SPACE is ignored. If a variable length
5837 record (that is a discriminated record with a component which is an array
5838 whose length depends on a discriminant), has a pragma Pack, then it is not
5839 in general possible to set the alignment of such a record to one, so the
5840 pragma is ignored in this case (with a warning).
5842 Specifying SPACE also disables alignment promotions for standalone objects,
5843 which occur when the compiler increases the alignment of a specific object
5844 without changing the alignment of its type.
5846 Specifying SPACE also disables component reordering in unpacked record types,
5847 which can result in larger sizes in order to meet alignment requirements.
5849 Specifying TIME causes larger default alignments to be chosen in the case of
5850 small types with sizes that are not a power of 2. For example, consider:
5863 The default alignment for this record is normally 1, but if this type is
5864 compiled in @code{Optimize_Alignment (Time)} mode, then the alignment is set
5865 to 4, which wastes space for objects of the type, since they are now 4 bytes
5866 long, but results in more efficient access when the whole record is referenced.
5868 As noted above, this is a configuration pragma, and there is a requirement
5869 that all units in a partition be compiled with a consistent setting of the
5870 optimization setting. This would normally be achieved by use of a configuration
5871 pragma file containing the appropriate setting. The exception to this rule is
5872 that units with an explicit configuration pragma in the same file as the source
5873 unit are excluded from the consistency check, as are all predefined units. The
5874 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5875 pragma appears at the start of the file.
5877 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5878 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{b2}
5879 @section Pragma Ordered
5885 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5888 Most enumeration types are from a conceptual point of view unordered.
5889 For example, consider:
5892 type Color is (Red, Blue, Green, Yellow);
5895 By Ada semantics @code{Blue > Red} and @code{Green > Blue},
5896 but really these relations make no sense; the enumeration type merely
5897 specifies a set of possible colors, and the order is unimportant.
5899 For unordered enumeration types, it is generally a good idea if
5900 clients avoid comparisons (other than equality or inequality) and
5901 explicit ranges. (A @emph{client} is a unit where the type is referenced,
5902 other than the unit where the type is declared, its body, and its subunits.)
5903 For example, if code buried in some client says:
5906 if Current_Color < Yellow then ...
5907 if Current_Color in Blue .. Green then ...
5910 then the client code is relying on the order, which is undesirable.
5911 It makes the code hard to read and creates maintenance difficulties if
5912 entries have to be added to the enumeration type. Instead,
5913 the code in the client should list the possibilities, or an
5914 appropriate subtype should be declared in the unit that declares
5915 the original enumeration type. E.g., the following subtype could
5916 be declared along with the type @code{Color}:
5919 subtype RBG is Color range Red .. Green;
5922 and then the client could write:
5925 if Current_Color in RBG then ...
5926 if Current_Color = Blue or Current_Color = Green then ...
5929 However, some enumeration types are legitimately ordered from a conceptual
5930 point of view. For example, if you declare:
5933 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5936 then the ordering imposed by the language is reasonable, and
5937 clients can depend on it, writing for example:
5940 if D in Mon .. Fri then ...
5944 The pragma @emph{Ordered} is provided to mark enumeration types that
5945 are conceptually ordered, alerting the reader that clients may depend
5946 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5947 rather than one to mark them as unordered, since in our experience,
5948 the great majority of enumeration types are conceptually unordered.
5950 The types @code{Boolean}, @code{Character}, @code{Wide_Character},
5951 and @code{Wide_Wide_Character}
5952 are considered to be ordered types, so each is declared with a
5953 pragma @code{Ordered} in package @code{Standard}.
5955 Normally pragma @code{Ordered} serves only as documentation and a guide for
5956 coding standards, but GNAT provides a warning switch @emph{-gnatw.u} that
5957 requests warnings for inappropriate uses (comparisons and explicit
5958 subranges) for unordered types. If this switch is used, then any
5959 enumeration type not marked with pragma @code{Ordered} will be considered
5960 as unordered, and will generate warnings for inappropriate uses.
5962 Note that generic types are not considered ordered or unordered (since the
5963 template can be instantiated for both cases), so we never generate warnings
5964 for the case of generic enumerated types.
5966 For additional information please refer to the description of the
5967 @emph{-gnatw.u} switch in the GNAT User's Guide.
5969 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5970 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{b3}
5971 @section Pragma Overflow_Mode
5977 pragma Overflow_Mode
5979 [,[Assertions =>] MODE]);
5981 MODE ::= STRICT | MINIMIZED | ELIMINATED
5984 This pragma sets the current overflow mode to the given setting. For details
5985 of the meaning of these modes, please refer to the
5986 'Overflow Check Handling in GNAT' appendix in the
5987 GNAT User's Guide. If only the @code{General} parameter is present,
5988 the given mode applies to all expressions. If both parameters are present,
5989 the @code{General} mode applies to expressions outside assertions, and
5990 the @code{Eliminated} mode applies to expressions within assertions.
5992 The case of the @code{MODE} parameter is ignored,
5993 so @code{MINIMIZED}, @code{Minimized} and
5994 @code{minimized} all have the same effect.
5996 The @code{Overflow_Mode} pragma has the same scoping and placement
5997 rules as pragma @code{Suppress}, so it can occur either as a
5998 configuration pragma, specifying a default for the whole
5999 program, or in a declarative scope, where it applies to the
6000 remaining declarations and statements in that scope.
6002 The pragma @code{Suppress (Overflow_Check)} suppresses
6003 overflow checking, but does not affect the overflow mode.
6005 The pragma @code{Unsuppress (Overflow_Check)} unsuppresses (enables)
6006 overflow checking, but does not affect the overflow mode.
6008 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
6009 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{b4}
6010 @section Pragma Overriding_Renamings
6013 @geindex Rational profile
6015 @geindex Rational compatibility
6020 pragma Overriding_Renamings;
6023 This is a GNAT configuration pragma to simplify porting
6024 legacy code accepted by the Rational
6025 Ada compiler. In the presence of this pragma, a renaming declaration that
6026 renames an inherited operation declared in the same scope is legal if selected
6027 notation is used as in:
6030 pragma Overriding_Renamings;
6035 function F (..) renames R.F;
6040 RM 8.3 (15) stipulates that an overridden operation is not visible within the
6041 declaration of the overriding operation.
6043 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
6044 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{b5}
6045 @section Pragma Partition_Elaboration_Policy
6051 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
6053 POLICY_IDENTIFIER ::= Concurrent | Sequential
6056 This pragma is standard in Ada 2005, but is available in all earlier
6057 versions of Ada as an implementation-defined pragma.
6058 See Ada 2012 Reference Manual for details.
6060 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
6061 @anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{b6}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{b7}
6062 @section Pragma Part_Of
6068 pragma Part_Of (ABSTRACT_STATE);
6070 ABSTRACT_STATE ::= NAME
6073 For the semantics of this pragma, see the entry for aspect @code{Part_Of} in the
6074 SPARK 2014 Reference Manual, section 7.2.6.
6076 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
6077 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{b8}
6078 @section Pragma Passive
6084 pragma Passive [(Semaphore | No)];
6087 Syntax checked, but otherwise ignored by GNAT. This is recognized for
6088 compatibility with DEC Ada 83 implementations, where it is used within a
6089 task definition to request that a task be made passive. If the argument
6090 @code{Semaphore} is present, or the argument is omitted, then DEC Ada 83
6091 treats the pragma as an assertion that the containing task is passive
6092 and that optimization of context switch with this task is permitted and
6093 desired. If the argument @code{No} is present, the task must not be
6094 optimized. GNAT does not attempt to optimize any tasks in this manner
6095 (since protected objects are available in place of passive tasks).
6097 For more information on the subject of passive tasks, see the section
6098 'Passive Task Optimization' in the GNAT Users Guide.
6100 @node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
6101 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{b9}@anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{ba}
6102 @section Pragma Persistent_BSS
6108 pragma Persistent_BSS [(LOCAL_NAME)]
6111 This pragma allows selected objects to be placed in the @code{.persistent_bss}
6112 section. On some targets the linker and loader provide for special
6113 treatment of this section, allowing a program to be reloaded without
6114 affecting the contents of this data (hence the name persistent).
6116 There are two forms of usage. If an argument is given, it must be the
6117 local name of a library-level object, with no explicit initialization
6118 and whose type is potentially persistent. If no argument is given, then
6119 the pragma is a configuration pragma, and applies to all library-level
6120 objects with no explicit initialization of potentially persistent types.
6122 A potentially persistent type is a scalar type, or an untagged,
6123 non-discriminated record, all of whose components have no explicit
6124 initialization and are themselves of a potentially persistent type,
6125 or an array, all of whose constraints are static, and whose component
6126 type is potentially persistent.
6128 If this pragma is used on a target where this feature is not supported,
6129 then the pragma will be ignored. See also @code{pragma Linker_Section}.
6131 @node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
6132 @anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{bb}
6133 @section Pragma Polling
6139 pragma Polling (ON | OFF);
6142 This pragma controls the generation of polling code. This is normally off.
6143 If @code{pragma Polling (ON)} is used then periodic calls are generated to
6144 the routine @code{Ada.Exceptions.Poll}. This routine is a separate unit in the
6145 runtime library, and can be found in file @code{a-excpol.adb}.
6147 Pragma @code{Polling} can appear as a configuration pragma (for example it
6148 can be placed in the @code{gnat.adc} file) to enable polling globally, or it
6149 can be used in the statement or declaration sequence to control polling
6152 A call to the polling routine is generated at the start of every loop and
6153 at the start of every subprogram call. This guarantees that the @code{Poll}
6154 routine is called frequently, and places an upper bound (determined by
6155 the complexity of the code) on the period between two @code{Poll} calls.
6157 The primary purpose of the polling interface is to enable asynchronous
6158 aborts on targets that cannot otherwise support it (for example Windows
6159 NT), but it may be used for any other purpose requiring periodic polling.
6160 The standard version is null, and can be replaced by a user program. This
6161 will require re-compilation of the @code{Ada.Exceptions} package that can
6162 be found in files @code{a-except.ads} and @code{a-except.adb}.
6164 A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
6165 distribution) is used to enable the asynchronous abort capability on
6166 targets that do not normally support the capability. The version of
6167 @code{Poll} in this file makes a call to the appropriate runtime routine
6168 to test for an abort condition.
6170 Note that polling can also be enabled by use of the @emph{-gnatP} switch.
6171 See the section on switches for gcc in the @cite{GNAT User's Guide}.
6173 @node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
6174 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{bc}
6175 @section Pragma Post
6181 @geindex postconditions
6186 pragma Post (Boolean_Expression);
6189 The @code{Post} pragma is intended to be an exact replacement for
6190 the language-defined
6191 @code{Post} aspect, and shares its restrictions and semantics.
6192 It must appear either immediately following the corresponding
6193 subprogram declaration (only other pragmas may intervene), or
6194 if there is no separate subprogram declaration, then it can
6195 appear at the start of the declarations in a subprogram body
6196 (preceded only by other pragmas).
6198 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
6199 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{bd}
6200 @section Pragma Postcondition
6203 @geindex Postcondition
6206 @geindex postconditions
6211 pragma Postcondition (
6212 [Check =>] Boolean_Expression
6213 [,[Message =>] String_Expression]);
6216 The @code{Postcondition} pragma allows specification of automatic
6217 postcondition checks for subprograms. These checks are similar to
6218 assertions, but are automatically inserted just prior to the return
6219 statements of the subprogram with which they are associated (including
6220 implicit returns at the end of procedure bodies and associated
6221 exception handlers).
6223 In addition, the boolean expression which is the condition which
6224 must be true may contain references to function'Result in the case
6225 of a function to refer to the returned value.
6227 @code{Postcondition} pragmas may appear either immediately following the
6228 (separate) declaration of a subprogram, or at the start of the
6229 declarations of a subprogram body. Only other pragmas may intervene
6230 (that is appear between the subprogram declaration and its
6231 postconditions, or appear before the postcondition in the
6232 declaration sequence in a subprogram body). In the case of a
6233 postcondition appearing after a subprogram declaration, the
6234 formal arguments of the subprogram are visible, and can be
6235 referenced in the postcondition expressions.
6237 The postconditions are collected and automatically tested just
6238 before any return (implicit or explicit) in the subprogram body.
6239 A postcondition is only recognized if postconditions are active
6240 at the time the pragma is encountered. The compiler switch @emph{gnata}
6241 turns on all postconditions by default, and pragma @code{Check_Policy}
6242 with an identifier of @code{Postcondition} can also be used to
6243 control whether postconditions are active.
6245 The general approach is that postconditions are placed in the spec
6246 if they represent functional aspects which make sense to the client.
6247 For example we might have:
6250 function Direction return Integer;
6251 pragma Postcondition
6252 (Direction'Result = +1
6254 Direction'Result = -1);
6257 which serves to document that the result must be +1 or -1, and
6258 will test that this is the case at run time if postcondition
6261 Postconditions within the subprogram body can be used to
6262 check that some internal aspect of the implementation,
6263 not visible to the client, is operating as expected.
6264 For instance if a square root routine keeps an internal
6265 counter of the number of times it is called, then we
6266 might have the following postcondition:
6269 Sqrt_Calls : Natural := 0;
6271 function Sqrt (Arg : Float) return Float is
6272 pragma Postcondition
6273 (Sqrt_Calls = Sqrt_Calls'Old + 1);
6278 As this example, shows, the use of the @code{Old} attribute
6279 is often useful in postconditions to refer to the state on
6280 entry to the subprogram.
6282 Note that postconditions are only checked on normal returns
6283 from the subprogram. If an abnormal return results from
6284 raising an exception, then the postconditions are not checked.
6286 If a postcondition fails, then the exception
6287 @code{System.Assertions.Assert_Failure} is raised. If
6288 a message argument was supplied, then the given string
6289 will be used as the exception message. If no message
6290 argument was supplied, then the default message has
6291 the form "Postcondition failed at file_name:line". The
6292 exception is raised in the context of the subprogram
6293 body, so it is possible to catch postcondition failures
6294 within the subprogram body itself.
6296 Within a package spec, normal visibility rules
6297 in Ada would prevent forward references within a
6298 postcondition pragma to functions defined later in
6299 the same package. This would introduce undesirable
6300 ordering constraints. To avoid this problem, all
6301 postcondition pragmas are analyzed at the end of
6302 the package spec, allowing forward references.
6304 The following example shows that this even allows
6305 mutually recursive postconditions as in:
6308 package Parity_Functions is
6309 function Odd (X : Natural) return Boolean;
6310 pragma Postcondition
6314 (x /= 0 and then Even (X - 1))));
6316 function Even (X : Natural) return Boolean;
6317 pragma Postcondition
6321 (x /= 1 and then Odd (X - 1))));
6323 end Parity_Functions;
6326 There are no restrictions on the complexity or form of
6327 conditions used within @code{Postcondition} pragmas.
6328 The following example shows that it is even possible
6329 to verify performance behavior.
6334 Performance : constant Float;
6335 -- Performance constant set by implementation
6336 -- to match target architecture behavior.
6338 procedure Treesort (Arg : String);
6339 -- Sorts characters of argument using N*logN sort
6340 pragma Postcondition
6341 (Float (Clock - Clock'Old) <=
6342 Float (Arg'Length) *
6343 log (Float (Arg'Length)) *
6348 Note: postcondition pragmas associated with subprograms that are
6349 marked as Inline_Always, or those marked as Inline with front-end
6350 inlining (-gnatN option set) are accepted and legality-checked
6351 by the compiler, but are ignored at run-time even if postcondition
6352 checking is enabled.
6354 Note that pragma @code{Postcondition} differs from the language-defined
6355 @code{Post} aspect (and corresponding @code{Post} pragma) in allowing
6356 multiple occurrences, allowing occurences in the body even if there
6357 is a separate spec, and allowing a second string parameter, and the
6358 use of the pragma identifier @code{Check}. Historically, pragma
6359 @code{Postcondition} was implemented prior to the development of
6360 Ada 2012, and has been retained in its original form for
6361 compatibility purposes.
6363 @node Pragma Post_Class,Pragma Rename_Pragma,Pragma Postcondition,Implementation Defined Pragmas
6364 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{be}
6365 @section Pragma Post_Class
6371 @geindex postconditions
6376 pragma Post_Class (Boolean_Expression);
6379 The @code{Post_Class} pragma is intended to be an exact replacement for
6380 the language-defined
6381 @code{Post'Class} aspect, and shares its restrictions and semantics.
6382 It must appear either immediately following the corresponding
6383 subprogram declaration (only other pragmas may intervene), or
6384 if there is no separate subprogram declaration, then it can
6385 appear at the start of the declarations in a subprogram body
6386 (preceded only by other pragmas).
6388 Note: This pragma is called @code{Post_Class} rather than
6389 @code{Post'Class} because the latter would not be strictly
6390 conforming to the allowed syntax for pragmas. The motivation
6391 for provinding pragmas equivalent to the aspects is to allow a program
6392 to be written using the pragmas, and then compiled if necessary
6393 using an Ada compiler that does not recognize the pragmas or
6394 aspects, but is prepared to ignore the pragmas. The assertion
6395 policy that controls this pragma is @code{Post'Class}, not
6398 @node Pragma Rename_Pragma,Pragma Pre,Pragma Post_Class,Implementation Defined Pragmas
6399 @anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{bf}
6400 @section Pragma Rename_Pragma
6409 pragma Rename_Pragma (
6410 [New_Name =>] IDENTIFIER,
6411 [Renamed =>] pragma_IDENTIFIER);
6414 This pragma provides a mechanism for supplying new names for existing
6415 pragmas. The @code{New_Name} identifier can subsequently be used as a synonym for
6416 the Renamed pragma. For example, suppose you have code that was originally
6417 developed on a compiler that supports Inline_Only as an implementation defined
6418 pragma. And suppose the semantics of pragma Inline_Only are identical to (or at
6419 least very similar to) the GNAT implementation defined pragma
6420 Inline_Always. You could globally replace Inline_Only with Inline_Always.
6422 However, to avoid that source modification, you could instead add a
6423 configuration pragma:
6426 pragma Rename_Pragma (
6427 New_Name => Inline_Only,
6428 Renamed => Inline_Always);
6431 Then GNAT will treat "pragma Inline_Only ..." as if you had written
6432 "pragma Inline_Always ...".
6434 Pragma Inline_Only will not necessarily mean the same thing as the other Ada
6435 compiler; it's up to you to make sure the semantics are close enough.
6437 @node Pragma Pre,Pragma Precondition,Pragma Rename_Pragma,Implementation Defined Pragmas
6438 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{c0}
6445 @geindex preconditions
6450 pragma Pre (Boolean_Expression);
6453 The @code{Pre} pragma is intended to be an exact replacement for
6454 the language-defined
6455 @code{Pre} aspect, and shares its restrictions and semantics.
6456 It must appear either immediately following the corresponding
6457 subprogram declaration (only other pragmas may intervene), or
6458 if there is no separate subprogram declaration, then it can
6459 appear at the start of the declarations in a subprogram body
6460 (preceded only by other pragmas).
6462 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
6463 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{c1}
6464 @section Pragma Precondition
6467 @geindex Preconditions
6470 @geindex preconditions
6475 pragma Precondition (
6476 [Check =>] Boolean_Expression
6477 [,[Message =>] String_Expression]);
6480 The @code{Precondition} pragma is similar to @code{Postcondition}
6481 except that the corresponding checks take place immediately upon
6482 entry to the subprogram, and if a precondition fails, the exception
6483 is raised in the context of the caller, and the attribute 'Result
6484 cannot be used within the precondition expression.
6486 Otherwise, the placement and visibility rules are identical to those
6487 described for postconditions. The following is an example of use
6488 within a package spec:
6491 package Math_Functions is
6493 function Sqrt (Arg : Float) return Float;
6494 pragma Precondition (Arg >= 0.0)
6499 @code{Precondition} pragmas may appear either immediately following the
6500 (separate) declaration of a subprogram, or at the start of the
6501 declarations of a subprogram body. Only other pragmas may intervene
6502 (that is appear between the subprogram declaration and its
6503 postconditions, or appear before the postcondition in the
6504 declaration sequence in a subprogram body).
6506 Note: precondition pragmas associated with subprograms that are
6507 marked as Inline_Always, or those marked as Inline with front-end
6508 inlining (-gnatN option set) are accepted and legality-checked
6509 by the compiler, but are ignored at run-time even if precondition
6510 checking is enabled.
6512 Note that pragma @code{Precondition} differs from the language-defined
6513 @code{Pre} aspect (and corresponding @code{Pre} pragma) in allowing
6514 multiple occurrences, allowing occurences in the body even if there
6515 is a separate spec, and allowing a second string parameter, and the
6516 use of the pragma identifier @code{Check}. Historically, pragma
6517 @code{Precondition} was implemented prior to the development of
6518 Ada 2012, and has been retained in its original form for
6519 compatibility purposes.
6521 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
6522 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{c2}@anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{c3}
6523 @section Pragma Predicate
6530 ([Entity =>] type_LOCAL_NAME,
6531 [Check =>] EXPRESSION);
6534 This pragma (available in all versions of Ada in GNAT) encompasses both
6535 the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
6536 Ada 2012. A predicate is regarded as static if it has an allowed form
6537 for @code{Static_Predicate} and is otherwise treated as a
6538 @code{Dynamic_Predicate}. Otherwise, predicates specified by this
6539 pragma behave exactly as described in the Ada 2012 reference manual.
6540 For example, if we have
6543 type R is range 1 .. 10;
6545 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6547 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6550 the effect is identical to the following Ada 2012 code:
6553 type R is range 1 .. 10;
6555 Static_Predicate => S not in 4 .. 6;
6557 Dynamic_Predicate => F(Q) or G(Q);
6560 Note that there are no pragmas @code{Dynamic_Predicate}
6561 or @code{Static_Predicate}. That is
6562 because these pragmas would affect legality and semantics of
6563 the program and thus do not have a neutral effect if ignored.
6564 The motivation behind providing pragmas equivalent to
6565 corresponding aspects is to allow a program to be written
6566 using the pragmas, and then compiled with a compiler that
6567 will ignore the pragmas. That doesn't work in the case of
6568 static and dynamic predicates, since if the corresponding
6569 pragmas are ignored, then the behavior of the program is
6570 fundamentally changed (for example a membership test
6571 @code{A in B} would not take into account a predicate
6572 defined for subtype B). When following this approach, the
6573 use of predicates should be avoided.
6575 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6576 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{c4}
6577 @section Pragma Predicate_Failure
6583 pragma Predicate_Failure
6584 ([Entity =>] type_LOCAL_NAME,
6585 [Message =>] String_Expression);
6588 The @code{Predicate_Failure} pragma is intended to be an exact replacement for
6589 the language-defined
6590 @code{Predicate_Failure} aspect, and shares its restrictions and semantics.
6592 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6593 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{c5}
6594 @section Pragma Preelaborable_Initialization
6600 pragma Preelaborable_Initialization (DIRECT_NAME);
6603 This pragma is standard in Ada 2005, but is available in all earlier
6604 versions of Ada as an implementation-defined pragma.
6605 See Ada 2012 Reference Manual for details.
6607 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6608 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c6}
6609 @section Pragma Prefix_Exception_Messages
6612 @geindex Prefix_Exception_Messages
6616 @geindex Exception_Message
6621 pragma Prefix_Exception_Messages;
6624 This is an implementation-defined configuration pragma that affects the
6625 behavior of raise statements with a message given as a static string
6626 constant (typically a string literal). In such cases, the string will
6627 be automatically prefixed by the name of the enclosing entity (giving
6628 the package and subprogram containing the raise statement). This helps
6629 to identify where messages are coming from, and this mode is automatic
6630 for the run-time library.
6632 The pragma has no effect if the message is computed with an expression other
6633 than a static string constant, since the assumption in this case is that
6634 the program computes exactly the string it wants. If you still want the
6635 prefixing in this case, you can always call
6636 @code{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6638 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6639 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c7}
6640 @section Pragma Pre_Class
6646 @geindex preconditions
6651 pragma Pre_Class (Boolean_Expression);
6654 The @code{Pre_Class} pragma is intended to be an exact replacement for
6655 the language-defined
6656 @code{Pre'Class} aspect, and shares its restrictions and semantics.
6657 It must appear either immediately following the corresponding
6658 subprogram declaration (only other pragmas may intervene), or
6659 if there is no separate subprogram declaration, then it can
6660 appear at the start of the declarations in a subprogram body
6661 (preceded only by other pragmas).
6663 Note: This pragma is called @code{Pre_Class} rather than
6664 @code{Pre'Class} because the latter would not be strictly
6665 conforming to the allowed syntax for pragmas. The motivation
6666 for providing pragmas equivalent to the aspects is to allow a program
6667 to be written using the pragmas, and then compiled if necessary
6668 using an Ada compiler that does not recognize the pragmas or
6669 aspects, but is prepared to ignore the pragmas. The assertion
6670 policy that controls this pragma is @code{Pre'Class}, not
6673 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6674 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c8}
6675 @section Pragma Priority_Specific_Dispatching
6681 pragma Priority_Specific_Dispatching (
6683 first_priority_EXPRESSION,
6684 last_priority_EXPRESSION)
6686 POLICY_IDENTIFIER ::=
6687 EDF_Across_Priorities |
6688 FIFO_Within_Priorities |
6689 Non_Preemptive_Within_Priorities |
6690 Round_Robin_Within_Priorities
6693 This pragma is standard in Ada 2005, but is available in all earlier
6694 versions of Ada as an implementation-defined pragma.
6695 See Ada 2012 Reference Manual for details.
6697 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6698 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c9}
6699 @section Pragma Profile
6705 pragma Profile (Ravenscar | Restricted | Rational |
6706 GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
6709 This pragma is standard in Ada 2005, but is available in all earlier
6710 versions of Ada as an implementation-defined pragma. This is a
6711 configuration pragma that establishes a set of configuration pragmas
6712 that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
6713 The other possibilities (@code{Restricted}, @code{Rational},
6714 @code{GNAT_Extended_Ravenscar}, @code{GNAT_Ravenscar_EDF})
6715 are implementation-defined. The set of configuration pragmas
6716 is defined in the following sections.
6722 Pragma Profile (Ravenscar)
6724 The @code{Ravenscar} profile is standard in Ada 2005,
6725 but is available in all earlier
6726 versions of Ada as an implementation-defined pragma. This profile
6727 establishes the following set of configuration pragmas:
6733 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6735 [RM D.2.2] Tasks are dispatched following a preemptive
6736 priority-ordered scheduling policy.
6739 @code{Locking_Policy (Ceiling_Locking)}
6741 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6742 the ceiling priority of the corresponding protected object.
6745 @code{Detect_Blocking}
6747 This pragma forces the detection of potentially blocking operations within a
6748 protected operation, and to raise Program_Error if that happens.
6751 plus the following set of restrictions:
6757 @code{Max_Entry_Queue_Length => 1}
6759 No task can be queued on a protected entry.
6762 @code{Max_Protected_Entries => 1}
6765 @code{Max_Task_Entries => 0}
6767 No rendezvous statements are allowed.
6770 @code{No_Abort_Statements}
6773 @code{No_Dynamic_Attachment}
6776 @code{No_Dynamic_Priorities}
6779 @code{No_Implicit_Heap_Allocations}
6782 @code{No_Local_Protected_Objects}
6785 @code{No_Local_Timing_Events}
6788 @code{No_Protected_Type_Allocators}
6791 @code{No_Relative_Delay}
6794 @code{No_Requeue_Statements}
6797 @code{No_Select_Statements}
6800 @code{No_Specific_Termination_Handlers}
6803 @code{No_Task_Allocators}
6806 @code{No_Task_Hierarchy}
6809 @code{No_Task_Termination}
6812 @code{Simple_Barriers}
6815 The Ravenscar profile also includes the following restrictions that specify
6816 that there are no semantic dependences on the corresponding predefined
6823 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6826 @code{No_Dependence => Ada.Calendar}
6829 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6832 @code{No_Dependence => Ada.Execution_Time.Timers}
6835 @code{No_Dependence => Ada.Task_Attributes}
6838 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6841 This set of configuration pragmas and restrictions correspond to the
6842 definition of the 'Ravenscar Profile' for limited tasking, devised and
6843 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6844 A description is also available at
6845 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6847 The original definition of the profile was revised at subsequent IRTAW
6848 meetings. It has been included in the ISO
6849 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6850 and was made part of the Ada 2005 standard.
6851 The formal definition given by
6852 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6853 AI-305) available at
6854 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6855 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6857 The above set is a superset of the restrictions provided by pragma
6858 @code{Profile (Restricted)}, it includes six additional restrictions
6859 (@code{Simple_Barriers}, @code{No_Select_Statements},
6860 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6861 @code{No_Relative_Delay} and @code{No_Task_Termination}). This means
6862 that pragma @code{Profile (Ravenscar)}, like the pragma
6863 @code{Profile (Restricted)},
6864 automatically causes the use of a simplified,
6865 more efficient version of the tasking run-time library.
6868 Pragma Profile (GNAT_Extended_Ravenscar)
6870 This profile corresponds to a GNAT specific extension of the
6871 Ravenscar profile. The profile may change in the future although
6872 only in a compatible way: some restrictions may be removed or
6873 relaxed. It is defined as a variation of the Ravenscar profile.
6875 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6876 by @code{No_Implicit_Task_Allocations} and
6877 @code{No_Implicit_Protected_Object_Allocations}.
6879 The @code{Simple_Barriers} restriction has been replaced by
6880 @code{Pure_Barriers}.
6882 The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
6883 @code{No_Relative_Delay} restrictions have been removed.
6886 Pragma Profile (GNAT_Ravenscar_EDF)
6888 This profile corresponds to the Ravenscar profile but using
6889 EDF_Across_Priority as the Task_Scheduling_Policy.
6892 Pragma Profile (Restricted)
6894 This profile corresponds to the GNAT restricted run time. It
6895 establishes the following set of restrictions:
6901 @code{No_Abort_Statements}
6904 @code{No_Entry_Queue}
6907 @code{No_Task_Hierarchy}
6910 @code{No_Task_Allocators}
6913 @code{No_Dynamic_Priorities}
6916 @code{No_Terminate_Alternatives}
6919 @code{No_Dynamic_Attachment}
6922 @code{No_Protected_Type_Allocators}
6925 @code{No_Local_Protected_Objects}
6928 @code{No_Requeue_Statements}
6931 @code{No_Task_Attributes_Package}
6934 @code{Max_Asynchronous_Select_Nesting = 0}
6937 @code{Max_Task_Entries = 0}
6940 @code{Max_Protected_Entries = 1}
6943 @code{Max_Select_Alternatives = 0}
6946 This set of restrictions causes the automatic selection of a simplified
6947 version of the run time that provides improved performance for the
6948 limited set of tasking functionality permitted by this set of restrictions.
6951 Pragma Profile (Rational)
6953 The Rational profile is intended to facilitate porting legacy code that
6954 compiles with the Rational APEX compiler, even when the code includes non-
6955 conforming Ada constructs. The profile enables the following three pragmas:
6961 @code{pragma Implicit_Packing}
6964 @code{pragma Overriding_Renamings}
6967 @code{pragma Use_VADS_Size}
6971 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6972 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{ca}
6973 @section Pragma Profile_Warnings
6979 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6982 This is an implementation-defined pragma that is similar in
6983 effect to @code{pragma Profile} except that instead of
6984 generating @code{Restrictions} pragmas, it generates
6985 @code{Restriction_Warnings} pragmas. The result is that
6986 violations of the profile generate warning messages instead
6989 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6990 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{cb}
6991 @section Pragma Propagate_Exceptions
6994 @geindex Interfacing to C++
6999 pragma Propagate_Exceptions;
7002 This pragma is now obsolete and, other than generating a warning if warnings
7003 on obsolescent features are enabled, is ignored.
7004 It is retained for compatibility
7005 purposes. It used to be used in connection with optimization of
7006 a now-obsolete mechanism for implementation of exceptions.
7008 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
7009 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{cc}
7010 @section Pragma Provide_Shift_Operators
7013 @geindex Shift operators
7018 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
7021 This pragma can be applied to a first subtype local name that specifies
7022 either an unsigned or signed type. It has the effect of providing the
7023 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
7024 Rotate_Left and Rotate_Right) for the given type. It is similar to
7025 including the function declarations for these five operators, together
7026 with the pragma Import (Intrinsic, ...) statements.
7028 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
7029 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{cd}
7030 @section Pragma Psect_Object
7036 pragma Psect_Object (
7037 [Internal =>] LOCAL_NAME,
7038 [, [External =>] EXTERNAL_SYMBOL]
7039 [, [Size =>] EXTERNAL_SYMBOL]);
7043 | static_string_EXPRESSION
7046 This pragma is identical in effect to pragma @code{Common_Object}.
7048 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
7049 @anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{ce}@anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{cf}
7050 @section Pragma Pure_Function
7056 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
7059 This pragma appears in the same declarative part as a function
7060 declaration (or a set of function declarations if more than one
7061 overloaded declaration exists, in which case the pragma applies
7062 to all entities). It specifies that the function @code{Entity} is
7063 to be considered pure for the purposes of code generation. This means
7064 that the compiler can assume that there are no side effects, and
7065 in particular that two calls with identical arguments produce the
7066 same result. It also means that the function can be used in an
7069 Note that, quite deliberately, there are no static checks to try
7070 to ensure that this promise is met, so @code{Pure_Function} can be used
7071 with functions that are conceptually pure, even if they do modify
7072 global variables. For example, a square root function that is
7073 instrumented to count the number of times it is called is still
7074 conceptually pure, and can still be optimized, even though it
7075 modifies a global variable (the count). Memo functions are another
7076 example (where a table of previous calls is kept and consulted to
7077 avoid re-computation).
7079 Note also that the normal rules excluding optimization of subprograms
7080 in pure units (when parameter types are descended from System.Address,
7081 or when the full view of a parameter type is limited), do not apply
7082 for the Pure_Function case. If you explicitly specify Pure_Function,
7083 the compiler may optimize away calls with identical arguments, and
7084 if that results in unexpected behavior, the proper action is not to
7085 use the pragma for subprograms that are not (conceptually) pure.
7087 Note: Most functions in a @code{Pure} package are automatically pure, and
7088 there is no need to use pragma @code{Pure_Function} for such functions. One
7089 exception is any function that has at least one formal of type
7090 @code{System.Address} or a type derived from it. Such functions are not
7091 considered pure by default, since the compiler assumes that the
7092 @code{Address} parameter may be functioning as a pointer and that the
7093 referenced data may change even if the address value does not.
7094 Similarly, imported functions are not considered to be pure by default,
7095 since there is no way of checking that they are in fact pure. The use
7096 of pragma @code{Pure_Function} for such a function will override these default
7097 assumption, and cause the compiler to treat a designated subprogram as pure
7100 Note: If pragma @code{Pure_Function} is applied to a renamed function, it
7101 applies to the underlying renamed function. This can be used to
7102 disambiguate cases of overloading where some but not all functions
7103 in a set of overloaded functions are to be designated as pure.
7105 If pragma @code{Pure_Function} is applied to a library-level function, the
7106 function is also considered pure from an optimization point of view, but the
7107 unit is not a Pure unit in the categorization sense. So for example, a function
7108 thus marked is free to @code{with} non-pure units.
7110 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
7111 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{d0}
7112 @section Pragma Rational
7121 This pragma is considered obsolescent, but is retained for
7122 compatibility purposes. It is equivalent to:
7125 pragma Profile (Rational);
7128 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
7129 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{d1}
7130 @section Pragma Ravenscar
7139 This pragma is considered obsolescent, but is retained for
7140 compatibility purposes. It is equivalent to:
7143 pragma Profile (Ravenscar);
7146 which is the preferred method of setting the @code{Ravenscar} profile.
7148 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
7149 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{d2}@anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{d3}
7150 @section Pragma Refined_Depends
7156 pragma Refined_Depends (DEPENDENCY_RELATION);
7158 DEPENDENCY_RELATION ::=
7160 | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
7162 DEPENDENCY_CLAUSE ::=
7163 OUTPUT_LIST =>[+] INPUT_LIST
7164 | NULL_DEPENDENCY_CLAUSE
7166 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
7168 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
7170 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
7172 OUTPUT ::= NAME | FUNCTION_RESULT
7175 where FUNCTION_RESULT is a function Result attribute_reference
7178 For the semantics of this pragma, see the entry for aspect @code{Refined_Depends} in
7179 the SPARK 2014 Reference Manual, section 6.1.5.
7181 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
7182 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{d4}@anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{d5}
7183 @section Pragma Refined_Global
7189 pragma Refined_Global (GLOBAL_SPECIFICATION);
7191 GLOBAL_SPECIFICATION ::=
7194 | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
7196 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
7198 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
7199 GLOBAL_LIST ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
7200 GLOBAL_ITEM ::= NAME
7203 For the semantics of this pragma, see the entry for aspect @code{Refined_Global} in
7204 the SPARK 2014 Reference Manual, section 6.1.4.
7206 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
7207 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d6}@anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d7}
7208 @section Pragma Refined_Post
7214 pragma Refined_Post (boolean_EXPRESSION);
7217 For the semantics of this pragma, see the entry for aspect @code{Refined_Post} in
7218 the SPARK 2014 Reference Manual, section 7.2.7.
7220 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
7221 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{d8}@anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d9}
7222 @section Pragma Refined_State
7228 pragma Refined_State (REFINEMENT_LIST);
7231 (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
7233 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
7235 CONSTITUENT_LIST ::=
7238 | (CONSTITUENT @{, CONSTITUENT@})
7240 CONSTITUENT ::= object_NAME | state_NAME
7243 For the semantics of this pragma, see the entry for aspect @code{Refined_State} in
7244 the SPARK 2014 Reference Manual, section 7.2.2.
7246 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
7247 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{da}
7248 @section Pragma Relative_Deadline
7254 pragma Relative_Deadline (time_span_EXPRESSION);
7257 This pragma is standard in Ada 2005, but is available in all earlier
7258 versions of Ada as an implementation-defined pragma.
7259 See Ada 2012 Reference Manual for details.
7261 @node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
7262 @anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{db}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{dc}
7263 @section Pragma Remote_Access_Type
7269 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
7272 This pragma appears in the formal part of a generic declaration.
7273 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
7274 the use of a remote access to class-wide type as actual for a formal
7277 When this pragma applies to a formal access type @code{Entity}, that
7278 type is treated as a remote access to class-wide type in the generic.
7279 It must be a formal general access type, and its designated type must
7280 be the class-wide type of a formal tagged limited private type from the
7281 same generic declaration.
7283 In the generic unit, the formal type is subject to all restrictions
7284 pertaining to remote access to class-wide types. At instantiation, the
7285 actual type must be a remote access to class-wide type.
7287 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
7288 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{dd}
7289 @section Pragma Restricted_Run_Time
7295 pragma Restricted_Run_Time;
7298 This pragma is considered obsolescent, but is retained for
7299 compatibility purposes. It is equivalent to:
7302 pragma Profile (Restricted);
7305 which is the preferred method of setting the restricted run time
7308 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
7309 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{de}
7310 @section Pragma Restriction_Warnings
7316 pragma Restriction_Warnings
7317 (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
7320 This pragma allows a series of restriction identifiers to be
7321 specified (the list of allowed identifiers is the same as for
7322 pragma @code{Restrictions}). For each of these identifiers
7323 the compiler checks for violations of the restriction, but
7324 generates a warning message rather than an error message
7325 if the restriction is violated.
7327 One use of this is in situations where you want to know
7328 about violations of a restriction, but you want to ignore some of
7329 these violations. Consider this example, where you want to set
7330 Ada_95 mode and enable style checks, but you want to know about
7331 any other use of implementation pragmas:
7334 pragma Restriction_Warnings (No_Implementation_Pragmas);
7335 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
7337 pragma Style_Checks ("2bfhkM160");
7338 pragma Warnings (On, "violation of No_Implementation_Pragmas");
7341 By including the above lines in a configuration pragmas file,
7342 the Ada_95 and Style_Checks pragmas are accepted without
7343 generating a warning, but any other use of implementation
7344 defined pragmas will cause a warning to be generated.
7346 @node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
7347 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{df}
7348 @section Pragma Reviewable
7357 This pragma is an RM-defined standard pragma, but has no effect on the
7358 program being compiled, or on the code generated for the program.
7360 To obtain the required output specified in RM H.3.1, the compiler must be
7361 run with various special switches as follows:
7367 @emph{Where compiler-generated run-time checks remain}
7369 The switch @emph{-gnatGL}
7370 may be used to list the expanded code in pseudo-Ada form.
7371 Runtime checks show up in the listing either as explicit
7372 checks or operators marked with @{@} to indicate a check is present.
7375 @emph{An identification of known exceptions at compile time}
7377 If the program is compiled with @emph{-gnatwa},
7378 the compiler warning messages will indicate all cases where the compiler
7379 detects that an exception is certain to occur at run time.
7382 @emph{Possible reads of uninitialized variables}
7384 The compiler warns of many such cases, but its output is incomplete.
7388 A supplemental static analysis tool
7389 may be used to obtain a comprehensive list of all
7390 possible points at which uninitialized data may be read.
7396 @emph{Where run-time support routines are implicitly invoked}
7398 In the output from @emph{-gnatGL},
7399 run-time calls are explicitly listed as calls to the relevant
7403 @emph{Object code listing}
7405 This may be obtained either by using the @emph{-S} switch,
7406 or the objdump utility.
7409 @emph{Constructs known to be erroneous at compile time}
7411 These are identified by warnings issued by the compiler (use @emph{-gnatwa}).
7414 @emph{Stack usage information}
7416 Static stack usage data (maximum per-subprogram) can be obtained via the
7417 @emph{-fstack-usage} switch to the compiler.
7418 Dynamic stack usage data (per task) can be obtained via the @emph{-u} switch
7427 @emph{Object code listing of entire partition}
7429 This can be obtained by compiling the partition with @emph{-S},
7430 or by applying objdump
7431 to all the object files that are part of the partition.
7434 @emph{A description of the run-time model}
7436 The full sources of the run-time are available, and the documentation of
7437 these routines describes how these run-time routines interface to the
7438 underlying operating system facilities.
7441 @emph{Control and data-flow information}
7445 A supplemental static analysis tool
7446 may be used to obtain complete control and data-flow information, as well as
7447 comprehensive messages identifying possible problems based on this
7450 @node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
7451 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{e0}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{e1}
7452 @section Pragma Secondary_Stack_Size
7458 pragma Secondary_Stack_Size (integer_EXPRESSION);
7461 This pragma appears within the task definition of a single task declaration
7462 or a task type declaration (like pragma @code{Storage_Size}) and applies to all
7463 task objects of that type. The argument specifies the size of the secondary
7464 stack to be used by these task objects, and must be of an integer type. The
7465 secondary stack is used to handle functions that return a variable-sized
7466 result, for example a function returning an unconstrained String.
7468 Note this pragma only applies to targets using fixed secondary stacks, like
7469 VxWorks 653 and bare board targets, where a fixed block for the
7470 secondary stack is allocated from the primary stack of the task. By default,
7471 these targets assign a percentage of the primary stack for the secondary stack,
7472 as defined by @code{System.Parameter.Sec_Stack_Percentage}. With this pragma,
7473 an @code{integer_EXPRESSION} of bytes is assigned from the primary stack instead.
7475 For most targets, the pragma does not apply as the secondary stack grows on
7476 demand: allocated as a chain of blocks in the heap. The default size of these
7477 blocks can be modified via the @code{-D} binder option as described in
7478 @cite{GNAT User's Guide}.
7480 Note that no check is made to see if the secondary stack can fit inside the
7483 Note the pragma cannot appear when the restriction @code{No_Secondary_Stack}
7486 @node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
7487 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{e2}
7488 @section Pragma Share_Generic
7494 pragma Share_Generic (GNAME @{, GNAME@});
7496 GNAME ::= generic_unit_NAME | generic_instance_NAME
7499 This pragma is provided for compatibility with Dec Ada 83. It has
7500 no effect in GNAT (which does not implement shared generics), other
7501 than to check that the given names are all names of generic units or
7504 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
7505 @anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{e3}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{e4}
7506 @section Pragma Shared
7509 This pragma is provided for compatibility with Ada 83. The syntax and
7510 semantics are identical to pragma Atomic.
7512 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
7513 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{e5}
7514 @section Pragma Short_Circuit_And_Or
7520 pragma Short_Circuit_And_Or;
7523 This configuration pragma causes any occurrence of the AND operator applied to
7524 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
7525 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
7526 may be useful in the context of certification protocols requiring the use of
7527 short-circuited logical operators. If this configuration pragma occurs locally
7528 within the file being compiled, it applies only to the file being compiled.
7529 There is no requirement that all units in a partition use this option.
7531 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
7532 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e6}
7533 @section Pragma Short_Descriptors
7539 pragma Short_Descriptors
7542 This pragma is provided for compatibility with other Ada implementations. It
7543 is recognized but ignored by all current versions of GNAT.
7545 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
7546 @anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{e7}@anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e8}
7547 @section Pragma Simple_Storage_Pool_Type
7550 @geindex Storage pool
7553 @geindex Simple storage pool
7558 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
7561 A type can be established as a 'simple storage pool type' by applying
7562 the representation pragma @code{Simple_Storage_Pool_Type} to the type.
7563 A type named in the pragma must be a library-level immutably limited record
7564 type or limited tagged type declared immediately within a package declaration.
7565 The type can also be a limited private type whose full type is allowed as
7566 a simple storage pool type.
7568 For a simple storage pool type @code{SSP}, nonabstract primitive subprograms
7569 @code{Allocate}, @code{Deallocate}, and @code{Storage_Size} can be declared that
7570 are subtype conformant with the following subprogram declarations:
7575 Storage_Address : out System.Address;
7576 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7577 Alignment : System.Storage_Elements.Storage_Count);
7579 procedure Deallocate
7581 Storage_Address : System.Address;
7582 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7583 Alignment : System.Storage_Elements.Storage_Count);
7585 function Storage_Size (Pool : SSP)
7586 return System.Storage_Elements.Storage_Count;
7589 Procedure @code{Allocate} must be declared, whereas @code{Deallocate} and
7590 @code{Storage_Size} are optional. If @code{Deallocate} is not declared, then
7591 applying an unchecked deallocation has no effect other than to set its actual
7592 parameter to null. If @code{Storage_Size} is not declared, then the
7593 @code{Storage_Size} attribute applied to an access type associated with
7594 a pool object of type SSP returns zero. Additional operations can be declared
7595 for a simple storage pool type (such as for supporting a mark/release
7596 storage-management discipline).
7598 An object of a simple storage pool type can be associated with an access
7599 type by specifying the attribute
7600 @ref{e9,,Simple_Storage_Pool}. For example:
7603 My_Pool : My_Simple_Storage_Pool_Type;
7605 type Acc is access My_Data_Type;
7607 for Acc'Simple_Storage_Pool use My_Pool;
7610 See attribute @ref{e9,,Simple_Storage_Pool}
7611 for further details.
7613 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7614 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{ea}@anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{eb}
7615 @section Pragma Source_File_Name
7621 pragma Source_File_Name (
7622 [Unit_Name =>] unit_NAME,
7623 Spec_File_Name => STRING_LITERAL,
7624 [Index => INTEGER_LITERAL]);
7626 pragma Source_File_Name (
7627 [Unit_Name =>] unit_NAME,
7628 Body_File_Name => STRING_LITERAL,
7629 [Index => INTEGER_LITERAL]);
7632 Use this to override the normal naming convention. It is a configuration
7633 pragma, and so has the usual applicability of configuration pragmas
7634 (i.e., it applies to either an entire partition, or to all units in a
7635 compilation, or to a single unit, depending on how it is used.
7636 @code{unit_name} is mapped to @code{file_name_literal}. The identifier for
7637 the second argument is required, and indicates whether this is the file
7638 name for the spec or for the body.
7640 The optional Index argument should be used when a file contains multiple
7641 units, and when you do not want to use @code{gnatchop} to separate then
7642 into multiple files (which is the recommended procedure to limit the
7643 number of recompilations that are needed when some sources change).
7644 For instance, if the source file @code{source.ada} contains
7658 you could use the following configuration pragmas:
7661 pragma Source_File_Name
7662 (B, Spec_File_Name => "source.ada", Index => 1);
7663 pragma Source_File_Name
7664 (A, Body_File_Name => "source.ada", Index => 2);
7667 Note that the @code{gnatname} utility can also be used to generate those
7668 configuration pragmas.
7670 Another form of the @code{Source_File_Name} pragma allows
7671 the specification of patterns defining alternative file naming schemes
7672 to apply to all files.
7675 pragma Source_File_Name
7676 ( [Spec_File_Name =>] STRING_LITERAL
7677 [,[Casing =>] CASING_SPEC]
7678 [,[Dot_Replacement =>] STRING_LITERAL]);
7680 pragma Source_File_Name
7681 ( [Body_File_Name =>] STRING_LITERAL
7682 [,[Casing =>] CASING_SPEC]
7683 [,[Dot_Replacement =>] STRING_LITERAL]);
7685 pragma Source_File_Name
7686 ( [Subunit_File_Name =>] STRING_LITERAL
7687 [,[Casing =>] CASING_SPEC]
7688 [,[Dot_Replacement =>] STRING_LITERAL]);
7690 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7693 The first argument is a pattern that contains a single asterisk indicating
7694 the point at which the unit name is to be inserted in the pattern string
7695 to form the file name. The second argument is optional. If present it
7696 specifies the casing of the unit name in the resulting file name string.
7697 The default is lower case. Finally the third argument allows for systematic
7698 replacement of any dots in the unit name by the specified string literal.
7700 Note that Source_File_Name pragmas should not be used if you are using
7701 project files. The reason for this rule is that the project manager is not
7702 aware of these pragmas, and so other tools that use the projet file would not
7703 be aware of the intended naming conventions. If you are using project files,
7704 file naming is controlled by Source_File_Name_Project pragmas, which are
7705 usually supplied automatically by the project manager. A pragma
7706 Source_File_Name cannot appear after a @ref{ec,,Pragma Source_File_Name_Project}.
7708 For more details on the use of the @code{Source_File_Name} pragma, see the
7709 sections on @code{Using Other File Names} and @cite{Alternative File Naming Schemes' in the :title:`GNAT User's Guide}.
7711 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7712 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{ec}@anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{ed}
7713 @section Pragma Source_File_Name_Project
7716 This pragma has the same syntax and semantics as pragma Source_File_Name.
7717 It is only allowed as a stand-alone configuration pragma.
7718 It cannot appear after a @ref{ea,,Pragma Source_File_Name}, and
7719 most importantly, once pragma Source_File_Name_Project appears,
7720 no further Source_File_Name pragmas are allowed.
7722 The intention is that Source_File_Name_Project pragmas are always
7723 generated by the Project Manager in a manner consistent with the naming
7724 specified in a project file, and when naming is controlled in this manner,
7725 it is not permissible to attempt to modify this naming scheme using
7726 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7727 known to the project manager).
7729 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7730 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{ee}
7731 @section Pragma Source_Reference
7737 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7740 This pragma must appear as the first line of a source file.
7741 @code{integer_literal} is the logical line number of the line following
7742 the pragma line (for use in error messages and debugging
7743 information). @code{string_literal} is a static string constant that
7744 specifies the file name to be used in error messages and debugging
7745 information. This is most notably used for the output of @code{gnatchop}
7746 with the @emph{-r} switch, to make sure that the original unchopped
7747 source file is the one referred to.
7749 The second argument must be a string literal, it cannot be a static
7750 string expression other than a string literal. This is because its value
7751 is needed for error messages issued by all phases of the compiler.
7753 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7754 @anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{ef}@anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{f0}
7755 @section Pragma SPARK_Mode
7761 pragma SPARK_Mode [(On | Off)] ;
7764 In general a program can have some parts that are in SPARK 2014 (and
7765 follow all the rules in the SPARK Reference Manual), and some parts
7766 that are full Ada 2012.
7768 The SPARK_Mode pragma is used to identify which parts are in SPARK
7769 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7770 be used in the following places:
7776 As a configuration pragma, in which case it sets the default mode for
7777 all units compiled with this pragma.
7780 Immediately following a library-level subprogram spec
7783 Immediately within a library-level package body
7786 Immediately following the @code{private} keyword of a library-level
7790 Immediately following the @code{begin} keyword of a library-level
7794 Immediately within a library-level subprogram body
7797 Normally a subprogram or package spec/body inherits the current mode
7798 that is active at the point it is declared. But this can be overridden
7799 by pragma within the spec or body as above.
7801 The basic consistency rule is that you can't turn SPARK_Mode back
7802 @code{On}, once you have explicitly (with a pragma) turned if
7803 @code{Off}. So the following rules apply:
7805 If a subprogram spec has SPARK_Mode @code{Off}, then the body must
7806 also have SPARK_Mode @code{Off}.
7808 For a package, we have four parts:
7814 the package public declarations
7817 the package private part
7820 the body of the package
7823 the elaboration code after @code{begin}
7826 For a package, the rule is that if you explicitly turn SPARK_Mode
7827 @code{Off} for any part, then all the following parts must have
7828 SPARK_Mode @code{Off}. Note that this may require repeating a pragma
7829 SPARK_Mode (@code{Off}) in the body. For example, if we have a
7830 configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
7831 default everywhere, and one particular package spec has pragma
7832 SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
7835 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7836 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{f1}
7837 @section Pragma Static_Elaboration_Desired
7843 pragma Static_Elaboration_Desired;
7846 This pragma is used to indicate that the compiler should attempt to initialize
7847 statically the objects declared in the library unit to which the pragma applies,
7848 when these objects are initialized (explicitly or implicitly) by an aggregate.
7849 In the absence of this pragma, aggregates in object declarations are expanded
7850 into assignments and loops, even when the aggregate components are static
7851 constants. When the aggregate is present the compiler builds a static expression
7852 that requires no run-time code, so that the initialized object can be placed in
7853 read-only data space. If the components are not static, or the aggregate has
7854 more that 100 components, the compiler emits a warning that the pragma cannot
7855 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7856 construction of larger aggregates with static components that include an others
7859 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7860 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{f2}
7861 @section Pragma Stream_Convert
7867 pragma Stream_Convert (
7868 [Entity =>] type_LOCAL_NAME,
7869 [Read =>] function_NAME,
7870 [Write =>] function_NAME);
7873 This pragma provides an efficient way of providing user-defined stream
7874 attributes. Not only is it simpler to use than specifying the attributes
7875 directly, but more importantly, it allows the specification to be made in such
7876 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7877 needed (i.e. unless the stream attributes are actually used); the use of
7878 the Stream_Convert pragma adds no overhead at all, unless the stream
7879 attributes are actually used on the designated type.
7881 The first argument specifies the type for which stream functions are
7882 provided. The second parameter provides a function used to read values
7883 of this type. It must name a function whose argument type may be any
7884 subtype, and whose returned type must be the type given as the first
7885 argument to the pragma.
7887 The meaning of the @code{Read} parameter is that if a stream attribute directly
7888 or indirectly specifies reading of the type given as the first parameter,
7889 then a value of the type given as the argument to the Read function is
7890 read from the stream, and then the Read function is used to convert this
7891 to the required target type.
7893 Similarly the @code{Write} parameter specifies how to treat write attributes
7894 that directly or indirectly apply to the type given as the first parameter.
7895 It must have an input parameter of the type specified by the first parameter,
7896 and the return type must be the same as the input type of the Read function.
7897 The effect is to first call the Write function to convert to the given stream
7898 type, and then write the result type to the stream.
7900 The Read and Write functions must not be overloaded subprograms. If necessary
7901 renamings can be supplied to meet this requirement.
7902 The usage of this attribute is best illustrated by a simple example, taken
7903 from the GNAT implementation of package Ada.Strings.Unbounded:
7906 function To_Unbounded (S : String) return Unbounded_String
7907 renames To_Unbounded_String;
7909 pragma Stream_Convert
7910 (Unbounded_String, To_Unbounded, To_String);
7913 The specifications of the referenced functions, as given in the Ada
7914 Reference Manual are:
7917 function To_Unbounded_String (Source : String)
7918 return Unbounded_String;
7920 function To_String (Source : Unbounded_String)
7924 The effect is that if the value of an unbounded string is written to a stream,
7925 then the representation of the item in the stream is in the same format that
7926 would be used for @code{Standard.String'Output}, and this same representation
7927 is expected when a value of this type is read from the stream. Note that the
7928 value written always includes the bounds, even for Unbounded_String'Write,
7929 since Unbounded_String is not an array type.
7931 Note that the @code{Stream_Convert} pragma is not effective in the case of
7932 a derived type of a non-limited tagged type. If such a type is specified then
7933 the pragma is silently ignored, and the default implementation of the stream
7934 attributes is used instead.
7936 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7937 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{f3}
7938 @section Pragma Style_Checks
7944 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7945 On | Off [, LOCAL_NAME]);
7948 This pragma is used in conjunction with compiler switches to control the
7949 built in style checking provided by GNAT. The compiler switches, if set,
7950 provide an initial setting for the switches, and this pragma may be used
7951 to modify these settings, or the settings may be provided entirely by
7952 the use of the pragma. This pragma can be used anywhere that a pragma
7953 is legal, including use as a configuration pragma (including use in
7954 the @code{gnat.adc} file).
7956 The form with a string literal specifies which style options are to be
7957 activated. These are additive, so they apply in addition to any previously
7958 set style check options. The codes for the options are the same as those
7959 used in the @emph{-gnaty} switch to @emph{gcc} or @emph{gnatmake}.
7960 For example the following two methods can be used to enable
7968 pragma Style_Checks ("l");
7977 The form @code{ALL_CHECKS} activates all standard checks (its use is equivalent
7978 to the use of the @code{gnaty} switch with no options.
7979 See the @cite{GNAT User's Guide} for details.)
7981 Note: the behavior is slightly different in GNAT mode (@code{-gnatg} used).
7982 In this case, @code{ALL_CHECKS} implies the standard set of GNAT mode style check
7983 options (i.e. equivalent to @code{-gnatyg}).
7985 The forms with @code{Off} and @code{On}
7986 can be used to temporarily disable style checks
7987 as shown in the following example:
7990 pragma Style_Checks ("k"); -- requires keywords in lower case
7991 pragma Style_Checks (Off); -- turn off style checks
7992 NULL; -- this will not generate an error message
7993 pragma Style_Checks (On); -- turn style checks back on
7994 NULL; -- this will generate an error message
7997 Finally the two argument form is allowed only if the first argument is
7998 @code{On} or @code{Off}. The effect is to turn of semantic style checks
7999 for the specified entity, as shown in the following example:
8002 pragma Style_Checks ("r"); -- require consistency of identifier casing
8004 Rf1 : Integer := ARG; -- incorrect, wrong case
8005 pragma Style_Checks (Off, Arg);
8006 Rf2 : Integer := ARG; -- OK, no error
8009 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
8010 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{f4}
8011 @section Pragma Subtitle
8017 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
8020 This pragma is recognized for compatibility with other Ada compilers
8021 but is ignored by GNAT.
8023 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
8024 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{f5}
8025 @section Pragma Suppress
8031 pragma Suppress (Identifier [, [On =>] Name]);
8034 This is a standard pragma, and supports all the check names required in
8035 the RM. It is included here because GNAT recognizes some additional check
8036 names that are implementation defined (as permitted by the RM):
8042 @code{Alignment_Check} can be used to suppress alignment checks
8043 on addresses used in address clauses. Such checks can also be suppressed
8044 by suppressing range checks, but the specific use of @code{Alignment_Check}
8045 allows suppression of alignment checks without suppressing other range checks.
8046 Note that @code{Alignment_Check} is suppressed by default on machines (such as
8047 the x86) with non-strict alignment.
8050 @code{Atomic_Synchronization} can be used to suppress the special memory
8051 synchronization instructions that are normally generated for access to
8052 @code{Atomic} variables to ensure correct synchronization between tasks
8053 that use such variables for synchronization purposes.
8056 @code{Duplicated_Tag_Check} Can be used to suppress the check that is generated
8057 for a duplicated tag value when a tagged type is declared.
8060 @code{Container_Checks} Can be used to suppress all checks within Ada.Containers
8061 and instances of its children, including Tampering_Check.
8064 @code{Tampering_Check} Can be used to suppress tampering check in the containers.
8067 @code{Predicate_Check} can be used to control whether predicate checks are
8068 active. It is applicable only to predicates for which the policy is
8069 @code{Check}. Unlike @code{Assertion_Policy}, which determines if a given
8070 predicate is ignored or checked for the whole program, the use of
8071 @code{Suppress} and @code{Unsuppress} with this check name allows a given
8072 predicate to be turned on and off at specific points in the program.
8075 @code{Validity_Check} can be used specifically to control validity checks.
8076 If @code{Suppress} is used to suppress validity checks, then no validity
8077 checks are performed, including those specified by the appropriate compiler
8078 switch or the @code{Validity_Checks} pragma.
8081 Additional check names previously introduced by use of the @code{Check_Name}
8082 pragma are also allowed.
8085 Note that pragma Suppress gives the compiler permission to omit
8086 checks, but does not require the compiler to omit checks. The compiler
8087 will generate checks if they are essentially free, even when they are
8088 suppressed. In particular, if the compiler can prove that a certain
8089 check will necessarily fail, it will generate code to do an
8090 unconditional 'raise', even if checks are suppressed. The compiler
8093 Of course, run-time checks are omitted whenever the compiler can prove
8094 that they will not fail, whether or not checks are suppressed.
8096 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
8097 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{f6}
8098 @section Pragma Suppress_All
8104 pragma Suppress_All;
8107 This pragma can appear anywhere within a unit.
8108 The effect is to apply @code{Suppress (All_Checks)} to the unit
8109 in which it appears. This pragma is implemented for compatibility with DEC
8110 Ada 83 usage where it appears at the end of a unit, and for compatibility
8111 with Rational Ada, where it appears as a program unit pragma.
8112 The use of the standard Ada pragma @code{Suppress (All_Checks)}
8113 as a normal configuration pragma is the preferred usage in GNAT.
8115 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
8116 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{f7}@anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f8}
8117 @section Pragma Suppress_Debug_Info
8123 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
8126 This pragma can be used to suppress generation of debug information
8127 for the specified entity. It is intended primarily for use in debugging
8128 the debugger, and navigating around debugger problems.
8130 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
8131 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f9}
8132 @section Pragma Suppress_Exception_Locations
8138 pragma Suppress_Exception_Locations;
8141 In normal mode, a raise statement for an exception by default generates
8142 an exception message giving the file name and line number for the location
8143 of the raise. This is useful for debugging and logging purposes, but this
8144 entails extra space for the strings for the messages. The configuration
8145 pragma @code{Suppress_Exception_Locations} can be used to suppress the
8146 generation of these strings, with the result that space is saved, but the
8147 exception message for such raises is null. This configuration pragma may
8148 appear in a global configuration pragma file, or in a specific unit as
8149 usual. It is not required that this pragma be used consistently within
8150 a partition, so it is fine to have some units within a partition compiled
8151 with this pragma and others compiled in normal mode without it.
8153 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
8154 @anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{fa}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{fb}
8155 @section Pragma Suppress_Initialization
8158 @geindex Suppressing initialization
8160 @geindex Initialization
8161 @geindex suppression of
8166 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
8169 Here variable_or_subtype_Name is the name introduced by a type declaration
8170 or subtype declaration or the name of a variable introduced by an
8173 In the case of a type or subtype
8174 this pragma suppresses any implicit or explicit initialization
8175 for all variables of the given type or subtype,
8176 including initialization resulting from the use of pragmas
8177 Normalize_Scalars or Initialize_Scalars.
8179 This is considered a representation item, so it cannot be given after
8180 the type is frozen. It applies to all subsequent object declarations,
8181 and also any allocator that creates objects of the type.
8183 If the pragma is given for the first subtype, then it is considered
8184 to apply to the base type and all its subtypes. If the pragma is given
8185 for other than a first subtype, then it applies only to the given subtype.
8186 The pragma may not be given after the type is frozen.
8188 Note that this includes eliminating initialization of discriminants
8189 for discriminated types, and tags for tagged types. In these cases,
8190 you will have to use some non-portable mechanism (e.g. address
8191 overlays or unchecked conversion) to achieve required initialization
8192 of these fields before accessing any object of the corresponding type.
8194 For the variable case, implicit initialization for the named variable
8195 is suppressed, just as though its subtype had been given in a pragma
8196 Suppress_Initialization, as described above.
8198 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
8199 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{fc}
8200 @section Pragma Task_Name
8206 pragma Task_Name (string_EXPRESSION);
8209 This pragma appears within a task definition (like pragma
8210 @code{Priority}) and applies to the task in which it appears. The
8211 argument must be of type String, and provides a name to be used for
8212 the task instance when the task is created. Note that this expression
8213 is not required to be static, and in particular, it can contain
8214 references to task discriminants. This facility can be used to
8215 provide different names for different tasks as they are created,
8216 as illustrated in the example below.
8218 The task name is recorded internally in the run-time structures
8219 and is accessible to tools like the debugger. In addition the
8220 routine @code{Ada.Task_Identification.Image} will return this
8221 string, with a unique task address appended.
8224 -- Example of the use of pragma Task_Name
8226 with Ada.Task_Identification;
8227 use Ada.Task_Identification;
8228 with Text_IO; use Text_IO;
8231 type Astring is access String;
8233 task type Task_Typ (Name : access String) is
8234 pragma Task_Name (Name.all);
8237 task body Task_Typ is
8238 Nam : constant String := Image (Current_Task);
8240 Put_Line ("-->" & Nam (1 .. 14) & "<--");
8243 type Ptr_Task is access Task_Typ;
8244 Task_Var : Ptr_Task;
8248 new Task_Typ (new String'("This is task 1"));
8250 new Task_Typ (new String'("This is task 2"));
8254 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
8255 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{fd}
8256 @section Pragma Task_Storage
8262 pragma Task_Storage (
8263 [Task_Type =>] LOCAL_NAME,
8264 [Top_Guard =>] static_integer_EXPRESSION);
8267 This pragma specifies the length of the guard area for tasks. The guard
8268 area is an additional storage area allocated to a task. A value of zero
8269 means that either no guard area is created or a minimal guard area is
8270 created, depending on the target. This pragma can appear anywhere a
8271 @code{Storage_Size} attribute definition clause is allowed for a task
8274 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
8275 @anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{fe}@anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{ff}
8276 @section Pragma Test_Case
8285 [Name =>] static_string_Expression
8286 ,[Mode =>] (Nominal | Robustness)
8287 [, Requires => Boolean_Expression]
8288 [, Ensures => Boolean_Expression]);
8291 The @code{Test_Case} pragma allows defining fine-grain specifications
8292 for use by testing tools.
8293 The compiler checks the validity of the @code{Test_Case} pragma, but its
8294 presence does not lead to any modification of the code generated by the
8297 @code{Test_Case} pragmas may only appear immediately following the
8298 (separate) declaration of a subprogram in a package declaration, inside
8299 a package spec unit. Only other pragmas may intervene (that is appear
8300 between the subprogram declaration and a test case).
8302 The compiler checks that boolean expressions given in @code{Requires} and
8303 @code{Ensures} are valid, where the rules for @code{Requires} are the
8304 same as the rule for an expression in @code{Precondition} and the rules
8305 for @code{Ensures} are the same as the rule for an expression in
8306 @code{Postcondition}. In particular, attributes @code{'Old} and
8307 @code{'Result} can only be used within the @code{Ensures}
8308 expression. The following is an example of use within a package spec:
8311 package Math_Functions is
8313 function Sqrt (Arg : Float) return Float;
8314 pragma Test_Case (Name => "Test 1",
8316 Requires => Arg < 10000,
8317 Ensures => Sqrt'Result < 10);
8322 The meaning of a test case is that there is at least one context where
8323 @code{Requires} holds such that, if the associated subprogram is executed in
8324 that context, then @code{Ensures} holds when the subprogram returns.
8325 Mode @code{Nominal} indicates that the input context should also satisfy the
8326 precondition of the subprogram, and the output context should also satisfy its
8327 postcondition. Mode @code{Robustness} indicates that the precondition and
8328 postcondition of the subprogram should be ignored for this test case.
8330 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
8331 @anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{100}@anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{101}
8332 @section Pragma Thread_Local_Storage
8335 @geindex Task specific storage
8337 @geindex TLS (Thread Local Storage)
8339 @geindex Task_Attributes
8344 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
8347 This pragma specifies that the specified entity, which must be
8348 a variable declared in a library-level package, is to be marked as
8349 "Thread Local Storage" (@code{TLS}). On systems supporting this (which
8350 include Windows, Solaris, GNU/Linux, and VxWorks 6), this causes each
8351 thread (and hence each Ada task) to see a distinct copy of the variable.
8353 The variable must not have default initialization, and if there is
8354 an explicit initialization, it must be either @code{null} for an
8355 access variable, a static expression for a scalar variable, or a fully
8356 static aggregate for a composite type, that is to say, an aggregate all
8357 of whose components are static, and which does not include packed or
8358 discriminated components.
8360 This provides a low-level mechanism similar to that provided by
8361 the @code{Ada.Task_Attributes} package, but much more efficient
8362 and is also useful in writing interface code that will interact
8363 with foreign threads.
8365 If this pragma is used on a system where @code{TLS} is not supported,
8366 then an error message will be generated and the program will be rejected.
8368 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
8369 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{102}
8370 @section Pragma Time_Slice
8376 pragma Time_Slice (static_duration_EXPRESSION);
8379 For implementations of GNAT on operating systems where it is possible
8380 to supply a time slice value, this pragma may be used for this purpose.
8381 It is ignored if it is used in a system that does not allow this control,
8382 or if it appears in other than the main program unit.
8384 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
8385 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{103}
8386 @section Pragma Title
8392 pragma Title (TITLING_OPTION [, TITLING OPTION]);
8395 [Title =>] STRING_LITERAL,
8396 | [Subtitle =>] STRING_LITERAL
8399 Syntax checked but otherwise ignored by GNAT. This is a listing control
8400 pragma used in DEC Ada 83 implementations to provide a title and/or
8401 subtitle for the program listing. The program listing generated by GNAT
8402 does not have titles or subtitles.
8404 Unlike other pragmas, the full flexibility of named notation is allowed
8405 for this pragma, i.e., the parameters may be given in any order if named
8406 notation is used, and named and positional notation can be mixed
8407 following the normal rules for procedure calls in Ada.
8409 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
8410 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{104}
8411 @section Pragma Type_Invariant
8417 pragma Type_Invariant
8418 ([Entity =>] type_LOCAL_NAME,
8419 [Check =>] EXPRESSION);
8422 The @code{Type_Invariant} pragma is intended to be an exact
8423 replacement for the language-defined @code{Type_Invariant}
8424 aspect, and shares its restrictions and semantics. It differs
8425 from the language defined @code{Invariant} pragma in that it
8426 does not permit a string parameter, and it is
8427 controlled by the assertion identifier @code{Type_Invariant}
8428 rather than @code{Invariant}.
8430 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
8431 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{105}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{106}
8432 @section Pragma Type_Invariant_Class
8438 pragma Type_Invariant_Class
8439 ([Entity =>] type_LOCAL_NAME,
8440 [Check =>] EXPRESSION);
8443 The @code{Type_Invariant_Class} pragma is intended to be an exact
8444 replacement for the language-defined @code{Type_Invariant'Class}
8445 aspect, and shares its restrictions and semantics.
8447 Note: This pragma is called @code{Type_Invariant_Class} rather than
8448 @code{Type_Invariant'Class} because the latter would not be strictly
8449 conforming to the allowed syntax for pragmas. The motivation
8450 for providing pragmas equivalent to the aspects is to allow a program
8451 to be written using the pragmas, and then compiled if necessary
8452 using an Ada compiler that does not recognize the pragmas or
8453 aspects, but is prepared to ignore the pragmas. The assertion
8454 policy that controls this pragma is @code{Type_Invariant'Class},
8455 not @code{Type_Invariant_Class}.
8457 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
8458 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{107}
8459 @section Pragma Unchecked_Union
8462 @geindex Unions in C
8467 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
8470 This pragma is used to specify a representation of a record type that is
8471 equivalent to a C union. It was introduced as a GNAT implementation defined
8472 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
8473 pragma, making it language defined, and GNAT fully implements this extended
8474 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
8475 details, consult the Ada 2012 Reference Manual, section B.3.3.
8477 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
8478 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{108}
8479 @section Pragma Unevaluated_Use_Of_Old
8482 @geindex Attribute Old
8484 @geindex Attribute Loop_Entry
8486 @geindex Unevaluated_Use_Of_Old
8491 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
8494 This pragma controls the processing of attributes Old and Loop_Entry.
8495 If either of these attributes is used in a potentially unevaluated
8496 expression (e.g. the then or else parts of an if expression), then
8497 normally this usage is considered illegal if the prefix of the attribute
8498 is other than an entity name. The language requires this
8499 behavior for Old, and GNAT copies the same rule for Loop_Entry.
8501 The reason for this rule is that otherwise, we can have a situation
8502 where we save the Old value, and this results in an exception, even
8503 though we might not evaluate the attribute. Consider this example:
8506 package UnevalOld is
8508 procedure U (A : String; C : Boolean) -- ERROR
8509 with Post => (if C then A(1)'Old = K else True);
8513 If procedure U is called with a string with a lower bound of 2, and
8514 C false, then an exception would be raised trying to evaluate A(1)
8515 on entry even though the value would not be actually used.
8517 Although the rule guarantees against this possibility, it is sometimes
8518 too restrictive. For example if we know that the string has a lower
8519 bound of 1, then we will never raise an exception.
8520 The pragma @code{Unevaluated_Use_Of_Old} can be
8521 used to modify this behavior. If the argument is @code{Error} then an
8522 error is given (this is the default RM behavior). If the argument is
8523 @code{Warn} then the usage is allowed as legal but with a warning
8524 that an exception might be raised. If the argument is @code{Allow}
8525 then the usage is allowed as legal without generating a warning.
8527 This pragma may appear as a configuration pragma, or in a declarative
8528 part or package specification. In the latter case it applies to
8529 uses up to the end of the corresponding statement sequence or
8530 sequence of package declarations.
8532 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
8533 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{109}
8534 @section Pragma Unimplemented_Unit
8540 pragma Unimplemented_Unit;
8543 If this pragma occurs in a unit that is processed by the compiler, GNAT
8544 aborts with the message @code{xxx not implemented}, where
8545 @code{xxx} is the name of the current compilation unit. This pragma is
8546 intended to allow the compiler to handle unimplemented library units in
8549 The abort only happens if code is being generated. Thus you can use
8550 specs of unimplemented packages in syntax or semantic checking mode.
8552 @node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
8553 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{10a}@anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{10b}
8554 @section Pragma Universal_Aliasing
8560 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
8563 @code{type_LOCAL_NAME} must refer to a type declaration in the current
8564 declarative part. The effect is to inhibit strict type-based aliasing
8565 optimization for the given type. In other words, the effect is as though
8566 access types designating this type were subject to pragma No_Strict_Aliasing.
8567 For a detailed description of the strict aliasing optimization, and the
8568 situations in which it must be suppressed, see the section on
8569 @code{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
8571 @node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
8572 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{10c}@anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{10d}
8573 @section Pragma Universal_Data
8579 pragma Universal_Data [(library_unit_Name)];
8582 This pragma is supported only for the AAMP target and is ignored for
8583 other targets. The pragma specifies that all library-level objects
8584 (Counter 0 data) associated with the library unit are to be accessed
8585 and updated using universal addressing (24-bit addresses for AAMP5)
8586 rather than the default of 16-bit Data Environment (DENV) addressing.
8587 Use of this pragma will generally result in less efficient code for
8588 references to global data associated with the library unit, but
8589 allows such data to be located anywhere in memory. This pragma is
8590 a library unit pragma, but can also be used as a configuration pragma
8591 (including use in the @code{gnat.adc} file). The functionality
8592 of this pragma is also available by applying the -univ switch on the
8593 compilations of units where universal addressing of the data is desired.
8595 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
8596 @anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10e}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{10f}
8597 @section Pragma Unmodified
8606 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8609 This pragma signals that the assignable entities (variables,
8610 @code{out} parameters, @code{in out} parameters) whose names are listed are
8611 deliberately not assigned in the current source unit. This
8612 suppresses warnings about the
8613 entities being referenced but not assigned, and in addition a warning will be
8614 generated if one of these entities is in fact assigned in the
8615 same unit as the pragma (or in the corresponding body, or one
8618 This is particularly useful for clearly signaling that a particular
8619 parameter is not modified, even though the spec suggests that it might
8622 For the variable case, warnings are never given for unreferenced variables
8623 whose name contains one of the substrings
8624 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8625 are typically to be used in cases where such warnings are expected.
8626 Thus it is never necessary to use @code{pragma Unmodified} for such
8627 variables, though it is harmless to do so.
8629 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8630 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{110}@anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{111}
8631 @section Pragma Unreferenced
8635 @geindex unreferenced
8640 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8641 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8644 This pragma signals that the entities whose names are listed are
8645 deliberately not referenced in the current source unit after the
8646 occurrence of the pragma. This
8647 suppresses warnings about the
8648 entities being unreferenced, and in addition a warning will be
8649 generated if one of these entities is in fact subsequently referenced in the
8650 same unit as the pragma (or in the corresponding body, or one
8653 This is particularly useful for clearly signaling that a particular
8654 parameter is not referenced in some particular subprogram implementation
8655 and that this is deliberate. It can also be useful in the case of
8656 objects declared only for their initialization or finalization side
8659 If @code{LOCAL_NAME} identifies more than one matching homonym in the
8660 current scope, then the entity most recently declared is the one to which
8661 the pragma applies. Note that in the case of accept formals, the pragma
8662 Unreferenced may appear immediately after the keyword @code{do} which
8663 allows the indication of whether or not accept formals are referenced
8664 or not to be given individually for each accept statement.
8666 The left hand side of an assignment does not count as a reference for the
8667 purpose of this pragma. Thus it is fine to assign to an entity for which
8668 pragma Unreferenced is given.
8670 Note that if a warning is desired for all calls to a given subprogram,
8671 regardless of whether they occur in the same unit as the subprogram
8672 declaration, then this pragma should not be used (calls from another
8673 unit would not be flagged); pragma Obsolescent can be used instead
8674 for this purpose, see @ref{af,,Pragma Obsolescent}.
8676 The second form of pragma @code{Unreferenced} is used within a context
8677 clause. In this case the arguments must be unit names of units previously
8678 mentioned in @code{with} clauses (similar to the usage of pragma
8679 @code{Elaborate_All}. The effect is to suppress warnings about unreferenced
8680 units and unreferenced entities within these units.
8682 For the variable case, warnings are never given for unreferenced variables
8683 whose name contains one of the substrings
8684 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8685 are typically to be used in cases where such warnings are expected.
8686 Thus it is never necessary to use @code{pragma Unreferenced} for such
8687 variables, though it is harmless to do so.
8689 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8690 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{112}@anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{113}
8691 @section Pragma Unreferenced_Objects
8695 @geindex unreferenced
8700 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8703 This pragma signals that for the types or subtypes whose names are
8704 listed, objects which are declared with one of these types or subtypes may
8705 not be referenced, and if no references appear, no warnings are given.
8707 This is particularly useful for objects which are declared solely for their
8708 initialization and finalization effect. Such variables are sometimes referred
8709 to as RAII variables (Resource Acquisition Is Initialization). Using this
8710 pragma on the relevant type (most typically a limited controlled type), the
8711 compiler will automatically suppress unwanted warnings about these variables
8712 not being referenced.
8714 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8715 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{114}
8716 @section Pragma Unreserve_All_Interrupts
8722 pragma Unreserve_All_Interrupts;
8725 Normally certain interrupts are reserved to the implementation. Any attempt
8726 to attach an interrupt causes Program_Error to be raised, as described in
8727 RM C.3.2(22). A typical example is the @code{SIGINT} interrupt used in
8728 many systems for a @code{Ctrl-C} interrupt. Normally this interrupt is
8729 reserved to the implementation, so that @code{Ctrl-C} can be used to
8730 interrupt execution.
8732 If the pragma @code{Unreserve_All_Interrupts} appears anywhere in any unit in
8733 a program, then all such interrupts are unreserved. This allows the
8734 program to handle these interrupts, but disables their standard
8735 functions. For example, if this pragma is used, then pressing
8736 @code{Ctrl-C} will not automatically interrupt execution. However,
8737 a program can then handle the @code{SIGINT} interrupt as it chooses.
8739 For a full list of the interrupts handled in a specific implementation,
8740 see the source code for the spec of @code{Ada.Interrupts.Names} in
8741 file @code{a-intnam.ads}. This is a target dependent file that contains the
8742 list of interrupts recognized for a given target. The documentation in
8743 this file also specifies what interrupts are affected by the use of
8744 the @code{Unreserve_All_Interrupts} pragma.
8746 For a more general facility for controlling what interrupts can be
8747 handled, see pragma @code{Interrupt_State}, which subsumes the functionality
8748 of the @code{Unreserve_All_Interrupts} pragma.
8750 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8751 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{115}
8752 @section Pragma Unsuppress
8758 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8761 This pragma undoes the effect of a previous pragma @code{Suppress}. If
8762 there is no corresponding pragma @code{Suppress} in effect, it has no
8763 effect. The range of the effect is the same as for pragma
8764 @code{Suppress}. The meaning of the arguments is identical to that used
8765 in pragma @code{Suppress}.
8767 One important application is to ensure that checks are on in cases where
8768 code depends on the checks for its correct functioning, so that the code
8769 will compile correctly even if the compiler switches are set to suppress
8770 checks. For example, in a program that depends on external names of tagged
8771 types and wants to ensure that the duplicated tag check occurs even if all
8772 run-time checks are suppressed by a compiler switch, the following
8773 configuration pragma will ensure this test is not suppressed:
8776 pragma Unsuppress (Duplicated_Tag_Check);
8779 This pragma is standard in Ada 2005. It is available in all earlier versions
8780 of Ada as an implementation-defined pragma.
8782 Note that in addition to the checks defined in the Ada RM, GNAT recogizes a
8783 number of implementation-defined check names. See the description of pragma
8784 @code{Suppress} for full details.
8786 @node Pragma Use_VADS_Size,Pragma Unused,Pragma Unsuppress,Implementation Defined Pragmas
8787 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{116}
8788 @section Pragma Use_VADS_Size
8792 @geindex VADS compatibility
8794 @geindex Rational profile
8799 pragma Use_VADS_Size;
8802 This is a configuration pragma. In a unit to which it applies, any use
8803 of the 'Size attribute is automatically interpreted as a use of the
8804 'VADS_Size attribute. Note that this may result in incorrect semantic
8805 processing of valid Ada 95 or Ada 2005 programs. This is intended to aid in
8806 the handling of existing code which depends on the interpretation of Size
8807 as implemented in the VADS compiler. See description of the VADS_Size
8808 attribute for further details.
8810 @node Pragma Unused,Pragma Validity_Checks,Pragma Use_VADS_Size,Implementation Defined Pragmas
8811 @anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{117}@anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{118}
8812 @section Pragma Unused
8821 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8824 This pragma signals that the assignable entities (variables,
8825 @code{out} parameters, and @code{in out} parameters) whose names are listed
8826 deliberately do not get assigned or referenced in the current source unit
8827 after the occurrence of the pragma in the current source unit. This
8828 suppresses warnings about the entities that are unreferenced and/or not
8829 assigned, and, in addition, a warning will be generated if one of these
8830 entities gets assigned or subsequently referenced in the same unit as the
8831 pragma (in the corresponding body or one of its subunits).
8833 This is particularly useful for clearly signaling that a particular
8834 parameter is not modified or referenced, even though the spec suggests
8837 For the variable case, warnings are never given for unreferenced
8838 variables whose name contains one of the substrings
8839 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8840 are typically to be used in cases where such warnings are expected.
8841 Thus it is never necessary to use @code{pragma Unmodified} for such
8842 variables, though it is harmless to do so.
8844 @node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
8845 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{119}
8846 @section Pragma Validity_Checks
8852 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8855 This pragma is used in conjunction with compiler switches to control the
8856 built-in validity checking provided by GNAT. The compiler switches, if set
8857 provide an initial setting for the switches, and this pragma may be used
8858 to modify these settings, or the settings may be provided entirely by
8859 the use of the pragma. This pragma can be used anywhere that a pragma
8860 is legal, including use as a configuration pragma (including use in
8861 the @code{gnat.adc} file).
8863 The form with a string literal specifies which validity options are to be
8864 activated. The validity checks are first set to include only the default
8865 reference manual settings, and then a string of letters in the string
8866 specifies the exact set of options required. The form of this string
8867 is exactly as described for the @emph{-gnatVx} compiler switch (see the
8868 GNAT User's Guide for details). For example the following two
8869 methods can be used to enable validity checking for mode @code{in} and
8870 @code{in out} subprogram parameters:
8877 pragma Validity_Checks ("im");
8882 $ gcc -c -gnatVim ...
8886 The form ALL_CHECKS activates all standard checks (its use is equivalent
8887 to the use of the @code{gnatVa} switch).
8889 The forms with @code{Off} and @code{On} can be used to temporarily disable
8890 validity checks as shown in the following example:
8893 pragma Validity_Checks ("c"); -- validity checks for copies
8894 pragma Validity_Checks (Off); -- turn off validity checks
8895 A := B; -- B will not be validity checked
8896 pragma Validity_Checks (On); -- turn validity checks back on
8897 A := C; -- C will be validity checked
8900 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8901 @anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{11a}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{11b}
8902 @section Pragma Volatile
8908 pragma Volatile (LOCAL_NAME);
8911 This pragma is defined by the Ada Reference Manual, and the GNAT
8912 implementation is fully conformant with this definition. The reason it
8913 is mentioned in this section is that a pragma of the same name was supplied
8914 in some Ada 83 compilers, including DEC Ada 83. The Ada 95 / Ada 2005
8915 implementation of pragma Volatile is upwards compatible with the
8916 implementation in DEC Ada 83.
8918 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8919 @anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{11c}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{11d}
8920 @section Pragma Volatile_Full_Access
8926 pragma Volatile_Full_Access (LOCAL_NAME);
8929 This is similar in effect to pragma Volatile, except that any reference to the
8930 object is guaranteed to be done only with instructions that read or write all
8931 the bits of the object. Furthermore, if the object is of a composite type,
8932 then any reference to a component of the object is guaranteed to read and/or
8933 write all the bits of the object.
8935 The intention is that this be suitable for use with memory-mapped I/O devices
8936 on some machines. Note that there are two important respects in which this is
8937 different from @code{pragma Atomic}. First a reference to a @code{Volatile_Full_Access}
8938 object is not a sequential action in the RM 9.10 sense and, therefore, does
8939 not create a synchronization point. Second, in the case of @code{pragma Atomic},
8940 there is no guarantee that all the bits will be accessed if the reference
8941 is not to the whole object; the compiler is allowed (and generally will)
8942 access only part of the object in this case.
8944 It is not permissible to specify @code{Atomic} and @code{Volatile_Full_Access} for
8947 It is not permissible to specify @code{Volatile_Full_Access} for a composite
8948 (record or array) type or object that has at least one @code{Aliased} component.
8950 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8951 @anchor{gnat_rm/implementation_defined_pragmas id56}@anchor{11e}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{11f}
8952 @section Pragma Volatile_Function
8958 pragma Volatile_Function [ (boolean_EXPRESSION) ];
8961 For the semantics of this pragma, see the entry for aspect @code{Volatile_Function}
8962 in the SPARK 2014 Reference Manual, section 7.1.2.
8964 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
8965 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{120}
8966 @section Pragma Warning_As_Error
8972 pragma Warning_As_Error (static_string_EXPRESSION);
8975 This configuration pragma allows the programmer to specify a set
8976 of warnings that will be treated as errors. Any warning that
8977 matches the pattern given by the pragma argument will be treated
8978 as an error. This gives more precise control than -gnatwe,
8979 which treats warnings as errors.
8981 This pragma can apply to regular warnings (messages enabled by -gnatw)
8982 and to style warnings (messages that start with "(style)",
8985 The pattern may contain asterisks, which match zero or more characters
8986 in the message. For example, you can use @code{pragma Warning_As_Error
8987 ("bits of*unused")} to treat the warning message @code{warning: 960 bits of
8988 "a" unused} as an error. All characters other than asterisk are treated
8989 as literal characters in the match. The match is case insensitive; for
8990 example XYZ matches xyz.
8992 Note that the pattern matches if it occurs anywhere within the warning
8993 message string (it is not necessary to put an asterisk at the start and
8994 the end of the message, since this is implied).
8996 Another possibility for the static_string_EXPRESSION which works whether
8997 or not error tags are enabled (@emph{-gnatw.d}) is to use a single
8998 @emph{-gnatw} tag string, enclosed in brackets,
8999 as shown in the example below, to treat one category of warnings as errors.
9000 Note that if you want to treat multiple categories of warnings as errors,
9001 you can use multiple pragma Warning_As_Error.
9003 The above use of patterns to match the message applies only to warning
9004 messages generated by the front end. This pragma can also be applied to
9005 warnings provided by the back end and mentioned in @ref{121,,Pragma Warnings}.
9006 By using a single full @emph{-Wxxx} switch in the pragma, such warnings
9007 can also be treated as errors.
9009 The pragma can appear either in a global configuration pragma file
9010 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
9011 configuration pragma file containing:
9014 pragma Warning_As_Error ("[-gnatwj]");
9017 which will treat all obsolescent feature warnings as errors, the
9018 following program compiles as shown (compile options here are
9019 @emph{-gnatwa.d -gnatl -gnatj55}).
9022 1. pragma Warning_As_Error ("*never assigned*");
9023 2. function Warnerr return String is
9026 >>> error: variable "X" is never read and
9027 never assigned [-gnatwv] [warning-as-error]
9031 >>> warning: variable "Y" is assigned but
9032 never read [-gnatwu]
9038 >>> error: use of "%" is an obsolescent
9039 feature (RM J.2(4)), use """ instead
9040 [-gnatwj] [warning-as-error]
9044 8 lines: No errors, 3 warnings (2 treated as errors)
9047 Note that this pragma does not affect the set of warnings issued in
9048 any way, it merely changes the effect of a matching warning if one
9049 is produced as a result of other warnings options. As shown in this
9050 example, if the pragma results in a warning being treated as an error,
9051 the tag is changed from "warning:" to "error:" and the string
9052 "[warning-as-error]" is appended to the end of the message.
9054 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
9055 @anchor{gnat_rm/implementation_defined_pragmas id57}@anchor{122}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{121}
9056 @section Pragma Warnings
9062 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
9064 DETAILS ::= On | Off
9065 DETAILS ::= On | Off, local_NAME
9066 DETAILS ::= static_string_EXPRESSION
9067 DETAILS ::= On | Off, static_string_EXPRESSION
9069 TOOL_NAME ::= GNAT | GNATProve
9071 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
9074 Note: in Ada 83 mode, a string literal may be used in place of a static string
9075 expression (which does not exist in Ada 83).
9077 Note if the second argument of @code{DETAILS} is a @code{local_NAME} then the
9078 second form is always understood. If the intention is to use
9079 the fourth form, then you can write @code{NAME & ""} to force the
9080 intepretation as a @emph{static_string_EXPRESSION}.
9082 Note: if the first argument is a valid @code{TOOL_NAME}, it will be interpreted
9083 that way. The use of the @code{TOOL_NAME} argument is relevant only to users
9084 of SPARK and GNATprove, see last part of this section for details.
9086 Normally warnings are enabled, with the output being controlled by
9087 the command line switch. Warnings (@code{Off}) turns off generation of
9088 warnings until a Warnings (@code{On}) is encountered or the end of the
9089 current unit. If generation of warnings is turned off using this
9090 pragma, then some or all of the warning messages are suppressed,
9091 regardless of the setting of the command line switches.
9093 The @code{Reason} parameter may optionally appear as the last argument
9094 in any of the forms of this pragma. It is intended purely for the
9095 purposes of documenting the reason for the @code{Warnings} pragma.
9096 The compiler will check that the argument is a static string but
9097 otherwise ignore this argument. Other tools may provide specialized
9098 processing for this string.
9100 The form with a single argument (or two arguments if Reason present),
9101 where the first argument is @code{ON} or @code{OFF}
9102 may be used as a configuration pragma.
9104 If the @code{LOCAL_NAME} parameter is present, warnings are suppressed for
9105 the specified entity. This suppression is effective from the point where
9106 it occurs till the end of the extended scope of the variable (similar to
9107 the scope of @code{Suppress}). This form cannot be used as a configuration
9110 In the case where the first argument is other than @code{ON} or
9112 the third form with a single static_string_EXPRESSION argument (and possible
9113 reason) provides more precise
9114 control over which warnings are active. The string is a list of letters
9115 specifying which warnings are to be activated and which deactivated. The
9116 code for these letters is the same as the string used in the command
9117 line switch controlling warnings. For a brief summary, use the gnatmake
9118 command with no arguments, which will generate usage information containing
9119 the list of warnings switches supported. For
9120 full details see the section on @code{Warning Message Control} in the
9121 @cite{GNAT User's Guide}.
9122 This form can also be used as a configuration pragma.
9124 The warnings controlled by the @code{-gnatw} switch are generated by the
9125 front end of the compiler. The GCC back end can provide additional warnings
9126 and they are controlled by the @code{-W} switch. Such warnings can be
9127 identified by the appearance of a string of the form @code{[-W@{xxx@}]} in the
9128 message which designates the @code{-W@emph{xxx}} switch that controls the message.
9129 The form with a single @emph{static_string_EXPRESSION} argument also works for these
9130 warnings, but the string must be a single full @code{-W@emph{xxx}} switch in this
9131 case. The above reference lists a few examples of these additional warnings.
9133 The specified warnings will be in effect until the end of the program
9134 or another pragma @code{Warnings} is encountered. The effect of the pragma is
9135 cumulative. Initially the set of warnings is the standard default set
9136 as possibly modified by compiler switches. Then each pragma Warning
9137 modifies this set of warnings as specified. This form of the pragma may
9138 also be used as a configuration pragma.
9140 The fourth form, with an @code{On|Off} parameter and a string, is used to
9141 control individual messages, based on their text. The string argument
9142 is a pattern that is used to match against the text of individual
9143 warning messages (not including the initial "warning: " tag).
9145 The pattern may contain asterisks, which match zero or more characters in
9146 the message. For example, you can use
9147 @code{pragma Warnings (Off, "bits of*unused")} to suppress the warning
9148 message @code{warning: 960 bits of "a" unused}. No other regular
9149 expression notations are permitted. All characters other than asterisk in
9150 these three specific cases are treated as literal characters in the match.
9151 The match is case insensitive, for example XYZ matches xyz.
9153 Note that the pattern matches if it occurs anywhere within the warning
9154 message string (it is not necessary to put an asterisk at the start and
9155 the end of the message, since this is implied).
9157 The above use of patterns to match the message applies only to warning
9158 messages generated by the front end. This form of the pragma with a string
9159 argument can also be used to control warnings provided by the back end and
9160 mentioned above. By using a single full @code{-W@emph{xxx}} switch in the pragma,
9161 such warnings can be turned on and off.
9163 There are two ways to use the pragma in this form. The OFF form can be used
9164 as a configuration pragma. The effect is to suppress all warnings (if any)
9165 that match the pattern string throughout the compilation (or match the
9166 -W switch in the back end case).
9168 The second usage is to suppress a warning locally, and in this case, two
9169 pragmas must appear in sequence:
9172 pragma Warnings (Off, Pattern);
9173 ... code where given warning is to be suppressed
9174 pragma Warnings (On, Pattern);
9177 In this usage, the pattern string must match in the Off and On
9178 pragmas, and (if @emph{-gnatw.w} is given) at least one matching
9179 warning must be suppressed.
9181 Note: if the ON form is not found, then the effect of the OFF form extends
9182 until the end of the file (pragma Warnings is purely textual, so its effect
9183 does not stop at the end of the enclosing scope).
9185 Note: to write a string that will match any warning, use the string
9186 @code{"***"}. It will not work to use a single asterisk or two
9187 asterisks since this looks like an operator name. This form with three
9188 asterisks is similar in effect to specifying @code{pragma Warnings (Off)} except (if @code{-gnatw.w} is given) that a matching
9189 @code{pragma Warnings (On, "***")} will be required. This can be
9190 helpful in avoiding forgetting to turn warnings back on.
9192 Note: the debug flag @code{-gnatd.i} can be
9193 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
9194 be useful in checking whether obsolete pragmas in existing programs are hiding
9197 Note: pragma Warnings does not affect the processing of style messages. See
9198 separate entry for pragma Style_Checks for control of style messages.
9200 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
9201 use the version of the pragma with a @code{TOOL_NAME} parameter.
9203 If present, @code{TOOL_NAME} is the name of a tool, currently either @code{GNAT} for the
9204 compiler or @code{GNATprove} for the formal verification tool. A given tool only
9205 takes into account pragma Warnings that do not specify a tool name, or that
9206 specify the matching tool name. This makes it possible to disable warnings
9207 selectively for each tool, and as a consequence to detect useless pragma
9208 Warnings with switch @code{-gnatw.w}.
9210 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
9211 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{123}
9212 @section Pragma Weak_External
9218 pragma Weak_External ([Entity =>] LOCAL_NAME);
9221 @code{LOCAL_NAME} must refer to an object that is declared at the library
9222 level. This pragma specifies that the given entity should be marked as a
9223 weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
9224 in GNU C and causes @code{LOCAL_NAME} to be emitted as a weak symbol instead
9225 of a regular symbol, that is to say a symbol that does not have to be
9226 resolved by the linker if used in conjunction with a pragma Import.
9228 When a weak symbol is not resolved by the linker, its address is set to
9229 zero. This is useful in writing interfaces to external modules that may
9230 or may not be linked in the final executable, for example depending on
9231 configuration settings.
9233 If a program references at run time an entity to which this pragma has been
9234 applied, and the corresponding symbol was not resolved at link time, then
9235 the execution of the program is erroneous. It is not erroneous to take the
9236 Address of such an entity, for example to guard potential references,
9237 as shown in the example below.
9239 Some file formats do not support weak symbols so not all target machines
9240 support this pragma.
9243 -- Example of the use of pragma Weak_External
9245 package External_Module is
9247 pragma Import (C, key);
9248 pragma Weak_External (key);
9249 function Present return boolean;
9250 end External_Module;
9252 with System; use System;
9253 package body External_Module is
9254 function Present return boolean is
9256 return key'Address /= System.Null_Address;
9258 end External_Module;
9261 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
9262 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{124}
9263 @section Pragma Wide_Character_Encoding
9269 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
9272 This pragma specifies the wide character encoding to be used in program
9273 source text appearing subsequently. It is a configuration pragma, but may
9274 also be used at any point that a pragma is allowed, and it is permissible
9275 to have more than one such pragma in a file, allowing multiple encodings
9276 to appear within the same file.
9278 However, note that the pragma cannot immediately precede the relevant
9279 wide character, because then the previous encoding will still be in
9280 effect, causing "illegal character" errors.
9282 The argument can be an identifier or a character literal. In the identifier
9283 case, it is one of @code{HEX}, @code{UPPER}, @code{SHIFT_JIS},
9284 @code{EUC}, @code{UTF8}, or @code{BRACKETS}. In the character literal
9285 case it is correspondingly one of the characters @code{h}, @code{u},
9286 @code{s}, @code{e}, @code{8}, or @code{b}.
9288 Note that when the pragma is used within a file, it affects only the
9289 encoding within that file, and does not affect withed units, specs,
9292 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
9293 @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}
9294 @chapter Implementation Defined Aspects
9297 Ada defines (throughout the Ada 2012 reference manual, summarized
9298 in Annex K) a set of aspects that can be specified for certain entities.
9299 These language defined aspects are implemented in GNAT in Ada 2012 mode
9300 and work as described in the Ada 2012 Reference Manual.
9302 In addition, Ada 2012 allows implementations to define additional aspects
9303 whose meaning is defined by the implementation. GNAT provides
9304 a number of these implementation-defined aspects which can be used
9305 to extend and enhance the functionality of the compiler. This section of
9306 the GNAT reference manual describes these additional aspects.
9308 Note that any program using these aspects may not be portable to
9309 other compilers (although GNAT implements this set of aspects on all
9310 platforms). Therefore if portability to other compilers is an important
9311 consideration, you should minimize the use of these aspects.
9313 Note that for many of these aspects, the effect is essentially similar
9314 to the use of a pragma or attribute specification with the same name
9315 applied to the entity. For example, if we write:
9318 type R is range 1 .. 100
9319 with Value_Size => 10;
9322 then the effect is the same as:
9325 type R is range 1 .. 100;
9326 for R'Value_Size use 10;
9332 type R is new Integer
9333 with Shared => True;
9336 then the effect is the same as:
9339 type R is new Integer;
9343 In the documentation below, such cases are simply marked
9344 as being boolean aspects equivalent to the corresponding pragma
9345 or attribute definition clause.
9348 * Aspect Abstract_State::
9350 * Aspect Async_Readers::
9351 * Aspect Async_Writers::
9352 * Aspect Constant_After_Elaboration::
9353 * Aspect Contract_Cases::
9355 * Aspect Default_Initial_Condition::
9356 * Aspect Dimension::
9357 * Aspect Dimension_System::
9358 * Aspect Disable_Controlled::
9359 * Aspect Effective_Reads::
9360 * Aspect Effective_Writes::
9361 * Aspect Extensions_Visible::
9362 * Aspect Favor_Top_Level::
9365 * Aspect Initial_Condition::
9366 * Aspect Initializes::
9367 * Aspect Inline_Always::
9368 * Aspect Invariant::
9369 * Aspect Invariant'Class::
9371 * Aspect Linker_Section::
9372 * Aspect Lock_Free::
9373 * Aspect Max_Queue_Length::
9374 * Aspect No_Caching::
9375 * Aspect No_Elaboration_Code_All::
9376 * Aspect No_Inline::
9377 * Aspect No_Tagged_Streams::
9378 * Aspect Object_Size::
9379 * Aspect Obsolescent::
9381 * Aspect Persistent_BSS::
9382 * Aspect Predicate::
9383 * Aspect Pure_Function::
9384 * Aspect Refined_Depends::
9385 * Aspect Refined_Global::
9386 * Aspect Refined_Post::
9387 * Aspect Refined_State::
9388 * Aspect Remote_Access_Type::
9389 * Aspect Secondary_Stack_Size::
9390 * Aspect Scalar_Storage_Order::
9392 * Aspect Simple_Storage_Pool::
9393 * Aspect Simple_Storage_Pool_Type::
9394 * Aspect SPARK_Mode::
9395 * Aspect Suppress_Debug_Info::
9396 * Aspect Suppress_Initialization::
9397 * Aspect Test_Case::
9398 * Aspect Thread_Local_Storage::
9399 * Aspect Universal_Aliasing::
9400 * Aspect Universal_Data::
9401 * Aspect Unmodified::
9402 * Aspect Unreferenced::
9403 * Aspect Unreferenced_Objects::
9404 * Aspect Value_Size::
9405 * Aspect Volatile_Full_Access::
9406 * Aspect Volatile_Function::
9411 @node Aspect Abstract_State,Aspect Annotate,,Implementation Defined Aspects
9412 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{128}
9413 @section Aspect Abstract_State
9416 @geindex Abstract_State
9418 This aspect is equivalent to @ref{1c,,pragma Abstract_State}.
9420 @node Aspect Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
9421 @anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{129}
9422 @section Aspect Annotate
9427 There are three forms of this aspect (where ID is an identifier,
9428 and ARG is a general expression),
9429 corresponding to @ref{2a,,pragma Annotate}.
9434 @item @emph{Annotate => ID}
9436 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9438 @item @emph{Annotate => (ID)}
9440 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9442 @item @emph{Annotate => (ID ,ID @{, ARG@})}
9444 Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
9447 @node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
9448 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{12a}
9449 @section Aspect Async_Readers
9452 @geindex Async_Readers
9454 This boolean aspect is equivalent to @ref{31,,pragma Async_Readers}.
9456 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
9457 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{12b}
9458 @section Aspect Async_Writers
9461 @geindex Async_Writers
9463 This boolean aspect is equivalent to @ref{34,,pragma Async_Writers}.
9465 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
9466 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{12c}
9467 @section Aspect Constant_After_Elaboration
9470 @geindex Constant_After_Elaboration
9472 This aspect is equivalent to @ref{45,,pragma Constant_After_Elaboration}.
9474 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
9475 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{12d}
9476 @section Aspect Contract_Cases
9479 @geindex Contract_Cases
9481 This aspect is equivalent to @ref{47,,pragma Contract_Cases}, the sequence
9482 of clauses being enclosed in parentheses so that syntactically it is an
9485 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
9486 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{12e}
9487 @section Aspect Depends
9492 This aspect is equivalent to @ref{56,,pragma Depends}.
9494 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
9495 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{12f}
9496 @section Aspect Default_Initial_Condition
9499 @geindex Default_Initial_Condition
9501 This aspect is equivalent to @ref{51,,pragma Default_Initial_Condition}.
9503 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
9504 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{130}
9505 @section Aspect Dimension
9510 The @code{Dimension} aspect is used to specify the dimensions of a given
9511 subtype of a dimensioned numeric type. The aspect also specifies a symbol
9512 used when doing formatted output of dimensioned quantities. The syntax is:
9516 ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
9518 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
9522 | others => RATIONAL
9523 | DISCRETE_CHOICE_LIST => RATIONAL
9525 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
9528 This aspect can only be applied to a subtype whose parent type has
9529 a @code{Dimension_System} aspect. The aspect must specify values for
9530 all dimensions of the system. The rational values are the powers of the
9531 corresponding dimensions that are used by the compiler to verify that
9532 physical (numeric) computations are dimensionally consistent. For example,
9533 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
9534 For further examples of the usage
9535 of this aspect, see package @code{System.Dim.Mks}.
9536 Note that when the dimensioned type is an integer type, then any
9537 dimension value must be an integer literal.
9539 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
9540 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{131}
9541 @section Aspect Dimension_System
9544 @geindex Dimension_System
9546 The @code{Dimension_System} aspect is used to define a system of
9547 dimensions that will be used in subsequent subtype declarations with
9548 @code{Dimension} aspects that reference this system. The syntax is:
9551 with Dimension_System => (DIMENSION @{, DIMENSION@});
9553 DIMENSION ::= ([Unit_Name =>] IDENTIFIER,
9554 [Unit_Symbol =>] SYMBOL,
9555 [Dim_Symbol =>] SYMBOL)
9557 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
9560 This aspect is applied to a type, which must be a numeric derived type
9561 (typically a floating-point type), that
9562 will represent values within the dimension system. Each @code{DIMENSION}
9563 corresponds to one particular dimension. A maximum of 7 dimensions may
9564 be specified. @code{Unit_Name} is the name of the dimension (for example
9565 @code{Meter}). @code{Unit_Symbol} is the shorthand used for quantities
9566 of this dimension (for example @code{m} for @code{Meter}).
9567 @code{Dim_Symbol} gives
9568 the identification within the dimension system (typically this is a
9569 single letter, e.g. @code{L} standing for length for unit name @code{Meter}).
9570 The @code{Unit_Symbol} is used in formatted output of dimensioned quantities.
9571 The @code{Dim_Symbol} is used in error messages when numeric operations have
9572 inconsistent dimensions.
9574 GNAT provides the standard definition of the International MKS system in
9575 the run-time package @code{System.Dim.Mks}. You can easily define
9576 similar packages for cgs units or British units, and define conversion factors
9577 between values in different systems. The MKS system is characterized by the
9581 type Mks_Type is new Long_Long_Float with
9582 Dimension_System => (
9583 (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'),
9584 (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'),
9585 (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'),
9586 (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'),
9587 (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => '@@'),
9588 (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'),
9589 (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J'));
9592 Note that in the above type definition, we use the @code{at} symbol (@code{@@}) to
9593 represent a theta character (avoiding the use of extended Latin-1
9594 characters in this context).
9596 See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
9597 Guide for detailed examples of use of the dimension system.
9599 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
9600 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{132}
9601 @section Aspect Disable_Controlled
9604 @geindex Disable_Controlled
9606 The aspect @code{Disable_Controlled} is defined for controlled record types. If
9607 active, this aspect causes suppression of all related calls to @code{Initialize},
9608 @code{Adjust}, and @code{Finalize}. The intended use is for conditional compilation,
9609 where for example you might want a record to be controlled or not depending on
9610 whether some run-time check is enabled or suppressed.
9612 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9613 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{133}
9614 @section Aspect Effective_Reads
9617 @geindex Effective_Reads
9619 This aspect is equivalent to @ref{5c,,pragma Effective_Reads}.
9621 @node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
9622 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{134}
9623 @section Aspect Effective_Writes
9626 @geindex Effective_Writes
9628 This aspect is equivalent to @ref{5e,,pragma Effective_Writes}.
9630 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
9631 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{135}
9632 @section Aspect Extensions_Visible
9635 @geindex Extensions_Visible
9637 This aspect is equivalent to @ref{6a,,pragma Extensions_Visible}.
9639 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9640 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{136}
9641 @section Aspect Favor_Top_Level
9644 @geindex Favor_Top_Level
9646 This boolean aspect is equivalent to @ref{6f,,pragma Favor_Top_Level}.
9648 @node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects
9649 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{137}
9650 @section Aspect Ghost
9655 This aspect is equivalent to @ref{72,,pragma Ghost}.
9657 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects
9658 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{138}
9659 @section Aspect Global
9664 This aspect is equivalent to @ref{74,,pragma Global}.
9666 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9667 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{139}
9668 @section Aspect Initial_Condition
9671 @geindex Initial_Condition
9673 This aspect is equivalent to @ref{82,,pragma Initial_Condition}.
9675 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9676 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{13a}
9677 @section Aspect Initializes
9680 @geindex Initializes
9682 This aspect is equivalent to @ref{84,,pragma Initializes}.
9684 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9685 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{13b}
9686 @section Aspect Inline_Always
9689 @geindex Inline_Always
9691 This boolean aspect is equivalent to @ref{87,,pragma Inline_Always}.
9693 @node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
9694 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{13c}
9695 @section Aspect Invariant
9700 This aspect is equivalent to @ref{8e,,pragma Invariant}. It is a
9701 synonym for the language defined aspect @code{Type_Invariant} except
9702 that it is separately controllable using pragma @code{Assertion_Policy}.
9704 @node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9705 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{13d}
9706 @section Aspect Invariant'Class
9709 @geindex Invariant'Class
9711 This aspect is equivalent to @ref{106,,pragma Type_Invariant_Class}. It is a
9712 synonym for the language defined aspect @code{Type_Invariant'Class} except
9713 that it is separately controllable using pragma @code{Assertion_Policy}.
9715 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
9716 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{13e}
9717 @section Aspect Iterable
9722 This aspect provides a light-weight mechanism for loops and quantified
9723 expressions over container types, without the overhead imposed by the tampering
9724 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9725 with six named components, of which the last three are optional: @code{First},
9726 @code{Next}, @code{Has_Element}, @code{Element}, @code{Last}, and @code{Previous}.
9727 When only the first three components are specified, only the
9728 @code{for .. in} form of iteration over cursors is available. When @code{Element}
9729 is specified, both this form and the @code{for .. of} form of iteration over
9730 elements are available. If the last two components are specified, reverse
9731 iterations over the container can be specified (analogous to what can be done
9732 over predefined containers that support the @code{Reverse_Iterator} interface).
9733 The following is a typical example of use:
9736 type List is private with
9737 Iterable => (First => First_Cursor,
9739 Has_Element => Cursor_Has_Element,
9740 [Element => Get_Element]);
9747 The value denoted by @code{First} must denote a primitive operation of the
9748 container type that returns a @code{Cursor}, which must a be a type declared in
9749 the container package or visible from it. For example:
9753 function First_Cursor (Cont : Container) return Cursor;
9760 The value of @code{Next} is a primitive operation of the container type that takes
9761 both a container and a cursor and yields a cursor. For example:
9765 function Advance (Cont : Container; Position : Cursor) return Cursor;
9772 The value of @code{Has_Element} is a primitive operation of the container type
9773 that takes both a container and a cursor and yields a boolean. For example:
9777 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9784 The value of @code{Element} is a primitive operation of the container type that
9785 takes both a container and a cursor and yields an @code{Element_Type}, which must
9786 be a type declared in the container package or visible from it. For example:
9790 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9793 This aspect is used in the GNAT-defined formal container packages.
9795 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
9796 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{13f}
9797 @section Aspect Linker_Section
9800 @geindex Linker_Section
9802 This aspect is equivalent to @ref{96,,pragma Linker_Section}.
9804 @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects
9805 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{140}
9806 @section Aspect Lock_Free
9811 This boolean aspect is equivalent to @ref{98,,pragma Lock_Free}.
9813 @node Aspect Max_Queue_Length,Aspect No_Caching,Aspect Lock_Free,Implementation Defined Aspects
9814 @anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{141}
9815 @section Aspect Max_Queue_Length
9818 @geindex Max_Queue_Length
9820 This aspect is equivalent to @ref{a0,,pragma Max_Queue_Length}.
9822 @node Aspect No_Caching,Aspect No_Elaboration_Code_All,Aspect Max_Queue_Length,Implementation Defined Aspects
9823 @anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{142}
9824 @section Aspect No_Caching
9829 This boolean aspect is equivalent to @ref{a2,,pragma No_Caching}.
9831 @node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect No_Caching,Implementation Defined Aspects
9832 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{143}
9833 @section Aspect No_Elaboration_Code_All
9836 @geindex No_Elaboration_Code_All
9838 This aspect is equivalent to @ref{a6,,pragma No_Elaboration_Code_All}
9841 @node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9842 @anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{144}
9843 @section Aspect No_Inline
9848 This boolean aspect is equivalent to @ref{a9,,pragma No_Inline}.
9850 @node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Inline,Implementation Defined Aspects
9851 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{145}
9852 @section Aspect No_Tagged_Streams
9855 @geindex No_Tagged_Streams
9857 This aspect is equivalent to @ref{ac,,pragma No_Tagged_Streams} with an
9858 argument specifying a root tagged type (thus this aspect can only be
9859 applied to such a type).
9861 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
9862 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{146}
9863 @section Aspect Object_Size
9866 @geindex Object_Size
9868 This aspect is equivalent to @ref{147,,attribute Object_Size}.
9870 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9871 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{148}
9872 @section Aspect Obsolescent
9875 @geindex Obsolsecent
9877 This aspect is equivalent to @ref{af,,pragma Obsolescent}. Note that the
9878 evaluation of this aspect happens at the point of occurrence, it is not
9879 delayed until the freeze point.
9881 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9882 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{149}
9883 @section Aspect Part_Of
9888 This aspect is equivalent to @ref{b7,,pragma Part_Of}.
9890 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9891 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{14a}
9892 @section Aspect Persistent_BSS
9895 @geindex Persistent_BSS
9897 This boolean aspect is equivalent to @ref{ba,,pragma Persistent_BSS}.
9899 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9900 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{14b}
9901 @section Aspect Predicate
9906 This aspect is equivalent to @ref{c2,,pragma Predicate}. It is thus
9907 similar to the language defined aspects @code{Dynamic_Predicate}
9908 and @code{Static_Predicate} except that whether the resulting
9909 predicate is static or dynamic is controlled by the form of the
9910 expression. It is also separately controllable using pragma
9911 @code{Assertion_Policy}.
9913 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9914 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{14c}
9915 @section Aspect Pure_Function
9918 @geindex Pure_Function
9920 This boolean aspect is equivalent to @ref{ce,,pragma Pure_Function}.
9922 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
9923 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{14d}
9924 @section Aspect Refined_Depends
9927 @geindex Refined_Depends
9929 This aspect is equivalent to @ref{d2,,pragma Refined_Depends}.
9931 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
9932 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{14e}
9933 @section Aspect Refined_Global
9936 @geindex Refined_Global
9938 This aspect is equivalent to @ref{d4,,pragma Refined_Global}.
9940 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
9941 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{14f}
9942 @section Aspect Refined_Post
9945 @geindex Refined_Post
9947 This aspect is equivalent to @ref{d6,,pragma Refined_Post}.
9949 @node Aspect Refined_State,Aspect Remote_Access_Type,Aspect Refined_Post,Implementation Defined Aspects
9950 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{150}
9951 @section Aspect Refined_State
9954 @geindex Refined_State
9956 This aspect is equivalent to @ref{d8,,pragma Refined_State}.
9958 @node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Refined_State,Implementation Defined Aspects
9959 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{151}
9960 @section Aspect Remote_Access_Type
9963 @geindex Remote_Access_Type
9965 This aspect is equivalent to @ref{dc,,pragma Remote_Access_Type}.
9967 @node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects
9968 @anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{152}
9969 @section Aspect Secondary_Stack_Size
9972 @geindex Secondary_Stack_Size
9974 This aspect is equivalent to @ref{e1,,pragma Secondary_Stack_Size}.
9976 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects
9977 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{153}
9978 @section Aspect Scalar_Storage_Order
9981 @geindex Scalar_Storage_Order
9983 This aspect is equivalent to a @ref{154,,attribute Scalar_Storage_Order}.
9985 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
9986 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{155}
9987 @section Aspect Shared
9992 This boolean aspect is equivalent to @ref{e4,,pragma Shared}
9993 and is thus a synonym for aspect @code{Atomic}.
9995 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
9996 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{156}
9997 @section Aspect Simple_Storage_Pool
10000 @geindex Simple_Storage_Pool
10002 This aspect is equivalent to @ref{e9,,attribute Simple_Storage_Pool}.
10004 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
10005 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{157}
10006 @section Aspect Simple_Storage_Pool_Type
10009 @geindex Simple_Storage_Pool_Type
10011 This boolean aspect is equivalent to @ref{e7,,pragma Simple_Storage_Pool_Type}.
10013 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
10014 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{158}
10015 @section Aspect SPARK_Mode
10018 @geindex SPARK_Mode
10020 This aspect is equivalent to @ref{ef,,pragma SPARK_Mode} and
10021 may be specified for either or both of the specification and body
10022 of a subprogram or package.
10024 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
10025 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{159}
10026 @section Aspect Suppress_Debug_Info
10029 @geindex Suppress_Debug_Info
10031 This boolean aspect is equivalent to @ref{f7,,pragma Suppress_Debug_Info}.
10033 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
10034 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{15a}
10035 @section Aspect Suppress_Initialization
10038 @geindex Suppress_Initialization
10040 This boolean aspect is equivalent to @ref{fb,,pragma Suppress_Initialization}.
10042 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
10043 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{15b}
10044 @section Aspect Test_Case
10049 This aspect is equivalent to @ref{fe,,pragma Test_Case}.
10051 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
10052 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{15c}
10053 @section Aspect Thread_Local_Storage
10056 @geindex Thread_Local_Storage
10058 This boolean aspect is equivalent to @ref{100,,pragma Thread_Local_Storage}.
10060 @node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
10061 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{15d}
10062 @section Aspect Universal_Aliasing
10065 @geindex Universal_Aliasing
10067 This boolean aspect is equivalent to @ref{10a,,pragma Universal_Aliasing}.
10069 @node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
10070 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{15e}
10071 @section Aspect Universal_Data
10074 @geindex Universal_Data
10076 This aspect is equivalent to @ref{10c,,pragma Universal_Data}.
10078 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
10079 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{15f}
10080 @section Aspect Unmodified
10083 @geindex Unmodified
10085 This boolean aspect is equivalent to @ref{10f,,pragma Unmodified}.
10087 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
10088 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{160}
10089 @section Aspect Unreferenced
10092 @geindex Unreferenced
10094 This boolean aspect is equivalent to @ref{110,,pragma Unreferenced}. Note that
10095 in the case of formal parameters, it is not permitted to have aspects for
10096 a formal parameter, so in this case the pragma form must be used.
10098 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
10099 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{161}
10100 @section Aspect Unreferenced_Objects
10103 @geindex Unreferenced_Objects
10105 This boolean aspect is equivalent to @ref{112,,pragma Unreferenced_Objects}.
10107 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
10108 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{162}
10109 @section Aspect Value_Size
10112 @geindex Value_Size
10114 This aspect is equivalent to @ref{163,,attribute Value_Size}.
10116 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
10117 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{164}
10118 @section Aspect Volatile_Full_Access
10121 @geindex Volatile_Full_Access
10123 This boolean aspect is equivalent to @ref{11d,,pragma Volatile_Full_Access}.
10125 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
10126 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{165}
10127 @section Aspect Volatile_Function
10130 @geindex Volatile_Function
10132 This boolean aspect is equivalent to @ref{11f,,pragma Volatile_Function}.
10134 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
10135 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{166}
10136 @section Aspect Warnings
10141 This aspect is equivalent to the two argument form of @ref{121,,pragma Warnings},
10142 where the first argument is @code{ON} or @code{OFF} and the second argument
10145 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
10146 @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}
10147 @chapter Implementation Defined Attributes
10150 Ada defines (throughout the Ada reference manual,
10151 summarized in Annex K),
10152 a set of attributes that provide useful additional functionality in all
10153 areas of the language. These language defined attributes are implemented
10154 in GNAT and work as described in the Ada Reference Manual.
10156 In addition, Ada allows implementations to define additional
10157 attributes whose meaning is defined by the implementation. GNAT provides
10158 a number of these implementation-dependent attributes which can be used
10159 to extend and enhance the functionality of the compiler. This section of
10160 the GNAT reference manual describes these additional attributes. It also
10161 describes additional implementation-dependent features of standard
10162 language-defined attributes.
10164 Note that any program using these attributes may not be portable to
10165 other compilers (although GNAT implements this set of attributes on all
10166 platforms). Therefore if portability to other compilers is an important
10167 consideration, you should minimize the use of these attributes.
10170 * Attribute Abort_Signal::
10171 * Attribute Address_Size::
10172 * Attribute Asm_Input::
10173 * Attribute Asm_Output::
10174 * Attribute Atomic_Always_Lock_Free::
10176 * Attribute Bit_Position::
10177 * Attribute Code_Address::
10178 * Attribute Compiler_Version::
10179 * Attribute Constrained::
10180 * Attribute Default_Bit_Order::
10181 * Attribute Default_Scalar_Storage_Order::
10182 * Attribute Deref::
10183 * Attribute Descriptor_Size::
10184 * Attribute Elaborated::
10185 * Attribute Elab_Body::
10186 * Attribute Elab_Spec::
10187 * Attribute Elab_Subp_Body::
10189 * Attribute Enabled::
10190 * Attribute Enum_Rep::
10191 * Attribute Enum_Val::
10192 * Attribute Epsilon::
10193 * Attribute Fast_Math::
10194 * Attribute Finalization_Size::
10195 * Attribute Fixed_Value::
10196 * Attribute From_Any::
10197 * Attribute Has_Access_Values::
10198 * Attribute Has_Discriminants::
10200 * Attribute Integer_Value::
10201 * Attribute Invalid_Value::
10202 * Attribute Iterable::
10203 * Attribute Large::
10204 * Attribute Library_Level::
10205 * Attribute Lock_Free::
10206 * Attribute Loop_Entry::
10207 * Attribute Machine_Size::
10208 * Attribute Mantissa::
10209 * Attribute Maximum_Alignment::
10210 * Attribute Mechanism_Code::
10211 * Attribute Null_Parameter::
10212 * Attribute Object_Size::
10214 * Attribute Passed_By_Reference::
10215 * Attribute Pool_Address::
10216 * Attribute Range_Length::
10217 * Attribute Restriction_Set::
10218 * Attribute Result::
10219 * Attribute Safe_Emax::
10220 * Attribute Safe_Large::
10221 * Attribute Safe_Small::
10222 * Attribute Scalar_Storage_Order::
10223 * Attribute Simple_Storage_Pool::
10224 * Attribute Small::
10225 * Attribute Storage_Unit::
10226 * Attribute Stub_Type::
10227 * Attribute System_Allocator_Alignment::
10228 * Attribute Target_Name::
10229 * Attribute To_Address::
10230 * Attribute To_Any::
10231 * Attribute Type_Class::
10232 * Attribute Type_Key::
10233 * Attribute TypeCode::
10234 * Attribute Unconstrained_Array::
10235 * Attribute Universal_Literal_String::
10236 * Attribute Unrestricted_Access::
10237 * Attribute Update::
10238 * Attribute Valid_Scalars::
10239 * Attribute VADS_Size::
10240 * Attribute Value_Size::
10241 * Attribute Wchar_T_Size::
10242 * Attribute Word_Size::
10246 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
10247 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{169}
10248 @section Attribute Abort_Signal
10251 @geindex Abort_Signal
10253 @code{Standard'Abort_Signal} (@code{Standard} is the only allowed
10254 prefix) provides the entity for the special exception used to signal
10255 task abort or asynchronous transfer of control. Normally this attribute
10256 should only be used in the tasking runtime (it is highly peculiar, and
10257 completely outside the normal semantics of Ada, for a user program to
10258 intercept the abort exception).
10260 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
10261 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{16a}
10262 @section Attribute Address_Size
10265 @geindex Size of `@w{`}Address`@w{`}
10267 @geindex Address_Size
10269 @code{Standard'Address_Size} (@code{Standard} is the only allowed
10270 prefix) is a static constant giving the number of bits in an
10271 @code{Address}. It is the same value as System.Address'Size,
10272 but has the advantage of being static, while a direct
10273 reference to System.Address'Size is nonstatic because Address
10276 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
10277 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{16b}
10278 @section Attribute Asm_Input
10283 The @code{Asm_Input} attribute denotes a function that takes two
10284 parameters. The first is a string, the second is an expression of the
10285 type designated by the prefix. The first (string) argument is required
10286 to be a static expression, and is the constraint for the parameter,
10287 (e.g., what kind of register is required). The second argument is the
10288 value to be used as the input argument. The possible values for the
10289 constant are the same as those used in the RTL, and are dependent on
10290 the configuration file used to built the GCC back end.
10291 @ref{16c,,Machine Code Insertions}
10293 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
10294 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{16d}
10295 @section Attribute Asm_Output
10298 @geindex Asm_Output
10300 The @code{Asm_Output} attribute denotes a function that takes two
10301 parameters. The first is a string, the second is the name of a variable
10302 of the type designated by the attribute prefix. The first (string)
10303 argument is required to be a static expression and designates the
10304 constraint for the parameter (e.g., what kind of register is
10305 required). The second argument is the variable to be updated with the
10306 result. The possible values for constraint are the same as those used in
10307 the RTL, and are dependent on the configuration file used to build the
10308 GCC back end. If there are no output operands, then this argument may
10309 either be omitted, or explicitly given as @code{No_Output_Operands}.
10310 @ref{16c,,Machine Code Insertions}
10312 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
10313 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{16e}
10314 @section Attribute Atomic_Always_Lock_Free
10317 @geindex Atomic_Always_Lock_Free
10319 The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type.
10320 The result is a Boolean value which is True if the type has discriminants,
10321 and False otherwise. The result indicate whether atomic operations are
10322 supported by the target for the given type.
10324 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
10325 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{16f}
10326 @section Attribute Bit
10331 @code{obj'Bit}, where @code{obj} is any object, yields the bit
10332 offset within the storage unit (byte) that contains the first bit of
10333 storage allocated for the object. The value of this attribute is of the
10334 type @emph{universal_integer}, and is always a non-negative number not
10335 exceeding the value of @code{System.Storage_Unit}.
10337 For an object that is a variable or a constant allocated in a register,
10338 the value is zero. (The use of this attribute does not force the
10339 allocation of a variable to memory).
10341 For an object that is a formal parameter, this attribute applies
10342 to either the matching actual parameter or to a copy of the
10343 matching actual parameter.
10345 For an access object the value is zero. Note that
10346 @code{obj.all'Bit} is subject to an @code{Access_Check} for the
10347 designated object. Similarly for a record component
10348 @code{X.C'Bit} is subject to a discriminant check and
10349 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
10350 are subject to index checks.
10352 This attribute is designed to be compatible with the DEC Ada 83 definition
10353 and implementation of the @code{Bit} attribute.
10355 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
10356 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{170}
10357 @section Attribute Bit_Position
10360 @geindex Bit_Position
10362 @code{R.C'Bit_Position}, where @code{R} is a record object and @code{C} is one
10363 of the fields of the record type, yields the bit
10364 offset within the record contains the first bit of
10365 storage allocated for the object. The value of this attribute is of the
10366 type @emph{universal_integer}. The value depends only on the field
10367 @code{C} and is independent of the alignment of
10368 the containing record @code{R}.
10370 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
10371 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{171}
10372 @section Attribute Code_Address
10375 @geindex Code_Address
10377 @geindex Subprogram address
10379 @geindex Address of subprogram code
10381 The @code{'Address}
10382 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
10383 intended effect seems to be to provide
10384 an address value which can be used to call the subprogram by means of
10385 an address clause as in the following example:
10391 for L'Address use K'Address;
10392 pragma Import (Ada, L);
10395 A call to @code{L} is then expected to result in a call to @code{K}.
10396 In Ada 83, where there were no access-to-subprogram values, this was
10397 a common work-around for getting the effect of an indirect call.
10398 GNAT implements the above use of @code{Address} and the technique
10399 illustrated by the example code works correctly.
10401 However, for some purposes, it is useful to have the address of the start
10402 of the generated code for the subprogram. On some architectures, this is
10403 not necessarily the same as the @code{Address} value described above.
10404 For example, the @code{Address} value may reference a subprogram
10405 descriptor rather than the subprogram itself.
10407 The @code{'Code_Address} attribute, which can only be applied to
10408 subprogram entities, always returns the address of the start of the
10409 generated code of the specified subprogram, which may or may not be
10410 the same value as is returned by the corresponding @code{'Address}
10413 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
10414 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{172}
10415 @section Attribute Compiler_Version
10418 @geindex Compiler_Version
10420 @code{Standard'Compiler_Version} (@code{Standard} is the only allowed
10421 prefix) yields a static string identifying the version of the compiler
10422 being used to compile the unit containing the attribute reference.
10424 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
10425 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{173}
10426 @section Attribute Constrained
10429 @geindex Constrained
10431 In addition to the usage of this attribute in the Ada RM, GNAT
10432 also permits the use of the @code{'Constrained} attribute
10433 in a generic template
10434 for any type, including types without discriminants. The value of this
10435 attribute in the generic instance when applied to a scalar type or a
10436 record type without discriminants is always @code{True}. This usage is
10437 compatible with older Ada compilers, including notably DEC Ada.
10439 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
10440 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{174}
10441 @section Attribute Default_Bit_Order
10444 @geindex Big endian
10446 @geindex Little endian
10448 @geindex Default_Bit_Order
10450 @code{Standard'Default_Bit_Order} (@code{Standard} is the only
10451 permissible prefix), provides the value @code{System.Default_Bit_Order}
10452 as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
10453 @code{Low_Order_First}). This is used to construct the definition of
10454 @code{Default_Bit_Order} in package @code{System}.
10456 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
10457 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{175}
10458 @section Attribute Default_Scalar_Storage_Order
10461 @geindex Big endian
10463 @geindex Little endian
10465 @geindex Default_Scalar_Storage_Order
10467 @code{Standard'Default_Scalar_Storage_Order} (@code{Standard} is the only
10468 permissible prefix), provides the current value of the default scalar storage
10469 order (as specified using pragma @code{Default_Scalar_Storage_Order}, or
10470 equal to @code{Default_Bit_Order} if unspecified) as a
10471 @code{System.Bit_Order} value. This is a static attribute.
10473 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
10474 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{176}
10475 @section Attribute Deref
10480 The attribute @code{typ'Deref(expr)} where @code{expr} is of type @code{System.Address} yields
10481 the variable of type @code{typ} that is located at the given address. It is similar
10482 to @code{(totyp (expr).all)}, where @code{totyp} is an unchecked conversion from address to
10483 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
10484 used on the left side of an assignment.
10486 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
10487 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{177}
10488 @section Attribute Descriptor_Size
10491 @geindex Descriptor
10493 @geindex Dope vector
10495 @geindex Descriptor_Size
10497 Nonstatic attribute @code{Descriptor_Size} returns the size in bits of the
10498 descriptor allocated for a type. The result is non-zero only for unconstrained
10499 array types and the returned value is of type universal integer. In GNAT, an
10500 array descriptor contains bounds information and is located immediately before
10501 the first element of the array.
10504 type Unconstr_Array is array (Positive range <>) of Boolean;
10505 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
10508 The attribute takes into account any additional padding due to type alignment.
10509 In the example above, the descriptor contains two values of type
10510 @code{Positive} representing the low and high bound. Since @code{Positive} has
10511 a size of 31 bits and an alignment of 4, the descriptor size is @code{2 * Positive'Size + 2} or 64 bits.
10513 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
10514 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{178}
10515 @section Attribute Elaborated
10518 @geindex Elaborated
10520 The prefix of the @code{'Elaborated} attribute must be a unit name. The
10521 value is a Boolean which indicates whether or not the given unit has been
10522 elaborated. This attribute is primarily intended for internal use by the
10523 generated code for dynamic elaboration checking, but it can also be used
10524 in user programs. The value will always be True once elaboration of all
10525 units has been completed. An exception is for units which need no
10526 elaboration, the value is always False for such units.
10528 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
10529 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{179}
10530 @section Attribute Elab_Body
10535 This attribute can only be applied to a program unit name. It returns
10536 the entity for the corresponding elaboration procedure for elaborating
10537 the body of the referenced unit. This is used in the main generated
10538 elaboration procedure by the binder and is not normally used in any
10539 other context. However, there may be specialized situations in which it
10540 is useful to be able to call this elaboration procedure from Ada code,
10541 e.g., if it is necessary to do selective re-elaboration to fix some
10544 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
10545 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{17a}
10546 @section Attribute Elab_Spec
10551 This attribute can only be applied to a program unit name. It returns
10552 the entity for the corresponding elaboration procedure for elaborating
10553 the spec of the referenced unit. This is used in the main
10554 generated elaboration procedure by the binder and is not normally used
10555 in any other context. However, there may be specialized situations in
10556 which it is useful to be able to call this elaboration procedure from
10557 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
10560 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
10561 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{17b}
10562 @section Attribute Elab_Subp_Body
10565 @geindex Elab_Subp_Body
10567 This attribute can only be applied to a library level subprogram
10568 name and is only allowed in CodePeer mode. It returns the entity
10569 for the corresponding elaboration procedure for elaborating the body
10570 of the referenced subprogram unit. This is used in the main generated
10571 elaboration procedure by the binder in CodePeer mode only and is unrecognized
10574 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
10575 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{17c}
10576 @section Attribute Emax
10579 @geindex Ada 83 attributes
10583 The @code{Emax} attribute is provided for compatibility with Ada 83. See
10584 the Ada 83 reference manual for an exact description of the semantics of
10587 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
10588 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{17d}
10589 @section Attribute Enabled
10594 The @code{Enabled} attribute allows an application program to check at compile
10595 time to see if the designated check is currently enabled. The prefix is a
10596 simple identifier, referencing any predefined check name (other than
10597 @code{All_Checks}) or a check name introduced by pragma Check_Name. If
10598 no argument is given for the attribute, the check is for the general state
10599 of the check, if an argument is given, then it is an entity name, and the
10600 check indicates whether an @code{Suppress} or @code{Unsuppress} has been
10601 given naming the entity (if not, then the argument is ignored).
10603 Note that instantiations inherit the check status at the point of the
10604 instantiation, so a useful idiom is to have a library package that
10605 introduces a check name with @code{pragma Check_Name}, and then contains
10606 generic packages or subprograms which use the @code{Enabled} attribute
10607 to see if the check is enabled. A user of this package can then issue
10608 a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
10609 the package or subprogram, controlling whether the check will be present.
10611 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
10612 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{17e}
10613 @section Attribute Enum_Rep
10616 @geindex Representation of enums
10620 For every enumeration subtype @code{S}, @code{S'Enum_Rep} denotes a
10621 function with the following spec:
10624 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
10627 It is also allowable to apply @code{Enum_Rep} directly to an object of an
10628 enumeration type or to a non-overloaded enumeration
10629 literal. In this case @code{S'Enum_Rep} is equivalent to
10630 @code{typ'Enum_Rep(S)} where @code{typ} is the type of the
10631 enumeration literal or object.
10633 The function returns the representation value for the given enumeration
10634 value. This will be equal to value of the @code{Pos} attribute in the
10635 absence of an enumeration representation clause. This is a static
10636 attribute (i.e.,:the result is static if the argument is static).
10638 @code{S'Enum_Rep} can also be used with integer types and objects,
10639 in which case it simply returns the integer value. The reason for this
10640 is to allow it to be used for @code{(<>)} discrete formal arguments in
10641 a generic unit that can be instantiated with either enumeration types
10642 or integer types. Note that if @code{Enum_Rep} is used on a modular
10643 type whose upper bound exceeds the upper bound of the largest signed
10644 integer type, and the argument is a variable, so that the universal
10645 integer calculation is done at run time, then the call to @code{Enum_Rep}
10646 may raise @code{Constraint_Error}.
10648 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10649 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{17f}
10650 @section Attribute Enum_Val
10653 @geindex Representation of enums
10657 For every enumeration subtype @code{S}, @code{S'Enum_Val} denotes a
10658 function with the following spec:
10661 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10664 The function returns the enumeration value whose representation matches the
10665 argument, or raises Constraint_Error if no enumeration literal of the type
10666 has the matching value.
10667 This will be equal to value of the @code{Val} attribute in the
10668 absence of an enumeration representation clause. This is a static
10669 attribute (i.e., the result is static if the argument is static).
10671 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10672 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{180}
10673 @section Attribute Epsilon
10676 @geindex Ada 83 attributes
10680 The @code{Epsilon} attribute is provided for compatibility with Ada 83. See
10681 the Ada 83 reference manual for an exact description of the semantics of
10684 @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
10685 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{181}
10686 @section Attribute Fast_Math
10691 @code{Standard'Fast_Math} (@code{Standard} is the only allowed
10692 prefix) yields a static Boolean value that is True if pragma
10693 @code{Fast_Math} is active, and False otherwise.
10695 @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
10696 @anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{182}
10697 @section Attribute Finalization_Size
10700 @geindex Finalization_Size
10702 The prefix of attribute @code{Finalization_Size} must be an object or
10703 a non-class-wide type. This attribute returns the size of any hidden data
10704 reserved by the compiler to handle finalization-related actions. The type of
10705 the attribute is @emph{universal_integer}.
10707 @code{Finalization_Size} yields a value of zero for a type with no controlled
10708 parts, an object whose type has no controlled parts, or an object of a
10709 class-wide type whose tag denotes a type with no controlled parts.
10711 Note that only heap-allocated objects contain finalization data.
10713 @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
10714 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{183}
10715 @section Attribute Fixed_Value
10718 @geindex Fixed_Value
10720 For every fixed-point type @code{S}, @code{S'Fixed_Value} denotes a
10721 function with the following specification:
10724 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10727 The value returned is the fixed-point value @code{V} such that:
10733 The effect is thus similar to first converting the argument to the
10734 integer type used to represent @code{S}, and then doing an unchecked
10735 conversion to the fixed-point type. The difference is
10736 that there are full range checks, to ensure that the result is in range.
10737 This attribute is primarily intended for use in implementation of the
10738 input-output functions for fixed-point values.
10740 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10741 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{184}
10742 @section Attribute From_Any
10747 This internal attribute is used for the generation of remote subprogram
10748 stubs in the context of the Distributed Systems Annex.
10750 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10751 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{185}
10752 @section Attribute Has_Access_Values
10755 @geindex Access values
10756 @geindex testing for
10758 @geindex Has_Access_Values
10760 The prefix of the @code{Has_Access_Values} attribute is a type. The result
10761 is a Boolean value which is True if the is an access type, or is a composite
10762 type with a component (at any nesting depth) that is an access type, and is
10764 The intended use of this attribute is in conjunction with generic
10765 definitions. If the attribute is applied to a generic private type, it
10766 indicates whether or not the corresponding actual type has access values.
10768 @node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
10769 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{186}
10770 @section Attribute Has_Discriminants
10773 @geindex Discriminants
10774 @geindex testing for
10776 @geindex Has_Discriminants
10778 The prefix of the @code{Has_Discriminants} attribute is a type. The result
10779 is a Boolean value which is True if the type has discriminants, and False
10780 otherwise. The intended use of this attribute is in conjunction with generic
10781 definitions. If the attribute is applied to a generic private type, it
10782 indicates whether or not the corresponding actual type has discriminants.
10784 @node Attribute Img,Attribute Integer_Value,Attribute Has_Discriminants,Implementation Defined Attributes
10785 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{187}
10786 @section Attribute Img
10791 The @code{Img} attribute differs from @code{Image} in that, while both can be
10792 applied directly to an object, @code{Img} cannot be applied to types.
10794 Example usage of the attribute:
10797 Put_Line ("X = " & X'Img);
10800 which has the same meaning as the more verbose:
10803 Put_Line ("X = " & T'Image (X));
10806 where @code{T} is the (sub)type of the object @code{X}.
10808 Note that technically, in analogy to @code{Image},
10809 @code{X'Img} returns a parameterless function
10810 that returns the appropriate string when called. This means that
10811 @code{X'Img} can be renamed as a function-returning-string, or used
10812 in an instantiation as a function parameter.
10814 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Img,Implementation Defined Attributes
10815 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{188}
10816 @section Attribute Integer_Value
10819 @geindex Integer_Value
10821 For every integer type @code{S}, @code{S'Integer_Value} denotes a
10822 function with the following spec:
10825 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10828 The value returned is the integer value @code{V}, such that:
10834 where @code{T} is the type of @code{Arg}.
10835 The effect is thus similar to first doing an unchecked conversion from
10836 the fixed-point type to its corresponding implementation type, and then
10837 converting the result to the target integer type. The difference is
10838 that there are full range checks, to ensure that the result is in range.
10839 This attribute is primarily intended for use in implementation of the
10840 standard input-output functions for fixed-point values.
10842 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
10843 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{189}
10844 @section Attribute Invalid_Value
10847 @geindex Invalid_Value
10849 For every scalar type S, S'Invalid_Value returns an undefined value of the
10850 type. If possible this value is an invalid representation for the type. The
10851 value returned is identical to the value used to initialize an otherwise
10852 uninitialized value of the type if pragma Initialize_Scalars is used,
10853 including the ability to modify the value with the binder -Sxx flag and
10854 relevant environment variables at run time.
10856 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
10857 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{18a}
10858 @section Attribute Iterable
10863 Equivalent to Aspect Iterable.
10865 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
10866 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{18b}
10867 @section Attribute Large
10870 @geindex Ada 83 attributes
10874 The @code{Large} attribute is provided for compatibility with Ada 83. See
10875 the Ada 83 reference manual for an exact description of the semantics of
10878 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
10879 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{18c}
10880 @section Attribute Library_Level
10883 @geindex Library_Level
10885 @code{P'Library_Level}, where P is an entity name,
10886 returns a Boolean value which is True if the entity is declared
10887 at the library level, and False otherwise. Note that within a
10888 generic instantition, the name of the generic unit denotes the
10889 instance, which means that this attribute can be used to test
10890 if a generic is instantiated at the library level, as shown
10897 pragma Compile_Time_Error
10898 (not Gen'Library_Level,
10899 "Gen can only be instantiated at library level");
10904 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
10905 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{18d}
10906 @section Attribute Lock_Free
10911 @code{P'Lock_Free}, where P is a protected object, returns True if a
10912 pragma @code{Lock_Free} applies to P.
10914 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
10915 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18e}
10916 @section Attribute Loop_Entry
10919 @geindex Loop_Entry
10924 X'Loop_Entry [(loop_name)]
10927 The @code{Loop_Entry} attribute is used to refer to the value that an
10928 expression had upon entry to a given loop in much the same way that the
10929 @code{Old} attribute in a subprogram postcondition can be used to refer
10930 to the value an expression had upon entry to the subprogram. The
10931 relevant loop is either identified by the given loop name, or it is the
10932 innermost enclosing loop when no loop name is given.
10934 A @code{Loop_Entry} attribute can only occur within a
10935 @code{Loop_Variant} or @code{Loop_Invariant} pragma. A common use of
10936 @code{Loop_Entry} is to compare the current value of objects with their
10937 initial value at loop entry, in a @code{Loop_Invariant} pragma.
10939 The effect of using @code{X'Loop_Entry} is the same as declaring
10940 a constant initialized with the initial value of @code{X} at loop
10941 entry. This copy is not performed if the loop is not entered, or if the
10942 corresponding pragmas are ignored or disabled.
10944 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
10945 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18f}
10946 @section Attribute Machine_Size
10949 @geindex Machine_Size
10951 This attribute is identical to the @code{Object_Size} attribute. It is
10952 provided for compatibility with the DEC Ada 83 attribute of this name.
10954 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
10955 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{190}
10956 @section Attribute Mantissa
10959 @geindex Ada 83 attributes
10963 The @code{Mantissa} attribute is provided for compatibility with Ada 83. See
10964 the Ada 83 reference manual for an exact description of the semantics of
10967 @node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
10968 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{191}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{192}
10969 @section Attribute Maximum_Alignment
10975 @geindex Maximum_Alignment
10977 @code{Standard'Maximum_Alignment} (@code{Standard} is the only
10978 permissible prefix) provides the maximum useful alignment value for the
10979 target. This is a static value that can be used to specify the alignment
10980 for an object, guaranteeing that it is properly aligned in all
10983 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
10984 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{193}
10985 @section Attribute Mechanism_Code
10988 @geindex Return values
10989 @geindex passing mechanism
10991 @geindex Parameters
10992 @geindex passing mechanism
10994 @geindex Mechanism_Code
10996 @code{func'Mechanism_Code} yields an integer code for the
10997 mechanism used for the result of function @code{func}, and
10998 @code{subprog'Mechanism_Code (n)} yields the mechanism
10999 used for formal parameter number @emph{n} (a static integer value, with 1
11000 meaning the first parameter) of subprogram @code{subprog}. The code returned is:
11014 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
11015 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{194}
11016 @section Attribute Null_Parameter
11019 @geindex Zero address
11022 @geindex Null_Parameter
11024 A reference @code{T'Null_Parameter} denotes an imaginary object of
11025 type or subtype @code{T} allocated at machine address zero. The attribute
11026 is allowed only as the default expression of a formal parameter, or as
11027 an actual expression of a subprogram call. In either case, the
11028 subprogram must be imported.
11030 The identity of the object is represented by the address zero in the
11031 argument list, independent of the passing mechanism (explicit or
11034 This capability is needed to specify that a zero address should be
11035 passed for a record or other composite object passed by reference.
11036 There is no way of indicating this without the @code{Null_Parameter}
11039 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
11040 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{147}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{195}
11041 @section Attribute Object_Size
11045 @geindex used for objects
11047 @geindex Object_Size
11049 The size of an object is not necessarily the same as the size of the type
11050 of an object. This is because by default object sizes are increased to be
11051 a multiple of the alignment of the object. For example,
11052 @code{Natural'Size} is
11053 31, but by default objects of type @code{Natural} will have a size of 32 bits.
11054 Similarly, a record containing an integer and a character:
11063 will have a size of 40 (that is @code{Rec'Size} will be 40). The
11064 alignment will be 4, because of the
11065 integer field, and so the default size of record objects for this type
11066 will be 64 (8 bytes).
11068 If the alignment of the above record is specified to be 1, then the
11069 object size will be 40 (5 bytes). This is true by default, and also
11070 an object size of 40 can be explicitly specified in this case.
11072 A consequence of this capability is that different object sizes can be
11073 given to subtypes that would otherwise be considered in Ada to be
11074 statically matching. But it makes no sense to consider such subtypes
11075 as statically matching. Consequently, GNAT adds a rule
11076 to the static matching rules that requires object sizes to match.
11077 Consider this example:
11080 1. procedure BadAVConvert is
11081 2. type R is new Integer;
11082 3. subtype R1 is R range 1 .. 10;
11083 4. subtype R2 is R range 1 .. 10;
11084 5. for R1'Object_Size use 8;
11085 6. for R2'Object_Size use 16;
11086 7. type R1P is access all R1;
11087 8. type R2P is access all R2;
11088 9. R1PV : R1P := new R1'(4);
11091 12. R2PV := R2P (R1PV);
11093 >>> target designated subtype not compatible with
11094 type "R1" defined at line 3
11099 In the absence of lines 5 and 6,
11100 types @code{R1} and @code{R2} statically match and
11101 hence the conversion on line 12 is legal. But since lines 5 and 6
11102 cause the object sizes to differ, GNAT considers that types
11103 @code{R1} and @code{R2} are not statically matching, and line 12
11104 generates the diagnostic shown above.
11106 Similar additional checks are performed in other contexts requiring
11107 statically matching subtypes.
11109 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
11110 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{196}
11111 @section Attribute Old
11116 In addition to the usage of @code{Old} defined in the Ada 2012 RM (usage
11117 within @code{Post} aspect), GNAT also permits the use of this attribute
11118 in implementation defined pragmas @code{Postcondition},
11119 @code{Contract_Cases} and @code{Test_Case}. Also usages of
11120 @code{Old} which would be illegal according to the Ada 2012 RM
11121 definition are allowed under control of
11122 implementation defined pragma @code{Unevaluated_Use_Of_Old}.
11124 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
11125 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{197}
11126 @section Attribute Passed_By_Reference
11129 @geindex Parameters
11130 @geindex when passed by reference
11132 @geindex Passed_By_Reference
11134 @code{typ'Passed_By_Reference} for any subtype @cite{typ} returns
11135 a value of type @code{Boolean} value that is @code{True} if the type is
11136 normally passed by reference and @code{False} if the type is normally
11137 passed by copy in calls. For scalar types, the result is always @code{False}
11138 and is static. For non-scalar types, the result is nonstatic.
11140 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
11141 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{198}
11142 @section Attribute Pool_Address
11145 @geindex Parameters
11146 @geindex when passed by reference
11148 @geindex Pool_Address
11150 @code{X'Pool_Address} for any object @code{X} returns the address
11151 of X within its storage pool. This is the same as
11152 @code{X'Address}, except that for an unconstrained array whose
11153 bounds are allocated just before the first component,
11154 @code{X'Pool_Address} returns the address of those bounds,
11155 whereas @code{X'Address} returns the address of the first
11158 Here, we are interpreting 'storage pool' broadly to mean
11159 @code{wherever the object is allocated}, which could be a
11160 user-defined storage pool,
11161 the global heap, on the stack, or in a static memory area.
11162 For an object created by @code{new}, @code{Ptr.all'Pool_Address} is
11163 what is passed to @code{Allocate} and returned from @code{Deallocate}.
11165 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
11166 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{199}
11167 @section Attribute Range_Length
11170 @geindex Range_Length
11172 @code{typ'Range_Length} for any discrete type @cite{typ} yields
11173 the number of values represented by the subtype (zero for a null
11174 range). The result is static for static subtypes. @code{Range_Length}
11175 applied to the index subtype of a one dimensional array always gives the
11176 same result as @code{Length} applied to the array itself.
11178 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
11179 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{19a}
11180 @section Attribute Restriction_Set
11183 @geindex Restriction_Set
11185 @geindex Restrictions
11187 This attribute allows compile time testing of restrictions that
11188 are currently in effect. It is primarily intended for specializing
11189 code in the run-time based on restrictions that are active (e.g.
11190 don't need to save fpt registers if restriction No_Floating_Point
11191 is known to be in effect), but can be used anywhere.
11193 There are two forms:
11196 System'Restriction_Set (partition_boolean_restriction_NAME)
11197 System'Restriction_Set (No_Dependence => library_unit_NAME);
11200 In the case of the first form, the only restriction names
11201 allowed are parameterless restrictions that are checked
11202 for consistency at bind time. For a complete list see the
11203 subtype @code{System.Rident.Partition_Boolean_Restrictions}.
11205 The result returned is True if the restriction is known to
11206 be in effect, and False if the restriction is known not to
11207 be in effect. An important guarantee is that the value of
11208 a Restriction_Set attribute is known to be consistent throughout
11209 all the code of a partition.
11211 This is trivially achieved if the entire partition is compiled
11212 with a consistent set of restriction pragmas. However, the
11213 compilation model does not require this. It is possible to
11214 compile one set of units with one set of pragmas, and another
11215 set of units with another set of pragmas. It is even possible
11216 to compile a spec with one set of pragmas, and then WITH the
11217 same spec with a different set of pragmas. Inconsistencies
11218 in the actual use of the restriction are checked at bind time.
11220 In order to achieve the guarantee of consistency for the
11221 Restriction_Set pragma, we consider that a use of the pragma
11222 that yields False is equivalent to a violation of the
11225 So for example if you write
11228 if System'Restriction_Set (No_Floating_Point) then
11235 And the result is False, so that the else branch is executed,
11236 you can assume that this restriction is not set for any unit
11237 in the partition. This is checked by considering this use of
11238 the restriction pragma to be a violation of the restriction
11239 No_Floating_Point. This means that no other unit can attempt
11240 to set this restriction (if some unit does attempt to set it,
11241 the binder will refuse to bind the partition).
11243 Technical note: The restriction name and the unit name are
11244 intepreted entirely syntactically, as in the corresponding
11245 Restrictions pragma, they are not analyzed semantically,
11246 so they do not have a type.
11248 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
11249 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{19b}
11250 @section Attribute Result
11255 @code{function'Result} can only be used with in a Postcondition pragma
11256 for a function. The prefix must be the name of the corresponding function. This
11257 is used to refer to the result of the function in the postcondition expression.
11258 For a further discussion of the use of this attribute and examples of its use,
11259 see the description of pragma Postcondition.
11261 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
11262 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{19c}
11263 @section Attribute Safe_Emax
11266 @geindex Ada 83 attributes
11270 The @code{Safe_Emax} attribute is provided for compatibility with Ada 83. See
11271 the Ada 83 reference manual for an exact description of the semantics of
11274 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
11275 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{19d}
11276 @section Attribute Safe_Large
11279 @geindex Ada 83 attributes
11281 @geindex Safe_Large
11283 The @code{Safe_Large} attribute is provided for compatibility with Ada 83. See
11284 the Ada 83 reference manual for an exact description of the semantics of
11287 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
11288 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{19e}
11289 @section Attribute Safe_Small
11292 @geindex Ada 83 attributes
11294 @geindex Safe_Small
11296 The @code{Safe_Small} attribute is provided for compatibility with Ada 83. See
11297 the Ada 83 reference manual for an exact description of the semantics of
11300 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
11301 @anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19f}@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{154}
11302 @section Attribute Scalar_Storage_Order
11305 @geindex Endianness
11307 @geindex Scalar storage order
11309 @geindex Scalar_Storage_Order
11311 For every array or record type @code{S}, the representation attribute
11312 @code{Scalar_Storage_Order} denotes the order in which storage elements
11313 that make up scalar components are ordered within S. The value given must
11314 be a static expression of type System.Bit_Order. The following is an example
11315 of the use of this feature:
11318 -- Component type definitions
11320 subtype Yr_Type is Natural range 0 .. 127;
11321 subtype Mo_Type is Natural range 1 .. 12;
11322 subtype Da_Type is Natural range 1 .. 31;
11324 -- Record declaration
11326 type Date is record
11327 Years_Since_1980 : Yr_Type;
11329 Day_Of_Month : Da_Type;
11332 -- Record representation clause
11334 for Date use record
11335 Years_Since_1980 at 0 range 0 .. 6;
11336 Month at 0 range 7 .. 10;
11337 Day_Of_Month at 0 range 11 .. 15;
11340 -- Attribute definition clauses
11342 for Date'Bit_Order use System.High_Order_First;
11343 for Date'Scalar_Storage_Order use System.High_Order_First;
11344 -- If Scalar_Storage_Order is specified, it must be consistent with
11345 -- Bit_Order, so it's best to always define the latter explicitly if
11346 -- the former is used.
11349 Other properties are as for the standard representation attribute @code{Bit_Order}
11350 defined by Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
11352 For a record type @code{T}, if @code{T'Scalar_Storage_Order} is
11353 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
11354 this means that if a @code{Scalar_Storage_Order} attribute definition
11355 clause is not confirming, then the type's @code{Bit_Order} shall be
11356 specified explicitly and set to the same value.
11358 Derived types inherit an explicitly set scalar storage order from their parent
11359 types. This may be overridden for the derived type by giving an explicit scalar
11360 storage order for it. However, for a record extension, the derived type must
11361 have the same scalar storage order as the parent type.
11363 A component of a record type that is itself a record or an array and that does
11364 not start and end on a byte boundary must have have the same scalar storage
11365 order as the record type. A component of a bit-packed array type that is itself
11366 a record or an array must have the same scalar storage order as the array type.
11368 No component of a type that has an explicit @code{Scalar_Storage_Order}
11369 attribute definition may be aliased.
11371 A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
11372 with a value equal to @code{System.Default_Bit_Order}) has no effect.
11374 If the opposite storage order is specified, then whenever the value of
11375 a scalar component of an object of type @code{S} is read, the storage
11376 elements of the enclosing machine scalar are first reversed (before
11377 retrieving the component value, possibly applying some shift and mask
11378 operatings on the enclosing machine scalar), and the opposite operation
11379 is done for writes.
11381 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
11382 are relaxed. Instead, the following rules apply:
11388 the underlying storage elements are those at positions
11389 @code{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
11392 the sequence of underlying storage elements shall have
11393 a size no greater than the largest machine scalar
11396 the enclosing machine scalar is defined as the smallest machine
11397 scalar starting at a position no greater than
11398 @code{position + first_bit / storage_element_size} and covering
11399 storage elements at least up to @code{position + (last_bit + storage_element_size - 1) / storage_element_size`}
11402 the position of the component is interpreted relative to that machine
11406 If no scalar storage order is specified for a type (either directly, or by
11407 inheritance in the case of a derived type), then the default is normally
11408 the native ordering of the target, but this default can be overridden using
11409 pragma @code{Default_Scalar_Storage_Order}.
11411 If a component of @code{T} is itself of a record or array type, the specfied
11412 @code{Scalar_Storage_Order} does @emph{not} apply to that nested type: an explicit
11413 attribute definition clause must be provided for the component type as well
11416 Note that the scalar storage order only affects the in-memory data
11417 representation. It has no effect on the representation used by stream
11420 Note that debuggers may be unable to display the correct value of scalar
11421 components of a type for which the opposite storage order is specified.
11423 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
11424 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e9}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{1a0}
11425 @section Attribute Simple_Storage_Pool
11428 @geindex Storage pool
11431 @geindex Simple storage pool
11433 @geindex Simple_Storage_Pool
11435 For every nonformal, nonderived access-to-object type @code{Acc}, the
11436 representation attribute @code{Simple_Storage_Pool} may be specified
11437 via an attribute_definition_clause (or by specifying the equivalent aspect):
11440 My_Pool : My_Simple_Storage_Pool_Type;
11442 type Acc is access My_Data_Type;
11444 for Acc'Simple_Storage_Pool use My_Pool;
11447 The name given in an attribute_definition_clause for the
11448 @code{Simple_Storage_Pool} attribute shall denote a variable of
11449 a 'simple storage pool type' (see pragma @cite{Simple_Storage_Pool_Type}).
11451 The use of this attribute is only allowed for a prefix denoting a type
11452 for which it has been specified. The type of the attribute is the type
11453 of the variable specified as the simple storage pool of the access type,
11454 and the attribute denotes that variable.
11456 It is illegal to specify both @code{Storage_Pool} and @code{Simple_Storage_Pool}
11457 for the same access type.
11459 If the @code{Simple_Storage_Pool} attribute has been specified for an access
11460 type, then applying the @code{Storage_Pool} attribute to the type is flagged
11461 with a warning and its evaluation raises the exception @code{Program_Error}.
11463 If the Simple_Storage_Pool attribute has been specified for an access
11464 type @code{S}, then the evaluation of the attribute @code{S'Storage_Size}
11465 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
11466 which is intended to indicate the number of storage elements reserved for
11467 the simple storage pool. If the Storage_Size function has not been defined
11468 for the simple storage pool type, then this attribute returns zero.
11470 If an access type @code{S} has a specified simple storage pool of type
11471 @code{SSP}, then the evaluation of an allocator for that access type calls
11472 the primitive @code{Allocate} procedure for type @code{SSP}, passing
11473 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
11474 semantics of such allocators is the same as those defined for allocators
11475 in section 13.11 of the @cite{Ada Reference Manual}, with the term
11476 @emph{simple storage pool} substituted for @emph{storage pool}.
11478 If an access type @code{S} has a specified simple storage pool of type
11479 @code{SSP}, then a call to an instance of the @code{Ada.Unchecked_Deallocation}
11480 for that access type invokes the primitive @code{Deallocate} procedure
11481 for type @code{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
11482 parameter. The detailed semantics of such unchecked deallocations is the same
11483 as defined in section 13.11.2 of the Ada Reference Manual, except that the
11484 term @emph{simple storage pool} is substituted for @emph{storage pool}.
11486 @node Attribute Small,Attribute Storage_Unit,Attribute Simple_Storage_Pool,Implementation Defined Attributes
11487 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{1a1}
11488 @section Attribute Small
11491 @geindex Ada 83 attributes
11495 The @code{Small} attribute is defined in Ada 95 (and Ada 2005) only for
11497 GNAT also allows this attribute to be applied to floating-point types
11498 for compatibility with Ada 83. See
11499 the Ada 83 reference manual for an exact description of the semantics of
11500 this attribute when applied to floating-point types.
11502 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small,Implementation Defined Attributes
11503 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{1a2}
11504 @section Attribute Storage_Unit
11507 @geindex Storage_Unit
11509 @code{Standard'Storage_Unit} (@code{Standard} is the only permissible
11510 prefix) provides the same value as @code{System.Storage_Unit}.
11512 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
11513 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{1a3}
11514 @section Attribute Stub_Type
11519 The GNAT implementation of remote access-to-classwide types is
11520 organized as described in AARM section E.4 (20.t): a value of an RACW type
11521 (designating a remote object) is represented as a normal access
11522 value, pointing to a "stub" object which in turn contains the
11523 necessary information to contact the designated remote object. A
11524 call on any dispatching operation of such a stub object does the
11525 remote call, if necessary, using the information in the stub object
11526 to locate the target partition, etc.
11528 For a prefix @code{T} that denotes a remote access-to-classwide type,
11529 @code{T'Stub_Type} denotes the type of the corresponding stub objects.
11531 By construction, the layout of @code{T'Stub_Type} is identical to that of
11532 type @code{RACW_Stub_Type} declared in the internal implementation-defined
11533 unit @code{System.Partition_Interface}. Use of this attribute will create
11534 an implicit dependency on this unit.
11536 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
11537 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{1a4}
11538 @section Attribute System_Allocator_Alignment
11544 @geindex System_Allocator_Alignment
11546 @code{Standard'System_Allocator_Alignment} (@code{Standard} is the only
11547 permissible prefix) provides the observable guaranted to be honored by
11548 the system allocator (malloc). This is a static value that can be used
11549 in user storage pools based on malloc either to reject allocation
11550 with alignment too large or to enable a realignment circuitry if the
11551 alignment request is larger than this value.
11553 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
11554 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{1a5}
11555 @section Attribute Target_Name
11558 @geindex Target_Name
11560 @code{Standard'Target_Name} (@code{Standard} is the only permissible
11561 prefix) provides a static string value that identifies the target
11562 for the current compilation. For GCC implementations, this is the
11563 standard gcc target name without the terminating slash (for
11564 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
11566 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
11567 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{1a6}
11568 @section Attribute To_Address
11571 @geindex To_Address
11573 The @code{System'To_Address}
11574 (@code{System} is the only permissible prefix)
11575 denotes a function identical to
11576 @code{System.Storage_Elements.To_Address} except that
11577 it is a static attribute. This means that if its argument is
11578 a static expression, then the result of the attribute is a
11579 static expression. This means that such an expression can be
11580 used in contexts (e.g., preelaborable packages) which require a
11581 static expression and where the function call could not be used
11582 (since the function call is always nonstatic, even if its
11583 argument is static). The argument must be in the range
11584 -(2**(m-1)) .. 2**m-1, where m is the memory size
11585 (typically 32 or 64). Negative values are intepreted in a
11586 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
11587 a 32 bits machine).
11589 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
11590 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{1a7}
11591 @section Attribute To_Any
11596 This internal attribute is used for the generation of remote subprogram
11597 stubs in the context of the Distributed Systems Annex.
11599 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
11600 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1a8}
11601 @section Attribute Type_Class
11604 @geindex Type_Class
11606 @code{typ'Type_Class} for any type or subtype @cite{typ} yields
11607 the value of the type class for the full type of @cite{typ}. If
11608 @cite{typ} is a generic formal type, the value is the value for the
11609 corresponding actual subtype. The value of this attribute is of type
11610 @code{System.Aux_DEC.Type_Class}, which has the following definition:
11614 (Type_Class_Enumeration,
11615 Type_Class_Integer,
11616 Type_Class_Fixed_Point,
11617 Type_Class_Floating_Point,
11622 Type_Class_Address);
11625 Protected types yield the value @code{Type_Class_Task}, which thus
11626 applies to all concurrent types. This attribute is designed to
11627 be compatible with the DEC Ada 83 attribute of the same name.
11629 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
11630 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1a9}
11631 @section Attribute Type_Key
11636 The @code{Type_Key} attribute is applicable to a type or subtype and
11637 yields a value of type Standard.String containing encoded information
11638 about the type or subtype. This provides improved compatibility with
11639 other implementations that support this attribute.
11641 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
11642 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1aa}
11643 @section Attribute TypeCode
11648 This internal attribute is used for the generation of remote subprogram
11649 stubs in the context of the Distributed Systems Annex.
11651 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
11652 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1ab}
11653 @section Attribute Unconstrained_Array
11656 @geindex Unconstrained_Array
11658 The @code{Unconstrained_Array} attribute can be used with a prefix that
11659 denotes any type or subtype. It is a static attribute that yields
11660 @code{True} if the prefix designates an unconstrained array,
11661 and @code{False} otherwise. In a generic instance, the result is
11662 still static, and yields the result of applying this test to the
11665 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
11666 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1ac}
11667 @section Attribute Universal_Literal_String
11670 @geindex Named numbers
11671 @geindex representation of
11673 @geindex Universal_Literal_String
11675 The prefix of @code{Universal_Literal_String} must be a named
11676 number. The static result is the string consisting of the characters of
11677 the number as defined in the original source. This allows the user
11678 program to access the actual text of named numbers without intermediate
11679 conversions and without the need to enclose the strings in quotes (which
11680 would preclude their use as numbers).
11682 For example, the following program prints the first 50 digits of pi:
11685 with Text_IO; use Text_IO;
11689 Put (Ada.Numerics.Pi'Universal_Literal_String);
11693 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11694 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1ad}
11695 @section Attribute Unrestricted_Access
11699 @geindex unrestricted
11701 @geindex Unrestricted_Access
11703 The @code{Unrestricted_Access} attribute is similar to @code{Access}
11704 except that all accessibility and aliased view checks are omitted. This
11705 is a user-beware attribute.
11707 For objects, it is similar to @code{Address}, for which it is a
11708 desirable replacement where the value desired is an access type.
11709 In other words, its effect is similar to first applying the
11710 @code{Address} attribute and then doing an unchecked conversion to a
11711 desired access type.
11713 For subprograms, @code{P'Unrestricted_Access} may be used where
11714 @code{P'Access} would be illegal, to construct a value of a
11715 less-nested named access type that designates a more-nested
11716 subprogram. This value may be used in indirect calls, so long as the
11717 more-nested subprogram still exists; once the subprogram containing it
11718 has returned, such calls are erroneous. For example:
11723 type Less_Nested is not null access procedure;
11724 Global : Less_Nested;
11732 Local_Var : Integer;
11734 procedure More_Nested is
11739 Global := More_Nested'Unrestricted_Access;
11746 When P1 is called from P2, the call via Global is OK, but if P1 were
11747 called after P2 returns, it would be an erroneous use of a dangling
11750 For objects, it is possible to use @code{Unrestricted_Access} for any
11751 type. However, if the result is of an access-to-unconstrained array
11752 subtype, then the resulting pointer has the same scope as the context
11753 of the attribute, and must not be returned to some enclosing scope.
11754 For instance, if a function uses @code{Unrestricted_Access} to create
11755 an access-to-unconstrained-array and returns that value to the caller,
11756 the result will involve dangling pointers. In addition, it is only
11757 valid to create pointers to unconstrained arrays using this attribute
11758 if the pointer has the normal default 'fat' representation where a
11759 pointer has two components, one points to the array and one points to
11760 the bounds. If a size clause is used to force 'thin' representation
11761 for a pointer to unconstrained where there is only space for a single
11762 pointer, then the resulting pointer is not usable.
11764 In the simple case where a direct use of Unrestricted_Access attempts
11765 to make a thin pointer for a non-aliased object, the compiler will
11766 reject the use as illegal, as shown in the following example:
11769 with System; use System;
11770 procedure SliceUA2 is
11771 type A is access all String;
11772 for A'Size use Standard'Address_Size;
11774 procedure P (Arg : A) is
11779 X : String := "hello world!";
11780 X2 : aliased String := "hello world!";
11782 AV : A := X'Unrestricted_Access; -- ERROR
11784 >>> illegal use of Unrestricted_Access attribute
11785 >>> attempt to generate thin pointer to unaliased object
11788 P (X'Unrestricted_Access); -- ERROR
11790 >>> illegal use of Unrestricted_Access attribute
11791 >>> attempt to generate thin pointer to unaliased object
11793 P (X(7 .. 12)'Unrestricted_Access); -- ERROR
11795 >>> illegal use of Unrestricted_Access attribute
11796 >>> attempt to generate thin pointer to unaliased object
11798 P (X2'Unrestricted_Access); -- OK
11802 but other cases cannot be detected by the compiler, and are
11803 considered to be erroneous. Consider the following example:
11806 with System; use System;
11807 with System; use System;
11808 procedure SliceUA is
11809 type AF is access all String;
11811 type A is access all String;
11812 for A'Size use Standard'Address_Size;
11814 procedure P (Arg : A) is
11816 if Arg'Length /= 6 then
11817 raise Program_Error;
11821 X : String := "hello world!";
11822 Y : AF := X (7 .. 12)'Unrestricted_Access;
11829 A normal unconstrained array value
11830 or a constrained array object marked as aliased has the bounds in memory
11831 just before the array, so a thin pointer can retrieve both the data and
11832 the bounds. But in this case, the non-aliased object @code{X} does not have the
11833 bounds before the string. If the size clause for type @code{A}
11834 were not present, then the pointer
11835 would be a fat pointer, where one component is a pointer to the bounds,
11836 and all would be well. But with the size clause present, the conversion from
11837 fat pointer to thin pointer in the call loses the bounds, and so this
11838 is erroneous, and the program likely raises a @code{Program_Error} exception.
11840 In general, it is advisable to completely
11841 avoid mixing the use of thin pointers and the use of
11842 @code{Unrestricted_Access} where the designated type is an
11843 unconstrained array. The use of thin pointers should be restricted to
11844 cases of porting legacy code that implicitly assumes the size of pointers,
11845 and such code should not in any case be using this attribute.
11847 Another erroneous situation arises if the attribute is
11848 applied to a constant. The resulting pointer can be used to access the
11849 constant, but the effect of trying to modify a constant in this manner
11850 is not well-defined. Consider this example:
11853 P : constant Integer := 4;
11854 type R is access all Integer;
11855 RV : R := P'Unrestricted_Access;
11860 Here we attempt to modify the constant P from 4 to 3, but the compiler may
11861 or may not notice this attempt, and subsequent references to P may yield
11862 either the value 3 or the value 4 or the assignment may blow up if the
11863 compiler decides to put P in read-only memory. One particular case where
11864 @code{Unrestricted_Access} can be used in this way is to modify the
11865 value of an @code{in} parameter:
11868 procedure K (S : in String) is
11869 type R is access all Character;
11870 RV : R := S (3)'Unrestricted_Access;
11876 In general this is a risky approach. It may appear to "work" but such uses of
11877 @code{Unrestricted_Access} are potentially non-portable, even from one version
11878 of GNAT to another, so are best avoided if possible.
11880 @node Attribute Update,Attribute Valid_Scalars,Attribute Unrestricted_Access,Implementation Defined Attributes
11881 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1ae}
11882 @section Attribute Update
11887 The @code{Update} attribute creates a copy of an array or record value
11888 with one or more modified components. The syntax is:
11891 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
11892 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
11893 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
11894 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
11896 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
11897 INDEX_EXPRESSION_LIST_LIST ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
11898 INDEX_EXPRESSION_LIST ::= ( EXPRESSION @{, EXPRESSION @} )
11901 where @code{PREFIX} is the name of an array or record object, the
11902 association list in parentheses does not contain an @code{others}
11903 choice and the box symbol @code{<>} may not appear in any
11904 expression. The effect is to yield a copy of the array or record value
11905 which is unchanged apart from the components mentioned in the
11906 association list, which are changed to the indicated value. The
11907 original value of the array or record value is not affected. For
11911 type Arr is Array (1 .. 5) of Integer;
11913 Avar1 : Arr := (1,2,3,4,5);
11914 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
11917 yields a value for @code{Avar2} of 1,10,20,20,5 with @code{Avar1}
11918 begin unmodified. Similarly:
11921 type Rec is A, B, C : Integer;
11923 Rvar1 : Rec := (A => 1, B => 2, C => 3);
11924 Rvar2 : Rec := Rvar1'Update (B => 20);
11927 yields a value for @code{Rvar2} of (A => 1, B => 20, C => 3),
11928 with @code{Rvar1} being unmodifed.
11929 Note that the value of the attribute reference is computed
11930 completely before it is used. This means that if you write:
11933 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
11936 then the value of @code{Avar1} is not modified if @code{Function_Call}
11937 raises an exception, unlike the effect of a series of direct assignments
11938 to elements of @code{Avar1}. In general this requires that
11939 two extra complete copies of the object are required, which should be
11940 kept in mind when considering efficiency.
11942 The @code{Update} attribute cannot be applied to prefixes of a limited
11943 type, and cannot reference discriminants in the case of a record type.
11944 The accessibility level of an Update attribute result object is defined
11945 as for an aggregate.
11947 In the record case, no component can be mentioned more than once. In
11948 the array case, two overlapping ranges can appear in the association list,
11949 in which case the modifications are processed left to right.
11951 Multi-dimensional arrays can be modified, as shown by this example:
11954 A : array (1 .. 10, 1 .. 10) of Integer;
11956 A := A'Update ((1, 2) => 20, (3, 4) => 30);
11959 which changes element (1,2) to 20 and (3,4) to 30.
11961 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Update,Implementation Defined Attributes
11962 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1af}
11963 @section Attribute Valid_Scalars
11966 @geindex Valid_Scalars
11968 The @code{'Valid_Scalars} attribute is intended to make it easier to check the
11969 validity of scalar subcomponents of composite objects. The attribute is defined
11970 for any prefix @code{P} which denotes an object. Prefix @code{P} can be any type
11971 except for tagged private or @code{Unchecked_Union} types. The value of the
11972 attribute is of type @code{Boolean}.
11974 @code{P'Valid_Scalars} yields @code{True} if and only if the evaluation of
11975 @code{C'Valid} yields @code{True} for every scalar subcomponent @code{C} of @code{P}, or if
11976 @code{P} has no scalar subcomponents. Attribute @code{'Valid_Scalars} is equivalent
11977 to attribute @code{'Valid} for scalar types.
11979 It is not specified in what order the subcomponents are checked, nor whether
11980 any more are checked after any one of them is determined to be invalid. If the
11981 prefix @code{P} is of a class-wide type @code{T'Class} (where @code{T} is the associated
11982 specific type), or if the prefix @code{P} is of a specific tagged type @code{T}, then
11983 only the subcomponents of @code{T} are checked; in other words, components of
11984 extensions of @code{T} are not checked even if @code{T'Class (P)'Tag /= T'Tag}.
11986 The compiler will issue a warning if it can be determined at compile time that
11987 the prefix of the attribute has no scalar subcomponents.
11989 Note: @code{Valid_Scalars} can generate a lot of code, especially in the case of
11990 a large variant record. If the attribute is called in many places in the same
11991 program applied to objects of the same type, it can reduce program size to
11992 write a function with a single use of the attribute, and then call that
11993 function from multiple places.
11995 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
11996 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1b0}
11997 @section Attribute VADS_Size
12001 @geindex VADS compatibility
12005 The @code{'VADS_Size} attribute is intended to make it easier to port
12006 legacy code which relies on the semantics of @code{'Size} as implemented
12007 by the VADS Ada 83 compiler. GNAT makes a best effort at duplicating the
12008 same semantic interpretation. In particular, @code{'VADS_Size} applied
12009 to a predefined or other primitive type with no Size clause yields the
12010 Object_Size (for example, @code{Natural'Size} is 32 rather than 31 on
12011 typical machines). In addition @code{'VADS_Size} applied to an object
12012 gives the result that would be obtained by applying the attribute to
12013 the corresponding type.
12015 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
12016 @anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1b1}@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{163}
12017 @section Attribute Value_Size
12021 @geindex setting for not-first subtype
12023 @geindex Value_Size
12025 @code{type'Value_Size} is the number of bits required to represent
12026 a value of the given subtype. It is the same as @code{type'Size},
12027 but, unlike @code{Size}, may be set for non-first subtypes.
12029 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
12030 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1b2}
12031 @section Attribute Wchar_T_Size
12034 @geindex Wchar_T_Size
12036 @code{Standard'Wchar_T_Size} (@code{Standard} is the only permissible
12037 prefix) provides the size in bits of the C @code{wchar_t} type
12038 primarily for constructing the definition of this type in
12039 package @code{Interfaces.C}. The result is a static constant.
12041 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
12042 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1b3}
12043 @section Attribute Word_Size
12048 @code{Standard'Word_Size} (@code{Standard} is the only permissible
12049 prefix) provides the value @code{System.Word_Size}. The result is
12052 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
12053 @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}
12054 @chapter Standard and Implementation Defined Restrictions
12057 All Ada Reference Manual-defined Restriction identifiers are implemented:
12063 language-defined restrictions (see 13.12.1)
12066 tasking restrictions (see D.7)
12069 high integrity restrictions (see H.4)
12072 GNAT implements additional restriction identifiers. All restrictions, whether
12073 language defined or GNAT-specific, are listed in the following.
12076 * Partition-Wide Restrictions::
12077 * Program Unit Level Restrictions::
12081 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
12082 @anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1b6}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1b7}
12083 @section Partition-Wide Restrictions
12086 There are two separate lists of restriction identifiers. The first
12087 set requires consistency throughout a partition (in other words, if the
12088 restriction identifier is used for any compilation unit in the partition,
12089 then all compilation units in the partition must obey the restriction).
12092 * Immediate_Reclamation::
12093 * Max_Asynchronous_Select_Nesting::
12094 * Max_Entry_Queue_Length::
12095 * Max_Protected_Entries::
12096 * Max_Select_Alternatives::
12097 * Max_Storage_At_Blocking::
12098 * Max_Task_Entries::
12100 * No_Abort_Statements::
12101 * No_Access_Parameter_Allocators::
12102 * No_Access_Subprograms::
12104 * No_Anonymous_Allocators::
12105 * No_Asynchronous_Control::
12107 * No_Coextensions::
12108 * No_Default_Initialization::
12111 * No_Direct_Boolean_Operators::
12113 * No_Dispatching_Calls::
12114 * No_Dynamic_Attachment::
12115 * No_Dynamic_Priorities::
12116 * No_Entry_Calls_In_Elaboration_Code::
12117 * No_Enumeration_Maps::
12118 * No_Exception_Handlers::
12119 * No_Exception_Propagation::
12120 * No_Exception_Registration::
12122 * No_Finalization::
12124 * No_Floating_Point::
12125 * No_Implicit_Conditionals::
12126 * No_Implicit_Dynamic_Code::
12127 * No_Implicit_Heap_Allocations::
12128 * No_Implicit_Protected_Object_Allocations::
12129 * No_Implicit_Task_Allocations::
12130 * No_Initialize_Scalars::
12132 * No_Local_Allocators::
12133 * No_Local_Protected_Objects::
12134 * No_Local_Timing_Events::
12135 * No_Long_Long_Integers::
12136 * No_Multiple_Elaboration::
12137 * No_Nested_Finalization::
12138 * No_Protected_Type_Allocators::
12139 * No_Protected_Types::
12142 * No_Relative_Delay::
12143 * No_Requeue_Statements::
12144 * No_Secondary_Stack::
12145 * No_Select_Statements::
12146 * No_Specific_Termination_Handlers::
12147 * No_Specification_of_Aspect::
12148 * No_Standard_Allocators_After_Elaboration::
12149 * No_Standard_Storage_Pools::
12150 * No_Stream_Optimizations::
12152 * No_Task_Allocators::
12153 * No_Task_At_Interrupt_Priority::
12154 * No_Task_Attributes_Package::
12155 * No_Task_Hierarchy::
12156 * No_Task_Termination::
12158 * No_Terminate_Alternatives::
12159 * No_Unchecked_Access::
12160 * No_Unchecked_Conversion::
12161 * No_Unchecked_Deallocation::
12162 * No_Use_Of_Entity::
12164 * Simple_Barriers::
12165 * Static_Priorities::
12166 * Static_Storage_Size::
12170 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
12171 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1b8}
12172 @subsection Immediate_Reclamation
12175 @geindex Immediate_Reclamation
12177 [RM H.4] This restriction ensures that, except for storage occupied by
12178 objects created by allocators and not deallocated via unchecked
12179 deallocation, any storage reserved at run time for an object is
12180 immediately reclaimed when the object no longer exists.
12182 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
12183 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1b9}
12184 @subsection Max_Asynchronous_Select_Nesting
12187 @geindex Max_Asynchronous_Select_Nesting
12189 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
12190 selects. Violations of this restriction with a value of zero are
12191 detected at compile time. Violations of this restriction with values
12192 other than zero cause Storage_Error to be raised.
12194 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
12195 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1ba}
12196 @subsection Max_Entry_Queue_Length
12199 @geindex Max_Entry_Queue_Length
12201 [RM D.7] This restriction is a declaration that any protected entry compiled in
12202 the scope of the restriction has at most the specified number of
12203 tasks waiting on the entry at any one time, and so no queue is required.
12204 Note that this restriction is checked at run time. Violation of this
12205 restriction results in the raising of Program_Error exception at the point of
12208 @geindex Max_Entry_Queue_Depth
12210 The restriction @code{Max_Entry_Queue_Depth} is recognized as a
12211 synonym for @code{Max_Entry_Queue_Length}. This is retained for historical
12212 compatibility purposes (and a warning will be generated for its use if
12213 warnings on obsolescent features are activated).
12215 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
12216 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1bb}
12217 @subsection Max_Protected_Entries
12220 @geindex Max_Protected_Entries
12222 [RM D.7] Specifies the maximum number of entries per protected type. The
12223 bounds of every entry family of a protected unit shall be static, or shall be
12224 defined by a discriminant of a subtype whose corresponding bound is static.
12226 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
12227 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1bc}
12228 @subsection Max_Select_Alternatives
12231 @geindex Max_Select_Alternatives
12233 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
12235 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
12236 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1bd}
12237 @subsection Max_Storage_At_Blocking
12240 @geindex Max_Storage_At_Blocking
12242 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
12243 Storage_Size that can be retained by a blocked task. A violation of this
12244 restriction causes Storage_Error to be raised.
12246 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
12247 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1be}
12248 @subsection Max_Task_Entries
12251 @geindex Max_Task_Entries
12253 [RM D.7] Specifies the maximum number of entries
12254 per task. The bounds of every entry family
12255 of a task unit shall be static, or shall be
12256 defined by a discriminant of a subtype whose
12257 corresponding bound is static.
12259 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
12260 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1bf}
12261 @subsection Max_Tasks
12266 [RM D.7] Specifies the maximum number of task that may be created, not
12267 counting the creation of the environment task. Violations of this
12268 restriction with a value of zero are detected at compile
12269 time. Violations of this restriction with values other than zero cause
12270 Storage_Error to be raised.
12272 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
12273 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1c0}
12274 @subsection No_Abort_Statements
12277 @geindex No_Abort_Statements
12279 [RM D.7] There are no abort_statements, and there are
12280 no calls to Task_Identification.Abort_Task.
12282 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
12283 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1c1}
12284 @subsection No_Access_Parameter_Allocators
12287 @geindex No_Access_Parameter_Allocators
12289 [RM H.4] This restriction ensures at compile time that there are no
12290 occurrences of an allocator as the actual parameter to an access
12293 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
12294 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1c2}
12295 @subsection No_Access_Subprograms
12298 @geindex No_Access_Subprograms
12300 [RM H.4] This restriction ensures at compile time that there are no
12301 declarations of access-to-subprogram types.
12303 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
12304 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1c3}
12305 @subsection No_Allocators
12308 @geindex No_Allocators
12310 [RM H.4] This restriction ensures at compile time that there are no
12311 occurrences of an allocator.
12313 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
12314 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1c4}
12315 @subsection No_Anonymous_Allocators
12318 @geindex No_Anonymous_Allocators
12320 [RM H.4] This restriction ensures at compile time that there are no
12321 occurrences of an allocator of anonymous access type.
12323 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
12324 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1c5}
12325 @subsection No_Asynchronous_Control
12328 @geindex No_Asynchronous_Control
12330 [RM J.13] This restriction ensures at compile time that there are no semantic
12331 dependences on the predefined package Asynchronous_Task_Control.
12333 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
12334 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1c6}
12335 @subsection No_Calendar
12338 @geindex No_Calendar
12340 [GNAT] This restriction ensures at compile time that there are no semantic
12341 dependences on package Calendar.
12343 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
12344 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1c7}
12345 @subsection No_Coextensions
12348 @geindex No_Coextensions
12350 [RM H.4] This restriction ensures at compile time that there are no
12351 coextensions. See 3.10.2.
12353 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
12354 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1c8}
12355 @subsection No_Default_Initialization
12358 @geindex No_Default_Initialization
12360 [GNAT] This restriction prohibits any instance of default initialization
12361 of variables. The binder implements a consistency rule which prevents
12362 any unit compiled without the restriction from with'ing a unit with the
12363 restriction (this allows the generation of initialization procedures to
12364 be skipped, since you can be sure that no call is ever generated to an
12365 initialization procedure in a unit with the restriction active). If used
12366 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
12367 is to prohibit all cases of variables declared without a specific
12368 initializer (including the case of OUT scalar parameters).
12370 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
12371 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1c9}
12372 @subsection No_Delay
12377 [RM H.4] This restriction ensures at compile time that there are no
12378 delay statements and no semantic dependences on package Calendar.
12380 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
12381 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1ca}
12382 @subsection No_Dependence
12385 @geindex No_Dependence
12387 [RM 13.12.1] This restriction ensures at compile time that there are no
12388 dependences on a library unit.
12390 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
12391 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1cb}
12392 @subsection No_Direct_Boolean_Operators
12395 @geindex No_Direct_Boolean_Operators
12397 [GNAT] This restriction ensures that no logical operators (and/or/xor)
12398 are used on operands of type Boolean (or any type derived from Boolean).
12399 This is intended for use in safety critical programs where the certification
12400 protocol requires the use of short-circuit (and then, or else) forms for all
12401 composite boolean operations.
12403 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
12404 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1cc}
12405 @subsection No_Dispatch
12408 @geindex No_Dispatch
12410 [RM H.4] This restriction ensures at compile time that there are no
12411 occurrences of @code{T'Class}, for any (tagged) subtype @code{T}.
12413 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
12414 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1cd}
12415 @subsection No_Dispatching_Calls
12418 @geindex No_Dispatching_Calls
12420 [GNAT] This restriction ensures at compile time that the code generated by the
12421 compiler involves no dispatching calls. The use of this restriction allows the
12422 safe use of record extensions, classwide membership tests and other classwide
12423 features not involving implicit dispatching. This restriction ensures that
12424 the code contains no indirect calls through a dispatching mechanism. Note that
12425 this includes internally-generated calls created by the compiler, for example
12426 in the implementation of class-wide objects assignments. The
12427 membership test is allowed in the presence of this restriction, because its
12428 implementation requires no dispatching.
12429 This restriction is comparable to the official Ada restriction
12430 @code{No_Dispatch} except that it is a bit less restrictive in that it allows
12431 all classwide constructs that do not imply dispatching.
12432 The following example indicates constructs that violate this restriction.
12436 type T is tagged record
12439 procedure P (X : T);
12441 type DT is new T with record
12442 More_Data : Natural;
12444 procedure Q (X : DT);
12448 procedure Example is
12449 procedure Test (O : T'Class) is
12450 N : Natural := O'Size;-- Error: Dispatching call
12451 C : T'Class := O; -- Error: implicit Dispatching Call
12453 if O in DT'Class then -- OK : Membership test
12454 Q (DT (O)); -- OK : Type conversion plus direct call
12456 P (O); -- Error: Dispatching call
12462 P (Obj); -- OK : Direct call
12463 P (T (Obj)); -- OK : Type conversion plus direct call
12464 P (T'Class (Obj)); -- Error: Dispatching call
12466 Test (Obj); -- OK : Type conversion
12468 if Obj in T'Class then -- OK : Membership test
12474 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
12475 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1ce}
12476 @subsection No_Dynamic_Attachment
12479 @geindex No_Dynamic_Attachment
12481 [RM D.7] This restriction ensures that there is no call to any of the
12482 operations defined in package Ada.Interrupts
12483 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
12484 Detach_Handler, and Reference).
12486 @geindex No_Dynamic_Interrupts
12488 The restriction @code{No_Dynamic_Interrupts} is recognized as a
12489 synonym for @code{No_Dynamic_Attachment}. This is retained for historical
12490 compatibility purposes (and a warning will be generated for its use if
12491 warnings on obsolescent features are activated).
12493 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
12494 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1cf}
12495 @subsection No_Dynamic_Priorities
12498 @geindex No_Dynamic_Priorities
12500 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
12502 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
12503 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1d0}
12504 @subsection No_Entry_Calls_In_Elaboration_Code
12507 @geindex No_Entry_Calls_In_Elaboration_Code
12509 [GNAT] This restriction ensures at compile time that no task or protected entry
12510 calls are made during elaboration code. As a result of the use of this
12511 restriction, the compiler can assume that no code past an accept statement
12512 in a task can be executed at elaboration time.
12514 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
12515 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1d1}
12516 @subsection No_Enumeration_Maps
12519 @geindex No_Enumeration_Maps
12521 [GNAT] This restriction ensures at compile time that no operations requiring
12522 enumeration maps are used (that is Image and Value attributes applied
12523 to enumeration types).
12525 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
12526 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1d2}
12527 @subsection No_Exception_Handlers
12530 @geindex No_Exception_Handlers
12532 [GNAT] This restriction ensures at compile time that there are no explicit
12533 exception handlers. It also indicates that no exception propagation will
12534 be provided. In this mode, exceptions may be raised but will result in
12535 an immediate call to the last chance handler, a routine that the user
12536 must define with the following profile:
12539 procedure Last_Chance_Handler
12540 (Source_Location : System.Address; Line : Integer);
12541 pragma Export (C, Last_Chance_Handler,
12542 "__gnat_last_chance_handler");
12545 The parameter is a C null-terminated string representing a message to be
12546 associated with the exception (typically the source location of the raise
12547 statement generated by the compiler). The Line parameter when nonzero
12548 represents the line number in the source program where the raise occurs.
12550 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
12551 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1d3}
12552 @subsection No_Exception_Propagation
12555 @geindex No_Exception_Propagation
12557 [GNAT] This restriction guarantees that exceptions are never propagated
12558 to an outer subprogram scope. The only case in which an exception may
12559 be raised is when the handler is statically in the same subprogram, so
12560 that the effect of a raise is essentially like a goto statement. Any
12561 other raise statement (implicit or explicit) will be considered
12562 unhandled. Exception handlers are allowed, but may not contain an
12563 exception occurrence identifier (exception choice). In addition, use of
12564 the package GNAT.Current_Exception is not permitted, and reraise
12565 statements (raise with no operand) are not permitted.
12567 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
12568 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1d4}
12569 @subsection No_Exception_Registration
12572 @geindex No_Exception_Registration
12574 [GNAT] This restriction ensures at compile time that no stream operations for
12575 types Exception_Id or Exception_Occurrence are used. This also makes it
12576 impossible to pass exceptions to or from a partition with this restriction
12577 in a distributed environment. If this restriction is active, the generated
12578 code is simplified by omitting the otherwise-required global registration
12579 of exceptions when they are declared.
12581 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
12582 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1d5}
12583 @subsection No_Exceptions
12586 @geindex No_Exceptions
12588 [RM H.4] This restriction ensures at compile time that there are no
12589 raise statements and no exception handlers and also suppresses the
12590 generation of language-defined run-time checks.
12592 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
12593 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1d6}
12594 @subsection No_Finalization
12597 @geindex No_Finalization
12599 [GNAT] This restriction disables the language features described in
12600 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
12601 performed by the compiler to support these features. The following types
12602 are no longer considered controlled when this restriction is in effect:
12608 @code{Ada.Finalization.Controlled}
12611 @code{Ada.Finalization.Limited_Controlled}
12614 Derivations from @code{Controlled} or @code{Limited_Controlled}
12626 Array and record types with controlled components
12629 The compiler no longer generates code to initialize, finalize or adjust an
12630 object or a nested component, either declared on the stack or on the heap. The
12631 deallocation of a controlled object no longer finalizes its contents.
12633 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
12634 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1d7}
12635 @subsection No_Fixed_Point
12638 @geindex No_Fixed_Point
12640 [RM H.4] This restriction ensures at compile time that there are no
12641 occurrences of fixed point types and operations.
12643 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
12644 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1d8}
12645 @subsection No_Floating_Point
12648 @geindex No_Floating_Point
12650 [RM H.4] This restriction ensures at compile time that there are no
12651 occurrences of floating point types and operations.
12653 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
12654 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1d9}
12655 @subsection No_Implicit_Conditionals
12658 @geindex No_Implicit_Conditionals
12660 [GNAT] This restriction ensures that the generated code does not contain any
12661 implicit conditionals, either by modifying the generated code where possible,
12662 or by rejecting any construct that would otherwise generate an implicit
12663 conditional. Note that this check does not include run time constraint
12664 checks, which on some targets may generate implicit conditionals as
12665 well. To control the latter, constraint checks can be suppressed in the
12666 normal manner. Constructs generating implicit conditionals include comparisons
12667 of composite objects and the Max/Min attributes.
12669 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12670 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1da}
12671 @subsection No_Implicit_Dynamic_Code
12674 @geindex No_Implicit_Dynamic_Code
12676 @geindex trampoline
12678 [GNAT] This restriction prevents the compiler from building 'trampolines'.
12679 This is a structure that is built on the stack and contains dynamic
12680 code to be executed at run time. On some targets, a trampoline is
12681 built for the following features: @code{Access},
12682 @code{Unrestricted_Access}, or @code{Address} of a nested subprogram;
12683 nested task bodies; primitive operations of nested tagged types.
12684 Trampolines do not work on machines that prevent execution of stack
12685 data. For example, on windows systems, enabling DEP (data execution
12686 protection) will cause trampolines to raise an exception.
12687 Trampolines are also quite slow at run time.
12689 On many targets, trampolines have been largely eliminated. Look at the
12690 version of system.ads for your target --- if it has
12691 Always_Compatible_Rep equal to False, then trampolines are largely
12692 eliminated. In particular, a trampoline is built for the following
12693 features: @code{Address} of a nested subprogram;
12694 @code{Access} or @code{Unrestricted_Access} of a nested subprogram,
12695 but only if pragma Favor_Top_Level applies, or the access type has a
12696 foreign-language convention; primitive operations of nested tagged
12699 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12700 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1db}
12701 @subsection No_Implicit_Heap_Allocations
12704 @geindex No_Implicit_Heap_Allocations
12706 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12708 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12709 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1dc}
12710 @subsection No_Implicit_Protected_Object_Allocations
12713 @geindex No_Implicit_Protected_Object_Allocations
12715 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12718 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12719 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1dd}
12720 @subsection No_Implicit_Task_Allocations
12723 @geindex No_Implicit_Task_Allocations
12725 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12727 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12728 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1de}
12729 @subsection No_Initialize_Scalars
12732 @geindex No_Initialize_Scalars
12734 [GNAT] This restriction ensures that no unit in the partition is compiled with
12735 pragma Initialize_Scalars. This allows the generation of more efficient
12736 code, and in particular eliminates dummy null initialization routines that
12737 are otherwise generated for some record and array types.
12739 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
12740 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1df}
12746 [RM H.4] This restriction ensures at compile time that there are no
12747 dependences on any of the library units Sequential_IO, Direct_IO,
12748 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
12750 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
12751 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1e0}
12752 @subsection No_Local_Allocators
12755 @geindex No_Local_Allocators
12757 [RM H.4] This restriction ensures at compile time that there are no
12758 occurrences of an allocator in subprograms, generic subprograms, tasks,
12761 @node No_Local_Protected_Objects,No_Local_Timing_Events,No_Local_Allocators,Partition-Wide Restrictions
12762 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1e1}
12763 @subsection No_Local_Protected_Objects
12766 @geindex No_Local_Protected_Objects
12768 [RM D.7] This restriction ensures at compile time that protected objects are
12769 only declared at the library level.
12771 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Protected_Objects,Partition-Wide Restrictions
12772 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1e2}
12773 @subsection No_Local_Timing_Events
12776 @geindex No_Local_Timing_Events
12778 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
12779 declared at the library level.
12781 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
12782 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1e3}
12783 @subsection No_Long_Long_Integers
12786 @geindex No_Long_Long_Integers
12788 [GNAT] This partition-wide restriction forbids any explicit reference to
12789 type Standard.Long_Long_Integer, and also forbids declaring range types whose
12790 implicit base type is Long_Long_Integer, and modular types whose size exceeds
12793 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
12794 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1e4}
12795 @subsection No_Multiple_Elaboration
12798 @geindex No_Multiple_Elaboration
12800 [GNAT] When this restriction is active and the static elaboration model is
12801 used, and -fpreserve-control-flow is not used, the compiler is allowed to
12802 suppress the elaboration counter normally associated with the unit, even if
12803 the unit has elaboration code. This counter is typically used to check for
12804 access before elaboration and to control multiple elaboration attempts. If the
12805 restriction is used, then the situations in which multiple elaboration is
12806 possible, including non-Ada main programs and Stand Alone libraries, are not
12807 permitted and will be diagnosed by the binder.
12809 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
12810 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1e5}
12811 @subsection No_Nested_Finalization
12814 @geindex No_Nested_Finalization
12816 [RM D.7] All objects requiring finalization are declared at the library level.
12818 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
12819 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1e6}
12820 @subsection No_Protected_Type_Allocators
12823 @geindex No_Protected_Type_Allocators
12825 [RM D.7] This restriction ensures at compile time that there are no allocator
12826 expressions that attempt to allocate protected objects.
12828 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
12829 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1e7}
12830 @subsection No_Protected_Types
12833 @geindex No_Protected_Types
12835 [RM H.4] This restriction ensures at compile time that there are no
12836 declarations of protected types or protected objects.
12838 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
12839 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1e8}
12840 @subsection No_Recursion
12843 @geindex No_Recursion
12845 [RM H.4] A program execution is erroneous if a subprogram is invoked as
12846 part of its execution.
12848 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
12849 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1e9}
12850 @subsection No_Reentrancy
12853 @geindex No_Reentrancy
12855 [RM H.4] A program execution is erroneous if a subprogram is executed by
12856 two tasks at the same time.
12858 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
12859 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1ea}
12860 @subsection No_Relative_Delay
12863 @geindex No_Relative_Delay
12865 [RM D.7] This restriction ensures at compile time that there are no delay
12866 relative statements and prevents expressions such as @code{delay 1.23;} from
12867 appearing in source code.
12869 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
12870 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1eb}
12871 @subsection No_Requeue_Statements
12874 @geindex No_Requeue_Statements
12876 [RM D.7] This restriction ensures at compile time that no requeue statements
12877 are permitted and prevents keyword @code{requeue} from being used in source
12880 @geindex No_Requeue
12882 The restriction @code{No_Requeue} is recognized as a
12883 synonym for @code{No_Requeue_Statements}. This is retained for historical
12884 compatibility purposes (and a warning will be generated for its use if
12885 warnings on oNobsolescent features are activated).
12887 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
12888 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1ec}
12889 @subsection No_Secondary_Stack
12892 @geindex No_Secondary_Stack
12894 [GNAT] This restriction ensures at compile time that the generated code
12895 does not contain any reference to the secondary stack. The secondary
12896 stack is used to implement functions returning unconstrained objects
12897 (arrays or records) on some targets. Suppresses the allocation of
12898 secondary stacks for tasks (excluding the environment task) at run time.
12900 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
12901 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1ed}
12902 @subsection No_Select_Statements
12905 @geindex No_Select_Statements
12907 [RM D.7] This restriction ensures at compile time no select statements of any
12908 kind are permitted, that is the keyword @code{select} may not appear.
12910 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
12911 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1ee}
12912 @subsection No_Specific_Termination_Handlers
12915 @geindex No_Specific_Termination_Handlers
12917 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
12918 or to Ada.Task_Termination.Specific_Handler.
12920 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
12921 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1ef}
12922 @subsection No_Specification_of_Aspect
12925 @geindex No_Specification_of_Aspect
12927 [RM 13.12.1] This restriction checks at compile time that no aspect
12928 specification, attribute definition clause, or pragma is given for a
12931 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
12932 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1f0}
12933 @subsection No_Standard_Allocators_After_Elaboration
12936 @geindex No_Standard_Allocators_After_Elaboration
12938 [RM D.7] Specifies that an allocator using a standard storage pool
12939 should never be evaluated at run time after the elaboration of the
12940 library items of the partition has completed. Otherwise, Storage_Error
12943 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
12944 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1f1}
12945 @subsection No_Standard_Storage_Pools
12948 @geindex No_Standard_Storage_Pools
12950 [GNAT] This restriction ensures at compile time that no access types
12951 use the standard default storage pool. Any access type declared must
12952 have an explicit Storage_Pool attribute defined specifying a
12953 user-defined storage pool.
12955 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
12956 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1f2}
12957 @subsection No_Stream_Optimizations
12960 @geindex No_Stream_Optimizations
12962 [GNAT] This restriction affects the performance of stream operations on types
12963 @code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
12964 compiler uses block reads and writes when manipulating @code{String} objects
12965 due to their superior performance. When this restriction is in effect, the
12966 compiler performs all IO operations on a per-character basis.
12968 @node No_Streams,No_Task_Allocators,No_Stream_Optimizations,Partition-Wide Restrictions
12969 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1f3}
12970 @subsection No_Streams
12973 @geindex No_Streams
12975 [GNAT] This restriction ensures at compile/bind time that there are no
12976 stream objects created and no use of stream attributes.
12977 This restriction does not forbid dependences on the package
12978 @code{Ada.Streams}. So it is permissible to with
12979 @code{Ada.Streams} (or another package that does so itself)
12980 as long as no actual stream objects are created and no
12981 stream attributes are used.
12983 Note that the use of restriction allows optimization of tagged types,
12984 since they do not need to worry about dispatching stream operations.
12985 To take maximum advantage of this space-saving optimization, any
12986 unit declaring a tagged type should be compiled with the restriction,
12987 though this is not required.
12989 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Streams,Partition-Wide Restrictions
12990 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1f4}
12991 @subsection No_Task_Allocators
12994 @geindex No_Task_Allocators
12996 [RM D.7] There are no allocators for task types
12997 or types containing task subcomponents.
12999 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
13000 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1f5}
13001 @subsection No_Task_At_Interrupt_Priority
13004 @geindex No_Task_At_Interrupt_Priority
13006 [GNAT] This restriction ensures at compile time that there is no
13007 Interrupt_Priority aspect or pragma for a task or a task type. As
13008 a consequence, the tasks are always created with a priority below
13009 that an interrupt priority.
13011 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
13012 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1f6}
13013 @subsection No_Task_Attributes_Package
13016 @geindex No_Task_Attributes_Package
13018 [GNAT] This restriction ensures at compile time that there are no implicit or
13019 explicit dependencies on the package @code{Ada.Task_Attributes}.
13021 @geindex No_Task_Attributes
13023 The restriction @code{No_Task_Attributes} is recognized as a synonym
13024 for @code{No_Task_Attributes_Package}. This is retained for historical
13025 compatibility purposes (and a warning will be generated for its use if
13026 warnings on obsolescent features are activated).
13028 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
13029 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1f7}
13030 @subsection No_Task_Hierarchy
13033 @geindex No_Task_Hierarchy
13035 [RM D.7] All (non-environment) tasks depend
13036 directly on the environment task of the partition.
13038 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
13039 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1f8}
13040 @subsection No_Task_Termination
13043 @geindex No_Task_Termination
13045 [RM D.7] Tasks that terminate are erroneous.
13047 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
13048 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1f9}
13049 @subsection No_Tasking
13052 @geindex No_Tasking
13054 [GNAT] This restriction prevents the declaration of tasks or task types
13055 throughout the partition. It is similar in effect to the use of
13056 @code{Max_Tasks => 0} except that violations are caught at compile time
13057 and cause an error message to be output either by the compiler or
13060 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
13061 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1fa}
13062 @subsection No_Terminate_Alternatives
13065 @geindex No_Terminate_Alternatives
13067 [RM D.7] There are no selective accepts with terminate alternatives.
13069 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
13070 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1fb}
13071 @subsection No_Unchecked_Access
13074 @geindex No_Unchecked_Access
13076 [RM H.4] This restriction ensures at compile time that there are no
13077 occurrences of the Unchecked_Access attribute.
13079 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
13080 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{1fc}
13081 @subsection No_Unchecked_Conversion
13084 @geindex No_Unchecked_Conversion
13086 [RM J.13] This restriction ensures at compile time that there are no semantic
13087 dependences on the predefined generic function Unchecked_Conversion.
13089 @node No_Unchecked_Deallocation,No_Use_Of_Entity,No_Unchecked_Conversion,Partition-Wide Restrictions
13090 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{1fd}
13091 @subsection No_Unchecked_Deallocation
13094 @geindex No_Unchecked_Deallocation
13096 [RM J.13] This restriction ensures at compile time that there are no semantic
13097 dependences on the predefined generic procedure Unchecked_Deallocation.
13099 @node No_Use_Of_Entity,Pure_Barriers,No_Unchecked_Deallocation,Partition-Wide Restrictions
13100 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{1fe}
13101 @subsection No_Use_Of_Entity
13104 @geindex No_Use_Of_Entity
13106 [GNAT] This restriction ensures at compile time that there are no references
13107 to the entity given in the form
13110 No_Use_Of_Entity => Name
13113 where @code{Name} is the fully qualified entity, for example
13116 No_Use_Of_Entity => Ada.Text_IO.Put_Line
13119 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
13120 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{1ff}
13121 @subsection Pure_Barriers
13124 @geindex Pure_Barriers
13126 [GNAT] This restriction ensures at compile time that protected entry
13127 barriers are restricted to:
13133 components of the protected object (excluding selection from dereferences),
13136 constant declarations,
13142 enumeration literals,
13151 character literals,
13154 implicitly defined comparison operators,
13157 uses of the Standard."not" operator,
13160 short-circuit operator,
13163 the Count attribute
13166 This restriction is a relaxation of the Simple_Barriers restriction,
13167 but still ensures absence of side effects, exceptions, and recursion
13168 during the evaluation of the barriers.
13170 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
13171 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{200}
13172 @subsection Simple_Barriers
13175 @geindex Simple_Barriers
13177 [RM D.7] This restriction ensures at compile time that barriers in entry
13178 declarations for protected types are restricted to either static boolean
13179 expressions or references to simple boolean variables defined in the private
13180 part of the protected type. No other form of entry barriers is permitted.
13182 @geindex Boolean_Entry_Barriers
13184 The restriction @code{Boolean_Entry_Barriers} is recognized as a
13185 synonym for @code{Simple_Barriers}. This is retained for historical
13186 compatibility purposes (and a warning will be generated for its use if
13187 warnings on obsolescent features are activated).
13189 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
13190 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{201}
13191 @subsection Static_Priorities
13194 @geindex Static_Priorities
13196 [GNAT] This restriction ensures at compile time that all priority expressions
13197 are static, and that there are no dependences on the package
13198 @code{Ada.Dynamic_Priorities}.
13200 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
13201 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{202}
13202 @subsection Static_Storage_Size
13205 @geindex Static_Storage_Size
13207 [GNAT] This restriction ensures at compile time that any expression appearing
13208 in a Storage_Size pragma or attribute definition clause is static.
13210 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
13211 @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}
13212 @section Program Unit Level Restrictions
13215 The second set of restriction identifiers
13216 does not require partition-wide consistency.
13217 The restriction may be enforced for a single
13218 compilation unit without any effect on any of the
13219 other compilation units in the partition.
13222 * No_Elaboration_Code::
13223 * No_Dynamic_Sized_Objects::
13225 * No_Implementation_Aspect_Specifications::
13226 * No_Implementation_Attributes::
13227 * No_Implementation_Identifiers::
13228 * No_Implementation_Pragmas::
13229 * No_Implementation_Restrictions::
13230 * No_Implementation_Units::
13231 * No_Implicit_Aliasing::
13232 * No_Implicit_Loops::
13233 * No_Obsolescent_Features::
13234 * No_Wide_Characters::
13235 * Static_Dispatch_Tables::
13240 @node No_Elaboration_Code,No_Dynamic_Sized_Objects,,Program Unit Level Restrictions
13241 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{205}
13242 @subsection No_Elaboration_Code
13245 @geindex No_Elaboration_Code
13247 [GNAT] This restriction ensures at compile time that no elaboration code is
13248 generated. Note that this is not the same condition as is enforced
13249 by pragma @code{Preelaborate}. There are cases in which pragma
13250 @code{Preelaborate} still permits code to be generated (e.g., code
13251 to initialize a large array to all zeroes), and there are cases of units
13252 which do not meet the requirements for pragma @code{Preelaborate},
13253 but for which no elaboration code is generated. Generally, it is
13254 the case that preelaborable units will meet the restrictions, with
13255 the exception of large aggregates initialized with an others_clause,
13256 and exception declarations (which generate calls to a run-time
13257 registry procedure). This restriction is enforced on
13258 a unit by unit basis, it need not be obeyed consistently
13259 throughout a partition.
13261 In the case of aggregates with others, if the aggregate has a dynamic
13262 size, there is no way to eliminate the elaboration code (such dynamic
13263 bounds would be incompatible with @code{Preelaborate} in any case). If
13264 the bounds are static, then use of this restriction actually modifies
13265 the code choice of the compiler to avoid generating a loop, and instead
13266 generate the aggregate statically if possible, no matter how many times
13267 the data for the others clause must be repeatedly generated.
13269 It is not possible to precisely document
13270 the constructs which are compatible with this restriction, since,
13271 unlike most other restrictions, this is not a restriction on the
13272 source code, but a restriction on the generated object code. For
13273 example, if the source contains a declaration:
13276 Val : constant Integer := X;
13279 where X is not a static constant, it may be possible, depending
13280 on complex optimization circuitry, for the compiler to figure
13281 out the value of X at compile time, in which case this initialization
13282 can be done by the loader, and requires no initialization code. It
13283 is not possible to document the precise conditions under which the
13284 optimizer can figure this out.
13286 Note that this the implementation of this restriction requires full
13287 code generation. If it is used in conjunction with "semantics only"
13288 checking, then some cases of violations may be missed.
13290 When this restriction is active, we are not requesting control-flow
13291 preservation with -fpreserve-control-flow, and the static elaboration model is
13292 used, the compiler is allowed to suppress the elaboration counter normally
13293 associated with the unit. This counter is typically used to check for access
13294 before elaboration and to control multiple elaboration attempts.
13296 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Elaboration_Code,Program Unit Level Restrictions
13297 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{206}
13298 @subsection No_Dynamic_Sized_Objects
13301 @geindex No_Dynamic_Sized_Objects
13303 [GNAT] This restriction disallows certain constructs that might lead to the
13304 creation of dynamic-sized composite objects (or array or discriminated type).
13305 An array subtype indication is illegal if the bounds are not static
13306 or references to discriminants of an enclosing type.
13307 A discriminated subtype indication is illegal if the type has
13308 discriminant-dependent array components or a variant part, and the
13309 discriminants are not static. In addition, array and record aggregates are
13310 illegal in corresponding cases. Note that this restriction does not forbid
13311 access discriminants. It is often a good idea to combine this restriction
13312 with No_Secondary_Stack.
13314 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
13315 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{207}
13316 @subsection No_Entry_Queue
13319 @geindex No_Entry_Queue
13321 [GNAT] This restriction is a declaration that any protected entry compiled in
13322 the scope of the restriction has at most one task waiting on the entry
13323 at any one time, and so no queue is required. This restriction is not
13324 checked at compile time. A program execution is erroneous if an attempt
13325 is made to queue a second task on such an entry.
13327 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
13328 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{208}
13329 @subsection No_Implementation_Aspect_Specifications
13332 @geindex No_Implementation_Aspect_Specifications
13334 [RM 13.12.1] This restriction checks at compile time that no
13335 GNAT-defined aspects are present. With this restriction, the only
13336 aspects that can be used are those defined in the Ada Reference Manual.
13338 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
13339 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{209}
13340 @subsection No_Implementation_Attributes
13343 @geindex No_Implementation_Attributes
13345 [RM 13.12.1] This restriction checks at compile time that no
13346 GNAT-defined attributes are present. With this restriction, the only
13347 attributes that can be used are those defined in the Ada Reference
13350 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
13351 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{20a}
13352 @subsection No_Implementation_Identifiers
13355 @geindex No_Implementation_Identifiers
13357 [RM 13.12.1] This restriction checks at compile time that no
13358 implementation-defined identifiers (marked with pragma Implementation_Defined)
13359 occur within language-defined packages.
13361 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
13362 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{20b}
13363 @subsection No_Implementation_Pragmas
13366 @geindex No_Implementation_Pragmas
13368 [RM 13.12.1] This restriction checks at compile time that no
13369 GNAT-defined pragmas are present. With this restriction, the only
13370 pragmas that can be used are those defined in the Ada Reference Manual.
13372 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
13373 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{20c}
13374 @subsection No_Implementation_Restrictions
13377 @geindex No_Implementation_Restrictions
13379 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
13380 identifiers (other than @code{No_Implementation_Restrictions} itself)
13381 are present. With this restriction, the only other restriction identifiers
13382 that can be used are those defined in the Ada Reference Manual.
13384 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
13385 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{20d}
13386 @subsection No_Implementation_Units
13389 @geindex No_Implementation_Units
13391 [RM 13.12.1] This restriction checks at compile time that there is no
13392 mention in the context clause of any implementation-defined descendants
13393 of packages Ada, Interfaces, or System.
13395 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
13396 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{20e}
13397 @subsection No_Implicit_Aliasing
13400 @geindex No_Implicit_Aliasing
13402 [GNAT] This restriction, which is not required to be partition-wide consistent,
13403 requires an explicit aliased keyword for an object to which 'Access,
13404 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
13405 the 'Unrestricted_Access attribute for objects. Note: the reason that
13406 Unrestricted_Access is forbidden is that it would require the prefix
13407 to be aliased, and in such cases, it can always be replaced by
13408 the standard attribute Unchecked_Access which is preferable.
13410 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
13411 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{20f}
13412 @subsection No_Implicit_Loops
13415 @geindex No_Implicit_Loops
13417 [GNAT] This restriction ensures that the generated code of the unit marked
13418 with this restriction does not contain any implicit @code{for} loops, either by
13419 modifying the generated code where possible, or by rejecting any construct
13420 that would otherwise generate an implicit @code{for} loop. If this restriction is
13421 active, it is possible to build large array aggregates with all static
13422 components without generating an intermediate temporary, and without generating
13423 a loop to initialize individual components. Otherwise, a loop is created for
13424 arrays larger than about 5000 scalar components. Note that if this restriction
13425 is set in the spec of a package, it will not apply to its body.
13427 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
13428 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{210}
13429 @subsection No_Obsolescent_Features
13432 @geindex No_Obsolescent_Features
13434 [RM 13.12.1] This restriction checks at compile time that no obsolescent
13435 features are used, as defined in Annex J of the Ada Reference Manual.
13437 @node No_Wide_Characters,Static_Dispatch_Tables,No_Obsolescent_Features,Program Unit Level Restrictions
13438 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{211}
13439 @subsection No_Wide_Characters
13442 @geindex No_Wide_Characters
13444 [GNAT] This restriction ensures at compile time that no uses of the types
13445 @code{Wide_Character} or @code{Wide_String} or corresponding wide
13447 appear, and that no wide or wide wide string or character literals
13448 appear in the program (that is literals representing characters not in
13449 type @code{Character}).
13451 @node Static_Dispatch_Tables,SPARK_05,No_Wide_Characters,Program Unit Level Restrictions
13452 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{212}
13453 @subsection Static_Dispatch_Tables
13456 @geindex Static_Dispatch_Tables
13458 [GNAT] This restriction checks at compile time that all the artifacts
13459 associated with dispatch tables can be placed in read-only memory.
13461 @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions
13462 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{213}
13463 @subsection SPARK_05
13468 [GNAT] This restriction checks at compile time that some constructs forbidden
13469 in SPARK 2005 are not present. Note that SPARK 2005 has been superseded by
13470 SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
13471 a codebase respects SPARK 2014 restrictions, mark the code with pragma or
13472 aspect @code{SPARK_Mode}, and run the tool GNATprove at Stone assurance level, as
13476 gnatprove -P project.gpr --mode=stone
13482 gnatprove -P project.gpr --mode=check_all
13485 With restriction @code{SPARK_05}, error messages related to SPARK 2005 restriction
13489 violation of restriction "SPARK_05" at <source-location>
13495 The restriction @code{SPARK} is recognized as a synonym for @code{SPARK_05}. This is
13496 retained for historical compatibility purposes (and an unconditional warning
13497 will be generated for its use, advising replacement by @code{SPARK_05}).
13499 This is not a replacement for the semantic checks performed by the
13500 SPARK Examiner tool, as the compiler currently only deals with code,
13501 not SPARK 2005 annotations, and does not guarantee catching all
13502 cases of constructs forbidden by SPARK 2005.
13504 Thus it may well be the case that code which passes the compiler with
13505 the SPARK 2005 restriction is rejected by the SPARK Examiner, e.g. due to
13506 the different visibility rules of the Examiner based on SPARK 2005
13507 @code{inherit} annotations.
13509 This restriction can be useful in providing an initial filter for code
13510 developed using SPARK 2005, or in examining legacy code to see how far
13511 it is from meeting SPARK 2005 restrictions.
13513 The list below summarizes the checks that are performed when this
13514 restriction is in force:
13520 No block statements
13523 No case statements with only an others clause
13526 Exit statements in loops must respect the SPARK 2005 language restrictions
13532 Return can only appear as last statement in function
13535 Function must have return statement
13538 Loop parameter specification must include subtype mark
13541 Prefix of expanded name cannot be a loop statement
13544 Abstract subprogram not allowed
13547 User-defined operators not allowed
13550 Access type parameters not allowed
13553 Default expressions for parameters not allowed
13556 Default expressions for record fields not allowed
13559 No tasking constructs allowed
13562 Label needed at end of subprograms and packages
13565 No mixing of positional and named parameter association
13568 No access types as result type
13571 No unconstrained arrays as result types
13577 Initial and later declarations must be in correct order (declaration can't come after body)
13580 No attributes on private types if full declaration not visible
13583 No package declaration within package specification
13586 No controlled types
13589 No discriminant types
13595 Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
13598 Access attribute not allowed
13601 Allocator not allowed
13604 Result of catenation must be String
13607 Operands of catenation must be string literal, static char or another catenation
13610 No conditional expressions
13613 No explicit dereference
13616 Quantified expression not allowed
13619 Slicing not allowed
13622 No exception renaming
13625 No generic renaming
13634 Aggregates must be qualified
13637 Nonstatic choice in array aggregates not allowed
13640 The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
13643 No mixing of positional and named association in aggregate, no multi choice
13646 AND, OR and XOR for arrays only allowed when operands have same static bounds
13649 Fixed point operands to * or / must be qualified or converted
13652 Comparison operators not allowed for Booleans or arrays (except strings)
13655 Equality not allowed for arrays with non-matching static bounds (except strings)
13658 Conversion / qualification not allowed for arrays with non-matching static bounds
13661 Subprogram declaration only allowed in package spec (unless followed by import)
13664 Access types not allowed
13667 Incomplete type declaration not allowed
13670 Object and subtype declarations must respect SPARK 2005 restrictions
13673 Digits or delta constraint not allowed
13676 Decimal fixed point type not allowed
13679 Aliasing of objects not allowed
13682 Modular type modulus must be power of 2
13685 Base not allowed on subtype mark
13688 Unary operators not allowed on modular types (except not)
13691 Untagged record cannot be null
13694 No class-wide operations
13697 Initialization expressions must respect SPARK 2005 restrictions
13700 Nonstatic ranges not allowed except in iteration schemes
13703 String subtypes must have lower bound of 1
13706 Subtype of Boolean cannot have constraint
13709 At most one tagged type or extension per package
13712 Interface is not allowed
13715 Character literal cannot be prefixed (selector name cannot be character literal)
13718 Record aggregate cannot contain 'others'
13721 Component association in record aggregate must contain a single choice
13724 Ancestor part cannot be a type mark
13727 Attributes 'Image, 'Width and 'Value not allowed
13730 Functions may not update globals
13733 Subprograms may not contain direct calls to themselves (prevents recursion within unit)
13736 Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
13739 The following restrictions are enforced, but note that they are actually more
13740 strict that the latest SPARK 2005 language definition:
13746 No derived types other than tagged type extensions
13749 Subtype of unconstrained array must have constraint
13752 This list summarises the main SPARK 2005 language rules that are not
13753 currently checked by the SPARK_05 restriction:
13759 SPARK 2005 annotations are treated as comments so are not checked at all
13762 Based real literals not allowed
13765 Objects cannot be initialized at declaration by calls to user-defined functions
13768 Objects cannot be initialized at declaration by assignments from variables
13771 Objects cannot be initialized at declaration by assignments from indexed/selected components
13774 Ranges shall not be null
13777 A fixed point delta expression must be a simple expression
13780 Restrictions on where renaming declarations may be placed
13783 Externals of mode 'out' cannot be referenced
13786 Externals of mode 'in' cannot be updated
13789 Loop with no iteration scheme or exits only allowed as last statement in main program or task
13792 Subprogram cannot have parent unit name
13795 SPARK 2005 inherited subprogram must be prefixed with overriding
13798 External variables (or functions that reference them) may not be passed as actual parameters
13801 Globals must be explicitly mentioned in contract
13804 Deferred constants cannot be completed by pragma Import
13807 Package initialization cannot read/write variables from other packages
13810 Prefix not allowed for entities that are directly visible
13813 Identifier declaration can't override inherited package name
13816 Cannot use Standard or other predefined packages as identifiers
13819 After renaming, cannot use the original name
13822 Subprograms can only be renamed to remove package prefix
13825 Pragma import must be immediately after entity it names
13828 No mutual recursion between multiple units (this can be checked with gnatcheck)
13831 Note that if a unit is compiled in Ada 95 mode with the SPARK 2005 restriction,
13832 violations will be reported for constructs forbidden in SPARK 95,
13833 instead of SPARK 2005.
13835 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13836 @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}
13837 @chapter Implementation Advice
13840 The main text of the Ada Reference Manual describes the required
13841 behavior of all Ada compilers, and the GNAT compiler conforms to
13842 these requirements.
13844 In addition, there are sections throughout the Ada Reference Manual headed
13845 by the phrase 'Implementation advice'. These sections are not normative,
13846 i.e., they do not specify requirements that all compilers must
13847 follow. Rather they provide advice on generally desirable behavior.
13848 They are not requirements, because they describe behavior that cannot
13849 be provided on all systems, or may be undesirable on some systems.
13851 As far as practical, GNAT follows the implementation advice in
13852 the Ada Reference Manual. Each such RM section corresponds to a section
13853 in this chapter whose title specifies the
13854 RM section number and paragraph number and the subject of
13855 the advice. The contents of each section consists of the RM text within
13857 followed by the GNAT interpretation of the advice. Most often, this simply says
13858 'followed', which means that GNAT follows the advice. However, in a
13859 number of cases, GNAT deliberately deviates from this advice, in which
13860 case the text describes what GNAT does and why.
13862 @geindex Error detection
13865 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection.
13866 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units.
13867 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors.
13868 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas.
13869 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas.
13870 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets.
13871 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types.
13872 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types.
13873 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values.
13874 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types.
13875 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays.
13876 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small.
13877 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation.
13878 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information.
13879 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks.
13880 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses.
13881 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types.
13882 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses.
13883 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses.
13884 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses.
13885 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses.
13886 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses.
13887 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses.
13888 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses.
13889 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes.
13890 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering.
13891 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private.
13892 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations.
13893 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion.
13894 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage.
13895 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation.
13896 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes.
13897 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types.
13898 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling.
13899 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling.
13900 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation.
13901 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate.
13902 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export.
13903 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces.
13904 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C.
13905 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL.
13906 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran.
13907 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations.
13908 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations.
13909 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support.
13910 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers.
13911 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts.
13912 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements.
13913 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names.
13914 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes.
13915 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies.
13916 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies.
13917 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort.
13918 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions.
13919 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time.
13920 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem.
13921 * RM F(7); COBOL Support: RM F 7 COBOL Support.
13922 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support.
13923 * RM G; Numerics: RM G Numerics.
13924 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types.
13925 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions.
13926 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements.
13927 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy.
13928 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy.
13932 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13933 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{216}
13934 @section RM 1.1.3(20): Error Detection
13939 "If an implementation detects the use of an unsupported Specialized Needs
13940 Annex feature at run time, it should raise @code{Program_Error} if
13944 Not relevant. All specialized needs annex features are either supported,
13945 or diagnosed at compile time.
13947 @geindex Child Units
13949 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13950 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{217}
13951 @section RM 1.1.3(31): Child Units
13956 "If an implementation wishes to provide implementation-defined
13957 extensions to the functionality of a language-defined library unit, it
13958 should normally do so by adding children to the library unit."
13963 @geindex Bounded errors
13965 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13966 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{218}
13967 @section RM 1.1.5(12): Bounded Errors
13972 "If an implementation detects a bounded error or erroneous
13973 execution, it should raise @code{Program_Error}."
13976 Followed in all cases in which the implementation detects a bounded
13977 error or erroneous execution. Not all such situations are detected at
13982 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
13983 @anchor{gnat_rm/implementation_advice id2}@anchor{219}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{21a}
13984 @section RM 2.8(16): Pragmas
13989 "Normally, implementation-defined pragmas should have no semantic effect
13990 for error-free programs; that is, if the implementation-defined pragmas
13991 are removed from a working program, the program should still be legal,
13992 and should still have the same semantics."
13995 The following implementation defined pragmas are exceptions to this
13999 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx}
14042 @emph{CPP_Constructor}
14058 @emph{Interface_Name}
14066 @emph{Machine_Attribute}
14074 @emph{Unimplemented_Unit}
14082 @emph{Unchecked_Union}
14091 In each of the above cases, it is essential to the purpose of the pragma
14092 that this advice not be followed. For details see
14093 @ref{7,,Implementation Defined Pragmas}.
14095 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
14096 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{21b}
14097 @section RM 2.8(17-19): Pragmas
14102 "Normally, an implementation should not define pragmas that can
14103 make an illegal program legal, except as follows:
14109 A pragma used to complete a declaration, such as a pragma @code{Import};
14112 A pragma used to configure the environment by adding, removing, or
14113 replacing @code{library_items}."
14117 See @ref{21a,,RM 2.8(16); Pragmas}.
14119 @geindex Character Sets
14121 @geindex Alternative Character Sets
14123 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
14124 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{21c}
14125 @section RM 3.5.2(5): Alternative Character Sets
14130 "If an implementation supports a mode with alternative interpretations
14131 for @code{Character} and @code{Wide_Character}, the set of graphic
14132 characters of @code{Character} should nevertheless remain a proper
14133 subset of the set of graphic characters of @code{Wide_Character}. Any
14134 character set 'localizations' should be reflected in the results of
14135 the subprograms defined in the language-defined package
14136 @code{Characters.Handling} (see A.3) available in such a mode. In a mode with
14137 an alternative interpretation of @code{Character}, the implementation should
14138 also support a corresponding change in what is a legal
14139 @code{identifier_letter}."
14142 Not all wide character modes follow this advice, in particular the JIS
14143 and IEC modes reflect standard usage in Japan, and in these encoding,
14144 the upper half of the Latin-1 set is not part of the wide-character
14145 subset, since the most significant bit is used for wide character
14146 encoding. However, this only applies to the external forms. Internally
14147 there is no such restriction.
14149 @geindex Integer types
14151 @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
14152 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{21d}
14153 @section RM 3.5.4(28): Integer Types
14158 "An implementation should support @code{Long_Integer} in addition to
14159 @code{Integer} if the target machine supports 32-bit (or longer)
14160 arithmetic. No other named integer subtypes are recommended for package
14161 @code{Standard}. Instead, appropriate named integer subtypes should be
14162 provided in the library package @code{Interfaces} (see B.2)."
14165 @code{Long_Integer} is supported. Other standard integer types are supported
14166 so this advice is not fully followed. These types
14167 are supported for convenient interface to C, and so that all hardware
14168 types of the machine are easily available.
14170 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
14171 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{21e}
14172 @section RM 3.5.4(29): Integer Types
14177 "An implementation for a two's complement machine should support
14178 modular types with a binary modulus up to @code{System.Max_Int*2+2}. An
14179 implementation should support a non-binary modules up to @code{Integer'Last}."
14184 @geindex Enumeration values
14186 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
14187 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{21f}
14188 @section RM 3.5.5(8): Enumeration Values
14193 "For the evaluation of a call on @code{S'Pos} for an enumeration
14194 subtype, if the value of the operand does not correspond to the internal
14195 code for any enumeration literal of its type (perhaps due to an
14196 un-initialized variable), then the implementation should raise
14197 @code{Program_Error}. This is particularly important for enumeration
14198 types with noncontiguous internal codes specified by an
14199 enumeration_representation_clause."
14204 @geindex Float types
14206 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
14207 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{220}
14208 @section RM 3.5.7(17): Float Types
14213 "An implementation should support @code{Long_Float} in addition to
14214 @code{Float} if the target machine supports 11 or more digits of
14215 precision. No other named floating point subtypes are recommended for
14216 package @code{Standard}. Instead, appropriate named floating point subtypes
14217 should be provided in the library package @code{Interfaces} (see B.2)."
14220 @code{Short_Float} and @code{Long_Long_Float} are also provided. The
14221 former provides improved compatibility with other implementations
14222 supporting this type. The latter corresponds to the highest precision
14223 floating-point type supported by the hardware. On most machines, this
14224 will be the same as @code{Long_Float}, but on some machines, it will
14225 correspond to the IEEE extended form. The notable case is all ia32
14226 (x86) implementations, where @code{Long_Long_Float} corresponds to
14227 the 80-bit extended precision format supported in hardware on this
14228 processor. Note that the 128-bit format on SPARC is not supported,
14229 since this is a software rather than a hardware format.
14231 @geindex Multidimensional arrays
14234 @geindex multidimensional
14236 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration'Small,RM 3 5 7 17 Float Types,Implementation Advice
14237 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{221}
14238 @section RM 3.6.2(11): Multidimensional Arrays
14243 "An implementation should normally represent multidimensional arrays in
14244 row-major order, consistent with the notation used for multidimensional
14245 array aggregates (see 4.3.3). However, if a pragma @code{Convention}
14246 (@code{Fortran}, ...) applies to a multidimensional array type, then
14247 column-major order should be used instead (see B.5, @emph{Interfacing with Fortran})."
14252 @geindex Duration'Small
14254 @node RM 9 6 30-31 Duration'Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
14255 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{222}
14256 @section RM 9.6(30-31): Duration'Small
14261 "Whenever possible in an implementation, the value of @code{Duration'Small}
14262 should be no greater than 100 microseconds."
14265 Followed. (@code{Duration'Small} = 10**(-9)).
14269 "The time base for @code{delay_relative_statements} should be monotonic;
14270 it need not be the same time base as used for @code{Calendar.Clock}."
14275 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration'Small,Implementation Advice
14276 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{223}
14277 @section RM 10.2.1(12): Consistent Representation
14282 "In an implementation, a type declared in a pre-elaborated package should
14283 have the same representation in every elaboration of a given version of
14284 the package, whether the elaborations occur in distinct executions of
14285 the same program, or in executions of distinct programs or partitions
14286 that include the given version."
14289 Followed, except in the case of tagged types. Tagged types involve
14290 implicit pointers to a local copy of a dispatch table, and these pointers
14291 have representations which thus depend on a particular elaboration of the
14292 package. It is not easy to see how it would be possible to follow this
14293 advice without severely impacting efficiency of execution.
14295 @geindex Exception information
14297 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
14298 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{224}
14299 @section RM 11.4.1(19): Exception Information
14304 "@code{Exception_Message} by default and @code{Exception_Information}
14305 should produce information useful for
14306 debugging. @code{Exception_Message} should be short, about one
14307 line. @code{Exception_Information} can be long. @code{Exception_Message}
14308 should not include the
14309 @code{Exception_Name}. @code{Exception_Information} should include both
14310 the @code{Exception_Name} and the @code{Exception_Message}."
14313 Followed. For each exception that doesn't have a specified
14314 @code{Exception_Message}, the compiler generates one containing the location
14315 of the raise statement. This location has the form 'file_name:line', where
14316 file_name is the short file name (without path information) and line is the line
14317 number in the file. Note that in the case of the Zero Cost Exception
14318 mechanism, these messages become redundant with the Exception_Information that
14319 contains a full backtrace of the calling sequence, so they are disabled.
14320 To disable explicitly the generation of the source location message, use the
14321 Pragma @code{Discard_Names}.
14323 @geindex Suppression of checks
14326 @geindex suppression of
14328 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
14329 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{225}
14330 @section RM 11.5(28): Suppression of Checks
14335 "The implementation should minimize the code executed for checks that
14336 have been suppressed."
14341 @geindex Representation clauses
14343 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
14344 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{226}
14345 @section RM 13.1 (21-24): Representation Clauses
14350 "The recommended level of support for all representation items is
14351 qualified as follows:
14353 An implementation need not support representation items containing
14354 nonstatic expressions, except that an implementation should support a
14355 representation item for a given entity if each nonstatic expression in
14356 the representation item is a name that statically denotes a constant
14357 declared before the entity."
14360 Followed. In fact, GNAT goes beyond the recommended level of support
14361 by allowing nonstatic expressions in some representation clauses even
14362 without the need to declare constants initialized with the values of
14369 for Y'Address use X'Address;>>
14372 "An implementation need not support a specification for the `@w{`}Size`@w{`}
14373 for a given composite subtype, nor the size or storage place for an
14374 object (including a component) of a given composite subtype, unless the
14375 constraints on the subtype and its composite subcomponents (if any) are
14376 all static constraints."
14379 Followed. Size Clauses are not permitted on nonstatic components, as
14384 "An aliased component, or a component whose type is by-reference, should
14385 always be allocated at an addressable location."
14390 @geindex Packed types
14392 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
14393 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{227}
14394 @section RM 13.2(6-8): Packed Types
14399 "If a type is packed, then the implementation should try to minimize
14400 storage allocated to objects of the type, possibly at the expense of
14401 speed of accessing components, subject to reasonable complexity in
14402 addressing calculations.
14404 The recommended level of support pragma @code{Pack} is:
14406 For a packed record type, the components should be packed as tightly as
14407 possible subject to the Sizes of the component subtypes, and subject to
14408 any @emph{record_representation_clause} that applies to the type; the
14409 implementation may, but need not, reorder components or cross aligned
14410 word boundaries to improve the packing. A component whose @code{Size} is
14411 greater than the word size may be allocated an integral number of words."
14414 Followed. Tight packing of arrays is supported for all component sizes
14415 up to 64-bits. If the array component size is 1 (that is to say, if
14416 the component is a boolean type or an enumeration type with two values)
14417 then values of the type are implicitly initialized to zero. This
14418 happens both for objects of the packed type, and for objects that have a
14419 subcomponent of the packed type.
14423 "An implementation should support Address clauses for imported
14429 @geindex Address clauses
14431 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
14432 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{228}
14433 @section RM 13.3(14-19): Address Clauses
14438 "For an array @code{X}, @code{X'Address} should point at the first
14439 component of the array, and not at the array bounds."
14446 "The recommended level of support for the @code{Address} attribute is:
14448 @code{X'Address} should produce a useful result if @code{X} is an
14449 object that is aliased or of a by-reference type, or is an entity whose
14450 @code{Address} has been specified."
14453 Followed. A valid address will be produced even if none of those
14454 conditions have been met. If necessary, the object is forced into
14455 memory to ensure the address is valid.
14459 "An implementation should support @code{Address} clauses for imported
14467 "Objects (including subcomponents) that are aliased or of a by-reference
14468 type should be allocated on storage element boundaries."
14475 "If the @code{Address} of an object is specified, or it is imported or exported,
14476 then the implementation should not perform optimizations based on
14477 assumptions of no aliases."
14482 @geindex Alignment clauses
14484 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
14485 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{229}
14486 @section RM 13.3(29-35): Alignment Clauses
14491 "The recommended level of support for the @code{Alignment} attribute for
14494 An implementation should support specified Alignments that are factors
14495 and multiples of the number of storage elements per word, subject to the
14503 "An implementation need not support specified Alignments for
14504 combinations of Sizes and Alignments that cannot be easily
14505 loaded and stored by available machine instructions."
14512 "An implementation need not support specified Alignments that are
14513 greater than the maximum @code{Alignment} the implementation ever returns by
14521 "The recommended level of support for the @code{Alignment} attribute for
14524 Same as above, for subtypes, but in addition:"
14531 "For stand-alone library-level objects of statically constrained
14532 subtypes, the implementation should support all alignments
14533 supported by the target linker. For example, page alignment is likely to
14534 be supported for such objects, but not for subtypes."
14539 @geindex Size clauses
14541 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
14542 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{22a}
14543 @section RM 13.3(42-43): Size Clauses
14548 "The recommended level of support for the @code{Size} attribute of
14551 A @code{Size} clause should be supported for an object if the specified
14552 @code{Size} is at least as large as its subtype's @code{Size}, and
14553 corresponds to a size in storage elements that is a multiple of the
14554 object's @code{Alignment} (if the @code{Alignment} is nonzero)."
14559 @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
14560 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{22b}
14561 @section RM 13.3(50-56): Size Clauses
14566 "If the @code{Size} of a subtype is specified, and allows for efficient
14567 independent addressability (see 9.10) on the target architecture, then
14568 the @code{Size} of the following objects of the subtype should equal the
14569 @code{Size} of the subtype:
14571 Aliased objects (including components)."
14578 "@cite{Size} clause on a composite subtype should not affect the
14579 internal layout of components."
14582 Followed. But note that this can be overridden by use of the implementation
14583 pragma Implicit_Packing in the case of packed arrays.
14587 "The recommended level of support for the @code{Size} attribute of subtypes is:
14589 The @code{Size} (if not specified) of a static discrete or fixed point
14590 subtype should be the number of bits needed to represent each value
14591 belonging to the subtype using an unbiased representation, leaving space
14592 for a sign bit only if the subtype contains negative values. If such a
14593 subtype is a first subtype, then an implementation should support a
14594 specified @code{Size} for it that reflects this representation."
14601 "For a subtype implemented with levels of indirection, the @code{Size}
14602 should include the size of the pointers, but not the size of what they
14608 @geindex Component_Size clauses
14610 @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
14611 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{22c}
14612 @section RM 13.3(71-73): Component Size Clauses
14617 "The recommended level of support for the @code{Component_Size}
14620 An implementation need not support specified @code{Component_Sizes} that are
14621 less than the @code{Size} of the component subtype."
14628 "An implementation should support specified Component_Sizes that
14629 are factors and multiples of the word size. For such
14630 Component_Sizes, the array should contain no gaps between
14631 components. For other Component_Sizes (if supported), the array
14632 should contain no gaps between components when packing is also
14633 specified; the implementation should forbid this combination in cases
14634 where it cannot support a no-gaps representation."
14639 @geindex Enumeration representation clauses
14641 @geindex Representation clauses
14642 @geindex enumeration
14644 @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
14645 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{22d}
14646 @section RM 13.4(9-10): Enumeration Representation Clauses
14651 "The recommended level of support for enumeration representation clauses
14654 An implementation need not support enumeration representation clauses
14655 for boolean types, but should at minimum support the internal codes in
14656 the range @code{System.Min_Int .. System.Max_Int}."
14661 @geindex Record representation clauses
14663 @geindex Representation clauses
14666 @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
14667 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{22e}
14668 @section RM 13.5.1(17-22): Record Representation Clauses
14673 "The recommended level of support for
14674 @emph{record_representation_clause}s is:
14676 An implementation should support storage places that can be extracted
14677 with a load, mask, shift sequence of machine code, and set with a load,
14678 shift, mask, store sequence, given the available machine instructions
14679 and run-time model."
14686 "A storage place should be supported if its size is equal to the
14687 @code{Size} of the component subtype, and it starts and ends on a
14688 boundary that obeys the @code{Alignment} of the component subtype."
14695 "If the default bit ordering applies to the declaration of a given type,
14696 then for a component whose subtype's @code{Size} is less than the word
14697 size, any storage place that does not cross an aligned word boundary
14698 should be supported."
14705 "An implementation may reserve a storage place for the tag field of a
14706 tagged type, and disallow other components from overlapping that place."
14709 Followed. The storage place for the tag field is the beginning of the tagged
14710 record, and its size is Address'Size. GNAT will reject an explicit component
14711 clause for the tag field.
14715 "An implementation need not support a @emph{component_clause} for a
14716 component of an extension part if the storage place is not after the
14717 storage places of all components of the parent type, whether or not
14718 those storage places had been specified."
14721 Followed. The above advice on record representation clauses is followed,
14722 and all mentioned features are implemented.
14724 @geindex Storage place attributes
14726 @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
14727 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{22f}
14728 @section RM 13.5.2(5): Storage Place Attributes
14733 "If a component is represented using some form of pointer (such as an
14734 offset) to the actual data of the component, and this data is contiguous
14735 with the rest of the object, then the storage place attributes should
14736 reflect the place of the actual data, not the pointer. If a component is
14737 allocated discontinuously from the rest of the object, then a warning
14738 should be generated upon reference to one of its storage place
14742 Followed. There are no such components in GNAT.
14744 @geindex Bit ordering
14746 @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
14747 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{230}
14748 @section RM 13.5.3(7-8): Bit Ordering
14753 "The recommended level of support for the non-default bit ordering is:
14755 If @code{Word_Size} = @code{Storage_Unit}, then the implementation
14756 should support the non-default bit ordering in addition to the default
14760 Followed. Word size does not equal storage size in this implementation.
14761 Thus non-default bit ordering is not supported.
14764 @geindex as private type
14766 @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
14767 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{231}
14768 @section RM 13.7(37): Address as Private
14773 "@cite{Address} should be of a private type."
14778 @geindex Operations
14779 @geindex on `@w{`}Address`@w{`}
14782 @geindex operations of
14784 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14785 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{232}
14786 @section RM 13.7.1(16): Address Operations
14791 "Operations in @code{System} and its children should reflect the target
14792 environment semantics as closely as is reasonable. For example, on most
14793 machines, it makes sense for address arithmetic to 'wrap around'.
14794 Operations that do not make sense should raise @code{Program_Error}."
14797 Followed. Address arithmetic is modular arithmetic that wraps around. No
14798 operation raises @code{Program_Error}, since all operations make sense.
14800 @geindex Unchecked conversion
14802 @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
14803 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{233}
14804 @section RM 13.9(14-17): Unchecked Conversion
14809 "The @code{Size} of an array object should not include its bounds; hence,
14810 the bounds should not be part of the converted data."
14817 "The implementation should not generate unnecessary run-time checks to
14818 ensure that the representation of @code{S} is a representation of the
14819 target type. It should take advantage of the permission to return by
14820 reference when possible. Restrictions on unchecked conversions should be
14821 avoided unless required by the target environment."
14824 Followed. There are no restrictions on unchecked conversion. A warning is
14825 generated if the source and target types do not have the same size since
14826 the semantics in this case may be target dependent.
14830 "The recommended level of support for unchecked conversions is:
14832 Unchecked conversions should be supported and should be reversible in
14833 the cases where this clause defines the result. To enable meaningful use
14834 of unchecked conversion, a contiguous representation should be used for
14835 elementary subtypes, for statically constrained array subtypes whose
14836 component subtype is one of the subtypes described in this paragraph,
14837 and for record subtypes without discriminants whose component subtypes
14838 are described in this paragraph."
14843 @geindex Heap usage
14846 @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
14847 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{234}
14848 @section RM 13.11(23-25): Implicit Heap Usage
14853 "An implementation should document any cases in which it dynamically
14854 allocates heap storage for a purpose other than the evaluation of an
14858 Followed, the only other points at which heap storage is dynamically
14859 allocated are as follows:
14865 At initial elaboration time, to allocate dynamically sized global
14869 To allocate space for a task when a task is created.
14872 To extend the secondary stack dynamically when needed. The secondary
14873 stack is used for returning variable length results.
14879 "A default (implementation-provided) storage pool for an
14880 access-to-constant type should not have overhead to support deallocation of
14881 individual objects."
14888 "A storage pool for an anonymous access type should be created at the
14889 point of an allocator for the type, and be reclaimed when the designated
14890 object becomes inaccessible."
14895 @geindex Unchecked deallocation
14897 @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
14898 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{235}
14899 @section RM 13.11.2(17): Unchecked Deallocation
14904 "For a standard storage pool, @code{Free} should actually reclaim the
14910 @geindex Stream oriented attributes
14912 @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
14913 @anchor{gnat_rm/implementation_advice rm-13-13-2-1-6-stream-oriented-attributes}@anchor{236}
14914 @section RM 13.13.2(1.6): Stream Oriented Attributes
14919 "If not specified, the value of Stream_Size for an elementary type
14920 should be the number of bits that corresponds to the minimum number of
14921 stream elements required by the first subtype of the type, rounded up
14922 to the nearest factor or multiple of the word size that is also a
14923 multiple of the stream element size."
14926 Followed, except that the number of stream elements is a power of 2.
14927 The Stream_Size may be used to override the default choice.
14929 However, such an implementation is based on direct binary
14930 representations and is therefore target- and endianness-dependent. To
14931 address this issue, GNAT also supplies an alternate implementation of
14932 the stream attributes @code{Read} and @code{Write}, which uses the
14933 target-independent XDR standard representation for scalar types.
14935 @geindex XDR representation
14937 @geindex Read attribute
14939 @geindex Write attribute
14941 @geindex Stream oriented attributes
14943 The XDR implementation is provided as an alternative body of the
14944 @code{System.Stream_Attributes} package, in the file
14945 @code{s-stratt-xdr.adb} in the GNAT library.
14946 There is no @code{s-stratt-xdr.ads} file.
14947 In order to install the XDR implementation, do the following:
14953 Replace the default implementation of the
14954 @code{System.Stream_Attributes} package with the XDR implementation.
14955 For example on a Unix platform issue the commands:
14958 $ mv s-stratt.adb s-stratt-default.adb
14959 $ mv s-stratt-xdr.adb s-stratt.adb
14963 Rebuild the GNAT run-time library as documented in
14964 the @emph{GNAT and Libraries} section of the @cite{GNAT User's Guide}.
14967 @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
14968 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{237}
14969 @section RM A.1(52): Names of Predefined Numeric Types
14974 "If an implementation provides additional named predefined integer types,
14975 then the names should end with @code{Integer} as in
14976 @code{Long_Integer}. If an implementation provides additional named
14977 predefined floating point types, then the names should end with
14978 @code{Float} as in @code{Long_Float}."
14983 @geindex Ada.Characters.Handling
14985 @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
14986 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{238}
14987 @section RM A.3.2(49): @code{Ada.Characters.Handling}
14992 "If an implementation provides a localized definition of @code{Character}
14993 or @code{Wide_Character}, then the effects of the subprograms in
14994 @code{Characters.Handling} should reflect the localizations.
14998 Followed. GNAT provides no such localized definitions.
15000 @geindex Bounded-length strings
15002 @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
15003 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{239}
15004 @section RM A.4.4(106): Bounded-Length String Handling
15009 "Bounded string objects should not be implemented by implicit pointers
15010 and dynamic allocation."
15013 Followed. No implicit pointers or dynamic allocation are used.
15015 @geindex Random number generation
15017 @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
15018 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{23a}
15019 @section RM A.5.2(46-47): Random Number Generation
15024 "Any storage associated with an object of type @code{Generator} should be
15025 reclaimed on exit from the scope of the object."
15032 "If the generator period is sufficiently long in relation to the number
15033 of distinct initiator values, then each possible value of
15034 @code{Initiator} passed to @code{Reset} should initiate a sequence of
15035 random numbers that does not, in a practical sense, overlap the sequence
15036 initiated by any other value. If this is not possible, then the mapping
15037 between initiator values and generator states should be a rapidly
15038 varying function of the initiator value."
15041 Followed. The generator period is sufficiently long for the first
15042 condition here to hold true.
15044 @geindex Get_Immediate
15046 @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
15047 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{23b}
15048 @section RM A.10.7(23): @code{Get_Immediate}
15053 "The @code{Get_Immediate} procedures should be implemented with
15054 unbuffered input. For a device such as a keyboard, input should be
15055 available if a key has already been typed, whereas for a disk
15056 file, input should always be available except at end of file. For a file
15057 associated with a keyboard-like device, any line-editing features of the
15058 underlying operating system should be disabled during the execution of
15059 @code{Get_Immediate}."
15062 Followed on all targets except VxWorks. For VxWorks, there is no way to
15063 provide this functionality that does not result in the input buffer being
15064 flushed before the @code{Get_Immediate} call. A special unit
15065 @code{Interfaces.Vxworks.IO} is provided that contains routines to enable
15066 this functionality.
15070 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 10 7 23 Get_Immediate,Implementation Advice
15071 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{23c}
15072 @section RM B.1(39-41): Pragma @code{Export}
15077 "If an implementation supports pragma @code{Export} to a given language,
15078 then it should also allow the main subprogram to be written in that
15079 language. It should support some mechanism for invoking the elaboration
15080 of the Ada library units included in the system, and for invoking the
15081 finalization of the environment task. On typical systems, the
15082 recommended mechanism is to provide two subprograms whose link names are
15083 @code{adainit} and @code{adafinal}. @code{adainit} should contain the
15084 elaboration code for library units. @code{adafinal} should contain the
15085 finalization code. These subprograms should have no effect the second
15086 and subsequent time they are called."
15093 "Automatic elaboration of pre-elaborated packages should be
15094 provided when pragma @code{Export} is supported."
15097 Followed when the main program is in Ada. If the main program is in a
15098 foreign language, then
15099 @code{adainit} must be called to elaborate pre-elaborated
15104 "For each supported convention @emph{L} other than @code{Intrinsic}, an
15105 implementation should support @code{Import} and @code{Export} pragmas
15106 for objects of @emph{L}-compatible types and for subprograms, and pragma
15107 @cite{Convention} for @emph{L}-eligible types and for subprograms,
15108 presuming the other language has corresponding features. Pragma
15109 @code{Convention} need not be supported for scalar types."
15114 @geindex Package Interfaces
15116 @geindex Interfaces
15118 @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
15119 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{23d}
15120 @section RM B.2(12-13): Package @code{Interfaces}
15125 "For each implementation-defined convention identifier, there should be a
15126 child package of package Interfaces with the corresponding name. This
15127 package should contain any declarations that would be useful for
15128 interfacing to the language (implementation) represented by the
15129 convention. Any declarations useful for interfacing to any language on
15130 the given hardware architecture should be provided directly in
15131 @code{Interfaces}."
15138 "An implementation supporting an interface to C, COBOL, or Fortran should
15139 provide the corresponding package or packages described in the following
15143 Followed. GNAT provides all the packages described in this section.
15146 @geindex interfacing with
15148 @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
15149 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{23e}
15150 @section RM B.3(63-71): Interfacing with C
15155 "An implementation should support the following interface correspondences
15156 between Ada and C."
15163 "An Ada procedure corresponds to a void-returning C function."
15170 "An Ada function corresponds to a non-void C function."
15177 "An Ada @code{in} scalar parameter is passed as a scalar argument to a C
15185 "An Ada @code{in} parameter of an access-to-object type with designated
15186 type @code{T} is passed as a @code{t*} argument to a C function,
15187 where @code{t} is the C type corresponding to the Ada type @code{T}."
15194 "An Ada access @code{T} parameter, or an Ada @code{out} or @code{in out}
15195 parameter of an elementary type @code{T}, is passed as a @code{t*}
15196 argument to a C function, where @code{t} is the C type corresponding to
15197 the Ada type @code{T}. In the case of an elementary @code{out} or
15198 @code{in out} parameter, a pointer to a temporary copy is used to
15199 preserve by-copy semantics."
15206 "An Ada parameter of a record type @code{T}, of any mode, is passed as a
15207 @code{t*} argument to a C function, where @code{t} is the C
15208 structure corresponding to the Ada type @code{T}."
15211 Followed. This convention may be overridden by the use of the C_Pass_By_Copy
15212 pragma, or Convention, or by explicitly specifying the mechanism for a given
15213 call using an extended import or export pragma.
15217 "An Ada parameter of an array type with component type @code{T}, of any
15218 mode, is passed as a @code{t*} argument to a C function, where
15219 @code{t} is the C type corresponding to the Ada type @code{T}."
15226 "An Ada parameter of an access-to-subprogram type is passed as a pointer
15227 to a C function whose prototype corresponds to the designated
15228 subprogram's specification."
15234 @geindex interfacing with
15236 @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
15237 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{23f}
15238 @section RM B.4(95-98): Interfacing with COBOL
15243 "An Ada implementation should support the following interface
15244 correspondences between Ada and COBOL."
15251 "An Ada access @code{T} parameter is passed as a @code{BY REFERENCE} data item of
15252 the COBOL type corresponding to @code{T}."
15259 "An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
15260 the corresponding COBOL type."
15267 "Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
15268 COBOL type corresponding to the Ada parameter type; for scalars, a local
15269 copy is used if necessary to ensure by-copy semantics."
15275 @geindex interfacing with
15277 @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
15278 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{240}
15279 @section RM B.5(22-26): Interfacing with Fortran
15284 "An Ada implementation should support the following interface
15285 correspondences between Ada and Fortran:"
15292 "An Ada procedure corresponds to a Fortran subroutine."
15299 "An Ada function corresponds to a Fortran function."
15306 "An Ada parameter of an elementary, array, or record type @code{T} is
15307 passed as a @code{T} argument to a Fortran procedure, where @code{T} is
15308 the Fortran type corresponding to the Ada type @code{T}, and where the
15309 INTENT attribute of the corresponding dummy argument matches the Ada
15310 formal parameter mode; the Fortran implementation's parameter passing
15311 conventions are used. For elementary types, a local copy is used if
15312 necessary to ensure by-copy semantics."
15319 "An Ada parameter of an access-to-subprogram type is passed as a
15320 reference to a Fortran procedure whose interface corresponds to the
15321 designated subprogram's specification."
15326 @geindex Machine operations
15328 @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
15329 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{241}
15330 @section RM C.1(3-5): Access to Machine Operations
15335 "The machine code or intrinsic support should allow access to all
15336 operations normally available to assembly language programmers for the
15337 target environment, including privileged instructions, if any."
15344 "The interfacing pragmas (see Annex B) should support interface to
15345 assembler; the default assembler should be associated with the
15346 convention identifier @code{Assembler}."
15353 "If an entity is exported to assembly language, then the implementation
15354 should allocate it at an addressable location, and should ensure that it
15355 is retained by the linking process, even if not otherwise referenced
15356 from the Ada code. The implementation should assume that any call to a
15357 machine code or assembler subprogram is allowed to read or update every
15358 object that is specified as exported."
15363 @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
15364 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{242}
15365 @section RM C.1(10-16): Access to Machine Operations
15370 "The implementation should ensure that little or no overhead is
15371 associated with calling intrinsic and machine-code subprograms."
15374 Followed for both intrinsics and machine-code subprograms.
15378 "It is recommended that intrinsic subprograms be provided for convenient
15379 access to any machine operations that provide special capabilities or
15380 efficiency and that are not otherwise available through the language
15384 Followed. A full set of machine operation intrinsic subprograms is provided.
15388 "Atomic read-modify-write operations---e.g., test and set, compare and
15389 swap, decrement and test, enqueue/dequeue."
15392 Followed on any target supporting such operations.
15396 "Standard numeric functions---e.g.:, sin, log."
15399 Followed on any target supporting such operations.
15403 "String manipulation operations---e.g.:, translate and test."
15406 Followed on any target supporting such operations.
15410 "Vector operations---e.g.:, compare vector against thresholds."
15413 Followed on any target supporting such operations.
15417 "Direct operations on I/O ports."
15420 Followed on any target supporting such operations.
15422 @geindex Interrupt support
15424 @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
15425 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{243}
15426 @section RM C.3(28): Interrupt Support
15431 "If the @code{Ceiling_Locking} policy is not in effect, the
15432 implementation should provide means for the application to specify which
15433 interrupts are to be blocked during protected actions, if the underlying
15434 system allows for a finer-grain control of interrupt blocking."
15437 Followed. The underlying system does not allow for finer-grain control
15438 of interrupt blocking.
15440 @geindex Protected procedure handlers
15442 @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
15443 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{244}
15444 @section RM C.3.1(20-21): Protected Procedure Handlers
15449 "Whenever possible, the implementation should allow interrupt handlers to
15450 be called directly by the hardware."
15453 Followed on any target where the underlying operating system permits
15458 "Whenever practical, violations of any
15459 implementation-defined restrictions should be detected before run time."
15462 Followed. Compile time warnings are given when possible.
15464 @geindex Package `@w{`}Interrupts`@w{`}
15466 @geindex Interrupts
15468 @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
15469 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{245}
15470 @section RM C.3.2(25): Package @code{Interrupts}
15475 "If implementation-defined forms of interrupt handler procedures are
15476 supported, such as protected procedures with parameters, then for each
15477 such form of a handler, a type analogous to @code{Parameterless_Handler}
15478 should be specified in a child package of @code{Interrupts}, with the
15479 same operations as in the predefined package Interrupts."
15484 @geindex Pre-elaboration requirements
15486 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
15487 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{246}
15488 @section RM C.4(14): Pre-elaboration Requirements
15493 "It is recommended that pre-elaborated packages be implemented in such a
15494 way that there should be little or no code executed at run time for the
15495 elaboration of entities not already covered by the Implementation
15499 Followed. Executable code is generated in some cases, e.g., loops
15500 to initialize large arrays.
15502 @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
15503 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{247}
15504 @section RM C.5(8): Pragma @code{Discard_Names}
15509 "If the pragma applies to an entity, then the implementation should
15510 reduce the amount of storage used for storing names associated with that
15516 @geindex Package Task_Attributes
15518 @geindex Task_Attributes
15520 @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
15521 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{248}
15522 @section RM C.7.2(30): The Package Task_Attributes
15527 "Some implementations are targeted to domains in which memory use at run
15528 time must be completely deterministic. For such implementations, it is
15529 recommended that the storage for task attributes will be pre-allocated
15530 statically and not from the heap. This can be accomplished by either
15531 placing restrictions on the number and the size of the task's
15532 attributes, or by using the pre-allocated storage for the first @code{N}
15533 attribute objects, and the heap for the others. In the latter case,
15534 @code{N} should be documented."
15537 Not followed. This implementation is not targeted to such a domain.
15539 @geindex Locking Policies
15541 @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
15542 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{249}
15543 @section RM D.3(17): Locking Policies
15548 "The implementation should use names that end with @code{_Locking} for
15549 locking policies defined by the implementation."
15552 Followed. Two implementation-defined locking policies are defined,
15553 whose names (@code{Inheritance_Locking} and
15554 @code{Concurrent_Readers_Locking}) follow this suggestion.
15556 @geindex Entry queuing policies
15558 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
15559 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{24a}
15560 @section RM D.4(16): Entry Queuing Policies
15565 "Names that end with @code{_Queuing} should be used
15566 for all implementation-defined queuing policies."
15569 Followed. No such implementation-defined queuing policies exist.
15571 @geindex Preemptive abort
15573 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
15574 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{24b}
15575 @section RM D.6(9-10): Preemptive Abort
15580 "Even though the @emph{abort_statement} is included in the list of
15581 potentially blocking operations (see 9.5.1), it is recommended that this
15582 statement be implemented in a way that never requires the task executing
15583 the @emph{abort_statement} to block."
15590 "On a multi-processor, the delay associated with aborting a task on
15591 another processor should be bounded; the implementation should use
15592 periodic polling, if necessary, to achieve this."
15597 @geindex Tasking restrictions
15599 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
15600 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{24c}
15601 @section RM D.7(21): Tasking Restrictions
15606 "When feasible, the implementation should take advantage of the specified
15607 restrictions to produce a more efficient implementation."
15610 GNAT currently takes advantage of these restrictions by providing an optimized
15611 run time when the Ravenscar profile and the GNAT restricted run time set
15612 of restrictions are specified. See pragma @code{Profile (Ravenscar)} and
15613 pragma @code{Profile (Restricted)} for more details.
15618 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
15619 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{24d}
15620 @section RM D.8(47-49): Monotonic Time
15625 "When appropriate, implementations should provide configuration
15626 mechanisms to change the value of @code{Tick}."
15629 Such configuration mechanisms are not appropriate to this implementation
15630 and are thus not supported.
15634 "It is recommended that @code{Calendar.Clock} and @code{Real_Time.Clock}
15635 be implemented as transformations of the same time base."
15642 "It is recommended that the best time base which exists in
15643 the underlying system be available to the application through
15644 @code{Clock}. @cite{Best} may mean highest accuracy or largest range."
15649 @geindex Partition communication subsystem
15653 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
15654 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{24e}
15655 @section RM E.5(28-29): Partition Communication Subsystem
15660 "Whenever possible, the PCS on the called partition should allow for
15661 multiple tasks to call the RPC-receiver with different messages and
15662 should allow them to block until the corresponding subprogram body
15666 Followed by GLADE, a separately supplied PCS that can be used with
15671 "The @code{Write} operation on a stream of type @code{Params_Stream_Type}
15672 should raise @code{Storage_Error} if it runs out of space trying to
15673 write the @code{Item} into the stream."
15676 Followed by GLADE, a separately supplied PCS that can be used with
15679 @geindex COBOL support
15681 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
15682 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{24f}
15683 @section RM F(7): COBOL Support
15688 "If COBOL (respectively, C) is widely supported in the target
15689 environment, implementations supporting the Information Systems Annex
15690 should provide the child package @code{Interfaces.COBOL} (respectively,
15691 @code{Interfaces.C}) specified in Annex B and should support a
15692 @code{convention_identifier} of COBOL (respectively, C) in the interfacing
15693 pragmas (see Annex B), thus allowing Ada programs to interface with
15694 programs written in that language."
15699 @geindex Decimal radix support
15701 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15702 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{250}
15703 @section RM F.1(2): Decimal Radix Support
15708 "Packed decimal should be used as the internal representation for objects
15709 of subtype @code{S} when @code{S}'Machine_Radix = 10."
15712 Not followed. GNAT ignores @code{S}'Machine_Radix and always uses binary
15717 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15718 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{251}
15719 @section RM G: Numerics
15724 "If Fortran (respectively, C) is widely supported in the target
15725 environment, implementations supporting the Numerics Annex
15726 should provide the child package @code{Interfaces.Fortran} (respectively,
15727 @code{Interfaces.C}) specified in Annex B and should support a
15728 @code{convention_identifier} of Fortran (respectively, C) in the interfacing
15729 pragmas (see Annex B), thus allowing Ada programs to interface with
15730 programs written in that language."
15735 @geindex Complex types
15737 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15738 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{252}
15739 @section RM G.1.1(56-58): Complex Types
15744 "Because the usual mathematical meaning of multiplication of a complex
15745 operand and a real operand is that of the scaling of both components of
15746 the former by the latter, an implementation should not perform this
15747 operation by first promoting the real operand to complex type and then
15748 performing a full complex multiplication. In systems that, in the
15749 future, support an Ada binding to IEC 559:1989, the latter technique
15750 will not generate the required result when one of the components of the
15751 complex operand is infinite. (Explicit multiplication of the infinite
15752 component by the zero component obtained during promotion yields a NaN
15753 that propagates into the final result.) Analogous advice applies in the
15754 case of multiplication of a complex operand and a pure-imaginary
15755 operand, and in the case of division of a complex operand by a real or
15756 pure-imaginary operand."
15763 "Similarly, because the usual mathematical meaning of addition of a
15764 complex operand and a real operand is that the imaginary operand remains
15765 unchanged, an implementation should not perform this operation by first
15766 promoting the real operand to complex type and then performing a full
15767 complex addition. In implementations in which the @code{Signed_Zeros}
15768 attribute of the component type is @code{True} (and which therefore
15769 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15770 predefined arithmetic operations), the latter technique will not
15771 generate the required result when the imaginary component of the complex
15772 operand is a negatively signed zero. (Explicit addition of the negative
15773 zero to the zero obtained during promotion yields a positive zero.)
15774 Analogous advice applies in the case of addition of a complex operand
15775 and a pure-imaginary operand, and in the case of subtraction of a
15776 complex operand and a real or pure-imaginary operand."
15783 "Implementations in which @code{Real'Signed_Zeros} is @code{True} should
15784 attempt to provide a rational treatment of the signs of zero results and
15785 result components. As one example, the result of the @code{Argument}
15786 function should have the sign of the imaginary component of the
15787 parameter @code{X} when the point represented by that parameter lies on
15788 the positive real axis; as another, the sign of the imaginary component
15789 of the @code{Compose_From_Polar} function should be the same as
15790 (respectively, the opposite of) that of the @code{Argument} parameter when that
15791 parameter has a value of zero and the @code{Modulus} parameter has a
15792 nonnegative (respectively, negative) value."
15797 @geindex Complex elementary functions
15799 @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
15800 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{253}
15801 @section RM G.1.2(49): Complex Elementary Functions
15806 "Implementations in which @code{Complex_Types.Real'Signed_Zeros} is
15807 @code{True} should attempt to provide a rational treatment of the signs
15808 of zero results and result components. For example, many of the complex
15809 elementary functions have components that are odd functions of one of
15810 the parameter components; in these cases, the result component should
15811 have the sign of the parameter component at the origin. Other complex
15812 elementary functions have zero components whose sign is opposite that of
15813 a parameter component at the origin, or is always positive or always
15819 @geindex Accuracy requirements
15821 @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
15822 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{254}
15823 @section RM G.2.4(19): Accuracy Requirements
15828 "The versions of the forward trigonometric functions without a
15829 @code{Cycle} parameter should not be implemented by calling the
15830 corresponding version with a @code{Cycle} parameter of
15831 @code{2.0*Numerics.Pi}, since this will not provide the required
15832 accuracy in some portions of the domain. For the same reason, the
15833 version of @code{Log} without a @code{Base} parameter should not be
15834 implemented by calling the corresponding version with a @code{Base}
15835 parameter of @code{Numerics.e}."
15840 @geindex Complex arithmetic accuracy
15843 @geindex complex arithmetic
15845 @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
15846 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{255}
15847 @section RM G.2.6(15): Complex Arithmetic Accuracy
15852 "The version of the @code{Compose_From_Polar} function without a
15853 @code{Cycle} parameter should not be implemented by calling the
15854 corresponding version with a @code{Cycle} parameter of
15855 @code{2.0*Numerics.Pi}, since this will not provide the required
15856 accuracy in some portions of the domain."
15861 @geindex Sequential elaboration policy
15863 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15864 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{256}
15865 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15870 "If the partition elaboration policy is @code{Sequential} and the
15871 Environment task becomes permanently blocked during elaboration then the
15872 partition is deadlocked and it is recommended that the partition be
15873 immediately terminated."
15878 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15879 @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}
15880 @chapter Implementation Defined Characteristics
15883 In addition to the implementation dependent pragmas and attributes, and the
15884 implementation advice, there are a number of other Ada features that are
15885 potentially implementation dependent and are designated as
15886 implementation-defined. These are mentioned throughout the Ada Reference
15887 Manual, and are summarized in Annex M.
15889 A requirement for conforming Ada compilers is that they provide
15890 documentation describing how the implementation deals with each of these
15891 issues. In this chapter you will find each point in Annex M listed,
15892 followed by a description of how GNAT
15893 handles the implementation dependence.
15895 You can use this chapter as a guide to minimizing implementation
15896 dependent features in your programs if portability to other compilers
15897 and other operating systems is an important consideration. The numbers
15898 in each entry below correspond to the paragraph numbers in the Ada
15905 "Whether or not each recommendation given in Implementation
15906 Advice is followed. See 1.1.2(37)."
15909 See @ref{a,,Implementation Advice}.
15915 "Capacity limitations of the implementation. See 1.1.3(3)."
15918 The complexity of programs that can be processed is limited only by the
15919 total amount of available virtual memory, and disk space for the
15920 generated object files.
15926 "Variations from the standard that are impractical to avoid
15927 given the implementation's execution environment. See 1.1.3(6)."
15930 There are no variations from the standard.
15936 "Which code_statements cause external
15937 interactions. See 1.1.3(10)."
15940 Any @emph{code_statement} can potentially cause external interactions.
15946 "The coded representation for the text of an Ada
15947 program. See 2.1(4)."
15950 See separate section on source representation.
15956 "The control functions allowed in comments. See 2.1(14)."
15959 See separate section on source representation.
15965 "The representation for an end of line. See 2.2(2)."
15968 See separate section on source representation.
15974 "Maximum supported line length and lexical element
15975 length. See 2.2(15)."
15978 The maximum line length is 255 characters and the maximum length of
15979 a lexical element is also 255 characters. This is the default setting
15980 if not overridden by the use of compiler switch @emph{-gnaty} (which
15981 sets the maximum to 79) or @emph{-gnatyMnn} which allows the maximum
15982 line length to be specified to be any value up to 32767. The maximum
15983 length of a lexical element is the same as the maximum line length.
15989 "Implementation defined pragmas. See 2.8(14)."
15992 See @ref{7,,Implementation Defined Pragmas}.
15998 "Effect of pragma @code{Optimize}. See 2.8(27)."
16001 Pragma @code{Optimize}, if given with a @code{Time} or @code{Space}
16002 parameter, checks that the optimization flag is set, and aborts if it is
16009 "The sequence of characters of the value returned by
16010 @code{S'Image} when some of the graphic characters of
16011 @code{S'Wide_Image} are not defined in @code{Character}. See
16015 The sequence of characters is as defined by the wide character encoding
16016 method used for the source. See section on source representation for
16023 "The predefined integer types declared in
16024 @code{Standard}. See 3.5.4(25)."
16028 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16039 @emph{Short_Short_Integer}
16047 @emph{Short_Integer}
16051 (Short) 16 bit signed
16063 @emph{Long_Integer}
16067 64 bit signed (on most 64 bit targets,
16068 depending on the C definition of long).
16069 32 bit signed (all other targets)
16073 @emph{Long_Long_Integer}
16086 "Any nonstandard integer types and the operators defined
16087 for them. See 3.5.4(26)."
16090 There are no nonstandard integer types.
16096 "Any nonstandard real types and the operators defined for
16097 them. See 3.5.6(8)."
16100 There are no nonstandard real types.
16106 "What combinations of requested decimal precision and range
16107 are supported for floating point types. See 3.5.7(7)."
16110 The precision and range is as defined by the IEEE standard.
16116 "The predefined floating point types declared in
16117 @code{Standard}. See 3.5.7(16)."
16121 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16144 (Short) 32 bit IEEE short
16156 @emph{Long_Long_Float}
16160 64 bit IEEE long (80 bit IEEE long on x86 processors)
16169 "The small of an ordinary fixed point type. See 3.5.9(8)."
16172 @code{Fine_Delta} is 2**(-63)
16178 "What combinations of small, range, and digits are
16179 supported for fixed point types. See 3.5.9(10)."
16182 Any combinations are permitted that do not result in a small less than
16183 @code{Fine_Delta} and do not result in a mantissa larger than 63 bits.
16184 If the mantissa is larger than 53 bits on machines where Long_Long_Float
16185 is 64 bits (true of all architectures except ia32), then the output from
16186 Text_IO is accurate to only 53 bits, rather than the full mantissa. This
16187 is because floating-point conversions are used to convert fixed point.
16193 "The result of @code{Tags.Expanded_Name} for types declared
16194 within an unnamed @emph{block_statement}. See 3.9(10)."
16197 Block numbers of the form @code{B@emph{nnn}}, where @emph{nnn} is a
16198 decimal integer are allocated.
16204 "Implementation-defined attributes. See 4.1.4(12)."
16207 See @ref{8,,Implementation Defined Attributes}.
16213 "Any implementation-defined time types. See 9.6(6)."
16216 There are no implementation-defined time types.
16222 "The time base associated with relative delays."
16225 See 9.6(20). The time base used is that provided by the C library
16226 function @code{gettimeofday}.
16232 "The time base of the type @code{Calendar.Time}. See
16236 The time base used is that provided by the C library function
16237 @code{gettimeofday}.
16243 "The time zone used for package @code{Calendar}
16244 operations. See 9.6(24)."
16247 The time zone used by package @code{Calendar} is the current system time zone
16248 setting for local time, as accessed by the C library function
16255 "Any limit on @emph{delay_until_statements} of
16256 @emph{select_statements}. See 9.6(29)."
16259 There are no such limits.
16265 "Whether or not two non-overlapping parts of a composite
16266 object are independently addressable, in the case where packing, record
16267 layout, or @code{Component_Size} is specified for the object. See
16271 Separate components are independently addressable if they do not share
16272 overlapping storage units.
16278 "The representation for a compilation. See 10.1(2)."
16281 A compilation is represented by a sequence of files presented to the
16282 compiler in a single invocation of the @emph{gcc} command.
16288 "Any restrictions on compilations that contain multiple
16289 compilation_units. See 10.1(4)."
16292 No single file can contain more than one compilation unit, but any
16293 sequence of files can be presented to the compiler as a single
16300 "The mechanisms for creating an environment and for adding
16301 and replacing compilation units. See 10.1.4(3)."
16304 See separate section on compilation model.
16310 "The manner of explicitly assigning library units to a
16311 partition. See 10.2(2)."
16314 If a unit contains an Ada main program, then the Ada units for the partition
16315 are determined by recursive application of the rules in the Ada Reference
16316 Manual section 10.2(2-6). In other words, the Ada units will be those that
16317 are needed by the main program, and then this definition of need is applied
16318 recursively to those units, and the partition contains the transitive
16319 closure determined by this relationship. In short, all the necessary units
16320 are included, with no need to explicitly specify the list. If additional
16321 units are required, e.g., by foreign language units, then all units must be
16322 mentioned in the context clause of one of the needed Ada units.
16324 If the partition contains no main program, or if the main program is in
16325 a language other than Ada, then GNAT
16326 provides the binder options @emph{-z} and @emph{-n} respectively, and in
16327 this case a list of units can be explicitly supplied to the binder for
16328 inclusion in the partition (all units needed by these units will also
16329 be included automatically). For full details on the use of these
16330 options, refer to @emph{GNAT Make Program gnatmake} in the
16331 @cite{GNAT User's Guide}.
16337 "The implementation-defined means, if any, of specifying
16338 which compilation units are needed by a given compilation unit. See
16342 The units needed by a given compilation unit are as defined in
16343 the Ada Reference Manual section 10.2(2-6). There are no
16344 implementation-defined pragmas or other implementation-defined
16345 means for specifying needed units.
16351 "The manner of designating the main subprogram of a
16352 partition. See 10.2(7)."
16355 The main program is designated by providing the name of the
16356 corresponding @code{ALI} file as the input parameter to the binder.
16362 "The order of elaboration of @emph{library_items}. See
16366 The first constraint on ordering is that it meets the requirements of
16367 Chapter 10 of the Ada Reference Manual. This still leaves some
16368 implementation dependent choices, which are resolved by first
16369 elaborating bodies as early as possible (i.e., in preference to specs
16370 where there is a choice), and second by evaluating the immediate with
16371 clauses of a unit to determine the probably best choice, and
16372 third by elaborating in alphabetical order of unit names
16373 where a choice still remains.
16379 "Parameter passing and function return for the main
16380 subprogram. See 10.2(21)."
16383 The main program has no parameters. It may be a procedure, or a function
16384 returning an integer type. In the latter case, the returned integer
16385 value is the return code of the program (overriding any value that
16386 may have been set by a call to @code{Ada.Command_Line.Set_Exit_Status}).
16392 "The mechanisms for building and running partitions. See
16396 GNAT itself supports programs with only a single partition. The GNATDIST
16397 tool provided with the GLADE package (which also includes an implementation
16398 of the PCS) provides a completely flexible method for building and running
16399 programs consisting of multiple partitions. See the separate GLADE manual
16406 "The details of program execution, including program
16407 termination. See 10.2(25)."
16410 See separate section on compilation model.
16416 "The semantics of any non-active partitions supported by the
16417 implementation. See 10.2(28)."
16420 Passive partitions are supported on targets where shared memory is
16421 provided by the operating system. See the GLADE reference manual for
16428 "The information returned by @code{Exception_Message}. See
16432 Exception message returns the null string unless a specific message has
16433 been passed by the program.
16439 "The result of @code{Exceptions.Exception_Name} for types
16440 declared within an unnamed @emph{block_statement}. See 11.4.1(12)."
16443 Blocks have implementation defined names of the form @code{B@emph{nnn}}
16444 where @emph{nnn} is an integer.
16450 "The information returned by
16451 @code{Exception_Information}. See 11.4.1(13)."
16454 @code{Exception_Information} returns a string in the following format:
16457 *Exception_Name:* nnnnn
16460 *Load address:* 0xhhhh
16461 *Call stack traceback locations:*
16462 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
16473 @code{nnnn} is the fully qualified name of the exception in all upper
16474 case letters. This line is always present.
16477 @code{mmmm} is the message (this line present only if message is non-null)
16480 @code{ppp} is the Process Id value as a decimal integer (this line is
16481 present only if the Process Id is nonzero). Currently we are
16482 not making use of this field.
16485 The Load address line, the Call stack traceback locations line and the
16486 following values are present only if at least one traceback location was
16487 recorded. The Load address indicates the address at which the main executable
16488 was loaded; this line may not be present if operating system hasn't relocated
16489 the main executable. The values are given in C style format, with lower case
16490 letters for a-f, and only as many digits present as are necessary.
16491 The line terminator sequence at the end of each line, including
16492 the last line is a single @code{LF} character (@code{16#0A#}).
16500 "Implementation-defined check names. See 11.5(27)."
16503 The implementation defined check names include Alignment_Check,
16504 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
16505 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
16506 program can add implementation-defined check names by means of the pragma
16507 Check_Name. See the description of pragma @code{Suppress} for full details.
16513 "The interpretation of each aspect of representation. See
16517 See separate section on data representations.
16523 "Any restrictions placed upon representation items. See
16527 See separate section on data representations.
16533 "The meaning of @code{Size} for indefinite subtypes. See
16537 Size for an indefinite subtype is the maximum possible size, except that
16538 for the case of a subprogram parameter, the size of the parameter object
16539 is the actual size.
16545 "The default external representation for a type tag. See
16549 The default external representation for a type tag is the fully expanded
16550 name of the type in upper case letters.
16556 "What determines whether a compilation unit is the same in
16557 two different partitions. See 13.3(76)."
16560 A compilation unit is the same in two different partitions if and only
16561 if it derives from the same source file.
16567 "Implementation-defined components. See 13.5.1(15)."
16570 The only implementation defined component is the tag for a tagged type,
16571 which contains a pointer to the dispatching table.
16577 "If @code{Word_Size} = @code{Storage_Unit}, the default bit
16578 ordering. See 13.5.3(5)."
16581 @code{Word_Size} (32) is not the same as @code{Storage_Unit} (8) for this
16582 implementation, so no non-default bit ordering is supported. The default
16583 bit ordering corresponds to the natural endianness of the target architecture.
16589 "The contents of the visible part of package @code{System}
16590 and its language-defined children. See 13.7(2)."
16593 See the definition of these packages in files @code{system.ads} and
16594 @code{s-stoele.ads}. Note that two declarations are added to package
16598 Max_Priority : constant Positive := Priority'Last;
16599 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
16606 "The contents of the visible part of package
16607 @code{System.Machine_Code}, and the meaning of
16608 @emph{code_statements}. See 13.8(7)."
16611 See the definition and documentation in file @code{s-maccod.ads}.
16617 "The effect of unchecked conversion. See 13.9(11)."
16620 Unchecked conversion between types of the same size
16621 results in an uninterpreted transmission of the bits from one type
16622 to the other. If the types are of unequal sizes, then in the case of
16623 discrete types, a shorter source is first zero or sign extended as
16624 necessary, and a shorter target is simply truncated on the left.
16625 For all non-discrete types, the source is first copied if necessary
16626 to ensure that the alignment requirements of the target are met, then
16627 a pointer is constructed to the source value, and the result is obtained
16628 by dereferencing this pointer after converting it to be a pointer to the
16629 target type. Unchecked conversions where the target subtype is an
16630 unconstrained array are not permitted. If the target alignment is
16631 greater than the source alignment, then a copy of the result is
16632 made with appropriate alignment
16638 "The semantics of operations on invalid representations.
16639 See 13.9.2(10-11)."
16642 For assignments and other operations where the use of invalid values cannot
16643 result in erroneous behavior, the compiler ignores the possibility of invalid
16644 values. An exception is raised at the point where an invalid value would
16645 result in erroneous behavior. For example executing:
16648 procedure invalidvals is
16650 Y : Natural range 1 .. 10;
16651 for Y'Address use X'Address;
16652 Z : Natural range 1 .. 10;
16653 A : array (Natural range 1 .. 10) of Integer;
16655 Z := Y; -- no exception
16656 A (Z) := 3; -- exception raised;
16660 As indicated, an exception is raised on the array assignment, but not
16661 on the simple assignment of the invalid negative value from Y to Z.
16667 "The manner of choosing a storage pool for an access type
16668 when @code{Storage_Pool} is not specified for the type. See 13.11(17)."
16671 There are 3 different standard pools used by the compiler when
16672 @code{Storage_Pool} is not specified depending whether the type is local
16673 to a subprogram or defined at the library level and whether
16674 @code{Storage_Size`@w{`}is specified or not. See documentation in the runtime
16675 library units `@w{`}System.Pool_Global}, @code{System.Pool_Size} and
16676 @code{System.Pool_Local} in files @code{s-poosiz.ads},
16677 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
16678 default pools used.
16684 "Whether or not the implementation provides user-accessible
16685 names for the standard pool type(s). See 13.11(17)."
16688 See documentation in the sources of the run time mentioned in the previous
16689 paragraph. All these pools are accessible by means of @cite{with}ing
16696 "The meaning of @code{Storage_Size}. See 13.11(18)."
16699 @code{Storage_Size} is measured in storage units, and refers to the
16700 total space available for an access type collection, or to the primary
16701 stack space for a task.
16707 "Implementation-defined aspects of storage pools. See
16711 See documentation in the sources of the run time mentioned in the
16712 paragraph about standard storage pools above
16713 for details on GNAT-defined aspects of storage pools.
16719 "The set of restrictions allowed in a pragma
16720 @code{Restrictions}. See 13.12(7)."
16723 See @ref{9,,Standard and Implementation Defined Restrictions}.
16729 "The consequences of violating limitations on
16730 @code{Restrictions} pragmas. See 13.12(9)."
16733 Restrictions that can be checked at compile time result in illegalities
16734 if violated. Currently there are no other consequences of violating
16741 "The representation used by the @code{Read} and
16742 @code{Write} attributes of elementary types in terms of stream
16743 elements. See 13.13.2(9)."
16746 The representation is the in-memory representation of the base type of
16747 the type, using the number of bits corresponding to the
16748 @code{type'Size} value, and the natural ordering of the machine.
16754 "The names and characteristics of the numeric subtypes
16755 declared in the visible part of package @code{Standard}. See A.1(3)."
16758 See items describing the integer and floating-point types supported.
16764 "The string returned by @code{Character_Set_Version}.
16768 @code{Ada.Wide_Characters.Handling.Character_Set_Version} returns
16769 the string "Unicode 4.0", referring to version 4.0 of the
16770 Unicode specification.
16776 "The accuracy actually achieved by the elementary
16777 functions. See A.5.1(1)."
16780 The elementary functions correspond to the functions available in the C
16781 library. Only fast math mode is implemented.
16787 "The sign of a zero result from some of the operators or
16788 functions in @code{Numerics.Generic_Elementary_Functions}, when
16789 @code{Float_Type'Signed_Zeros} is @code{True}. See A.5.1(46)."
16792 The sign of zeroes follows the requirements of the IEEE 754 standard on
16800 @code{Numerics.Float_Random.Max_Image_Width}. See A.5.2(27)."
16803 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16810 @code{Numerics.Discrete_Random.Max_Image_Width}. See A.5.2(27)."
16813 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16819 "The algorithms for random number generation. See
16823 The algorithm is the Mersenne Twister, as documented in the source file
16824 @code{s-rannum.adb}. This version of the algorithm has a period of
16831 "The string representation of a random number generator's
16832 state. See A.5.2(38)."
16835 The value returned by the Image function is the concatenation of
16836 the fixed-width decimal representations of the 624 32-bit integers
16837 of the state vector.
16843 "The minimum time interval between calls to the
16844 time-dependent Reset procedure that are guaranteed to initiate different
16845 random number sequences. See A.5.2(45)."
16848 The minimum period between reset calls to guarantee distinct series of
16849 random numbers is one microsecond.
16855 "The values of the @code{Model_Mantissa},
16856 @code{Model_Emin}, @code{Model_Epsilon}, @code{Model},
16857 @code{Safe_First}, and @code{Safe_Last} attributes, if the Numerics
16858 Annex is not supported. See A.5.3(72)."
16861 Run the compiler with @emph{-gnatS} to produce a listing of package
16862 @code{Standard}, has the values of all numeric attributes.
16868 "Any implementation-defined characteristics of the
16869 input-output packages. See A.7(14)."
16872 There are no special implementation defined characteristics for these
16879 "The value of @code{Buffer_Size} in @code{Storage_IO}. See
16883 All type representations are contiguous, and the @code{Buffer_Size} is
16884 the value of @code{type'Size} rounded up to the next storage unit
16891 "External files for standard input, standard output, and
16892 standard error See A.10(5)."
16895 These files are mapped onto the files provided by the C streams
16896 libraries. See source file @code{i-cstrea.ads} for further details.
16902 "The accuracy of the value produced by @code{Put}. See
16906 If more digits are requested in the output than are represented by the
16907 precision of the value, zeroes are output in the corresponding least
16908 significant digit positions.
16914 "The meaning of @code{Argument_Count}, @code{Argument}, and
16915 @code{Command_Name}. See A.15(1)."
16918 These are mapped onto the @code{argv} and @code{argc} parameters of the
16919 main program in the natural manner.
16925 "The interpretation of the @code{Form} parameter in procedure
16926 @code{Create_Directory}. See A.16(56)."
16929 The @code{Form} parameter is not used.
16935 "The interpretation of the @code{Form} parameter in procedure
16936 @code{Create_Path}. See A.16(60)."
16939 The @code{Form} parameter is not used.
16945 "The interpretation of the @code{Form} parameter in procedure
16946 @code{Copy_File}. See A.16(68)."
16949 The @code{Form} parameter is case-insensitive.
16950 Two fields are recognized in the @code{Form} parameter:
16957 <value> starts immediately after the character '=' and ends with the
16958 character immediately preceding the next comma (',') or with the last
16959 character of the parameter.
16961 The only possible values for preserve= are:
16964 @multitable {xxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16975 @emph{no_attributes}
16979 Do not try to preserve any file attributes. This is the
16980 default if no preserve= is found in Form.
16984 @emph{all_attributes}
16988 Try to preserve all file attributes (timestamps, access rights).
16996 Preserve the timestamp of the copied file, but not the other
17002 The only possible values for mode= are:
17005 @multitable {xxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17020 Only do the copy if the destination file does not already exist.
17021 If it already exists, Copy_File fails.
17029 Copy the file in all cases. Overwrite an already existing destination file.
17037 Append the original file to the destination file. If the destination file
17038 does not exist, the destination file is a copy of the source file.
17039 When mode=append, the field preserve=, if it exists, is not taken into account.
17044 If the Form parameter includes one or both of the fields and the value or
17045 values are incorrect, Copy_file fails with Use_Error.
17047 Examples of correct Forms:
17050 Form => "preserve=no_attributes,mode=overwrite" (the default)
17051 Form => "mode=append"
17052 Form => "mode=copy, preserve=all_attributes"
17055 Examples of incorrect Forms:
17058 Form => "preserve=junk"
17059 Form => "mode=internal, preserve=timestamps"
17066 "The interpretation of the @code{Pattern} parameter, when not the null string,
17067 in the @code{Start_Search} and @code{Search} procedures.
17068 See A.16(104) and A.16(112)."
17071 When the @code{Pattern} parameter is not the null string, it is interpreted
17072 according to the syntax of regular expressions as defined in the
17073 @code{GNAT.Regexp} package.
17075 See @ref{259,,GNAT.Regexp (g-regexp.ads)}.
17081 "Implementation-defined convention names. See B.1(11)."
17084 The following convention names are supported
17087 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17106 @emph{Ada_Pass_By_Copy}
17110 Allowed for any types except by-reference types such as limited
17111 records. Compatible with convention Ada, but causes any parameters
17112 with this convention to be passed by copy.
17116 @emph{Ada_Pass_By_Reference}
17120 Allowed for any types except by-copy types such as scalars.
17121 Compatible with convention Ada, but causes any parameters
17122 with this convention to be passed by reference.
17138 Synonym for Assembler
17146 Synonym for Assembler
17158 @emph{C_Pass_By_Copy}
17162 Allowed only for record types, like C, but also notes that record
17163 is to be passed by copy rather than reference.
17175 @emph{C_Plus_Plus (or CPP)}
17187 Treated the same as C
17195 Treated the same as C
17211 For support of pragma @code{Import} with convention Intrinsic, see
17212 separate section on Intrinsic Subprograms.
17220 Stdcall (used for Windows implementations only). This convention correspond
17221 to the WINAPI (previously called Pascal convention) C/C++ convention under
17222 Windows. A routine with this convention cleans the stack before
17223 exit. This pragma cannot be applied to a dispatching call.
17231 Synonym for Stdcall
17239 Synonym for Stdcall
17247 Stubbed is a special convention used to indicate that the body of the
17248 subprogram will be entirely ignored. Any call to the subprogram
17249 is converted into a raise of the @code{Program_Error} exception. If a
17250 pragma @code{Import} specifies convention @code{stubbed} then no body need
17251 be present at all. This convention is useful during development for the
17252 inclusion of subprograms whose body has not yet been written.
17253 In addition, all otherwise unrecognized convention names are also
17254 treated as being synonymous with convention C. In all implementations,
17255 use of such other names results in a warning.
17264 "The meaning of link names. See B.1(36)."
17267 Link names are the actual names used by the linker.
17273 "The manner of choosing link names when neither the link
17274 name nor the address of an imported or exported entity is specified. See
17278 The default linker name is that which would be assigned by the relevant
17279 external language, interpreting the Ada name as being in all lower case
17286 "The effect of pragma @code{Linker_Options}. See B.1(37)."
17289 The string passed to @code{Linker_Options} is presented uninterpreted as
17290 an argument to the link command, unless it contains ASCII.NUL characters.
17291 NUL characters if they appear act as argument separators, so for example
17294 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
17297 causes two separate arguments @code{-labc} and @code{-ldef} to be passed to the
17298 linker. The order of linker options is preserved for a given unit. The final
17299 list of options passed to the linker is in reverse order of the elaboration
17300 order. For example, linker options for a body always appear before the options
17301 from the corresponding package spec.
17307 "The contents of the visible part of package
17308 @code{Interfaces} and its language-defined descendants. See B.2(1)."
17311 See files with prefix @code{i-} in the distributed library.
17317 "Implementation-defined children of package
17318 @code{Interfaces}. The contents of the visible part of package
17319 @code{Interfaces}. See B.2(11)."
17322 See files with prefix @code{i-} in the distributed library.
17328 "The types @code{Floating}, @code{Long_Floating},
17329 @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and
17330 @code{COBOL_Character}; and the initialization of the variables
17331 @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in
17332 @code{Interfaces.COBOL}. See B.4(50)."
17336 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17355 @emph{Long_Floating}
17359 (Floating) Long_Float
17379 @emph{Decimal_Element}
17387 @emph{COBOL_Character}
17396 For initialization, see the file @code{i-cobol.ads} in the distributed library.
17402 "Support for access to machine instructions. See C.1(1)."
17405 See documentation in file @code{s-maccod.ads} in the distributed library.
17411 "Implementation-defined aspects of access to machine
17412 operations. See C.1(9)."
17415 See documentation in file @code{s-maccod.ads} in the distributed library.
17421 "Implementation-defined aspects of interrupts. See C.3(2)."
17424 Interrupts are mapped to signals or conditions as appropriate. See
17426 @code{Ada.Interrupt_Names} in source file @code{a-intnam.ads} for details
17427 on the interrupts supported on a particular target.
17433 "Implementation-defined aspects of pre-elaboration. See
17437 GNAT does not permit a partition to be restarted without reloading,
17438 except under control of the debugger.
17444 "The semantics of pragma @code{Discard_Names}. See C.5(7)."
17447 Pragma @code{Discard_Names} causes names of enumeration literals to
17448 be suppressed. In the presence of this pragma, the Image attribute
17449 provides the image of the Pos of the literal, and Value accepts
17452 For tagged types, when pragmas @code{Discard_Names} and @code{No_Tagged_Streams}
17453 simultaneously apply, their Expanded_Name and External_Tag are initialized
17454 with empty strings. This is useful to avoid exposing entity names at binary
17461 "The result of the @code{Task_Identification.Image}
17462 attribute. See C.7.1(7)."
17465 The result of this attribute is a string that identifies
17466 the object or component that denotes a given task. If a variable @code{Var}
17467 has a task type, the image for this task will have the form @code{Var_@emph{XXXXXXXX}},
17468 where the suffix @emph{XXXXXXXX}
17469 is the hexadecimal representation of the virtual address of the corresponding
17470 task control block. If the variable is an array of tasks, the image of each
17471 task will have the form of an indexed component indicating the position of a
17472 given task in the array, e.g., @code{Group(5)_@emph{XXXXXXX}}. If the task is a
17473 component of a record, the image of the task will have the form of a selected
17474 component. These rules are fully recursive, so that the image of a task that
17475 is a subcomponent of a composite object corresponds to the expression that
17476 designates this task.
17478 If a task is created by an allocator, its image depends on the context. If the
17479 allocator is part of an object declaration, the rules described above are used
17480 to construct its image, and this image is not affected by subsequent
17481 assignments. If the allocator appears within an expression, the image
17482 includes only the name of the task type.
17484 If the configuration pragma Discard_Names is present, or if the restriction
17485 No_Implicit_Heap_Allocation is in effect, the image reduces to
17486 the numeric suffix, that is to say the hexadecimal representation of the
17487 virtual address of the control block of the task.
17493 "The value of @code{Current_Task} when in a protected entry
17494 or interrupt handler. See C.7.1(17)."
17497 Protected entries or interrupt handlers can be executed by any
17498 convenient thread, so the value of @code{Current_Task} is undefined.
17504 "The effect of calling @code{Current_Task} from an entry
17505 body or interrupt handler. See C.7.1(19)."
17508 When GNAT can determine statically that @code{Current_Task} is called directly in
17509 the body of an entry (or barrier) then a warning is emitted and @code{Program_Error}
17510 is raised at run time. Otherwise, the effect of calling @code{Current_Task} from an
17511 entry body or interrupt handler is to return the identification of the task
17512 currently executing the code.
17518 "Implementation-defined aspects of
17519 @code{Task_Attributes}. See C.7.2(19)."
17522 There are no implementation-defined aspects of @code{Task_Attributes}.
17528 "Values of all @code{Metrics}. See D(2)."
17531 The metrics information for GNAT depends on the performance of the
17532 underlying operating system. The sources of the run-time for tasking
17533 implementation, together with the output from @emph{-gnatG} can be
17534 used to determine the exact sequence of operating systems calls made
17535 to implement various tasking constructs. Together with appropriate
17536 information on the performance of the underlying operating system,
17537 on the exact target in use, this information can be used to determine
17538 the required metrics.
17544 "The declarations of @code{Any_Priority} and
17545 @code{Priority}. See D.1(11)."
17548 See declarations in file @code{system.ads}.
17554 "Implementation-defined execution resources. See D.1(15)."
17557 There are no implementation-defined execution resources.
17563 "Whether, on a multiprocessor, a task that is waiting for
17564 access to a protected object keeps its processor busy. See D.2.1(3)."
17567 On a multi-processor, a task that is waiting for access to a protected
17568 object does not keep its processor busy.
17574 "The affect of implementation defined execution resources
17575 on task dispatching. See D.2.1(9)."
17578 Tasks map to threads in the threads package used by GNAT. Where possible
17579 and appropriate, these threads correspond to native threads of the
17580 underlying operating system.
17586 "Implementation-defined @emph{policy_identifiers} allowed
17587 in a pragma @code{Task_Dispatching_Policy}. See D.2.2(3)."
17590 There are no implementation-defined policy-identifiers allowed in this
17597 "Implementation-defined aspects of priority inversion. See
17601 Execution of a task cannot be preempted by the implementation processing
17602 of delay expirations for lower priority tasks.
17608 "Implementation-defined task dispatching. See D.2.2(18)."
17611 The policy is the same as that of the underlying threads implementation.
17617 "Implementation-defined @emph{policy_identifiers} allowed
17618 in a pragma @code{Locking_Policy}. See D.3(4)."
17621 The two implementation defined policies permitted in GNAT are
17622 @code{Inheritance_Locking} and @code{Concurrent_Readers_Locking}. On
17623 targets that support the @code{Inheritance_Locking} policy, locking is
17624 implemented by inheritance, i.e., the task owning the lock operates
17625 at a priority equal to the highest priority of any task currently
17626 requesting the lock. On targets that support the
17627 @code{Concurrent_Readers_Locking} policy, locking is implemented with a
17628 read/write lock allowing multiple protected object functions to enter
17635 "Default ceiling priorities. See D.3(10)."
17638 The ceiling priority of protected objects of the type
17639 @code{System.Interrupt_Priority'Last} as described in the Ada
17640 Reference Manual D.3(10),
17646 "The ceiling of any protected object used internally by
17647 the implementation. See D.3(16)."
17650 The ceiling priority of internal protected objects is
17651 @code{System.Priority'Last}.
17657 "Implementation-defined queuing policies. See D.4(1)."
17660 There are no implementation-defined queuing policies.
17666 "On a multiprocessor, any conditions that cause the
17667 completion of an aborted construct to be delayed later than what is
17668 specified for a single processor. See D.6(3)."
17671 The semantics for abort on a multi-processor is the same as on a single
17672 processor, there are no further delays.
17678 "Any operations that implicitly require heap storage
17679 allocation. See D.7(8)."
17682 The only operation that implicitly requires heap storage allocation is
17689 "What happens when a task terminates in the presence of
17690 pragma @code{No_Task_Termination}. See D.7(15)."
17693 Execution is erroneous in that case.
17699 "Implementation-defined aspects of pragma
17700 @code{Restrictions}. See D.7(20)."
17703 There are no such implementation-defined aspects.
17709 "Implementation-defined aspects of package
17710 @code{Real_Time}. See D.8(17)."
17713 There are no implementation defined aspects of package @code{Real_Time}.
17719 "Implementation-defined aspects of
17720 @emph{delay_statements}. See D.9(8)."
17723 Any difference greater than one microsecond will cause the task to be
17724 delayed (see D.9(7)).
17730 "The upper bound on the duration of interrupt blocking
17731 caused by the implementation. See D.12(5)."
17734 The upper bound is determined by the underlying operating system. In
17735 no cases is it more than 10 milliseconds.
17741 "The means for creating and executing distributed
17742 programs. See E(5)."
17745 The GLADE package provides a utility GNATDIST for creating and executing
17746 distributed programs. See the GLADE reference manual for further details.
17752 "Any events that can result in a partition becoming
17753 inaccessible. See E.1(7)."
17756 See the GLADE reference manual for full details on such events.
17762 "The scheduling policies, treatment of priorities, and
17763 management of shared resources between partitions in certain cases. See
17767 See the GLADE reference manual for full details on these aspects of
17768 multi-partition execution.
17774 "Events that cause the version of a compilation unit to
17775 change. See E.3(5)."
17778 Editing the source file of a compilation unit, or the source files of
17779 any units on which it is dependent in a significant way cause the version
17780 to change. No other actions cause the version number to change. All changes
17781 are significant except those which affect only layout, capitalization or
17788 "Whether the execution of the remote subprogram is
17789 immediately aborted as a result of cancellation. See E.4(13)."
17792 See the GLADE reference manual for details on the effect of abort in
17793 a distributed application.
17799 "Implementation-defined aspects of the PCS. See E.5(25)."
17802 See the GLADE reference manual for a full description of all implementation
17803 defined aspects of the PCS.
17809 "Implementation-defined interfaces in the PCS. See
17813 See the GLADE reference manual for a full description of all
17814 implementation defined interfaces.
17820 "The values of named numbers in the package
17821 @code{Decimal}. See F.2(7)."
17825 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx}
17868 @emph{Max_Decimal_Digits}
17881 "The value of @code{Max_Picture_Length} in the package
17882 @code{Text_IO.Editing}. See F.3.3(16)."
17891 "The value of @code{Max_Picture_Length} in the package
17892 @code{Wide_Text_IO.Editing}. See F.3.4(5)."
17901 "The accuracy actually achieved by the complex elementary
17902 functions and by other complex arithmetic operations. See G.1(1)."
17905 Standard library functions are used for the complex arithmetic
17906 operations. Only fast math mode is currently supported.
17912 "The sign of a zero result (or a component thereof) from
17913 any operator or function in @code{Numerics.Generic_Complex_Types}, when
17914 @code{Real'Signed_Zeros} is True. See G.1.1(53)."
17917 The signs of zero values are as recommended by the relevant
17918 implementation advice.
17924 "The sign of a zero result (or a component thereof) from
17925 any operator or function in
17926 @code{Numerics.Generic_Complex_Elementary_Functions}, when
17927 @code{Real'Signed_Zeros} is @code{True}. See G.1.2(45)."
17930 The signs of zero values are as recommended by the relevant
17931 implementation advice.
17937 "Whether the strict mode or the relaxed mode is the
17938 default. See G.2(2)."
17941 The strict mode is the default. There is no separate relaxed mode. GNAT
17942 provides a highly efficient implementation of strict mode.
17948 "The result interval in certain cases of fixed-to-float
17949 conversion. See G.2.1(10)."
17952 For cases where the result interval is implementation dependent, the
17953 accuracy is that provided by performing all operations in 64-bit IEEE
17954 floating-point format.
17960 "The result of a floating point arithmetic operation in
17961 overflow situations, when the @code{Machine_Overflows} attribute of the
17962 result type is @code{False}. See G.2.1(13)."
17965 Infinite and NaN values are produced as dictated by the IEEE
17966 floating-point standard.
17967 Note that on machines that are not fully compliant with the IEEE
17968 floating-point standard, such as Alpha, the @emph{-mieee} compiler flag
17969 must be used for achieving IEEE conforming behavior (although at the cost
17970 of a significant performance penalty), so infinite and NaN values are
17971 properly generated.
17977 "The result interval for division (or exponentiation by a
17978 negative exponent), when the floating point hardware implements division
17979 as multiplication by a reciprocal. See G.2.1(16)."
17982 Not relevant, division is IEEE exact.
17988 "The definition of close result set, which determines the
17989 accuracy of certain fixed point multiplications and divisions. See
17993 Operations in the close result set are performed using IEEE long format
17994 floating-point arithmetic. The input operands are converted to
17995 floating-point, the operation is done in floating-point, and the result
17996 is converted to the target type.
18002 "Conditions on a @emph{universal_real} operand of a fixed
18003 point multiplication or division for which the result shall be in the
18004 perfect result set. See G.2.3(22)."
18007 The result is only defined to be in the perfect result set if the result
18008 can be computed by a single scaling operation involving a scale factor
18009 representable in 64-bits.
18015 "The result of a fixed point arithmetic operation in
18016 overflow situations, when the @code{Machine_Overflows} attribute of the
18017 result type is @code{False}. See G.2.3(27)."
18020 Not relevant, @code{Machine_Overflows} is @code{True} for fixed-point
18027 "The result of an elementary function reference in
18028 overflow situations, when the @code{Machine_Overflows} attribute of the
18029 result type is @code{False}. See G.2.4(4)."
18032 IEEE infinite and Nan values are produced as appropriate.
18038 "The value of the angle threshold, within which certain
18039 elementary functions, complex arithmetic operations, and complex
18040 elementary functions yield results conforming to a maximum relative
18041 error bound. See G.2.4(10)."
18044 Information on this subject is not yet available.
18050 "The accuracy of certain elementary functions for
18051 parameters beyond the angle threshold. See G.2.4(10)."
18054 Information on this subject is not yet available.
18060 "The result of a complex arithmetic operation or complex
18061 elementary function reference in overflow situations, when the
18062 @code{Machine_Overflows} attribute of the corresponding real type is
18063 @code{False}. See G.2.6(5)."
18066 IEEE infinite and Nan values are produced as appropriate.
18072 "The accuracy of certain complex arithmetic operations and
18073 certain complex elementary functions for parameters (or components
18074 thereof) beyond the angle threshold. See G.2.6(8)."
18077 Information on those subjects is not yet available.
18083 "Information regarding bounded errors and erroneous
18084 execution. See H.2(1)."
18087 Information on this subject is not yet available.
18093 "Implementation-defined aspects of pragma
18094 @code{Inspection_Point}. See H.3.2(8)."
18097 Pragma @code{Inspection_Point} ensures that the variable is live and can
18098 be examined by the debugger at the inspection point.
18104 "Implementation-defined aspects of pragma
18105 @code{Restrictions}. See H.4(25)."
18108 There are no implementation-defined aspects of pragma @code{Restrictions}. The
18109 use of pragma @code{Restrictions [No_Exceptions]} has no effect on the
18110 generated code. Checks must suppressed by use of pragma @code{Suppress}.
18116 "Any restrictions on pragma @code{Restrictions}. See
18120 There are no restrictions on pragma @code{Restrictions}.
18122 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
18123 @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}
18124 @chapter Intrinsic Subprograms
18127 @geindex Intrinsic Subprograms
18129 GNAT allows a user application program to write the declaration:
18132 pragma Import (Intrinsic, name);
18135 providing that the name corresponds to one of the implemented intrinsic
18136 subprograms in GNAT, and that the parameter profile of the referenced
18137 subprogram meets the requirements. This chapter describes the set of
18138 implemented intrinsic subprograms, and the requirements on parameter profiles.
18139 Note that no body is supplied; as with other uses of pragma Import, the
18140 body is supplied elsewhere (in this case by the compiler itself). Note
18141 that any use of this feature is potentially non-portable, since the
18142 Ada standard does not require Ada compilers to implement this feature.
18145 * Intrinsic Operators::
18146 * Compilation_ISO_Date::
18147 * Compilation_Date::
18148 * Compilation_Time::
18149 * Enclosing_Entity::
18150 * Exception_Information::
18151 * Exception_Message::
18155 * Shifts and Rotates::
18156 * Source_Location::
18160 @node Intrinsic Operators,Compilation_ISO_Date,,Intrinsic Subprograms
18161 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{25c}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{25d}
18162 @section Intrinsic Operators
18165 @geindex Intrinsic operator
18167 All the predefined numeric operators in package Standard
18168 in @code{pragma Import (Intrinsic,..)}
18169 declarations. In the binary operator case, the operands must have the same
18170 size. The operand or operands must also be appropriate for
18171 the operator. For example, for addition, the operands must
18172 both be floating-point or both be fixed-point, and the
18173 right operand for @code{"**"} must have a root type of
18174 @code{Standard.Integer'Base}.
18175 You can use an intrinsic operator declaration as in the following example:
18178 type Int1 is new Integer;
18179 type Int2 is new Integer;
18181 function "+" (X1 : Int1; X2 : Int2) return Int1;
18182 function "+" (X1 : Int1; X2 : Int2) return Int2;
18183 pragma Import (Intrinsic, "+");
18186 This declaration would permit 'mixed mode' arithmetic on items
18187 of the differing types @code{Int1} and @code{Int2}.
18188 It is also possible to specify such operators for private types, if the
18189 full views are appropriate arithmetic types.
18191 @node Compilation_ISO_Date,Compilation_Date,Intrinsic Operators,Intrinsic Subprograms
18192 @anchor{gnat_rm/intrinsic_subprograms id3}@anchor{25e}@anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{25f}
18193 @section Compilation_ISO_Date
18196 @geindex Compilation_ISO_Date
18198 This intrinsic subprogram is used in the implementation of the
18199 library package @code{GNAT.Source_Info}. The only useful use of the
18200 intrinsic import in this case is the one in this unit, so an
18201 application program should simply call the function
18202 @code{GNAT.Source_Info.Compilation_ISO_Date} to obtain the date of
18203 the current compilation (in local time format YYYY-MM-DD).
18205 @node Compilation_Date,Compilation_Time,Compilation_ISO_Date,Intrinsic Subprograms
18206 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{260}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{261}
18207 @section Compilation_Date
18210 @geindex Compilation_Date
18212 Same as Compilation_ISO_Date, except the string is in the form
18215 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
18216 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{262}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{263}
18217 @section Compilation_Time
18220 @geindex Compilation_Time
18222 This intrinsic subprogram is used in the implementation of the
18223 library package @code{GNAT.Source_Info}. The only useful use of the
18224 intrinsic import in this case is the one in this unit, so an
18225 application program should simply call the function
18226 @code{GNAT.Source_Info.Compilation_Time} to obtain the time of
18227 the current compilation (in local time format HH:MM:SS).
18229 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
18230 @anchor{gnat_rm/intrinsic_subprograms id6}@anchor{264}@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{265}
18231 @section Enclosing_Entity
18234 @geindex Enclosing_Entity
18236 This intrinsic subprogram is used in the implementation of the
18237 library package @code{GNAT.Source_Info}. The only useful use of the
18238 intrinsic import in this case is the one in this unit, so an
18239 application program should simply call the function
18240 @code{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
18241 the current subprogram, package, task, entry, or protected subprogram.
18243 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
18244 @anchor{gnat_rm/intrinsic_subprograms id7}@anchor{266}@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{267}
18245 @section Exception_Information
18248 @geindex Exception_Information'
18250 This intrinsic subprogram is used in the implementation of the
18251 library package @code{GNAT.Current_Exception}. The only useful
18252 use of the intrinsic import in this case is the one in this unit,
18253 so an application program should simply call the function
18254 @code{GNAT.Current_Exception.Exception_Information} to obtain
18255 the exception information associated with the current exception.
18257 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
18258 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{268}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{269}
18259 @section Exception_Message
18262 @geindex Exception_Message
18264 This intrinsic subprogram is used in the implementation of the
18265 library package @code{GNAT.Current_Exception}. The only useful
18266 use of the intrinsic import in this case is the one in this unit,
18267 so an application program should simply call the function
18268 @code{GNAT.Current_Exception.Exception_Message} to obtain
18269 the message associated with the current exception.
18271 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
18272 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{26a}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{26b}
18273 @section Exception_Name
18276 @geindex Exception_Name
18278 This intrinsic subprogram is used in the implementation of the
18279 library package @code{GNAT.Current_Exception}. The only useful
18280 use of the intrinsic import in this case is the one in this unit,
18281 so an application program should simply call the function
18282 @code{GNAT.Current_Exception.Exception_Name} to obtain
18283 the name of the current exception.
18285 @node File,Line,Exception_Name,Intrinsic Subprograms
18286 @anchor{gnat_rm/intrinsic_subprograms id10}@anchor{26c}@anchor{gnat_rm/intrinsic_subprograms file}@anchor{26d}
18292 This intrinsic subprogram is used in the implementation of the
18293 library package @code{GNAT.Source_Info}. The only useful use of the
18294 intrinsic import in this case is the one in this unit, so an
18295 application program should simply call the function
18296 @code{GNAT.Source_Info.File} to obtain the name of the current
18299 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
18300 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{26e}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{26f}
18306 This intrinsic subprogram is used in the implementation of the
18307 library package @code{GNAT.Source_Info}. The only useful use of the
18308 intrinsic import in this case is the one in this unit, so an
18309 application program should simply call the function
18310 @code{GNAT.Source_Info.Line} to obtain the number of the current
18313 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
18314 @anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{270}@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{271}
18315 @section Shifts and Rotates
18318 @geindex Shift_Left
18320 @geindex Shift_Right
18322 @geindex Shift_Right_Arithmetic
18324 @geindex Rotate_Left
18326 @geindex Rotate_Right
18328 In standard Ada, the shift and rotate functions are available only
18329 for the predefined modular types in package @code{Interfaces}. However, in
18330 GNAT it is possible to define these functions for any integer
18331 type (signed or modular), as in this example:
18334 function Shift_Left
18336 Amount : Natural) return T;
18339 The function name must be one of
18340 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
18341 Rotate_Right. T must be an integer type. T'Size must be
18342 8, 16, 32 or 64 bits; if T is modular, the modulus
18343 must be 2**8, 2**16, 2**32 or 2**64.
18344 The result type must be the same as the type of @code{Value}.
18345 The shift amount must be Natural.
18346 The formal parameter names can be anything.
18348 A more convenient way of providing these shift operators is to use
18349 the Provide_Shift_Operators pragma, which provides the function declarations
18350 and corresponding pragma Import's for all five shift functions.
18352 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
18353 @anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{272}@anchor{gnat_rm/intrinsic_subprograms id13}@anchor{273}
18354 @section Source_Location
18357 @geindex Source_Location
18359 This intrinsic subprogram is used in the implementation of the
18360 library routine @code{GNAT.Source_Info}. The only useful use of the
18361 intrinsic import in this case is the one in this unit, so an
18362 application program should simply call the function
18363 @code{GNAT.Source_Info.Source_Location} to obtain the current
18364 source file location.
18366 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
18367 @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}
18368 @chapter Representation Clauses and Pragmas
18371 @geindex Representation Clauses
18373 @geindex Representation Clause
18375 @geindex Representation Pragma
18378 @geindex representation
18380 This section describes the representation clauses accepted by GNAT, and
18381 their effect on the representation of corresponding data objects.
18383 GNAT fully implements Annex C (Systems Programming). This means that all
18384 the implementation advice sections in chapter 13 are fully implemented.
18385 However, these sections only require a minimal level of support for
18386 representation clauses. GNAT provides much more extensive capabilities,
18387 and this section describes the additional capabilities provided.
18390 * Alignment Clauses::
18392 * Storage_Size Clauses::
18393 * Size of Variant Record Objects::
18394 * Biased Representation::
18395 * Value_Size and Object_Size Clauses::
18396 * Component_Size Clauses::
18397 * Bit_Order Clauses::
18398 * Effect of Bit_Order on Byte Ordering::
18399 * Pragma Pack for Arrays::
18400 * Pragma Pack for Records::
18401 * Record Representation Clauses::
18402 * Handling of Records with Holes::
18403 * Enumeration Clauses::
18404 * Address Clauses::
18405 * Use of Address Clauses for Memory-Mapped I/O::
18406 * Effect of Convention on Representation::
18407 * Conventions and Anonymous Access Types::
18408 * Determining the Representations chosen by GNAT::
18412 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
18413 @anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{276}@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{277}
18414 @section Alignment Clauses
18417 @geindex Alignment Clause
18419 GNAT requires that all alignment clauses specify 0 or a power of 2, and
18420 all default alignments are always a power of 2. Specifying 0 is the
18421 same as specifying 1.
18423 The default alignment values are as follows:
18429 @emph{Elementary Types}.
18431 For elementary types, the alignment is the minimum of the actual size of
18432 objects of the type divided by @code{Storage_Unit},
18433 and the maximum alignment supported by the target.
18434 (This maximum alignment is given by the GNAT-specific attribute
18435 @code{Standard'Maximum_Alignment}; see @ref{191,,Attribute Maximum_Alignment}.)
18437 @geindex Maximum_Alignment attribute
18439 For example, for type @code{Long_Float}, the object size is 8 bytes, and the
18440 default alignment will be 8 on any target that supports alignments
18441 this large, but on some targets, the maximum alignment may be smaller
18442 than 8, in which case objects of type @code{Long_Float} will be maximally
18448 For arrays, the alignment is equal to the alignment of the component type
18449 for the normal case where no packing or component size is given. If the
18450 array is packed, and the packing is effective (see separate section on
18451 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
18452 arrays or arrays whose length is not known at compile time, depending on
18453 whether the component size is divisible by 4, 2, or is odd. For short packed
18454 arrays, which are handled internally as modular types, the alignment
18455 will be as described for elementary types, e.g. a packed array of length
18456 31 bits will have an object size of four bytes, and an alignment of 4.
18461 For the normal unpacked case, the alignment of a record is equal to
18462 the maximum alignment of any of its components. For tagged records, this
18463 includes the implicit access type used for the tag. If a pragma @code{Pack}
18464 is used and all components are packable (see separate section on pragma
18465 @code{Pack}), then the resulting alignment is 1, unless the layout of the
18466 record makes it profitable to increase it.
18468 A special case is when:
18474 the size of the record is given explicitly, or a
18475 full record representation clause is given, and
18478 the size of the record is 2, 4, or 8 bytes.
18481 In this case, an alignment is chosen to match the
18482 size of the record. For example, if we have:
18485 type Small is record
18488 for Small'Size use 16;
18491 then the default alignment of the record type @code{Small} is 2, not 1. This
18492 leads to more efficient code when the record is treated as a unit, and also
18493 allows the type to specified as @code{Atomic} on architectures requiring
18497 An alignment clause may specify a larger alignment than the default value
18498 up to some maximum value dependent on the target (obtainable by using the
18499 attribute reference @code{Standard'Maximum_Alignment}). It may also specify
18500 a smaller alignment than the default value for enumeration, integer and
18501 fixed point types, as well as for record types, for example
18508 for V'alignment use 1;
18514 The default alignment for the type @code{V} is 4, as a result of the
18515 Integer field in the record, but it is permissible, as shown, to
18516 override the default alignment of the record with a smaller value.
18521 Note that according to the Ada standard, an alignment clause applies only
18522 to the first named subtype. If additional subtypes are declared, then the
18523 compiler is allowed to choose any alignment it likes, and there is no way
18524 to control this choice. Consider:
18527 type R is range 1 .. 10_000;
18528 for R'Alignment use 1;
18529 subtype RS is R range 1 .. 1000;
18532 The alignment clause specifies an alignment of 1 for the first named subtype
18533 @code{R} but this does not necessarily apply to @code{RS}. When writing
18534 portable Ada code, you should avoid writing code that explicitly or
18535 implicitly relies on the alignment of such subtypes.
18537 For the GNAT compiler, if an explicit alignment clause is given, this
18538 value is also used for any subsequent subtypes. So for GNAT, in the
18539 above example, you can count on the alignment of @code{RS} being 1. But this
18540 assumption is non-portable, and other compilers may choose different
18541 alignments for the subtype @code{RS}.
18543 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
18544 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{278}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{279}
18545 @section Size Clauses
18548 @geindex Size Clause
18550 The default size for a type @code{T} is obtainable through the
18551 language-defined attribute @code{T'Size} and also through the
18552 equivalent GNAT-defined attribute @code{T'Value_Size}.
18553 For objects of type @code{T}, GNAT will generally increase the type size
18554 so that the object size (obtainable through the GNAT-defined attribute
18555 @code{T'Object_Size})
18556 is a multiple of @code{T'Alignment * Storage_Unit}.
18561 type Smallint is range 1 .. 6;
18569 In this example, @code{Smallint'Size} = @code{Smallint'Value_Size} = 3,
18570 as specified by the RM rules,
18571 but objects of this type will have a size of 8
18572 (@code{Smallint'Object_Size} = 8),
18573 since objects by default occupy an integral number
18574 of storage units. On some targets, notably older
18575 versions of the Digital Alpha, the size of stand
18576 alone objects of this type may be 32, reflecting
18577 the inability of the hardware to do byte load/stores.
18579 Similarly, the size of type @code{Rec} is 40 bits
18580 (@code{Rec'Size} = @code{Rec'Value_Size} = 40), but
18581 the alignment is 4, so objects of this type will have
18582 their size increased to 64 bits so that it is a multiple
18583 of the alignment (in bits). This decision is
18584 in accordance with the specific Implementation Advice in RM 13.3(43):
18588 "A @code{Size} clause should be supported for an object if the specified
18589 @code{Size} is at least as large as its subtype's @code{Size}, and corresponds
18590 to a size in storage elements that is a multiple of the object's
18591 @code{Alignment} (if the @code{Alignment} is nonzero)."
18594 An explicit size clause may be used to override the default size by
18595 increasing it. For example, if we have:
18598 type My_Boolean is new Boolean;
18599 for My_Boolean'Size use 32;
18602 then values of this type will always be 32 bits long. In the case of
18603 discrete types, the size can be increased up to 64 bits, with the effect
18604 that the entire specified field is used to hold the value, sign- or
18605 zero-extended as appropriate. If more than 64 bits is specified, then
18606 padding space is allocated after the value, and a warning is issued that
18607 there are unused bits.
18609 Similarly the size of records and arrays may be increased, and the effect
18610 is to add padding bits after the value. This also causes a warning message
18613 The largest Size value permitted in GNAT is 2**31-1. Since this is a
18614 Size in bits, this corresponds to an object of size 256 megabytes (minus
18615 one). This limitation is true on all targets. The reason for this
18616 limitation is that it improves the quality of the code in many cases
18617 if it is known that a Size value can be accommodated in an object of
18620 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
18621 @anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{27a}@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{27b}
18622 @section Storage_Size Clauses
18625 @geindex Storage_Size Clause
18627 For tasks, the @code{Storage_Size} clause specifies the amount of space
18628 to be allocated for the task stack. This cannot be extended, and if the
18629 stack is exhausted, then @code{Storage_Error} will be raised (if stack
18630 checking is enabled). Use a @code{Storage_Size} attribute definition clause,
18631 or a @code{Storage_Size} pragma in the task definition to set the
18632 appropriate required size. A useful technique is to include in every
18633 task definition a pragma of the form:
18636 pragma Storage_Size (Default_Stack_Size);
18639 Then @code{Default_Stack_Size} can be defined in a global package, and
18640 modified as required. Any tasks requiring stack sizes different from the
18641 default can have an appropriate alternative reference in the pragma.
18643 You can also use the @emph{-d} binder switch to modify the default stack
18646 For access types, the @code{Storage_Size} clause specifies the maximum
18647 space available for allocation of objects of the type. If this space is
18648 exceeded then @code{Storage_Error} will be raised by an allocation attempt.
18649 In the case where the access type is declared local to a subprogram, the
18650 use of a @code{Storage_Size} clause triggers automatic use of a special
18651 predefined storage pool (@code{System.Pool_Size}) that ensures that all
18652 space for the pool is automatically reclaimed on exit from the scope in
18653 which the type is declared.
18655 A special case recognized by the compiler is the specification of a
18656 @code{Storage_Size} of zero for an access type. This means that no
18657 items can be allocated from the pool, and this is recognized at compile
18658 time, and all the overhead normally associated with maintaining a fixed
18659 size storage pool is eliminated. Consider the following example:
18663 type R is array (Natural) of Character;
18664 type P is access all R;
18665 for P'Storage_Size use 0;
18666 -- Above access type intended only for interfacing purposes
18670 procedure g (m : P);
18671 pragma Import (C, g);
18681 As indicated in this example, these dummy storage pools are often useful in
18682 connection with interfacing where no object will ever be allocated. If you
18683 compile the above example, you get the warning:
18686 p.adb:16:09: warning: allocation from empty storage pool
18687 p.adb:16:09: warning: Storage_Error will be raised at run time
18690 Of course in practice, there will not be any explicit allocators in the
18691 case of such an access declaration.
18693 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
18694 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{27c}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{27d}
18695 @section Size of Variant Record Objects
18699 @geindex variant record objects
18701 @geindex Variant record objects
18704 In the case of variant record objects, there is a question whether Size gives
18705 information about a particular variant, or the maximum size required
18706 for any variant. Consider the following program
18709 with Text_IO; use Text_IO;
18711 type R1 (A : Boolean := False) is record
18713 when True => X : Character;
18714 when False => null;
18722 Put_Line (Integer'Image (V1'Size));
18723 Put_Line (Integer'Image (V2'Size));
18727 Here we are dealing with a variant record, where the True variant
18728 requires 16 bits, and the False variant requires 8 bits.
18729 In the above example, both V1 and V2 contain the False variant,
18730 which is only 8 bits long. However, the result of running the
18738 The reason for the difference here is that the discriminant value of
18739 V1 is fixed, and will always be False. It is not possible to assign
18740 a True variant value to V1, therefore 8 bits is sufficient. On the
18741 other hand, in the case of V2, the initial discriminant value is
18742 False (from the default), but it is possible to assign a True
18743 variant value to V2, therefore 16 bits must be allocated for V2
18744 in the general case, even fewer bits may be needed at any particular
18745 point during the program execution.
18747 As can be seen from the output of this program, the @code{'Size}
18748 attribute applied to such an object in GNAT gives the actual allocated
18749 size of the variable, which is the largest size of any of the variants.
18750 The Ada Reference Manual is not completely clear on what choice should
18751 be made here, but the GNAT behavior seems most consistent with the
18752 language in the RM.
18754 In some cases, it may be desirable to obtain the size of the current
18755 variant, rather than the size of the largest variant. This can be
18756 achieved in GNAT by making use of the fact that in the case of a
18757 subprogram parameter, GNAT does indeed return the size of the current
18758 variant (because a subprogram has no way of knowing how much space
18759 is actually allocated for the actual).
18761 Consider the following modified version of the above program:
18764 with Text_IO; use Text_IO;
18766 type R1 (A : Boolean := False) is record
18768 when True => X : Character;
18769 when False => null;
18775 function Size (V : R1) return Integer is
18781 Put_Line (Integer'Image (V2'Size));
18782 Put_Line (Integer'Image (Size (V2)));
18784 Put_Line (Integer'Image (V2'Size));
18785 Put_Line (Integer'Image (Size (V2)));
18789 The output from this program is
18798 Here we see that while the @code{'Size} attribute always returns
18799 the maximum size, regardless of the current variant value, the
18800 @code{Size} function does indeed return the size of the current
18803 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18804 @anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{27e}@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{27f}
18805 @section Biased Representation
18808 @geindex Size for biased representation
18810 @geindex Biased representation
18812 In the case of scalars with a range starting at other than zero, it is
18813 possible in some cases to specify a size smaller than the default minimum
18814 value, and in such cases, GNAT uses an unsigned biased representation,
18815 in which zero is used to represent the lower bound, and successive values
18816 represent successive values of the type.
18818 For example, suppose we have the declaration:
18821 type Small is range -7 .. -4;
18822 for Small'Size use 2;
18825 Although the default size of type @code{Small} is 4, the @code{Size}
18826 clause is accepted by GNAT and results in the following representation
18830 -7 is represented as 2#00#
18831 -6 is represented as 2#01#
18832 -5 is represented as 2#10#
18833 -4 is represented as 2#11#
18836 Biased representation is only used if the specified @code{Size} clause
18837 cannot be accepted in any other manner. These reduced sizes that force
18838 biased representation can be used for all discrete types except for
18839 enumeration types for which a representation clause is given.
18841 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
18842 @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}
18843 @section Value_Size and Object_Size Clauses
18846 @geindex Value_Size
18848 @geindex Object_Size
18851 @geindex of objects
18853 In Ada 95 and Ada 2005, @code{T'Size} for a type @code{T} is the minimum
18854 number of bits required to hold values of type @code{T}.
18855 Although this interpretation was allowed in Ada 83, it was not required,
18856 and this requirement in practice can cause some significant difficulties.
18857 For example, in most Ada 83 compilers, @code{Natural'Size} was 32.
18858 However, in Ada 95 and Ada 2005,
18859 @code{Natural'Size} is
18860 typically 31. This means that code may change in behavior when moving
18861 from Ada 83 to Ada 95 or Ada 2005. For example, consider:
18864 type Rec is record;
18870 at 0 range 0 .. Natural'Size - 1;
18871 at 0 range Natural'Size .. 2 * Natural'Size - 1;
18875 In the above code, since the typical size of @code{Natural} objects
18876 is 32 bits and @code{Natural'Size} is 31, the above code can cause
18877 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
18878 there are cases where the fact that the object size can exceed the
18879 size of the type causes surprises.
18881 To help get around this problem GNAT provides two implementation
18882 defined attributes, @code{Value_Size} and @code{Object_Size}. When
18883 applied to a type, these attributes yield the size of the type
18884 (corresponding to the RM defined size attribute), and the size of
18885 objects of the type respectively.
18887 The @code{Object_Size} is used for determining the default size of
18888 objects and components. This size value can be referred to using the
18889 @code{Object_Size} attribute. The phrase 'is used' here means that it is
18890 the basis of the determination of the size. The backend is free to
18891 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
18892 character might be stored in 32 bits on a machine with no efficient
18893 byte access instructions such as the Alpha.
18895 The default rules for the value of @code{Object_Size} for
18896 discrete types are as follows:
18902 The @code{Object_Size} for base subtypes reflect the natural hardware
18903 size in bits (run the compiler with @emph{-gnatS} to find those values
18904 for numeric types). Enumeration types and fixed-point base subtypes have
18905 8, 16, 32, or 64 bits for this size, depending on the range of values
18909 The @code{Object_Size} of a subtype is the same as the
18910 @code{Object_Size} of
18911 the type from which it is obtained.
18914 The @code{Object_Size} of a derived base type is copied from the parent
18915 base type, and the @code{Object_Size} of a derived first subtype is copied
18916 from the parent first subtype.
18919 The @code{Value_Size} attribute
18920 is the (minimum) number of bits required to store a value
18922 This value is used to determine how tightly to pack
18923 records or arrays with components of this type, and also affects
18924 the semantics of unchecked conversion (unchecked conversions where
18925 the @code{Value_Size} values differ generate a warning, and are potentially
18928 The default rules for the value of @code{Value_Size} are as follows:
18934 The @code{Value_Size} for a base subtype is the minimum number of bits
18935 required to store all values of the type (including the sign bit
18936 only if negative values are possible).
18939 If a subtype statically matches the first subtype of a given type, then it has
18940 by default the same @code{Value_Size} as the first subtype. This is a
18941 consequence of RM 13.1(14): "if two subtypes statically match,
18942 then their subtype-specific aspects are the same".)
18945 All other subtypes have a @code{Value_Size} corresponding to the minimum
18946 number of bits required to store all values of the subtype. For
18947 dynamic bounds, it is assumed that the value can range down or up
18948 to the corresponding bound of the ancestor
18951 The RM defined attribute @code{Size} corresponds to the
18952 @code{Value_Size} attribute.
18954 The @code{Size} attribute may be defined for a first-named subtype. This sets
18955 the @code{Value_Size} of
18956 the first-named subtype to the given value, and the
18957 @code{Object_Size} of this first-named subtype to the given value padded up
18958 to an appropriate boundary. It is a consequence of the default rules
18959 above that this @code{Object_Size} will apply to all further subtypes. On the
18960 other hand, @code{Value_Size} is affected only for the first subtype, any
18961 dynamic subtypes obtained from it directly, and any statically matching
18962 subtypes. The @code{Value_Size} of any other static subtypes is not affected.
18964 @code{Value_Size} and
18965 @code{Object_Size} may be explicitly set for any subtype using
18966 an attribute definition clause. Note that the use of these attributes
18967 can cause the RM 13.1(14) rule to be violated. If two access types
18968 reference aliased objects whose subtypes have differing @code{Object_Size}
18969 values as a result of explicit attribute definition clauses, then it
18970 is illegal to convert from one access subtype to the other. For a more
18971 complete description of this additional legality rule, see the
18972 description of the @code{Object_Size} attribute.
18974 To get a feel for the difference, consider the following examples (note
18975 that in each case the base is @code{Short_Short_Integer} with a size of 8):
18978 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx}
18981 Type or subtype declaration
18993 @code{type x1 is range 0 .. 5;}
19005 @code{type x2 is range 0 .. 5;}
19006 @code{for x2'size use 12;}
19018 @code{subtype x3 is x2 range 0 .. 3;}
19030 @code{subtype x4 is x2'base range 0 .. 10;}
19042 @code{dynamic : x2'Base range -64 .. +63;}
19050 @code{subtype x5 is x2 range 0 .. dynamic;}
19062 @code{subtype x6 is x2'base range 0 .. dynamic;}
19075 Note: the entries marked '*' are not actually specified by the Ada
19076 Reference Manual, which has nothing to say about size in the dynamic
19077 case. What GNAT does is to allocate sufficient bits to accomodate any
19078 possible dynamic values for the bounds at run-time.
19080 So far, so good, but GNAT has to obey the RM rules, so the question is
19081 under what conditions must the RM @code{Size} be used.
19082 The following is a list
19083 of the occasions on which the RM @code{Size} must be used:
19089 Component size for packed arrays or records
19092 Value of the attribute @code{Size} for a type
19095 Warning about sizes not matching for unchecked conversion
19098 For record types, the @code{Object_Size} is always a multiple of the
19099 alignment of the type (this is true for all types). In some cases the
19100 @code{Value_Size} can be smaller. Consider:
19109 On a typical 32-bit architecture, the X component will occupy four bytes
19110 and the Y component will occupy one byte, for a total of 5 bytes. As a
19111 result @code{R'Value_Size} will be 40 (bits) since this is the minimum size
19112 required to store a value of this type. For example, it is permissible
19113 to have a component of type R in an array whose component size is
19114 specified to be 40 bits.
19116 However, @code{R'Object_Size} will be 64 (bits). The difference is due to
19117 the alignment requirement for objects of the record type. The X
19118 component will require four-byte alignment because that is what type
19119 Integer requires, whereas the Y component, a Character, will only
19120 require 1-byte alignment. Since the alignment required for X is the
19121 greatest of all the components' alignments, that is the alignment
19122 required for the enclosing record type, i.e., 4 bytes or 32 bits. As
19123 indicated above, the actual object size must be rounded up so that it is
19124 a multiple of the alignment value. Therefore, 40 bits rounded up to the
19125 next multiple of 32 yields 64 bits.
19127 For all other types, the @code{Object_Size}
19128 and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}).
19129 Only @code{Size} may be specified for such types.
19131 Note that @code{Value_Size} can be used to force biased representation
19132 for a particular subtype. Consider this example:
19135 type R is (A, B, C, D, E, F);
19136 subtype RAB is R range A .. B;
19137 subtype REF is R range E .. F;
19140 By default, @code{RAB}
19141 has a size of 1 (sufficient to accommodate the representation
19142 of @code{A} and @code{B}, 0 and 1), and @code{REF}
19143 has a size of 3 (sufficient to accommodate the representation
19144 of @code{E} and @code{F}, 4 and 5). But if we add the
19145 following @code{Value_Size} attribute definition clause:
19148 for REF'Value_Size use 1;
19151 then biased representation is forced for @code{REF},
19152 and 0 will represent @code{E} and 1 will represent @code{F}.
19153 A warning is issued when a @code{Value_Size} attribute
19154 definition clause forces biased representation. This
19155 warning can be turned off using @code{-gnatw.B}.
19157 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
19158 @anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{282}@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{283}
19159 @section Component_Size Clauses
19162 @geindex Component_Size Clause
19164 Normally, the value specified in a component size clause must be consistent
19165 with the subtype of the array component with regard to size and alignment.
19166 In other words, the value specified must be at least equal to the size
19167 of this subtype, and must be a multiple of the alignment value.
19169 In addition, component size clauses are allowed which cause the array
19170 to be packed, by specifying a smaller value. A first case is for
19171 component size values in the range 1 through 63. The value specified
19172 must not be smaller than the Size of the subtype. GNAT will accurately
19173 honor all packing requests in this range. For example, if we have:
19176 type r is array (1 .. 8) of Natural;
19177 for r'Component_Size use 31;
19180 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
19181 Of course access to the components of such an array is considerably
19182 less efficient than if the natural component size of 32 is used.
19183 A second case is when the subtype of the component is a record type
19184 padded because of its default alignment. For example, if we have:
19193 type a is array (1 .. 8) of r;
19194 for a'Component_Size use 72;
19197 then the resulting array has a length of 72 bytes, instead of 96 bytes
19198 if the alignment of the record (4) was obeyed.
19200 Note that there is no point in giving both a component size clause
19201 and a pragma Pack for the same array type. if such duplicate
19202 clauses are given, the pragma Pack will be ignored.
19204 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
19205 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{284}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{285}
19206 @section Bit_Order Clauses
19209 @geindex Bit_Order Clause
19211 @geindex bit ordering
19216 For record subtypes, GNAT permits the specification of the @code{Bit_Order}
19217 attribute. The specification may either correspond to the default bit
19218 order for the target, in which case the specification has no effect and
19219 places no additional restrictions, or it may be for the non-standard
19220 setting (that is the opposite of the default).
19222 In the case where the non-standard value is specified, the effect is
19223 to renumber bits within each byte, but the ordering of bytes is not
19224 affected. There are certain
19225 restrictions placed on component clauses as follows:
19231 Components fitting within a single storage unit.
19233 These are unrestricted, and the effect is merely to renumber bits. For
19234 example if we are on a little-endian machine with @code{Low_Order_First}
19235 being the default, then the following two declarations have exactly
19241 B : Integer range 1 .. 120;
19245 A at 0 range 0 .. 0;
19246 B at 0 range 1 .. 7;
19251 B : Integer range 1 .. 120;
19254 for R2'Bit_Order use High_Order_First;
19257 A at 0 range 7 .. 7;
19258 B at 0 range 0 .. 6;
19262 The useful application here is to write the second declaration with the
19263 @code{Bit_Order} attribute definition clause, and know that it will be treated
19264 the same, regardless of whether the target is little-endian or big-endian.
19267 Components occupying an integral number of bytes.
19269 These are components that exactly fit in two or more bytes. Such component
19270 declarations are allowed, but have no effect, since it is important to realize
19271 that the @code{Bit_Order} specification does not affect the ordering of bytes.
19272 In particular, the following attempt at getting an endian-independent integer
19280 for R2'Bit_Order use High_Order_First;
19283 A at 0 range 0 .. 31;
19287 This declaration will result in a little-endian integer on a
19288 little-endian machine, and a big-endian integer on a big-endian machine.
19289 If byte flipping is required for interoperability between big- and
19290 little-endian machines, this must be explicitly programmed. This capability
19291 is not provided by @code{Bit_Order}.
19294 Components that are positioned across byte boundaries.
19296 but do not occupy an integral number of bytes. Given that bytes are not
19297 reordered, such fields would occupy a non-contiguous sequence of bits
19298 in memory, requiring non-trivial code to reassemble. They are for this
19299 reason not permitted, and any component clause specifying such a layout
19300 will be flagged as illegal by GNAT.
19303 Since the misconception that Bit_Order automatically deals with all
19304 endian-related incompatibilities is a common one, the specification of
19305 a component field that is an integral number of bytes will always
19306 generate a warning. This warning may be suppressed using @code{pragma Warnings (Off)}
19307 if desired. The following section contains additional
19308 details regarding the issue of byte ordering.
19310 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
19311 @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}
19312 @section Effect of Bit_Order on Byte Ordering
19315 @geindex byte ordering
19320 In this section we will review the effect of the @code{Bit_Order} attribute
19321 definition clause on byte ordering. Briefly, it has no effect at all, but
19322 a detailed example will be helpful. Before giving this
19323 example, let us review the precise
19324 definition of the effect of defining @code{Bit_Order}. The effect of a
19325 non-standard bit order is described in section 13.5.3 of the Ada
19330 "2 A bit ordering is a method of interpreting the meaning of
19331 the storage place attributes."
19334 To understand the precise definition of storage place attributes in
19335 this context, we visit section 13.5.1 of the manual:
19339 "13 A record_representation_clause (without the mod_clause)
19340 specifies the layout. The storage place attributes (see 13.5.2)
19341 are taken from the values of the position, first_bit, and last_bit
19342 expressions after normalizing those values so that first_bit is
19343 less than Storage_Unit."
19346 The critical point here is that storage places are taken from
19347 the values after normalization, not before. So the @code{Bit_Order}
19348 interpretation applies to normalized values. The interpretation
19349 is described in the later part of the 13.5.3 paragraph:
19353 "2 A bit ordering is a method of interpreting the meaning of
19354 the storage place attributes. High_Order_First (known in the
19355 vernacular as 'big endian') means that the first bit of a
19356 storage element (bit 0) is the most significant bit (interpreting
19357 the sequence of bits that represent a component as an unsigned
19358 integer value). Low_Order_First (known in the vernacular as
19359 'little endian') means the opposite: the first bit is the
19360 least significant."
19363 Note that the numbering is with respect to the bits of a storage
19364 unit. In other words, the specification affects only the numbering
19365 of bits within a single storage unit.
19367 We can make the effect clearer by giving an example.
19369 Suppose that we have an external device which presents two bytes, the first
19370 byte presented, which is the first (low addressed byte) of the two byte
19371 record is called Master, and the second byte is called Slave.
19373 The left most (most significant bit is called Control for each byte, and
19374 the remaining 7 bits are called V1, V2, ... V7, where V7 is the rightmost
19375 (least significant) bit.
19377 On a big-endian machine, we can write the following representation clause
19380 type Data is record
19381 Master_Control : Bit;
19389 Slave_Control : Bit;
19399 for Data use record
19400 Master_Control at 0 range 0 .. 0;
19401 Master_V1 at 0 range 1 .. 1;
19402 Master_V2 at 0 range 2 .. 2;
19403 Master_V3 at 0 range 3 .. 3;
19404 Master_V4 at 0 range 4 .. 4;
19405 Master_V5 at 0 range 5 .. 5;
19406 Master_V6 at 0 range 6 .. 6;
19407 Master_V7 at 0 range 7 .. 7;
19408 Slave_Control at 1 range 0 .. 0;
19409 Slave_V1 at 1 range 1 .. 1;
19410 Slave_V2 at 1 range 2 .. 2;
19411 Slave_V3 at 1 range 3 .. 3;
19412 Slave_V4 at 1 range 4 .. 4;
19413 Slave_V5 at 1 range 5 .. 5;
19414 Slave_V6 at 1 range 6 .. 6;
19415 Slave_V7 at 1 range 7 .. 7;
19419 Now if we move this to a little endian machine, then the bit ordering within
19420 the byte is backwards, so we have to rewrite the record rep clause as:
19423 for Data use record
19424 Master_Control at 0 range 7 .. 7;
19425 Master_V1 at 0 range 6 .. 6;
19426 Master_V2 at 0 range 5 .. 5;
19427 Master_V3 at 0 range 4 .. 4;
19428 Master_V4 at 0 range 3 .. 3;
19429 Master_V5 at 0 range 2 .. 2;
19430 Master_V6 at 0 range 1 .. 1;
19431 Master_V7 at 0 range 0 .. 0;
19432 Slave_Control at 1 range 7 .. 7;
19433 Slave_V1 at 1 range 6 .. 6;
19434 Slave_V2 at 1 range 5 .. 5;
19435 Slave_V3 at 1 range 4 .. 4;
19436 Slave_V4 at 1 range 3 .. 3;
19437 Slave_V5 at 1 range 2 .. 2;
19438 Slave_V6 at 1 range 1 .. 1;
19439 Slave_V7 at 1 range 0 .. 0;
19443 It is a nuisance to have to rewrite the clause, especially if
19444 the code has to be maintained on both machines. However,
19445 this is a case that we can handle with the
19446 @code{Bit_Order} attribute if it is implemented.
19447 Note that the implementation is not required on byte addressed
19448 machines, but it is indeed implemented in GNAT.
19449 This means that we can simply use the
19450 first record clause, together with the declaration
19453 for Data'Bit_Order use High_Order_First;
19456 and the effect is what is desired, namely the layout is exactly the same,
19457 independent of whether the code is compiled on a big-endian or little-endian
19460 The important point to understand is that byte ordering is not affected.
19461 A @code{Bit_Order} attribute definition never affects which byte a field
19462 ends up in, only where it ends up in that byte.
19463 To make this clear, let us rewrite the record rep clause of the previous
19467 for Data'Bit_Order use High_Order_First;
19468 for Data use record
19469 Master_Control at 0 range 0 .. 0;
19470 Master_V1 at 0 range 1 .. 1;
19471 Master_V2 at 0 range 2 .. 2;
19472 Master_V3 at 0 range 3 .. 3;
19473 Master_V4 at 0 range 4 .. 4;
19474 Master_V5 at 0 range 5 .. 5;
19475 Master_V6 at 0 range 6 .. 6;
19476 Master_V7 at 0 range 7 .. 7;
19477 Slave_Control at 0 range 8 .. 8;
19478 Slave_V1 at 0 range 9 .. 9;
19479 Slave_V2 at 0 range 10 .. 10;
19480 Slave_V3 at 0 range 11 .. 11;
19481 Slave_V4 at 0 range 12 .. 12;
19482 Slave_V5 at 0 range 13 .. 13;
19483 Slave_V6 at 0 range 14 .. 14;
19484 Slave_V7 at 0 range 15 .. 15;
19488 This is exactly equivalent to saying (a repeat of the first example):
19491 for Data'Bit_Order use High_Order_First;
19492 for Data use record
19493 Master_Control at 0 range 0 .. 0;
19494 Master_V1 at 0 range 1 .. 1;
19495 Master_V2 at 0 range 2 .. 2;
19496 Master_V3 at 0 range 3 .. 3;
19497 Master_V4 at 0 range 4 .. 4;
19498 Master_V5 at 0 range 5 .. 5;
19499 Master_V6 at 0 range 6 .. 6;
19500 Master_V7 at 0 range 7 .. 7;
19501 Slave_Control at 1 range 0 .. 0;
19502 Slave_V1 at 1 range 1 .. 1;
19503 Slave_V2 at 1 range 2 .. 2;
19504 Slave_V3 at 1 range 3 .. 3;
19505 Slave_V4 at 1 range 4 .. 4;
19506 Slave_V5 at 1 range 5 .. 5;
19507 Slave_V6 at 1 range 6 .. 6;
19508 Slave_V7 at 1 range 7 .. 7;
19512 Why are they equivalent? Well take a specific field, the @code{Slave_V2}
19513 field. The storage place attributes are obtained by normalizing the
19514 values given so that the @code{First_Bit} value is less than 8. After
19515 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
19516 we specified in the other case.
19518 Now one might expect that the @code{Bit_Order} attribute might affect
19519 bit numbering within the entire record component (two bytes in this
19520 case, thus affecting which byte fields end up in), but that is not
19521 the way this feature is defined, it only affects numbering of bits,
19522 not which byte they end up in.
19524 Consequently it never makes sense to specify a starting bit number
19525 greater than 7 (for a byte addressable field) if an attribute
19526 definition for @code{Bit_Order} has been given, and indeed it
19527 may be actively confusing to specify such a value, so the compiler
19528 generates a warning for such usage.
19530 If you do need to control byte ordering then appropriate conditional
19531 values must be used. If in our example, the slave byte came first on
19532 some machines we might write:
19535 Master_Byte_First constant Boolean := ...;
19537 Master_Byte : constant Natural :=
19538 1 - Boolean'Pos (Master_Byte_First);
19539 Slave_Byte : constant Natural :=
19540 Boolean'Pos (Master_Byte_First);
19542 for Data'Bit_Order use High_Order_First;
19543 for Data use record
19544 Master_Control at Master_Byte range 0 .. 0;
19545 Master_V1 at Master_Byte range 1 .. 1;
19546 Master_V2 at Master_Byte range 2 .. 2;
19547 Master_V3 at Master_Byte range 3 .. 3;
19548 Master_V4 at Master_Byte range 4 .. 4;
19549 Master_V5 at Master_Byte range 5 .. 5;
19550 Master_V6 at Master_Byte range 6 .. 6;
19551 Master_V7 at Master_Byte range 7 .. 7;
19552 Slave_Control at Slave_Byte range 0 .. 0;
19553 Slave_V1 at Slave_Byte range 1 .. 1;
19554 Slave_V2 at Slave_Byte range 2 .. 2;
19555 Slave_V3 at Slave_Byte range 3 .. 3;
19556 Slave_V4 at Slave_Byte range 4 .. 4;
19557 Slave_V5 at Slave_Byte range 5 .. 5;
19558 Slave_V6 at Slave_Byte range 6 .. 6;
19559 Slave_V7 at Slave_Byte range 7 .. 7;
19563 Now to switch between machines, all that is necessary is
19564 to set the boolean constant @code{Master_Byte_First} in
19565 an appropriate manner.
19567 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
19568 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{288}@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{289}
19569 @section Pragma Pack for Arrays
19572 @geindex Pragma Pack (for arrays)
19574 Pragma @code{Pack} applied to an array has an effect that depends upon whether the
19575 component type is @emph{packable}. For a component type to be @emph{packable}, it must
19576 be one of the following cases:
19582 Any elementary type.
19585 Any small packed array type with a static size.
19588 Any small simple record type with a static size.
19591 For all these cases, if the component subtype size is in the range
19592 1 through 64, then the effect of the pragma @code{Pack} is exactly as though a
19593 component size were specified giving the component subtype size.
19595 All other types are non-packable, they occupy an integral number of storage
19596 units and the only effect of pragma Pack is to remove alignment gaps.
19598 For example if we have:
19601 type r is range 0 .. 17;
19603 type ar is array (1 .. 8) of r;
19607 Then the component size of @code{ar} will be set to 5 (i.e., to @code{r'size},
19608 and the size of the array @code{ar} will be exactly 40 bits).
19610 Note that in some cases this rather fierce approach to packing can produce
19611 unexpected effects. For example, in Ada 95 and Ada 2005,
19612 subtype @code{Natural} typically has a size of 31, meaning that if you
19613 pack an array of @code{Natural}, you get 31-bit
19614 close packing, which saves a few bits, but results in far less efficient
19615 access. Since many other Ada compilers will ignore such a packing request,
19616 GNAT will generate a warning on some uses of pragma @code{Pack} that it guesses
19617 might not be what is intended. You can easily remove this warning by
19618 using an explicit @code{Component_Size} setting instead, which never generates
19619 a warning, since the intention of the programmer is clear in this case.
19621 GNAT treats packed arrays in one of two ways. If the size of the array is
19622 known at compile time and is less than 64 bits, then internally the array
19623 is represented as a single modular type, of exactly the appropriate number
19624 of bits. If the length is greater than 63 bits, or is not known at compile
19625 time, then the packed array is represented as an array of bytes, and the
19626 length is always a multiple of 8 bits.
19628 Note that to represent a packed array as a modular type, the alignment must
19629 be suitable for the modular type involved. For example, on typical machines
19630 a 32-bit packed array will be represented by a 32-bit modular integer with
19631 an alignment of four bytes. If you explicitly override the default alignment
19632 with an alignment clause that is too small, the modular representation
19633 cannot be used. For example, consider the following set of declarations:
19636 type R is range 1 .. 3;
19637 type S is array (1 .. 31) of R;
19638 for S'Component_Size use 2;
19640 for S'Alignment use 1;
19643 If the alignment clause were not present, then a 62-bit modular
19644 representation would be chosen (typically with an alignment of 4 or 8
19645 bytes depending on the target). But the default alignment is overridden
19646 with the explicit alignment clause. This means that the modular
19647 representation cannot be used, and instead the array of bytes
19648 representation must be used, meaning that the length must be a multiple
19649 of 8. Thus the above set of declarations will result in a diagnostic
19650 rejecting the size clause and noting that the minimum size allowed is 64.
19652 @geindex Pragma Pack (for type Natural)
19654 @geindex Pragma Pack warning
19656 One special case that is worth noting occurs when the base type of the
19657 component size is 8/16/32 and the subtype is one bit less. Notably this
19658 occurs with subtype @code{Natural}. Consider:
19661 type Arr is array (1 .. 32) of Natural;
19665 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
19666 since typically @code{Natural'Size} is 32 in Ada 83, and in any case most
19667 Ada 83 compilers did not attempt 31 bit packing.
19669 In Ada 95 and Ada 2005, @code{Natural'Size} is required to be 31. Furthermore,
19670 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
19671 substantial unintended performance penalty when porting legacy Ada 83 code.
19672 To help prevent this, GNAT generates a warning in such cases. If you really
19673 want 31 bit packing in a case like this, you can set the component size
19677 type Arr is array (1 .. 32) of Natural;
19678 for Arr'Component_Size use 31;
19681 Here 31-bit packing is achieved as required, and no warning is generated,
19682 since in this case the programmer intention is clear.
19684 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
19685 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{28a}@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{28b}
19686 @section Pragma Pack for Records
19689 @geindex Pragma Pack (for records)
19691 Pragma @code{Pack} applied to a record will pack the components to reduce
19692 wasted space from alignment gaps and by reducing the amount of space
19693 taken by components. We distinguish between @emph{packable} components and
19694 @emph{non-packable} components.
19695 Components of the following types are considered packable:
19701 Components of an elementary type are packable unless they are aliased,
19702 independent, or of an atomic type.
19705 Small packed arrays, where the size is statically known, are represented
19706 internally as modular integers, and so they are also packable.
19709 Small simple records, where the size is statically known, are also packable.
19712 For all these cases, if the @code{'Size} value is in the range 1 through 64, the
19713 components occupy the exact number of bits corresponding to this value
19714 and are packed with no padding bits, i.e. they can start on an arbitrary
19717 All other types are non-packable, they occupy an integral number of storage
19718 units and the only effect of pragma @code{Pack} is to remove alignment gaps.
19720 For example, consider the record
19723 type Rb1 is array (1 .. 13) of Boolean;
19726 type Rb2 is array (1 .. 65) of Boolean;
19729 type AF is new Float with Atomic;
19742 The representation for the record @code{X2} is as follows:
19745 for X2'Size use 224;
19747 L1 at 0 range 0 .. 0;
19748 L2 at 0 range 1 .. 64;
19749 L3 at 12 range 0 .. 31;
19750 L4 at 16 range 0 .. 0;
19751 L5 at 16 range 1 .. 13;
19752 L6 at 18 range 0 .. 71;
19756 Studying this example, we see that the packable fields @code{L1}
19758 of length equal to their sizes, and placed at specific bit boundaries (and
19759 not byte boundaries) to
19760 eliminate padding. But @code{L3} is of a non-packable float type (because
19761 it is aliased), so it is on the next appropriate alignment boundary.
19763 The next two fields are fully packable, so @code{L4} and @code{L5} are
19764 minimally packed with no gaps. However, type @code{Rb2} is a packed
19765 array that is longer than 64 bits, so it is itself non-packable. Thus
19766 the @code{L6} field is aligned to the next byte boundary, and takes an
19767 integral number of bytes, i.e., 72 bits.
19769 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19770 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{28c}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{28d}
19771 @section Record Representation Clauses
19774 @geindex Record Representation Clause
19776 Record representation clauses may be given for all record types, including
19777 types obtained by record extension. Component clauses are allowed for any
19778 static component. The restrictions on component clauses depend on the type
19781 @geindex Component Clause
19783 For all components of an elementary type, the only restriction on component
19784 clauses is that the size must be at least the @code{'Size} value of the type
19785 (actually the Value_Size). There are no restrictions due to alignment,
19786 and such components may freely cross storage boundaries.
19788 Packed arrays with a size up to and including 64 bits are represented
19789 internally using a modular type with the appropriate number of bits, and
19790 thus the same lack of restriction applies. For example, if you declare:
19793 type R is array (1 .. 49) of Boolean;
19798 then a component clause for a component of type @code{R} may start on any
19799 specified bit boundary, and may specify a value of 49 bits or greater.
19801 For packed bit arrays that are longer than 64 bits, there are two
19802 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
19803 including the important case of single bits or boolean values, then
19804 there are no limitations on placement of such components, and they
19805 may start and end at arbitrary bit boundaries.
19807 If the component size is not a power of 2 (e.g., 3 or 5), then
19808 an array of this type longer than 64 bits must always be placed on
19809 on a storage unit (byte) boundary and occupy an integral number
19810 of storage units (bytes). Any component clause that does not
19811 meet this requirement will be rejected.
19813 Any aliased component, or component of an aliased type, must
19814 have its normal alignment and size. A component clause that
19815 does not meet this requirement will be rejected.
19817 The tag field of a tagged type always occupies an address sized field at
19818 the start of the record. No component clause may attempt to overlay this
19819 tag. When a tagged type appears as a component, the tag field must have
19822 In the case of a record extension @code{T1}, of a type @code{T}, no component clause applied
19823 to the type @code{T1} can specify a storage location that would overlap the first
19824 @code{T'Size} bytes of the record.
19826 For all other component types, including non-bit-packed arrays,
19827 the component can be placed at an arbitrary bit boundary,
19828 so for example, the following is permitted:
19831 type R is array (1 .. 10) of Boolean;
19840 G at 0 range 0 .. 0;
19841 H at 0 range 1 .. 1;
19842 L at 0 range 2 .. 81;
19843 R at 0 range 82 .. 161;
19847 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
19848 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{28e}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{28f}
19849 @section Handling of Records with Holes
19852 @geindex Handling of Records with Holes
19854 As a result of alignment considerations, records may contain "holes"
19856 which do not correspond to the data bits of any of the components.
19857 Record representation clauses can also result in holes in records.
19859 GNAT does not attempt to clear these holes, so in record objects,
19860 they should be considered to hold undefined rubbish. The generated
19861 equality routine just tests components so does not access these
19862 undefined bits, and assignment and copy operations may or may not
19863 preserve the contents of these holes (for assignments, the holes
19864 in the target will in practice contain either the bits that are
19865 present in the holes in the source, or the bits that were present
19866 in the target before the assignment).
19868 If it is necessary to ensure that holes in records have all zero
19869 bits, then record objects for which this initialization is desired
19870 should be explicitly set to all zero values using Unchecked_Conversion
19871 or address overlays. For example
19874 type HRec is record
19880 On typical machines, integers need to be aligned on a four-byte
19881 boundary, resulting in three bytes of undefined rubbish following
19882 the 8-bit field for C. To ensure that the hole in a variable of
19883 type HRec is set to all zero bits,
19884 you could for example do:
19887 type Base is record
19888 Dummy1, Dummy2 : Integer := 0;
19893 for RealVar'Address use BaseVar'Address;
19896 Now the 8-bytes of the value of RealVar start out containing all zero
19897 bits. A safer approach is to just define dummy fields, avoiding the
19901 type HRec is record
19903 Dummy1 : Short_Short_Integer := 0;
19904 Dummy2 : Short_Short_Integer := 0;
19905 Dummy3 : Short_Short_Integer := 0;
19910 And to make absolutely sure that the intent of this is followed, you
19911 can use representation clauses:
19914 for Hrec use record
19915 C at 0 range 0 .. 7;
19916 Dummy1 at 1 range 0 .. 7;
19917 Dummy2 at 2 range 0 .. 7;
19918 Dummy3 at 3 range 0 .. 7;
19919 I at 4 range 0 .. 31;
19921 for Hrec'Size use 64;
19924 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
19925 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{290}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{291}
19926 @section Enumeration Clauses
19929 The only restriction on enumeration clauses is that the range of values
19930 must be representable. For the signed case, if one or more of the
19931 representation values are negative, all values must be in the range:
19934 System.Min_Int .. System.Max_Int
19937 For the unsigned case, where all values are nonnegative, the values must
19941 0 .. System.Max_Binary_Modulus;
19944 A @emph{confirming} representation clause is one in which the values range
19945 from 0 in sequence, i.e., a clause that confirms the default representation
19946 for an enumeration type.
19947 Such a confirming representation
19948 is permitted by these rules, and is specially recognized by the compiler so
19949 that no extra overhead results from the use of such a clause.
19951 If an array has an index type which is an enumeration type to which an
19952 enumeration clause has been applied, then the array is stored in a compact
19953 manner. Consider the declarations:
19956 type r is (A, B, C);
19957 for r use (A => 1, B => 5, C => 10);
19958 type t is array (r) of Character;
19961 The array type t corresponds to a vector with exactly three elements and
19962 has a default size equal to @code{3*Character'Size}. This ensures efficient
19963 use of space, but means that accesses to elements of the array will incur
19964 the overhead of converting representation values to the corresponding
19965 positional values, (i.e., the value delivered by the @code{Pos} attribute).
19967 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
19968 @anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{292}@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{293}
19969 @section Address Clauses
19972 @geindex Address Clause
19974 The reference manual allows a general restriction on representation clauses,
19975 as found in RM 13.1(22):
19979 "An implementation need not support representation
19980 items containing nonstatic expressions, except that
19981 an implementation should support a representation item
19982 for a given entity if each nonstatic expression in the
19983 representation item is a name that statically denotes
19984 a constant declared before the entity."
19987 In practice this is applicable only to address clauses, since this is the
19988 only case in which a nonstatic expression is permitted by the syntax. As
19989 the AARM notes in sections 13.1 (22.a-22.h):
19993 22.a Reason: This is to avoid the following sort of thing:
19995 22.b X : Integer := F(...);
19996 Y : Address := G(...);
19997 for X'Address use Y;
19999 22.c In the above, we have to evaluate the
20000 initialization expression for X before we
20001 know where to put the result. This seems
20002 like an unreasonable implementation burden.
20004 22.d The above code should instead be written
20007 22.e Y : constant Address := G(...);
20008 X : Integer := F(...);
20009 for X'Address use Y;
20011 22.f This allows the expression 'Y' to be safely
20012 evaluated before X is created.
20014 22.g The constant could be a formal parameter of mode in.
20016 22.h An implementation can support other nonstatic
20017 expressions if it wants to. Expressions of type
20018 Address are hardly ever static, but their value
20019 might be known at compile time anyway in many
20023 GNAT does indeed permit many additional cases of nonstatic expressions. In
20024 particular, if the type involved is elementary there are no restrictions
20025 (since in this case, holding a temporary copy of the initialization value,
20026 if one is present, is inexpensive). In addition, if there is no implicit or
20027 explicit initialization, then there are no restrictions. GNAT will reject
20028 only the case where all three of these conditions hold:
20034 The type of the item is non-elementary (e.g., a record or array).
20037 There is explicit or implicit initialization required for the object.
20038 Note that access values are always implicitly initialized.
20041 The address value is nonstatic. Here GNAT is more permissive than the
20042 RM, and allows the address value to be the address of a previously declared
20043 stand-alone variable, as long as it does not itself have an address clause.
20046 Anchor : Some_Initialized_Type;
20047 Overlay : Some_Initialized_Type;
20048 for Overlay'Address use Anchor'Address;
20051 However, the prefix of the address clause cannot be an array component, or
20052 a component of a discriminated record.
20055 As noted above in section 22.h, address values are typically nonstatic. In
20056 particular the To_Address function, even if applied to a literal value, is
20057 a nonstatic function call. To avoid this minor annoyance, GNAT provides
20058 the implementation defined attribute 'To_Address. The following two
20059 expressions have identical values:
20063 @geindex To_Address
20066 To_Address (16#1234_0000#)
20067 System'To_Address (16#1234_0000#);
20070 except that the second form is considered to be a static expression, and
20071 thus when used as an address clause value is always permitted.
20073 Additionally, GNAT treats as static an address clause that is an
20074 unchecked_conversion of a static integer value. This simplifies the porting
20075 of legacy code, and provides a portable equivalent to the GNAT attribute
20078 Another issue with address clauses is the interaction with alignment
20079 requirements. When an address clause is given for an object, the address
20080 value must be consistent with the alignment of the object (which is usually
20081 the same as the alignment of the type of the object). If an address clause
20082 is given that specifies an inappropriately aligned address value, then the
20083 program execution is erroneous.
20085 Since this source of erroneous behavior can have unfortunate effects on
20086 machines with strict alignment requirements, GNAT
20087 checks (at compile time if possible, generating a warning, or at execution
20088 time with a run-time check) that the alignment is appropriate. If the
20089 run-time check fails, then @code{Program_Error} is raised. This run-time
20090 check is suppressed if range checks are suppressed, or if the special GNAT
20091 check Alignment_Check is suppressed, or if
20092 @code{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
20093 suppressed by default on non-strict alignment machines (such as the x86).
20095 Finally, GNAT does not permit overlaying of objects of class-wide types. In
20096 most cases, the compiler can detect an attempt at such overlays and will
20097 generate a warning at compile time and a Program_Error exception at run time.
20101 An address clause cannot be given for an exported object. More
20102 understandably the real restriction is that objects with an address
20103 clause cannot be exported. This is because such variables are not
20104 defined by the Ada program, so there is no external object to export.
20108 It is permissible to give an address clause and a pragma Import for the
20109 same object. In this case, the variable is not really defined by the
20110 Ada program, so there is no external symbol to be linked. The link name
20111 and the external name are ignored in this case. The reason that we allow this
20112 combination is that it provides a useful idiom to avoid unwanted
20113 initializations on objects with address clauses.
20115 When an address clause is given for an object that has implicit or
20116 explicit initialization, then by default initialization takes place. This
20117 means that the effect of the object declaration is to overwrite the
20118 memory at the specified address. This is almost always not what the
20119 programmer wants, so GNAT will output a warning:
20129 for Ext'Address use System'To_Address (16#1234_1234#);
20131 >>> warning: implicit initialization of "Ext" may
20132 modify overlaid storage
20133 >>> warning: use pragma Import for "Ext" to suppress
20134 initialization (RM B(24))
20139 As indicated by the warning message, the solution is to use a (dummy) pragma
20140 Import to suppress this initialization. The pragma tell the compiler that the
20141 object is declared and initialized elsewhere. The following package compiles
20142 without warnings (and the initialization is suppressed):
20152 for Ext'Address use System'To_Address (16#1234_1234#);
20153 pragma Import (Ada, Ext);
20157 A final issue with address clauses involves their use for overlaying
20158 variables, as in the following example:
20160 @geindex Overlaying of objects
20165 for B'Address use A'Address;
20168 or alternatively, using the form recommended by the RM:
20172 Addr : constant Address := A'Address;
20174 for B'Address use Addr;
20177 In both of these cases, @code{A} and @code{B} become aliased to one another
20178 via the address clause. This use of address clauses to overlay
20179 variables, achieving an effect similar to unchecked conversion
20180 was erroneous in Ada 83, but in Ada 95 and Ada 2005
20181 the effect is implementation defined. Furthermore, the
20182 Ada RM specifically recommends that in a situation
20183 like this, @code{B} should be subject to the following
20184 implementation advice (RM 13.3(19)):
20188 "19 If the Address of an object is specified, or it is imported
20189 or exported, then the implementation should not perform
20190 optimizations based on assumptions of no aliases."
20193 GNAT follows this recommendation, and goes further by also applying
20194 this recommendation to the overlaid variable (@code{A} in the above example)
20195 in this case. This means that the overlay works "as expected", in that
20196 a modification to one of the variables will affect the value of the other.
20198 More generally, GNAT interprets this recommendation conservatively for
20199 address clauses: in the cases other than overlays, it considers that the
20200 object is effectively subject to pragma @code{Volatile} and implements the
20201 associated semantics.
20203 Note that when address clause overlays are used in this way, there is an
20204 issue of unintentional initialization, as shown by this example:
20207 package Overwrite_Record is
20209 A : Character := 'C';
20210 B : Character := 'A';
20212 X : Short_Integer := 3;
20214 for Y'Address use X'Address;
20216 >>> warning: default initialization of "Y" may
20217 modify "X", use pragma Import for "Y" to
20218 suppress initialization (RM B.1(24))
20220 end Overwrite_Record;
20223 Here the default initialization of @code{Y} will clobber the value
20224 of @code{X}, which justifies the warning. The warning notes that
20225 this effect can be eliminated by adding a @code{pragma Import}
20226 which suppresses the initialization:
20229 package Overwrite_Record is
20231 A : Character := 'C';
20232 B : Character := 'A';
20234 X : Short_Integer := 3;
20236 for Y'Address use X'Address;
20237 pragma Import (Ada, Y);
20238 end Overwrite_Record;
20241 Note that the use of @code{pragma Initialize_Scalars} may cause variables to
20242 be initialized when they would not otherwise have been in the absence
20243 of the use of this pragma. This may cause an overlay to have this
20244 unintended clobbering effect. The compiler avoids this for scalar
20245 types, but not for composite objects (where in general the effect
20246 of @code{Initialize_Scalars} is part of the initialization routine
20247 for the composite object:
20250 pragma Initialize_Scalars;
20251 with Ada.Text_IO; use Ada.Text_IO;
20252 procedure Overwrite_Array is
20253 type Arr is array (1 .. 5) of Integer;
20254 X : Arr := (others => 1);
20256 for A'Address use X'Address;
20258 >>> warning: default initialization of "A" may
20259 modify "X", use pragma Import for "A" to
20260 suppress initialization (RM B.1(24))
20263 if X /= Arr'(others => 1) then
20264 Put_Line ("X was clobbered");
20266 Put_Line ("X was not clobbered");
20268 end Overwrite_Array;
20271 The above program generates the warning as shown, and at execution
20272 time, prints @code{X was clobbered}. If the @code{pragma Import} is
20273 added as suggested:
20276 pragma Initialize_Scalars;
20277 with Ada.Text_IO; use Ada.Text_IO;
20278 procedure Overwrite_Array is
20279 type Arr is array (1 .. 5) of Integer;
20280 X : Arr := (others => 1);
20282 for A'Address use X'Address;
20283 pragma Import (Ada, A);
20285 if X /= Arr'(others => 1) then
20286 Put_Line ("X was clobbered");
20288 Put_Line ("X was not clobbered");
20290 end Overwrite_Array;
20293 then the program compiles without the warning and when run will generate
20294 the output @code{X was not clobbered}.
20296 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
20297 @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}
20298 @section Use of Address Clauses for Memory-Mapped I/O
20301 @geindex Memory-mapped I/O
20303 A common pattern is to use an address clause to map an atomic variable to
20304 a location in memory that corresponds to a memory-mapped I/O operation or
20305 operations, for example:
20308 type Mem_Word is record
20311 pragma Atomic (Mem_Word);
20312 for Mem_Word_Size use 32;
20315 for Mem'Address use some-address;
20322 For a full access (reference or modification) of the variable (Mem) in this
20323 case, as in the above examples, GNAT guarantees that the entire atomic word
20324 will be accessed, in accordance with the RM C.6(15) clause.
20326 A problem arises with a component access such as:
20332 Note that the component A is not declared as atomic. This means that it is
20333 not clear what this assignment means. It could correspond to full word read
20334 and write as given in the first example, or on architectures that supported
20335 such an operation it might be a single byte store instruction. The RM does
20336 not have anything to say in this situation, and GNAT does not make any
20337 guarantee. The code generated may vary from target to target. GNAT will issue
20338 a warning in such a case:
20343 >>> warning: access to non-atomic component of atomic array,
20344 may cause unexpected accesses to atomic object
20347 It is best to be explicit in this situation, by either declaring the
20348 components to be atomic if you want the byte store, or explicitly writing
20349 the full word access sequence if that is what the hardware requires.
20350 Alternatively, if the full word access sequence is required, GNAT also
20351 provides the pragma @code{Volatile_Full_Access} which can be used in lieu of
20352 pragma @code{Atomic} and will give the additional guarantee.
20354 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
20355 @anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{296}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{297}
20356 @section Effect of Convention on Representation
20359 @geindex Convention
20360 @geindex effect on representation
20362 Normally the specification of a foreign language convention for a type or
20363 an object has no effect on the chosen representation. In particular, the
20364 representation chosen for data in GNAT generally meets the standard system
20365 conventions, and for example records are laid out in a manner that is
20366 consistent with C. This means that specifying convention C (for example)
20369 There are four exceptions to this general rule:
20375 @emph{Convention Fortran and array subtypes}.
20377 If pragma Convention Fortran is specified for an array subtype, then in
20378 accordance with the implementation advice in section 3.6.2(11) of the
20379 Ada Reference Manual, the array will be stored in a Fortran-compatible
20380 column-major manner, instead of the normal default row-major order.
20383 @emph{Convention C and enumeration types}
20385 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
20386 to accommodate all values of the type. For example, for the enumeration
20390 type Color is (Red, Green, Blue);
20393 8 bits is sufficient to store all values of the type, so by default, objects
20394 of type @code{Color} will be represented using 8 bits. However, normal C
20395 convention is to use 32 bits for all enum values in C, since enum values
20396 are essentially of type int. If pragma @code{Convention C} is specified for an
20397 Ada enumeration type, then the size is modified as necessary (usually to
20398 32 bits) to be consistent with the C convention for enum values.
20400 Note that this treatment applies only to types. If Convention C is given for
20401 an enumeration object, where the enumeration type is not Convention C, then
20402 Object_Size bits are allocated. For example, for a normal enumeration type,
20403 with less than 256 elements, only 8 bits will be allocated for the object.
20404 Since this may be a surprise in terms of what C expects, GNAT will issue a
20405 warning in this situation. The warning can be suppressed by giving an explicit
20406 size clause specifying the desired size.
20409 @emph{Convention C/Fortran and Boolean types}
20411 In C, the usual convention for boolean values, that is values used for
20412 conditions, is that zero represents false, and nonzero values represent
20413 true. In Ada, the normal convention is that two specific values, typically
20414 0/1, are used to represent false/true respectively.
20416 Fortran has a similar convention for @code{LOGICAL} values (any nonzero
20417 value represents true).
20419 To accommodate the Fortran and C conventions, if a pragma Convention specifies
20420 C or Fortran convention for a derived Boolean, as in the following example:
20423 type C_Switch is new Boolean;
20424 pragma Convention (C, C_Switch);
20427 then the GNAT generated code will treat any nonzero value as true. For truth
20428 values generated by GNAT, the conventional value 1 will be used for True, but
20429 when one of these values is read, any nonzero value is treated as True.
20432 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
20433 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{298}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{299}
20434 @section Conventions and Anonymous Access Types
20437 @geindex Anonymous access types
20439 @geindex Convention for anonymous access types
20441 The RM is not entirely clear on convention handling in a number of cases,
20442 and in particular, it is not clear on the convention to be given to
20443 anonymous access types in general, and in particular what is to be
20444 done for the case of anonymous access-to-subprogram.
20446 In GNAT, we decide that if an explicit Convention is applied
20447 to an object or component, and its type is such an anonymous type,
20448 then the convention will apply to this anonymous type as well. This
20449 seems to make sense since it is anomolous in any case to have a
20450 different convention for an object and its type, and there is clearly
20451 no way to explicitly specify a convention for an anonymous type, since
20452 it doesn't have a name to specify!
20454 Furthermore, we decide that if a convention is applied to a record type,
20455 then this convention is inherited by any of its components that are of an
20456 anonymous access type which do not have an explicitly specified convention.
20458 The following program shows these conventions in action:
20461 package ConvComp is
20462 type Foo is range 1 .. 10;
20464 A : access function (X : Foo) return Integer;
20467 pragma Convention (C, T1);
20470 A : access function (X : Foo) return Integer;
20471 pragma Convention (C, A);
20474 pragma Convention (COBOL, T2);
20477 A : access function (X : Foo) return Integer;
20478 pragma Convention (COBOL, A);
20481 pragma Convention (C, T3);
20484 A : access function (X : Foo) return Integer;
20487 pragma Convention (COBOL, T4);
20489 function F (X : Foo) return Integer;
20490 pragma Convention (C, F);
20492 function F (X : Foo) return Integer is (13);
20494 TV1 : T1 := (F'Access, 12); -- OK
20495 TV2 : T2 := (F'Access, 13); -- OK
20497 TV3 : T3 := (F'Access, 13); -- ERROR
20499 >>> subprogram "F" has wrong convention
20500 >>> does not match access to subprogram declared at line 17
20501 38. TV4 : T4 := (F'Access, 13); -- ERROR
20503 >>> subprogram "F" has wrong convention
20504 >>> does not match access to subprogram declared at line 24
20508 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
20509 @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}
20510 @section Determining the Representations chosen by GNAT
20513 @geindex Representation
20514 @geindex determination of
20516 @geindex -gnatR (gcc)
20518 Although the descriptions in this section are intended to be complete, it is
20519 often easier to simply experiment to see what GNAT accepts and what the
20520 effect is on the layout of types and objects.
20522 As required by the Ada RM, if a representation clause is not accepted, then
20523 it must be rejected as illegal by the compiler. However, when a
20524 representation clause or pragma is accepted, there can still be questions
20525 of what the compiler actually does. For example, if a partial record
20526 representation clause specifies the location of some components and not
20527 others, then where are the non-specified components placed? Or if pragma
20528 @code{Pack} is used on a record, then exactly where are the resulting
20529 fields placed? The section on pragma @code{Pack} in this chapter can be
20530 used to answer the second question, but it is often easier to just see
20531 what the compiler does.
20533 For this purpose, GNAT provides the option @emph{-gnatR}. If you compile
20534 with this option, then the compiler will output information on the actual
20535 representations chosen, in a format similar to source representation
20536 clauses. For example, if we compile the package:
20540 type r (x : boolean) is tagged record
20542 when True => S : String (1 .. 100);
20543 when False => null;
20547 type r2 is new r (false) with record
20552 y2 at 16 range 0 .. 31;
20559 type x1 is array (1 .. 10) of x;
20560 for x1'component_size use 11;
20562 type ia is access integer;
20564 type Rb1 is array (1 .. 13) of Boolean;
20567 type Rb2 is array (1 .. 65) of Boolean;
20582 using the switch @emph{-gnatR} we obtain the following output:
20585 Representation information for unit q
20586 -------------------------------------
20589 for r'Alignment use 4;
20591 x at 4 range 0 .. 7;
20592 _tag at 0 range 0 .. 31;
20593 s at 5 range 0 .. 799;
20596 for r2'Size use 160;
20597 for r2'Alignment use 4;
20599 x at 4 range 0 .. 7;
20600 _tag at 0 range 0 .. 31;
20601 _parent at 0 range 0 .. 63;
20602 y2 at 16 range 0 .. 31;
20606 for x'Alignment use 1;
20608 y at 0 range 0 .. 7;
20611 for x1'Size use 112;
20612 for x1'Alignment use 1;
20613 for x1'Component_Size use 11;
20615 for rb1'Size use 13;
20616 for rb1'Alignment use 2;
20617 for rb1'Component_Size use 1;
20619 for rb2'Size use 72;
20620 for rb2'Alignment use 1;
20621 for rb2'Component_Size use 1;
20623 for x2'Size use 224;
20624 for x2'Alignment use 4;
20626 l1 at 0 range 0 .. 0;
20627 l2 at 0 range 1 .. 64;
20628 l3 at 12 range 0 .. 31;
20629 l4 at 16 range 0 .. 0;
20630 l5 at 16 range 1 .. 13;
20631 l6 at 18 range 0 .. 71;
20635 The Size values are actually the Object_Size, i.e., the default size that
20636 will be allocated for objects of the type.
20637 The @code{??} size for type r indicates that we have a variant record, and the
20638 actual size of objects will depend on the discriminant value.
20640 The Alignment values show the actual alignment chosen by the compiler
20641 for each record or array type.
20643 The record representation clause for type r shows where all fields
20644 are placed, including the compiler generated tag field (whose location
20645 cannot be controlled by the programmer).
20647 The record representation clause for the type extension r2 shows all the
20648 fields present, including the parent field, which is a copy of the fields
20649 of the parent type of r2, i.e., r1.
20651 The component size and size clauses for types rb1 and rb2 show
20652 the exact effect of pragma @code{Pack} on these arrays, and the record
20653 representation clause for type x2 shows how pragma @cite{Pack} affects
20656 In some cases, it may be useful to cut and paste the representation clauses
20657 generated by the compiler into the original source to fix and guarantee
20658 the actual representation to be used.
20660 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
20661 @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}
20662 @chapter Standard Library Routines
20665 The Ada Reference Manual contains in Annex A a full description of an
20666 extensive set of standard library routines that can be used in any Ada
20667 program, and which must be provided by all Ada compilers. They are
20668 analogous to the standard C library used by C programs.
20670 GNAT implements all of the facilities described in annex A, and for most
20671 purposes the description in the Ada Reference Manual, or appropriate Ada
20672 text book, will be sufficient for making use of these facilities.
20674 In the case of the input-output facilities,
20675 @ref{f,,The Implementation of Standard I/O},
20676 gives details on exactly how GNAT interfaces to the
20677 file system. For the remaining packages, the Ada Reference Manual
20678 should be sufficient. The following is a list of the packages included,
20679 together with a brief description of the functionality that is provided.
20681 For completeness, references are included to other predefined library
20682 routines defined in other sections of the Ada Reference Manual (these are
20683 cross-indexed from Annex A). For further details see the relevant
20684 package declarations in the run-time library. In particular, a few units
20685 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
20686 and in this case the package declaration contains comments explaining why
20687 the unit is not implemented.
20692 @item @code{Ada} @emph{(A.2)}
20694 This is a parent package for all the standard library packages. It is
20695 usually included implicitly in your program, and itself contains no
20696 useful data or routines.
20698 @item @code{Ada.Assertions} @emph{(11.4.2)}
20700 @code{Assertions} provides the @code{Assert} subprograms, and also
20701 the declaration of the @code{Assertion_Error} exception.
20703 @item @code{Ada.Asynchronous_Task_Control} @emph{(D.11)}
20705 @code{Asynchronous_Task_Control} provides low level facilities for task
20706 synchronization. It is typically not implemented. See package spec for details.
20708 @item @code{Ada.Calendar} @emph{(9.6)}
20710 @code{Calendar} provides time of day access, and routines for
20711 manipulating times and durations.
20713 @item @code{Ada.Calendar.Arithmetic} @emph{(9.6.1)}
20715 This package provides additional arithmetic
20716 operations for @code{Calendar}.
20718 @item @code{Ada.Calendar.Formatting} @emph{(9.6.1)}
20720 This package provides formatting operations for @code{Calendar}.
20722 @item @code{Ada.Calendar.Time_Zones} @emph{(9.6.1)}
20724 This package provides additional @code{Calendar} facilities
20725 for handling time zones.
20727 @item @code{Ada.Characters} @emph{(A.3.1)}
20729 This is a dummy parent package that contains no useful entities
20731 @item @code{Ada.Characters.Conversions} @emph{(A.3.2)}
20733 This package provides character conversion functions.
20735 @item @code{Ada.Characters.Handling} @emph{(A.3.2)}
20737 This package provides some basic character handling capabilities,
20738 including classification functions for classes of characters (e.g., test
20739 for letters, or digits).
20741 @item @code{Ada.Characters.Latin_1} @emph{(A.3.3)}
20743 This package includes a complete set of definitions of the characters
20744 that appear in type CHARACTER. It is useful for writing programs that
20745 will run in international environments. For example, if you want an
20746 upper case E with an acute accent in a string, it is often better to use
20747 the definition of @code{UC_E_Acute} in this package. Then your program
20748 will print in an understandable manner even if your environment does not
20749 support these extended characters.
20751 @item @code{Ada.Command_Line} @emph{(A.15)}
20753 This package provides access to the command line parameters and the name
20754 of the current program (analogous to the use of @code{argc} and @code{argv}
20755 in C), and also allows the exit status for the program to be set in a
20756 system-independent manner.
20758 @item @code{Ada.Complex_Text_IO} @emph{(G.1.3)}
20760 This package provides text input and output of complex numbers.
20762 @item @code{Ada.Containers} @emph{(A.18.1)}
20764 A top level package providing a few basic definitions used by all the
20765 following specific child packages that provide specific kinds of
20769 @code{Ada.Containers.Bounded_Priority_Queues} @emph{(A.18.31)}
20771 @code{Ada.Containers.Bounded_Synchronized_Queues} @emph{(A.18.29)}
20773 @code{Ada.Containers.Doubly_Linked_Lists} @emph{(A.18.3)}
20775 @code{Ada.Containers.Generic_Array_Sort} @emph{(A.18.26)}
20777 @code{Ada.Containers.Generic_Constrained_Array_Sort} @emph{(A.18.26)}
20779 @code{Ada.Containers.Generic_Sort} @emph{(A.18.26)}
20781 @code{Ada.Containers.Hashed_Maps} @emph{(A.18.5)}
20783 @code{Ada.Containers.Hashed_Sets} @emph{(A.18.8)}
20785 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} @emph{(A.18.12)}
20787 @code{Ada.Containers.Indefinite_Hashed_Maps} @emph{(A.18.13)}
20789 @code{Ada.Containers.Indefinite_Hashed_Sets} @emph{(A.18.15)}
20791 @code{Ada.Containers.Indefinite_Holders} @emph{(A.18.18)}
20793 @code{Ada.Containers.Indefinite_Multiway_Trees} @emph{(A.18.17)}
20795 @code{Ada.Containers.Indefinite_Ordered_Maps} @emph{(A.18.14)}
20797 @code{Ada.Containers.Indefinite_Ordered_Sets} @emph{(A.18.16)}
20799 @code{Ada.Containers.Indefinite_Vectors} @emph{(A.18.11)}
20801 @code{Ada.Containers.Multiway_Trees} @emph{(A.18.10)}
20803 @code{Ada.Containers.Ordered_Maps} @emph{(A.18.6)}
20805 @code{Ada.Containers.Ordered_Sets} @emph{(A.18.9)}
20807 @code{Ada.Containers.Synchronized_Queue_Interfaces} @emph{(A.18.27)}
20809 @code{Ada.Containers.Unbounded_Priority_Queues} @emph{(A.18.30)}
20811 @code{Ada.Containers.Unbounded_Synchronized_Queues} @emph{(A.18.28)}
20813 @code{Ada.Containers.Vectors} @emph{(A.18.2)}
20818 @item @code{Ada.Directories} @emph{(A.16)}
20820 This package provides operations on directories.
20822 @item @code{Ada.Directories.Hierarchical_File_Names} @emph{(A.16.1)}
20824 This package provides additional directory operations handling
20825 hiearchical file names.
20827 @item @code{Ada.Directories.Information} @emph{(A.16)}
20829 This is an implementation defined package for additional directory
20830 operations, which is not implemented in GNAT.
20832 @item @code{Ada.Decimal} @emph{(F.2)}
20834 This package provides constants describing the range of decimal numbers
20835 implemented, and also a decimal divide routine (analogous to the COBOL
20836 verb DIVIDE ... GIVING ... REMAINDER ...)
20838 @item @code{Ada.Direct_IO} @emph{(A.8.4)}
20840 This package provides input-output using a model of a set of records of
20841 fixed-length, containing an arbitrary definite Ada type, indexed by an
20842 integer record number.
20844 @item @code{Ada.Dispatching} @emph{(D.2.1)}
20846 A parent package containing definitions for task dispatching operations.
20848 @item @code{Ada.Dispatching.EDF} @emph{(D.2.6)}
20850 Not implemented in GNAT.
20852 @item @code{Ada.Dispatching.Non_Preemptive} @emph{(D.2.4)}
20854 Not implemented in GNAT.
20856 @item @code{Ada.Dispatching.Round_Robin} @emph{(D.2.5)}
20858 Not implemented in GNAT.
20860 @item @code{Ada.Dynamic_Priorities} @emph{(D.5)}
20862 This package allows the priorities of a task to be adjusted dynamically
20863 as the task is running.
20865 @item @code{Ada.Environment_Variables} @emph{(A.17)}
20867 This package provides facilities for accessing environment variables.
20869 @item @code{Ada.Exceptions} @emph{(11.4.1)}
20871 This package provides additional information on exceptions, and also
20872 contains facilities for treating exceptions as data objects, and raising
20873 exceptions with associated messages.
20875 @item @code{Ada.Execution_Time} @emph{(D.14)}
20877 This package provides CPU clock functionalities. It is not implemented on
20878 all targets (see package spec for details).
20880 @item @code{Ada.Execution_Time.Group_Budgets} @emph{(D.14.2)}
20882 Not implemented in GNAT.
20884 @item @code{Ada.Execution_Time.Timers} @emph{(D.14.1)'}
20886 Not implemented in GNAT.
20888 @item @code{Ada.Finalization} @emph{(7.6)}
20890 This package contains the declarations and subprograms to support the
20891 use of controlled types, providing for automatic initialization and
20892 finalization (analogous to the constructors and destructors of C++).
20894 @item @code{Ada.Float_Text_IO} @emph{(A.10.9)}
20896 A library level instantiation of Text_IO.Float_IO for type Float.
20898 @item @code{Ada.Float_Wide_Text_IO} @emph{(A.10.9)}
20900 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
20902 @item @code{Ada.Float_Wide_Wide_Text_IO} @emph{(A.10.9)}
20904 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
20906 @item @code{Ada.Integer_Text_IO} @emph{(A.10.9)}
20908 A library level instantiation of Text_IO.Integer_IO for type Integer.
20910 @item @code{Ada.Integer_Wide_Text_IO} @emph{(A.10.9)}
20912 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
20914 @item @code{Ada.Integer_Wide_Wide_Text_IO} @emph{(A.10.9)}
20916 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
20918 @item @code{Ada.Interrupts} @emph{(C.3.2)}
20920 This package provides facilities for interfacing to interrupts, which
20921 includes the set of signals or conditions that can be raised and
20922 recognized as interrupts.
20924 @item @code{Ada.Interrupts.Names} @emph{(C.3.2)}
20926 This package provides the set of interrupt names (actually signal
20927 or condition names) that can be handled by GNAT.
20929 @item @code{Ada.IO_Exceptions} @emph{(A.13)}
20931 This package defines the set of exceptions that can be raised by use of
20932 the standard IO packages.
20934 @item @code{Ada.Iterator_Interfaces} @emph{(5.5.1)}
20936 This package provides a generic interface to generalized iterators.
20938 @item @code{Ada.Locales} @emph{(A.19)}
20940 This package provides declarations providing information (Language
20941 and Country) about the current locale.
20943 @item @code{Ada.Numerics}
20945 This package contains some standard constants and exceptions used
20946 throughout the numerics packages. Note that the constants pi and e are
20947 defined here, and it is better to use these definitions than rolling
20950 @item @code{Ada.Numerics.Complex_Arrays} @emph{(G.3.2)}
20952 Provides operations on arrays of complex numbers.
20954 @item @code{Ada.Numerics.Complex_Elementary_Functions}
20956 Provides the implementation of standard elementary functions (such as
20957 log and trigonometric functions) operating on complex numbers using the
20958 standard @code{Float} and the @code{Complex} and @code{Imaginary} types
20959 created by the package @code{Numerics.Complex_Types}.
20961 @item @code{Ada.Numerics.Complex_Types}
20963 This is a predefined instantiation of
20964 @code{Numerics.Generic_Complex_Types} using @code{Standard.Float} to
20965 build the type @code{Complex} and @code{Imaginary}.
20967 @item @code{Ada.Numerics.Discrete_Random}
20969 This generic package provides a random number generator suitable for generating
20970 uniformly distributed values of a specified discrete subtype.
20972 @item @code{Ada.Numerics.Float_Random}
20974 This package provides a random number generator suitable for generating
20975 uniformly distributed floating point values in the unit interval.
20977 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
20979 This is a generic version of the package that provides the
20980 implementation of standard elementary functions (such as log and
20981 trigonometric functions) for an arbitrary complex type.
20983 The following predefined instantiations of this package are provided:
20991 @code{Ada.Numerics.Short_Complex_Elementary_Functions}
20996 @code{Ada.Numerics.Complex_Elementary_Functions}
21001 @code{Ada.Numerics.Long_Complex_Elementary_Functions}
21004 @item @code{Ada.Numerics.Generic_Complex_Types}
21006 This is a generic package that allows the creation of complex types,
21007 with associated complex arithmetic operations.
21009 The following predefined instantiations of this package exist
21017 @code{Ada.Numerics.Short_Complex_Complex_Types}
21022 @code{Ada.Numerics.Complex_Complex_Types}
21027 @code{Ada.Numerics.Long_Complex_Complex_Types}
21030 @item @code{Ada.Numerics.Generic_Elementary_Functions}
21032 This is a generic package that provides the implementation of standard
21033 elementary functions (such as log an trigonometric functions) for an
21034 arbitrary float type.
21036 The following predefined instantiations of this package exist
21044 @code{Ada.Numerics.Short_Elementary_Functions}
21049 @code{Ada.Numerics.Elementary_Functions}
21054 @code{Ada.Numerics.Long_Elementary_Functions}
21057 @item @code{Ada.Numerics.Generic_Real_Arrays} @emph{(G.3.1)}
21059 Generic operations on arrays of reals
21061 @item @code{Ada.Numerics.Real_Arrays} @emph{(G.3.1)}
21063 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
21065 @item @code{Ada.Real_Time} @emph{(D.8)}
21067 This package provides facilities similar to those of @code{Calendar}, but
21068 operating with a finer clock suitable for real time control. Note that
21069 annex D requires that there be no backward clock jumps, and GNAT generally
21070 guarantees this behavior, but of course if the external clock on which
21071 the GNAT runtime depends is deliberately reset by some external event,
21072 then such a backward jump may occur.
21074 @item @code{Ada.Real_Time.Timing_Events} @emph{(D.15)}
21076 Not implemented in GNAT.
21078 @item @code{Ada.Sequential_IO} @emph{(A.8.1)}
21080 This package provides input-output facilities for sequential files,
21081 which can contain a sequence of values of a single type, which can be
21082 any Ada type, including indefinite (unconstrained) types.
21084 @item @code{Ada.Storage_IO} @emph{(A.9)}
21086 This package provides a facility for mapping arbitrary Ada types to and
21087 from a storage buffer. It is primarily intended for the creation of new
21090 @item @code{Ada.Streams} @emph{(13.13.1)}
21092 This is a generic package that provides the basic support for the
21093 concept of streams as used by the stream attributes (@code{Input},
21094 @code{Output}, @code{Read} and @code{Write}).
21096 @item @code{Ada.Streams.Stream_IO} @emph{(A.12.1)}
21098 This package is a specialization of the type @code{Streams} defined in
21099 package @code{Streams} together with a set of operations providing
21100 Stream_IO capability. The Stream_IO model permits both random and
21101 sequential access to a file which can contain an arbitrary set of values
21102 of one or more Ada types.
21104 @item @code{Ada.Strings} @emph{(A.4.1)}
21106 This package provides some basic constants used by the string handling
21109 @item @code{Ada.Strings.Bounded} @emph{(A.4.4)}
21111 This package provides facilities for handling variable length
21112 strings. The bounded model requires a maximum length. It is thus
21113 somewhat more limited than the unbounded model, but avoids the use of
21114 dynamic allocation or finalization.
21116 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} @emph{(A.4.10)}
21118 Provides case-insensitive comparisons of bounded strings
21120 @item @code{Ada.Strings.Bounded.Hash} @emph{(A.4.9)}
21122 This package provides a generic hash function for bounded strings
21124 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} @emph{(A.4.9)}
21126 This package provides a generic hash function for bounded strings that
21127 converts the string to be hashed to lower case.
21129 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} @emph{(A.4.10)}
21131 This package provides a comparison function for bounded strings that works
21132 in a case insensitive manner by converting to lower case before the comparison.
21134 @item @code{Ada.Strings.Fixed} @emph{(A.4.3)}
21136 This package provides facilities for handling fixed length strings.
21138 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} @emph{(A.4.10)}
21140 This package provides an equality function for fixed strings that compares
21141 the strings after converting both to lower case.
21143 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} @emph{(A.4.9)}
21145 This package provides a case insensitive hash function for fixed strings that
21146 converts the string to lower case before computing the hash.
21148 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} @emph{(A.4.10)}
21150 This package provides a comparison function for fixed strings that works
21151 in a case insensitive manner by converting to lower case before the comparison.
21153 @item @code{Ada.Strings.Hash} @emph{(A.4.9)}
21155 This package provides a hash function for strings.
21157 @item @code{Ada.Strings.Hash_Case_Insensitive} @emph{(A.4.9)}
21159 This package provides a hash function for strings that is case insensitive.
21160 The string is converted to lower case before computing the hash.
21162 @item @code{Ada.Strings.Less_Case_Insensitive} @emph{(A.4.10)}
21164 This package provides a comparison function for\strings that works
21165 in a case insensitive manner by converting to lower case before the comparison.
21167 @item @code{Ada.Strings.Maps} @emph{(A.4.2)}
21169 This package provides facilities for handling character mappings and
21170 arbitrarily defined subsets of characters. For instance it is useful in
21171 defining specialized translation tables.
21173 @item @code{Ada.Strings.Maps.Constants} @emph{(A.4.6)}
21175 This package provides a standard set of predefined mappings and
21176 predefined character sets. For example, the standard upper to lower case
21177 conversion table is found in this package. Note that upper to lower case
21178 conversion is non-trivial if you want to take the entire set of
21179 characters, including extended characters like E with an acute accent,
21180 into account. You should use the mappings in this package (rather than
21181 adding 32 yourself) to do case mappings.
21183 @item @code{Ada.Strings.Unbounded} @emph{(A.4.5)}
21185 This package provides facilities for handling variable length
21186 strings. The unbounded model allows arbitrary length strings, but
21187 requires the use of dynamic allocation and finalization.
21189 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} @emph{(A.4.10)}
21191 Provides case-insensitive comparisons of unbounded strings
21193 @item @code{Ada.Strings.Unbounded.Hash} @emph{(A.4.9)}
21195 This package provides a generic hash function for unbounded strings
21197 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} @emph{(A.4.9)}
21199 This package provides a generic hash function for unbounded strings that
21200 converts the string to be hashed to lower case.
21202 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} @emph{(A.4.10)}
21204 This package provides a comparison function for unbounded strings that works
21205 in a case insensitive manner by converting to lower case before the comparison.
21207 @item @code{Ada.Strings.UTF_Encoding} @emph{(A.4.11)}
21209 This package provides basic definitions for dealing with UTF-encoded strings.
21211 @item @code{Ada.Strings.UTF_Encoding.Conversions} @emph{(A.4.11)}
21213 This package provides conversion functions for UTF-encoded strings.
21216 @code{Ada.Strings.UTF_Encoding.Strings} @emph{(A.4.11)}
21218 @code{Ada.Strings.UTF_Encoding.Wide_Strings} @emph{(A.4.11)}
21223 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} @emph{(A.4.11)}
21225 These packages provide facilities for handling UTF encodings for
21226 Strings, Wide_Strings and Wide_Wide_Strings.
21229 @code{Ada.Strings.Wide_Bounded} @emph{(A.4.7)}
21231 @code{Ada.Strings.Wide_Fixed} @emph{(A.4.7)}
21233 @code{Ada.Strings.Wide_Maps} @emph{(A.4.7)}
21238 @item @code{Ada.Strings.Wide_Unbounded} @emph{(A.4.7)}
21240 These packages provide analogous capabilities to the corresponding
21241 packages without @code{Wide_} in the name, but operate with the types
21242 @code{Wide_String} and @code{Wide_Character} instead of @code{String}
21243 and @code{Character}. Versions of all the child packages are available.
21246 @code{Ada.Strings.Wide_Wide_Bounded} @emph{(A.4.7)}
21248 @code{Ada.Strings.Wide_Wide_Fixed} @emph{(A.4.7)}
21250 @code{Ada.Strings.Wide_Wide_Maps} @emph{(A.4.7)}
21255 @item @code{Ada.Strings.Wide_Wide_Unbounded} @emph{(A.4.7)}
21257 These packages provide analogous capabilities to the corresponding
21258 packages without @code{Wide_} in the name, but operate with the types
21259 @code{Wide_Wide_String} and @code{Wide_Wide_Character} instead
21260 of @code{String} and @code{Character}.
21262 @item @code{Ada.Synchronous_Barriers} @emph{(D.10.1)}
21264 This package provides facilities for synchronizing tasks at a low level
21267 @item @code{Ada.Synchronous_Task_Control} @emph{(D.10)}
21269 This package provides some standard facilities for controlling task
21270 communication in a synchronous manner.
21272 @item @code{Ada.Synchronous_Task_Control.EDF} @emph{(D.10)}
21274 Not implemented in GNAT.
21276 @item @code{Ada.Tags}
21278 This package contains definitions for manipulation of the tags of tagged
21281 @item @code{Ada.Tags.Generic_Dispatching_Constructor} @emph{(3.9)}
21283 This package provides a way of constructing tagged class-wide values given
21284 only the tag value.
21286 @item @code{Ada.Task_Attributes} @emph{(C.7.2)}
21288 This package provides the capability of associating arbitrary
21289 task-specific data with separate tasks.
21291 @item @code{Ada.Task_Identifification} @emph{(C.7.1)}
21293 This package provides capabilities for task identification.
21295 @item @code{Ada.Task_Termination} @emph{(C.7.3)}
21297 This package provides control over task termination.
21299 @item @code{Ada.Text_IO}
21301 This package provides basic text input-output capabilities for
21302 character, string and numeric data. The subpackages of this
21303 package are listed next. Note that although these are defined
21304 as subpackages in the RM, they are actually transparently
21305 implemented as child packages in GNAT, meaning that they
21306 are only loaded if needed.
21308 @item @code{Ada.Text_IO.Decimal_IO}
21310 Provides input-output facilities for decimal fixed-point types
21312 @item @code{Ada.Text_IO.Enumeration_IO}
21314 Provides input-output facilities for enumeration types.
21316 @item @code{Ada.Text_IO.Fixed_IO}
21318 Provides input-output facilities for ordinary fixed-point types.
21320 @item @code{Ada.Text_IO.Float_IO}
21322 Provides input-output facilities for float types. The following
21323 predefined instantiations of this generic package are available:
21331 @code{Short_Float_Text_IO}
21336 @code{Float_Text_IO}
21341 @code{Long_Float_Text_IO}
21344 @item @code{Ada.Text_IO.Integer_IO}
21346 Provides input-output facilities for integer types. The following
21347 predefined instantiations of this generic package are available:
21353 @code{Short_Short_Integer}
21355 @code{Ada.Short_Short_Integer_Text_IO}
21358 @code{Short_Integer}
21360 @code{Ada.Short_Integer_Text_IO}
21365 @code{Ada.Integer_Text_IO}
21368 @code{Long_Integer}
21370 @code{Ada.Long_Integer_Text_IO}
21373 @code{Long_Long_Integer}
21375 @code{Ada.Long_Long_Integer_Text_IO}
21378 @item @code{Ada.Text_IO.Modular_IO}
21380 Provides input-output facilities for modular (unsigned) types.
21382 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
21384 Provides input-output facilities for bounded strings.
21386 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
21388 This package provides basic text input-output capabilities for complex
21391 @item @code{Ada.Text_IO.Editing (F.3.3)}
21393 This package contains routines for edited output, analogous to the use
21394 of pictures in COBOL. The picture formats used by this package are a
21395 close copy of the facility in COBOL.
21397 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
21399 This package provides a facility that allows Text_IO files to be treated
21400 as streams, so that the stream attributes can be used for writing
21401 arbitrary data, including binary data, to Text_IO files.
21403 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
21405 This package provides input-output facilities for unbounded strings.
21407 @item @code{Ada.Unchecked_Conversion (13.9)}
21409 This generic package allows arbitrary conversion from one type to
21410 another of the same size, providing for breaking the type safety in
21411 special circumstances.
21413 If the types have the same Size (more accurately the same Value_Size),
21414 then the effect is simply to transfer the bits from the source to the
21415 target type without any modification. This usage is well defined, and
21416 for simple types whose representation is typically the same across
21417 all implementations, gives a portable method of performing such
21420 If the types do not have the same size, then the result is implementation
21421 defined, and thus may be non-portable. The following describes how GNAT
21422 handles such unchecked conversion cases.
21424 If the types are of different sizes, and are both discrete types, then
21425 the effect is of a normal type conversion without any constraint checking.
21426 In particular if the result type has a larger size, the result will be
21427 zero or sign extended. If the result type has a smaller size, the result
21428 will be truncated by ignoring high order bits.
21430 If the types are of different sizes, and are not both discrete types,
21431 then the conversion works as though pointers were created to the source
21432 and target, and the pointer value is converted. The effect is that bits
21433 are copied from successive low order storage units and bits of the source
21434 up to the length of the target type.
21436 A warning is issued if the lengths differ, since the effect in this
21437 case is implementation dependent, and the above behavior may not match
21438 that of some other compiler.
21440 A pointer to one type may be converted to a pointer to another type using
21441 unchecked conversion. The only case in which the effect is undefined is
21442 when one or both pointers are pointers to unconstrained array types. In
21443 this case, the bounds information may get incorrectly transferred, and in
21444 particular, GNAT uses double size pointers for such types, and it is
21445 meaningless to convert between such pointer types. GNAT will issue a
21446 warning if the alignment of the target designated type is more strict
21447 than the alignment of the source designated type (since the result may
21448 be unaligned in this case).
21450 A pointer other than a pointer to an unconstrained array type may be
21451 converted to and from System.Address. Such usage is common in Ada 83
21452 programs, but note that Ada.Address_To_Access_Conversions is the
21453 preferred method of performing such conversions in Ada 95 and Ada 2005.
21455 unchecked conversion nor Ada.Address_To_Access_Conversions should be
21456 used in conjunction with pointers to unconstrained objects, since
21457 the bounds information cannot be handled correctly in this case.
21459 @item @code{Ada.Unchecked_Deallocation} @emph{(13.11.2)}
21461 This generic package allows explicit freeing of storage previously
21462 allocated by use of an allocator.
21464 @item @code{Ada.Wide_Text_IO} @emph{(A.11)}
21466 This package is similar to @code{Ada.Text_IO}, except that the external
21467 file supports wide character representations, and the internal types are
21468 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21469 and @code{String}. The corresponding set of nested packages and child
21470 packages are defined.
21472 @item @code{Ada.Wide_Wide_Text_IO} @emph{(A.11)}
21474 This package is similar to @code{Ada.Text_IO}, except that the external
21475 file supports wide character representations, and the internal types are
21476 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21477 and @code{String}. The corresponding set of nested packages and child
21478 packages are defined.
21481 For packages in Interfaces and System, all the RM defined packages are
21482 available in GNAT, see the Ada 2012 RM for full details.
21484 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
21485 @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}
21486 @chapter The Implementation of Standard I/O
21489 GNAT implements all the required input-output facilities described in
21490 A.6 through A.14. These sections of the Ada Reference Manual describe the
21491 required behavior of these packages from the Ada point of view, and if
21492 you are writing a portable Ada program that does not need to know the
21493 exact manner in which Ada maps to the outside world when it comes to
21494 reading or writing external files, then you do not need to read this
21495 chapter. As long as your files are all regular files (not pipes or
21496 devices), and as long as you write and read the files only from Ada, the
21497 description in the Ada Reference Manual is sufficient.
21499 However, if you want to do input-output to pipes or other devices, such
21500 as the keyboard or screen, or if the files you are dealing with are
21501 either generated by some other language, or to be read by some other
21502 language, then you need to know more about the details of how the GNAT
21503 implementation of these input-output facilities behaves.
21505 In this chapter we give a detailed description of exactly how GNAT
21506 interfaces to the file system. As always, the sources of the system are
21507 available to you for answering questions at an even more detailed level,
21508 but for most purposes the information in this chapter will suffice.
21510 Another reason that you may need to know more about how input-output is
21511 implemented arises when you have a program written in mixed languages
21512 where, for example, files are shared between the C and Ada sections of
21513 the same program. GNAT provides some additional facilities, in the form
21514 of additional child library packages, that facilitate this sharing, and
21515 these additional facilities are also described in this chapter.
21518 * Standard I/O Packages::
21524 * Wide_Wide_Text_IO::
21526 * Text Translation::
21528 * Filenames encoding::
21529 * File content encoding::
21531 * Operations on C Streams::
21532 * Interfacing to C Streams::
21536 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
21537 @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}
21538 @section Standard I/O Packages
21541 The Standard I/O packages described in Annex A for
21550 Ada.Text_IO.Complex_IO
21553 Ada.Text_IO.Text_Streams
21559 Ada.Wide_Text_IO.Complex_IO
21562 Ada.Wide_Text_IO.Text_Streams
21565 Ada.Wide_Wide_Text_IO
21568 Ada.Wide_Wide_Text_IO.Complex_IO
21571 Ada.Wide_Wide_Text_IO.Text_Streams
21583 are implemented using the C
21584 library streams facility; where
21590 All files are opened using @code{fopen}.
21593 All input/output operations use @code{fread}/@cite{fwrite}.
21596 There is no internal buffering of any kind at the Ada library level. The only
21597 buffering is that provided at the system level in the implementation of the
21598 library routines that support streams. This facilitates shared use of these
21599 streams by mixed language programs. Note though that system level buffering is
21600 explicitly enabled at elaboration of the standard I/O packages and that can
21601 have an impact on mixed language programs, in particular those using I/O before
21602 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
21603 the Ada elaboration routine before performing any I/O or when impractical,
21604 flush the common I/O streams and in particular Standard_Output before
21605 elaborating the Ada code.
21607 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
21608 @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}
21609 @section FORM Strings
21612 The format of a FORM string in GNAT is:
21615 "keyword=value,keyword=value,...,keyword=value"
21618 where letters may be in upper or lower case, and there are no spaces
21619 between values. The order of the entries is not important. Currently
21620 the following keywords defined.
21623 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
21625 WCEM=[n|h|u|s|e|8|b]
21626 ENCODING=[UTF8|8BITS]
21629 The use of these parameters is described later in this section. If an
21630 unrecognized keyword appears in a form string, it is silently ignored
21631 and not considered invalid.
21633 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
21634 @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}
21638 Direct_IO can only be instantiated for definite types. This is a
21639 restriction of the Ada language, which means that the records are fixed
21640 length (the length being determined by @code{type'Size}, rounded
21641 up to the next storage unit boundary if necessary).
21643 The records of a Direct_IO file are simply written to the file in index
21644 sequence, with the first record starting at offset zero, and subsequent
21645 records following. There is no control information of any kind. For
21646 example, if 32-bit integers are being written, each record takes
21647 4-bytes, so the record at index @code{K} starts at offset
21650 There is no limit on the size of Direct_IO files, they are expanded as
21651 necessary to accommodate whatever records are written to the file.
21653 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
21654 @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}
21655 @section Sequential_IO
21658 Sequential_IO may be instantiated with either a definite (constrained)
21659 or indefinite (unconstrained) type.
21661 For the definite type case, the elements written to the file are simply
21662 the memory images of the data values with no control information of any
21663 kind. The resulting file should be read using the same type, no validity
21664 checking is performed on input.
21666 For the indefinite type case, the elements written consist of two
21667 parts. First is the size of the data item, written as the memory image
21668 of a @code{Interfaces.C.size_t} value, followed by the memory image of
21669 the data value. The resulting file can only be read using the same
21670 (unconstrained) type. Normal assignment checks are performed on these
21671 read operations, and if these checks fail, @code{Data_Error} is
21672 raised. In particular, in the array case, the lengths must match, and in
21673 the variant record case, if the variable for a particular read operation
21674 is constrained, the discriminants must match.
21676 Note that it is not possible to use Sequential_IO to write variable
21677 length array items, and then read the data back into different length
21678 arrays. For example, the following will raise @code{Data_Error}:
21681 package IO is new Sequential_IO (String);
21686 IO.Write (F, "hello!")
21687 IO.Reset (F, Mode=>In_File);
21692 On some Ada implementations, this will print @code{hell}, but the program is
21693 clearly incorrect, since there is only one element in the file, and that
21694 element is the string @code{hello!}.
21696 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
21697 using Stream_IO, and this is the preferred mechanism. In particular, the
21698 above program fragment rewritten to use Stream_IO will work correctly.
21700 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
21701 @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}
21705 Text_IO files consist of a stream of characters containing the following
21706 special control characters:
21709 LF (line feed, 16#0A#) Line Mark
21710 FF (form feed, 16#0C#) Page Mark
21713 A canonical Text_IO file is defined as one in which the following
21714 conditions are met:
21720 The character @code{LF} is used only as a line mark, i.e., to mark the end
21724 The character @code{FF} is used only as a page mark, i.e., to mark the
21725 end of a page and consequently can appear only immediately following a
21726 @code{LF} (line mark) character.
21729 The file ends with either @code{LF} (line mark) or @code{LF}-@cite{FF}
21730 (line mark, page mark). In the former case, the page mark is implicitly
21731 assumed to be present.
21734 A file written using Text_IO will be in canonical form provided that no
21735 explicit @code{LF} or @code{FF} characters are written using @code{Put}
21736 or @code{Put_Line}. There will be no @code{FF} character at the end of
21737 the file unless an explicit @code{New_Page} operation was performed
21738 before closing the file.
21740 A canonical Text_IO file that is a regular file (i.e., not a device or a
21741 pipe) can be read using any of the routines in Text_IO. The
21742 semantics in this case will be exactly as defined in the Ada Reference
21743 Manual, and all the routines in Text_IO are fully implemented.
21745 A text file that does not meet the requirements for a canonical Text_IO
21746 file has one of the following:
21752 The file contains @code{FF} characters not immediately following a
21753 @code{LF} character.
21756 The file contains @code{LF} or @code{FF} characters written by
21757 @code{Put} or @code{Put_Line}, which are not logically considered to be
21758 line marks or page marks.
21761 The file ends in a character other than @code{LF} or @code{FF},
21762 i.e., there is no explicit line mark or page mark at the end of the file.
21765 Text_IO can be used to read such non-standard text files but subprograms
21766 to do with line or page numbers do not have defined meanings. In
21767 particular, a @code{FF} character that does not follow a @code{LF}
21768 character may or may not be treated as a page mark from the point of
21769 view of page and line numbering. Every @code{LF} character is considered
21770 to end a line, and there is an implied @code{LF} character at the end of
21774 * Stream Pointer Positioning::
21775 * Reading and Writing Non-Regular Files::
21777 * Treating Text_IO Files as Streams::
21778 * Text_IO Extensions::
21779 * Text_IO Facilities for Unbounded Strings::
21783 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21784 @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}
21785 @subsection Stream Pointer Positioning
21788 @code{Ada.Text_IO} has a definition of current position for a file that
21789 is being read. No internal buffering occurs in Text_IO, and usually the
21790 physical position in the stream used to implement the file corresponds
21791 to this logical position defined by Text_IO. There are two exceptions:
21797 After a call to @code{End_Of_Page} that returns @code{True}, the stream
21798 is positioned past the @code{LF} (line mark) that precedes the page
21799 mark. Text_IO maintains an internal flag so that subsequent read
21800 operations properly handle the logical position which is unchanged by
21801 the @code{End_Of_Page} call.
21804 After a call to @code{End_Of_File} that returns @code{True}, if the
21805 Text_IO file was positioned before the line mark at the end of file
21806 before the call, then the logical position is unchanged, but the stream
21807 is physically positioned right at the end of file (past the line mark,
21808 and past a possible page mark following the line mark. Again Text_IO
21809 maintains internal flags so that subsequent read operations properly
21810 handle the logical position.
21813 These discrepancies have no effect on the observable behavior of
21814 Text_IO, but if a single Ada stream is shared between a C program and
21815 Ada program, or shared (using @code{shared=yes} in the form string)
21816 between two Ada files, then the difference may be observable in some
21819 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21820 @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}
21821 @subsection Reading and Writing Non-Regular Files
21824 A non-regular file is a device (such as a keyboard), or a pipe. Text_IO
21825 can be used for reading and writing. Writing is not affected and the
21826 sequence of characters output is identical to the normal file case, but
21827 for reading, the behavior of Text_IO is modified to avoid undesirable
21828 look-ahead as follows:
21830 An input file that is not a regular file is considered to have no page
21831 marks. Any @code{Ascii.FF} characters (the character normally used for a
21832 page mark) appearing in the file are considered to be data
21833 characters. In particular:
21839 @code{Get_Line} and @code{Skip_Line} do not test for a page mark
21840 following a line mark. If a page mark appears, it will be treated as a
21844 This avoids the need to wait for an extra character to be typed or
21845 entered from the pipe to complete one of these operations.
21848 @code{End_Of_Page} always returns @code{False}
21851 @code{End_Of_File} will return @code{False} if there is a page mark at
21852 the end of the file.
21855 Output to non-regular files is the same as for regular files. Page marks
21856 may be written to non-regular files using @code{New_Page}, but as noted
21857 above they will not be treated as page marks on input if the output is
21858 piped to another Ada program.
21860 Another important discrepancy when reading non-regular files is that the end
21861 of file indication is not 'sticky'. If an end of file is entered, e.g., by
21862 pressing the @code{EOT} key,
21864 is signaled once (i.e., the test @code{End_Of_File}
21865 will yield @code{True}, or a read will
21866 raise @code{End_Error}), but then reading can resume
21867 to read data past that end of
21868 file indication, until another end of file indication is entered.
21870 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
21871 @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}
21872 @subsection Get_Immediate
21875 @geindex Get_Immediate
21877 Get_Immediate returns the next character (including control characters)
21878 from the input file. In particular, Get_Immediate will return LF or FF
21879 characters used as line marks or page marks. Such operations leave the
21880 file positioned past the control character, and it is thus not treated
21881 as having its normal function. This means that page, line and column
21882 counts after this kind of Get_Immediate call are set as though the mark
21883 did not occur. In the case where a Get_Immediate leaves the file
21884 positioned between the line mark and page mark (which is not normally
21885 possible), it is undefined whether the FF character will be treated as a
21888 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
21889 @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}
21890 @subsection Treating Text_IO Files as Streams
21893 @geindex Stream files
21895 The package @code{Text_IO.Streams} allows a @code{Text_IO} file to be treated
21896 as a stream. Data written to a @code{Text_IO} file in this stream mode is
21897 binary data. If this binary data contains bytes 16#0A# (@code{LF}) or
21898 16#0C# (@code{FF}), the resulting file may have non-standard
21899 format. Similarly if read operations are used to read from a Text_IO
21900 file treated as a stream, then @code{LF} and @code{FF} characters may be
21901 skipped and the effect is similar to that described above for
21902 @code{Get_Immediate}.
21904 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
21905 @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}
21906 @subsection Text_IO Extensions
21909 @geindex Text_IO extensions
21911 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
21912 to the standard @code{Text_IO} package:
21918 function File_Exists (Name : String) return Boolean;
21919 Determines if a file of the given name exists.
21922 function Get_Line return String;
21923 Reads a string from the standard input file. The value returned is exactly
21924 the length of the line that was read.
21927 function Get_Line (File : Ada.Text_IO.File_Type) return String;
21928 Similar, except that the parameter File specifies the file from which
21929 the string is to be read.
21932 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
21933 @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}
21934 @subsection Text_IO Facilities for Unbounded Strings
21937 @geindex Text_IO for unbounded strings
21939 @geindex Unbounded_String
21940 @geindex Text_IO operations
21942 The package @code{Ada.Strings.Unbounded.Text_IO}
21943 in library files @code{a-suteio.ads/adb} contains some GNAT-specific
21944 subprograms useful for Text_IO operations on unbounded strings:
21950 function Get_Line (File : File_Type) return Unbounded_String;
21951 Reads a line from the specified file
21952 and returns the result as an unbounded string.
21955 procedure Put (File : File_Type; U : Unbounded_String);
21956 Writes the value of the given unbounded string to the specified file
21957 Similar to the effect of
21958 @code{Put (To_String (U))} except that an extra copy is avoided.
21961 procedure Put_Line (File : File_Type; U : Unbounded_String);
21962 Writes the value of the given unbounded string to the specified file,
21963 followed by a @code{New_Line}.
21964 Similar to the effect of @code{Put_Line (To_String (U))} except
21965 that an extra copy is avoided.
21968 In the above procedures, @code{File} is of type @code{Ada.Text_IO.File_Type}
21969 and is optional. If the parameter is omitted, then the standard input or
21970 output file is referenced as appropriate.
21972 The package @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
21973 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
21974 @code{Wide_Text_IO} functionality for unbounded wide strings.
21976 The package @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
21977 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
21978 @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
21980 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
21981 @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}
21982 @section Wide_Text_IO
21985 @code{Wide_Text_IO} is similar in most respects to Text_IO, except that
21986 both input and output files may contain special sequences that represent
21987 wide character values. The encoding scheme for a given file may be
21988 specified using a FORM parameter:
21994 as part of the FORM string (WCEM = wide character encoding method),
21995 where @code{x} is one of the following characters
21998 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx}
22021 Upper half encoding
22058 The encoding methods match those that
22059 can be used in a source
22060 program, but there is no requirement that the encoding method used for
22061 the source program be the same as the encoding method used for files,
22062 and different files may use different encoding methods.
22064 The default encoding method for the standard files, and for opened files
22065 for which no WCEM parameter is given in the FORM string matches the
22066 wide character encoding specified for the main program (the default
22067 being brackets encoding if no coding method was specified with -gnatW).
22072 @item @emph{Hex Coding}
22074 In this encoding, a wide character is represented by a five character
22085 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22086 characters (using upper case letters) of the wide character code. For
22087 example, ESC A345 is used to represent the wide character with code
22088 16#A345#. This scheme is compatible with use of the full
22089 @code{Wide_Character} set.
22095 @item @emph{Upper Half Coding}
22097 The wide character with encoding 16#abcd#, where the upper bit is on
22098 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
22099 16#cd#. The second byte may never be a format control character, but is
22100 not required to be in the upper half. This method can be also used for
22101 shift-JIS or EUC where the internal coding matches the external coding.
22103 @item @emph{Shift JIS Coding}
22105 A wide character is represented by a two character sequence 16#ab# and
22106 16#cd#, with the restrictions described for upper half encoding as
22107 described above. The internal character code is the corresponding JIS
22108 character according to the standard algorithm for Shift-JIS
22109 conversion. Only characters defined in the JIS code set table can be
22110 used with this encoding method.
22112 @item @emph{EUC Coding}
22114 A wide character is represented by a two character sequence 16#ab# and
22115 16#cd#, with both characters being in the upper half. The internal
22116 character code is the corresponding JIS character according to the EUC
22117 encoding algorithm. Only characters defined in the JIS code set table
22118 can be used with this encoding method.
22120 @item @emph{UTF-8 Coding}
22122 A wide character is represented using
22123 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22124 10646-1/Am.2. Depending on the character value, the representation
22125 is a one, two, or three byte sequence:
22129 16#0000#-16#007f#: 2#0xxxxxxx#
22130 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
22131 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22137 where the @code{xxx} bits correspond to the left-padded bits of the
22138 16-bit character value. Note that all lower half ASCII characters
22139 are represented as ASCII bytes and all upper half characters and
22140 other wide characters are represented as sequences of upper-half
22141 (The full UTF-8 scheme allows for encoding 31-bit characters as
22142 6-byte sequences, but in this implementation, all UTF-8 sequences
22143 of four or more bytes length will raise a Constraint_Error, as
22144 will all invalid UTF-8 sequences.)
22150 @item @emph{Brackets Coding}
22152 In this encoding, a wide character is represented by the following eight
22153 character sequence:
22163 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22164 characters (using uppercase letters) of the wide character code. For
22165 example, @code{["A345"]} is used to represent the wide character with code
22167 This scheme is compatible with use of the full Wide_Character set.
22168 On input, brackets coding can also be used for upper half characters,
22169 e.g., @code{["C1"]} for lower case a. However, on output, brackets notation
22170 is only used for wide characters with a code greater than @code{16#FF#}.
22172 Note that brackets coding is not normally used in the context of
22173 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
22174 a portable way of encoding source files. In the context of Wide_Text_IO
22175 or Wide_Wide_Text_IO, it can only be used if the file does not contain
22176 any instance of the left bracket character other than to encode wide
22177 character values using the brackets encoding method. In practice it is
22178 expected that some standard wide character encoding method such
22179 as UTF-8 will be used for text input output.
22181 If brackets notation is used, then any occurrence of a left bracket
22182 in the input file which is not the start of a valid wide character
22183 sequence will cause Constraint_Error to be raised. It is possible to
22184 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
22185 input will interpret this as a left bracket.
22187 However, when a left bracket is output, it will be output as a left bracket
22188 and not as ["5B"]. We make this decision because for normal use of
22189 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
22190 brackets. For example, if we write:
22193 Put_Line ("Start of output [first run]");
22196 we really do not want to have the left bracket in this message clobbered so
22197 that the output reads:
22201 Start of output ["5B"]first run]
22207 In practice brackets encoding is reasonably useful for normal Put_Line use
22208 since we won't get confused between left brackets and wide character
22209 sequences in the output. But for input, or when files are written out
22210 and read back in, it really makes better sense to use one of the standard
22211 encoding methods such as UTF-8.
22214 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
22215 not all wide character
22216 values can be represented. An attempt to output a character that cannot
22217 be represented using the encoding scheme for the file causes
22218 Constraint_Error to be raised. An invalid wide character sequence on
22219 input also causes Constraint_Error to be raised.
22222 * Stream Pointer Positioning: Stream Pointer Positioning<2>.
22223 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>.
22227 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
22228 @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}
22229 @subsection Stream Pointer Positioning
22232 @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22233 of stream pointer positioning (@ref{2a9,,Text_IO}). There is one additional
22236 If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
22237 normal lower ASCII set (i.e., a character in the range:
22240 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
22243 then although the logical position of the file pointer is unchanged by
22244 the @code{Look_Ahead} call, the stream is physically positioned past the
22245 wide character sequence. Again this is to avoid the need for buffering
22246 or backup, and all @code{Wide_Text_IO} routines check the internal
22247 indication that this situation has occurred so that this is not visible
22248 to a normal program using @code{Wide_Text_IO}. However, this discrepancy
22249 can be observed if the wide text file shares a stream with another file.
22251 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
22252 @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}
22253 @subsection Reading and Writing Non-Regular Files
22256 As in the case of Text_IO, when a non-regular file is read, it is
22257 assumed that the file contains no page marks (any form characters are
22258 treated as data characters), and @code{End_Of_Page} always returns
22259 @code{False}. Similarly, the end of file indication is not sticky, so
22260 it is possible to read beyond an end of file.
22262 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
22263 @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}
22264 @section Wide_Wide_Text_IO
22267 @code{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
22268 both input and output files may contain special sequences that represent
22269 wide wide character values. The encoding scheme for a given file may be
22270 specified using a FORM parameter:
22276 as part of the FORM string (WCEM = wide character encoding method),
22277 where @code{x} is one of the following characters
22280 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx}
22303 Upper half encoding
22340 The encoding methods match those that
22341 can be used in a source
22342 program, but there is no requirement that the encoding method used for
22343 the source program be the same as the encoding method used for files,
22344 and different files may use different encoding methods.
22346 The default encoding method for the standard files, and for opened files
22347 for which no WCEM parameter is given in the FORM string matches the
22348 wide character encoding specified for the main program (the default
22349 being brackets encoding if no coding method was specified with -gnatW).
22354 @item @emph{UTF-8 Coding}
22356 A wide character is represented using
22357 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22358 10646-1/Am.2. Depending on the character value, the representation
22359 is a one, two, three, or four byte sequence:
22363 16#000000#-16#00007f#: 2#0xxxxxxx#
22364 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
22365 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22366 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
22372 where the @code{xxx} bits correspond to the left-padded bits of the
22373 21-bit character value. Note that all lower half ASCII characters
22374 are represented as ASCII bytes and all upper half characters and
22375 other wide characters are represented as sequences of upper-half
22382 @item @emph{Brackets Coding}
22384 In this encoding, a wide wide character is represented by the following eight
22385 character sequence if is in wide character range
22395 and by the following ten character sequence if not
22399 [ " a b c d e f " ]
22405 where @code{a}, @code{b}, @code{c}, @code{d}, @code{e}, and @code{f}
22406 are the four or six hexadecimal
22407 characters (using uppercase letters) of the wide wide character code. For
22408 example, @code{["01A345"]} is used to represent the wide wide character
22409 with code @code{16#01A345#}.
22411 This scheme is compatible with use of the full Wide_Wide_Character set.
22412 On input, brackets coding can also be used for upper half characters,
22413 e.g., @code{["C1"]} for lower case a. However, on output, brackets notation
22414 is only used for wide characters with a code greater than @code{16#FF#}.
22417 If is also possible to use the other Wide_Character encoding methods,
22418 such as Shift-JIS, but the other schemes cannot support the full range
22419 of wide wide characters.
22420 An attempt to output a character that cannot
22421 be represented using the encoding scheme for the file causes
22422 Constraint_Error to be raised. An invalid wide character sequence on
22423 input also causes Constraint_Error to be raised.
22426 * Stream Pointer Positioning: Stream Pointer Positioning<3>.
22427 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>.
22431 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
22432 @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}
22433 @subsection Stream Pointer Positioning
22436 @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22437 of stream pointer positioning (@ref{2a9,,Text_IO}). There is one additional
22440 If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
22441 normal lower ASCII set (i.e., a character in the range:
22444 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
22447 then although the logical position of the file pointer is unchanged by
22448 the @code{Look_Ahead} call, the stream is physically positioned past the
22449 wide character sequence. Again this is to avoid the need for buffering
22450 or backup, and all @code{Wide_Wide_Text_IO} routines check the internal
22451 indication that this situation has occurred so that this is not visible
22452 to a normal program using @code{Wide_Wide_Text_IO}. However, this discrepancy
22453 can be observed if the wide text file shares a stream with another file.
22455 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
22456 @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}
22457 @subsection Reading and Writing Non-Regular Files
22460 As in the case of Text_IO, when a non-regular file is read, it is
22461 assumed that the file contains no page marks (any form characters are
22462 treated as data characters), and @code{End_Of_Page} always returns
22463 @code{False}. Similarly, the end of file indication is not sticky, so
22464 it is possible to read beyond an end of file.
22466 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
22467 @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}
22471 A stream file is a sequence of bytes, where individual elements are
22472 written to the file as described in the Ada Reference Manual. The type
22473 @code{Stream_Element} is simply a byte. There are two ways to read or
22474 write a stream file.
22480 The operations @code{Read} and @code{Write} directly read or write a
22481 sequence of stream elements with no control information.
22484 The stream attributes applied to a stream file transfer data in the
22485 manner described for stream attributes.
22488 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
22489 @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}
22490 @section Text Translation
22493 @code{Text_Translation=xxx} may be used as the Form parameter
22494 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
22495 has no effect on Unix systems. Possible values are:
22501 @code{Yes} or @code{Text} is the default, which means to
22502 translate LF to/from CR/LF on Windows systems.
22504 @code{No} disables this translation; i.e. it
22505 uses binary mode. For output files, @code{Text_Translation=No}
22506 may be used to create Unix-style files on
22510 @code{wtext} translation enabled in Unicode mode.
22511 (corresponds to _O_WTEXT).
22514 @code{u8text} translation enabled in Unicode UTF-8 mode.
22515 (corresponds to O_U8TEXT).
22518 @code{u16text} translation enabled in Unicode UTF-16
22519 mode. (corresponds to_O_U16TEXT).
22522 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
22523 @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}
22524 @section Shared Files
22527 Section A.14 of the Ada Reference Manual allows implementations to
22528 provide a wide variety of behavior if an attempt is made to access the
22529 same external file with two or more internal files.
22531 To provide a full range of functionality, while at the same time
22532 minimizing the problems of portability caused by this implementation
22533 dependence, GNAT handles file sharing as follows:
22539 In the absence of a @code{shared=xxx} form parameter, an attempt
22540 to open two or more files with the same full name is considered an error
22541 and is not supported. The exception @code{Use_Error} will be
22542 raised. Note that a file that is not explicitly closed by the program
22543 remains open until the program terminates.
22546 If the form parameter @code{shared=no} appears in the form string, the
22547 file can be opened or created with its own separate stream identifier,
22548 regardless of whether other files sharing the same external file are
22549 opened. The exact effect depends on how the C stream routines handle
22550 multiple accesses to the same external files using separate streams.
22553 If the form parameter @code{shared=yes} appears in the form string for
22554 each of two or more files opened using the same full name, the same
22555 stream is shared between these files, and the semantics are as described
22556 in Ada Reference Manual, Section A.14.
22559 When a program that opens multiple files with the same name is ported
22560 from another Ada compiler to GNAT, the effect will be that
22561 @code{Use_Error} is raised.
22563 The documentation of the original compiler and the documentation of the
22564 program should then be examined to determine if file sharing was
22565 expected, and @code{shared=xxx} parameters added to @code{Open}
22566 and @code{Create} calls as required.
22568 When a program is ported from GNAT to some other Ada compiler, no
22569 special attention is required unless the @code{shared=xxx} form
22570 parameter is used in the program. In this case, you must examine the
22571 documentation of the new compiler to see if it supports the required
22572 file sharing semantics, and form strings modified appropriately. Of
22573 course it may be the case that the program cannot be ported if the
22574 target compiler does not support the required functionality. The best
22575 approach in writing portable code is to avoid file sharing (and hence
22576 the use of the @code{shared=xxx} parameter in the form string)
22579 One common use of file sharing in Ada 83 is the use of instantiations of
22580 Sequential_IO on the same file with different types, to achieve
22581 heterogeneous input-output. Although this approach will work in GNAT if
22582 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
22583 for this purpose (using the stream attributes)
22585 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
22586 @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}
22587 @section Filenames encoding
22590 An encoding form parameter can be used to specify the filename
22591 encoding @code{encoding=xxx}.
22597 If the form parameter @code{encoding=utf8} appears in the form string, the
22598 filename must be encoded in UTF-8.
22601 If the form parameter @code{encoding=8bits} appears in the form
22602 string, the filename must be a standard 8bits string.
22605 In the absence of a @code{encoding=xxx} form parameter, the
22606 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
22607 variable. And if not set @code{utf8} is assumed.
22612 @item @emph{CP_ACP}
22614 The current system Windows ANSI code page.
22616 @item @emph{CP_UTF8}
22621 This encoding form parameter is only supported on the Windows
22622 platform. On the other Operating Systems the run-time is supporting
22625 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
22626 @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}
22627 @section File content encoding
22630 For text files it is possible to specify the encoding to use. This is
22631 controlled by the by the @code{GNAT_CCS_ENCODING} environment
22632 variable. And if not set @code{TEXT} is assumed.
22634 The possible values are those supported on Windows:
22641 Translated text mode
22645 Translated unicode encoding
22647 @item @emph{U16TEXT}
22649 Unicode 16-bit encoding
22651 @item @emph{U8TEXT}
22653 Unicode 8-bit encoding
22656 This encoding is only supported on the Windows platform.
22658 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
22659 @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}
22660 @section Open Modes
22663 @code{Open} and @code{Create} calls result in a call to @code{fopen}
22664 using the mode shown in the following table:
22667 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx}
22670 @code{Open} and @code{Create} Call Modes
22712 Out_File (Direct_IO)
22724 Out_File (all other cases)
22749 If text file translation is required, then either @code{b} or @code{t}
22750 is added to the mode, depending on the setting of Text. Text file
22751 translation refers to the mapping of CR/LF sequences in an external file
22752 to LF characters internally. This mapping only occurs in DOS and
22753 DOS-like systems, and is not relevant to other systems.
22755 A special case occurs with Stream_IO. As shown in the above table, the
22756 file is initially opened in @code{r} or @code{w} mode for the
22757 @code{In_File} and @code{Out_File} cases. If a @code{Set_Mode} operation
22758 subsequently requires switching from reading to writing or vice-versa,
22759 then the file is reopened in @code{r+} mode to permit the required operation.
22761 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22762 @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}
22763 @section Operations on C Streams
22766 The package @code{Interfaces.C_Streams} provides an Ada program with direct
22767 access to the C library functions for operations on C streams:
22770 package Interfaces.C_Streams is
22771 -- Note: the reason we do not use the types that are in
22772 -- Interfaces.C is that we want to avoid dragging in the
22773 -- code in this unit if possible.
22774 subtype chars is System.Address;
22775 -- Pointer to null-terminated array of characters
22776 subtype FILEs is System.Address;
22777 -- Corresponds to the C type FILE*
22778 subtype voids is System.Address;
22779 -- Corresponds to the C type void*
22780 subtype int is Integer;
22781 subtype long is Long_Integer;
22782 -- Note: the above types are subtypes deliberately, and it
22783 -- is part of this spec that the above correspondences are
22784 -- guaranteed. This means that it is legitimate to, for
22785 -- example, use Integer instead of int. We provide these
22786 -- synonyms for clarity, but in some cases it may be
22787 -- convenient to use the underlying types (for example to
22788 -- avoid an unnecessary dependency of a spec on the spec
22790 type size_t is mod 2 ** Standard'Address_Size;
22791 NULL_Stream : constant FILEs;
22792 -- Value returned (NULL in C) to indicate an
22793 -- fdopen/fopen/tmpfile error
22794 ----------------------------------
22795 -- Constants Defined in stdio.h --
22796 ----------------------------------
22797 EOF : constant int;
22798 -- Used by a number of routines to indicate error or
22800 IOFBF : constant int;
22801 IOLBF : constant int;
22802 IONBF : constant int;
22803 -- Used to indicate buffering mode for setvbuf call
22804 SEEK_CUR : constant int;
22805 SEEK_END : constant int;
22806 SEEK_SET : constant int;
22807 -- Used to indicate origin for fseek call
22808 function stdin return FILEs;
22809 function stdout return FILEs;
22810 function stderr return FILEs;
22811 -- Streams associated with standard files
22812 --------------------------
22813 -- Standard C functions --
22814 --------------------------
22815 -- The functions selected below are ones that are
22816 -- available in UNIX (but not necessarily in ANSI C).
22817 -- These are very thin interfaces
22818 -- which copy exactly the C headers. For more
22819 -- documentation on these functions, see the Microsoft C
22820 -- "Run-Time Library Reference" (Microsoft Press, 1990,
22821 -- ISBN 1-55615-225-6), which includes useful information
22822 -- on system compatibility.
22823 procedure clearerr (stream : FILEs);
22824 function fclose (stream : FILEs) return int;
22825 function fdopen (handle : int; mode : chars) return FILEs;
22826 function feof (stream : FILEs) return int;
22827 function ferror (stream : FILEs) return int;
22828 function fflush (stream : FILEs) return int;
22829 function fgetc (stream : FILEs) return int;
22830 function fgets (strng : chars; n : int; stream : FILEs)
22832 function fileno (stream : FILEs) return int;
22833 function fopen (filename : chars; Mode : chars)
22835 -- Note: to maintain target independence, use
22836 -- text_translation_required, a boolean variable defined in
22837 -- a-sysdep.c to deal with the target dependent text
22838 -- translation requirement. If this variable is set,
22839 -- then b/t should be appended to the standard mode
22840 -- argument to set the text translation mode off or on
22842 function fputc (C : int; stream : FILEs) return int;
22843 function fputs (Strng : chars; Stream : FILEs) return int;
22860 function ftell (stream : FILEs) return long;
22867 function isatty (handle : int) return int;
22868 procedure mktemp (template : chars);
22869 -- The return value (which is just a pointer to template)
22871 procedure rewind (stream : FILEs);
22872 function rmtmp return int;
22880 function tmpfile return FILEs;
22881 function ungetc (c : int; stream : FILEs) return int;
22882 function unlink (filename : chars) return int;
22883 ---------------------
22884 -- Extra functions --
22885 ---------------------
22886 -- These functions supply slightly thicker bindings than
22887 -- those above. They are derived from functions in the
22888 -- C Run-Time Library, but may do a bit more work than
22889 -- just directly calling one of the Library functions.
22890 function is_regular_file (handle : int) return int;
22891 -- Tests if given handle is for a regular file (result 1)
22892 -- or for a non-regular file (pipe or device, result 0).
22893 ---------------------------------
22894 -- Control of Text/Binary Mode --
22895 ---------------------------------
22896 -- If text_translation_required is true, then the following
22897 -- functions may be used to dynamically switch a file from
22898 -- binary to text mode or vice versa. These functions have
22899 -- no effect if text_translation_required is false (i.e., in
22900 -- normal UNIX mode). Use fileno to get a stream handle.
22901 procedure set_binary_mode (handle : int);
22902 procedure set_text_mode (handle : int);
22903 ----------------------------
22904 -- Full Path Name support --
22905 ----------------------------
22906 procedure full_name (nam : chars; buffer : chars);
22907 -- Given a NUL terminated string representing a file
22908 -- name, returns in buffer a NUL terminated string
22909 -- representing the full path name for the file name.
22910 -- On systems where it is relevant the drive is also
22911 -- part of the full path name. It is the responsibility
22912 -- of the caller to pass an actual parameter for buffer
22913 -- that is big enough for any full path name. Use
22914 -- max_path_len given below as the size of buffer.
22915 max_path_len : integer;
22916 -- Maximum length of an allowable full path name on the
22917 -- system, including a terminating NUL character.
22918 end Interfaces.C_Streams;
22921 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
22922 @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}
22923 @section Interfacing to C Streams
22926 The packages in this section permit interfacing Ada files to C Stream
22930 with Interfaces.C_Streams;
22931 package Ada.Sequential_IO.C_Streams is
22932 function C_Stream (F : File_Type)
22933 return Interfaces.C_Streams.FILEs;
22935 (File : in out File_Type;
22936 Mode : in File_Mode;
22937 C_Stream : in Interfaces.C_Streams.FILEs;
22938 Form : in String := "");
22939 end Ada.Sequential_IO.C_Streams;
22941 with Interfaces.C_Streams;
22942 package Ada.Direct_IO.C_Streams is
22943 function C_Stream (F : File_Type)
22944 return Interfaces.C_Streams.FILEs;
22946 (File : in out File_Type;
22947 Mode : in File_Mode;
22948 C_Stream : in Interfaces.C_Streams.FILEs;
22949 Form : in String := "");
22950 end Ada.Direct_IO.C_Streams;
22952 with Interfaces.C_Streams;
22953 package Ada.Text_IO.C_Streams is
22954 function C_Stream (F : File_Type)
22955 return Interfaces.C_Streams.FILEs;
22957 (File : in out File_Type;
22958 Mode : in File_Mode;
22959 C_Stream : in Interfaces.C_Streams.FILEs;
22960 Form : in String := "");
22961 end Ada.Text_IO.C_Streams;
22963 with Interfaces.C_Streams;
22964 package Ada.Wide_Text_IO.C_Streams is
22965 function C_Stream (F : File_Type)
22966 return Interfaces.C_Streams.FILEs;
22968 (File : in out File_Type;
22969 Mode : in File_Mode;
22970 C_Stream : in Interfaces.C_Streams.FILEs;
22971 Form : in String := "");
22972 end Ada.Wide_Text_IO.C_Streams;
22974 with Interfaces.C_Streams;
22975 package Ada.Wide_Wide_Text_IO.C_Streams is
22976 function C_Stream (F : File_Type)
22977 return Interfaces.C_Streams.FILEs;
22979 (File : in out File_Type;
22980 Mode : in File_Mode;
22981 C_Stream : in Interfaces.C_Streams.FILEs;
22982 Form : in String := "");
22983 end Ada.Wide_Wide_Text_IO.C_Streams;
22985 with Interfaces.C_Streams;
22986 package Ada.Stream_IO.C_Streams is
22987 function C_Stream (F : File_Type)
22988 return Interfaces.C_Streams.FILEs;
22990 (File : in out File_Type;
22991 Mode : in File_Mode;
22992 C_Stream : in Interfaces.C_Streams.FILEs;
22993 Form : in String := "");
22994 end Ada.Stream_IO.C_Streams;
22997 In each of these six packages, the @code{C_Stream} function obtains the
22998 @code{FILE} pointer from a currently opened Ada file. It is then
22999 possible to use the @code{Interfaces.C_Streams} package to operate on
23000 this stream, or the stream can be passed to a C program which can
23001 operate on it directly. Of course the program is responsible for
23002 ensuring that only appropriate sequences of operations are executed.
23004 One particular use of relevance to an Ada program is that the
23005 @code{setvbuf} function can be used to control the buffering of the
23006 stream used by an Ada file. In the absence of such a call the standard
23007 default buffering is used.
23009 The @code{Open} procedures in these packages open a file giving an
23010 existing C Stream instead of a file name. Typically this stream is
23011 imported from a C program, allowing an Ada file to operate on an
23014 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
23015 @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}
23016 @chapter The GNAT Library
23019 The GNAT library contains a number of general and special purpose packages.
23020 It represents functionality that the GNAT developers have found useful, and
23021 which is made available to GNAT users. The packages described here are fully
23022 supported, and upwards compatibility will be maintained in future releases,
23023 so you can use these facilities with the confidence that the same functionality
23024 will be available in future releases.
23026 The chapter here simply gives a brief summary of the facilities available.
23027 The full documentation is found in the spec file for the package. The full
23028 sources of these library packages, including both spec and body, are provided
23029 with all GNAT releases. For example, to find out the full specifications of
23030 the SPITBOL pattern matching capability, including a full tutorial and
23031 extensive examples, look in the @code{g-spipat.ads} file in the library.
23033 For each entry here, the package name (as it would appear in a @code{with}
23034 clause) is given, followed by the name of the corresponding spec file in
23035 parentheses. The packages are children in four hierarchies, @code{Ada},
23036 @code{Interfaces}, @code{System}, and @code{GNAT}, the latter being a
23037 GNAT-specific hierarchy.
23039 Note that an application program should only use packages in one of these
23040 four hierarchies if the package is defined in the Ada Reference Manual,
23041 or is listed in this section of the GNAT Programmers Reference Manual.
23042 All other units should be considered internal implementation units and
23043 should not be directly @code{with}ed by application code. The use of
23044 a @code{with} clause that references one of these internal implementation
23045 units makes an application potentially dependent on changes in versions
23046 of GNAT, and will generate a warning message.
23049 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads.
23050 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads.
23051 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads.
23052 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads.
23053 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads.
23054 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads.
23055 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads.
23056 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads.
23057 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads.
23058 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads.
23059 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads.
23060 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads.
23061 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads.
23062 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads.
23063 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads.
23064 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads.
23065 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads.
23066 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads.
23067 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads.
23068 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads.
23069 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads.
23070 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads.
23071 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads.
23072 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads.
23073 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads.
23074 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
23075 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
23076 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
23077 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
23078 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
23079 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
23080 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads.
23081 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads.
23082 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads.
23083 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads.
23084 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads.
23085 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads.
23086 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads.
23087 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads.
23088 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads.
23089 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads.
23090 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads.
23091 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads.
23092 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads.
23093 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads.
23094 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads.
23095 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads.
23096 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads.
23097 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads.
23098 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads.
23099 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads.
23100 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads.
23101 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads.
23102 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads.
23103 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads.
23104 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads.
23105 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads.
23106 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads.
23107 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads.
23108 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads.
23109 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads.
23110 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads.
23111 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads.
23112 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads.
23113 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads.
23114 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads.
23115 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads.
23116 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads.
23117 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads.
23118 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads.
23119 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads.
23120 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads.
23121 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads.
23122 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads.
23123 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads.
23124 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads.
23125 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads.
23126 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads.
23127 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads.
23128 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads.
23129 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads.
23130 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads.
23131 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads.
23132 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads.
23133 * GNAT.IO (g-io.ads): GNAT IO g-io ads.
23134 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads.
23135 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads.
23136 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads.
23137 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads.
23138 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads.
23139 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads.
23140 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads.
23141 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads.
23142 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads.
23143 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads.
23144 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads.
23145 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads.
23146 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads.
23147 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads.
23148 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads.
23149 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads.
23150 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads.
23151 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads.
23152 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads.
23153 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads.
23154 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads.
23155 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads.
23156 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads.
23157 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads.
23158 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads.
23159 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads.
23160 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads.
23161 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads.
23162 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads.
23163 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads.
23164 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads.
23165 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads.
23166 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads.
23167 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads.
23168 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads.
23169 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads.
23170 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads.
23171 * GNAT.Table (g-table.ads): GNAT Table g-table ads.
23172 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads.
23173 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads.
23174 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads.
23175 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads.
23176 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads.
23177 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads.
23178 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads.
23179 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads.
23180 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads.
23181 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads.
23182 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads.
23183 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads.
23184 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads.
23185 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads.
23186 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads.
23187 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads.
23188 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads.
23189 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads.
23190 * System.Assertions (s-assert.ads): System Assertions s-assert ads.
23191 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads.
23192 * System.Memory (s-memory.ads): System Memory s-memory ads.
23193 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads.
23194 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads.
23195 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads.
23196 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads.
23197 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads.
23198 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads.
23199 * System.Rident (s-rident.ads): System Rident s-rident ads.
23200 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads.
23201 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads.
23202 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads.
23203 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads.
23207 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
23208 @anchor{gnat_rm/the_gnat_library id2}@anchor{2d4}@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2d5}
23209 @section @code{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
23212 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
23214 @geindex Latin_9 constants for Character
23216 This child of @code{Ada.Characters}
23217 provides a set of definitions corresponding to those in the
23218 RM-defined package @code{Ada.Characters.Latin_1} but with the
23219 few modifications required for @code{Latin-9}
23220 The provision of such a package
23221 is specifically authorized by the Ada Reference Manual
23224 @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
23225 @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}
23226 @section @code{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
23229 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
23231 @geindex Latin_1 constants for Wide_Character
23233 This child of @code{Ada.Characters}
23234 provides a set of definitions corresponding to those in the
23235 RM-defined package @code{Ada.Characters.Latin_1} but with the
23236 types of the constants being @code{Wide_Character}
23237 instead of @code{Character}. The provision of such a package
23238 is specifically authorized by the Ada Reference Manual
23241 @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
23242 @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}
23243 @section @code{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
23246 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
23248 @geindex Latin_9 constants for Wide_Character
23250 This child of @code{Ada.Characters}
23251 provides a set of definitions corresponding to those in the
23252 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23253 types of the constants being @code{Wide_Character}
23254 instead of @code{Character}. The provision of such a package
23255 is specifically authorized by the Ada Reference Manual
23258 @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
23259 @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}
23260 @section @code{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
23263 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
23265 @geindex Latin_1 constants for Wide_Wide_Character
23267 This child of @code{Ada.Characters}
23268 provides a set of definitions corresponding to those in the
23269 RM-defined package @code{Ada.Characters.Latin_1} but with the
23270 types of the constants being @code{Wide_Wide_Character}
23271 instead of @code{Character}. The provision of such a package
23272 is specifically authorized by the Ada Reference Manual
23275 @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
23276 @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}
23277 @section @code{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
23280 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
23282 @geindex Latin_9 constants for Wide_Wide_Character
23284 This child of @code{Ada.Characters}
23285 provides a set of definitions corresponding to those in the
23286 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23287 types of the constants being @code{Wide_Wide_Character}
23288 instead of @code{Character}. The provision of such a package
23289 is specifically authorized by the Ada Reference Manual
23292 @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
23293 @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}
23294 @section @code{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
23297 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
23299 @geindex Formal container for doubly linked lists
23301 This child of @code{Ada.Containers} defines a modified version of the
23302 Ada 2005 container for doubly linked lists, meant to facilitate formal
23303 verification of code using such containers. The specification of this
23304 unit is compatible with SPARK 2014.
23306 Note that although this container was designed with formal verification
23307 in mind, it may well be generally useful in that it is a simplified more
23308 efficient version than the one defined in the standard. In particular it
23309 does not have the complex overhead required to detect cursor tampering.
23311 @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
23312 @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}
23313 @section @code{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
23316 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
23318 @geindex Formal container for hashed maps
23320 This child of @code{Ada.Containers} defines a modified version of the
23321 Ada 2005 container for hashed maps, meant to facilitate formal
23322 verification of code using such containers. The specification of this
23323 unit is compatible with SPARK 2014.
23325 Note that although this container was designed with formal verification
23326 in mind, it may well be generally useful in that it is a simplified more
23327 efficient version than the one defined in the standard. In particular it
23328 does not have the complex overhead required to detect cursor tampering.
23330 @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
23331 @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}
23332 @section @code{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
23335 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
23337 @geindex Formal container for hashed sets
23339 This child of @code{Ada.Containers} defines a modified version of the
23340 Ada 2005 container for hashed sets, meant to facilitate formal
23341 verification of code using such containers. The specification of this
23342 unit is compatible with SPARK 2014.
23344 Note that although this container was designed with formal verification
23345 in mind, it may well be generally useful in that it is a simplified more
23346 efficient version than the one defined in the standard. In particular it
23347 does not have the complex overhead required to detect cursor tampering.
23349 @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
23350 @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}
23351 @section @code{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
23354 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
23356 @geindex Formal container for ordered maps
23358 This child of @code{Ada.Containers} defines a modified version of the
23359 Ada 2005 container for ordered maps, meant to facilitate formal
23360 verification of code using such containers. The specification of this
23361 unit is compatible with SPARK 2014.
23363 Note that although this container was designed with formal verification
23364 in mind, it may well be generally useful in that it is a simplified more
23365 efficient version than the one defined in the standard. In particular it
23366 does not have the complex overhead required to detect cursor tampering.
23368 @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
23369 @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}
23370 @section @code{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
23373 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
23375 @geindex Formal container for ordered sets
23377 This child of @code{Ada.Containers} defines a modified version of the
23378 Ada 2005 container for ordered sets, meant to facilitate formal
23379 verification of code using such containers. The specification of this
23380 unit is compatible with SPARK 2014.
23382 Note that although this container was designed with formal verification
23383 in mind, it may well be generally useful in that it is a simplified more
23384 efficient version than the one defined in the standard. In particular it
23385 does not have the complex overhead required to detect cursor tampering.
23387 @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
23388 @anchor{gnat_rm/the_gnat_library id12}@anchor{2e8}@anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{2e9}
23389 @section @code{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
23392 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
23394 @geindex Formal container for vectors
23396 This child of @code{Ada.Containers} defines a modified version of the
23397 Ada 2005 container for vectors, meant to facilitate formal
23398 verification of code using such containers. The specification of this
23399 unit is compatible with SPARK 2014.
23401 Note that although this container was designed with formal verification
23402 in mind, it may well be generally useful in that it is a simplified more
23403 efficient version than the one defined in the standard. In particular it
23404 does not have the complex overhead required to detect cursor tampering.
23406 @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
23407 @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}
23408 @section @code{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
23411 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
23413 @geindex Formal container for vectors
23415 This child of @code{Ada.Containers} defines a modified version of the
23416 Ada 2005 container for vectors of indefinite elements, meant to
23417 facilitate formal verification of code using such containers. The
23418 specification of this unit is compatible with SPARK 2014.
23420 Note that although this container was designed with formal verification
23421 in mind, it may well be generally useful in that it is a simplified more
23422 efficient version than the one defined in the standard. In particular it
23423 does not have the complex overhead required to detect cursor tampering.
23425 @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
23426 @anchor{gnat_rm/the_gnat_library id14}@anchor{2ec}@anchor{gnat_rm/the_gnat_library ada-containers-functional-vectors-a-cofuve-ads}@anchor{2ed}
23427 @section @code{Ada.Containers.Functional_Vectors} (@code{a-cofuve.ads})
23430 @geindex Ada.Containers.Functional_Vectors (a-cofuve.ads)
23432 @geindex Functional vectors
23434 This child of @code{Ada.Containers} defines immutable vectors. These
23435 containers are unbounded and may contain indefinite elements. Furthermore, to
23436 be usable in every context, they are neither controlled nor limited. As they
23437 are functional, that is, no primitives are provided which would allow modifying
23438 an existing container, these containers can still be used safely.
23440 Their API features functions creating new containers from existing ones.
23441 As a consequence, these containers are highly inefficient. They are also
23442 memory consuming, as the allocated memory is not reclaimed when the container
23443 is no longer referenced. Thus, they should in general be used in ghost code
23444 and annotations, so that they can be removed from the final executable. The
23445 specification of this unit is compatible with SPARK 2014.
23447 @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
23448 @anchor{gnat_rm/the_gnat_library ada-containers-functional-sets-a-cofuse-ads}@anchor{2ee}@anchor{gnat_rm/the_gnat_library id15}@anchor{2ef}
23449 @section @code{Ada.Containers.Functional_Sets} (@code{a-cofuse.ads})
23452 @geindex Ada.Containers.Functional_Sets (a-cofuse.ads)
23454 @geindex Functional sets
23456 This child of @code{Ada.Containers} defines immutable sets. These containers are
23457 unbounded and may contain indefinite elements. Furthermore, to be usable in
23458 every context, they are neither controlled nor limited. As they are functional,
23459 that is, no primitives are provided which would allow modifying an existing
23460 container, these containers can still be used safely.
23462 Their API features functions creating new containers from existing ones.
23463 As a consequence, these containers are highly inefficient. They are also
23464 memory consuming, as the allocated memory is not reclaimed when the container
23465 is no longer referenced. Thus, they should in general be used in ghost code
23466 and annotations, so that they can be removed from the final executable. The
23467 specification of this unit is compatible with SPARK 2014.
23469 @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
23470 @anchor{gnat_rm/the_gnat_library id16}@anchor{2f0}@anchor{gnat_rm/the_gnat_library ada-containers-functional-maps-a-cofuma-ads}@anchor{2f1}
23471 @section @code{Ada.Containers.Functional_Maps} (@code{a-cofuma.ads})
23474 @geindex Ada.Containers.Functional_Maps (a-cofuma.ads)
23476 @geindex Functional maps
23478 This child of @code{Ada.Containers} defines immutable maps. These containers are
23479 unbounded and may contain indefinite elements. Furthermore, to be usable in
23480 every context, they are neither controlled nor limited. As they are functional,
23481 that is, no primitives are provided which would allow modifying an existing
23482 container, these containers can still be used safely.
23484 Their API features functions creating new containers from existing ones.
23485 As a consequence, these containers are highly inefficient. They are also
23486 memory consuming, as the allocated memory is not reclaimed when the container
23487 is no longer referenced. Thus, they should in general be used in ghost code
23488 and annotations, so that they can be removed from the final executable. The
23489 specification of this unit is compatible with SPARK 2014.
23491 @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
23492 @anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2f2}@anchor{gnat_rm/the_gnat_library id17}@anchor{2f3}
23493 @section @code{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
23496 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
23498 @geindex Formal container for vectors
23500 This child of @code{Ada.Containers} defines a modified version of
23501 Indefinite_Holders that avoids heap allocation.
23503 @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
23504 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2f4}@anchor{gnat_rm/the_gnat_library id18}@anchor{2f5}
23505 @section @code{Ada.Command_Line.Environment} (@code{a-colien.ads})
23508 @geindex Ada.Command_Line.Environment (a-colien.ads)
23510 @geindex Environment entries
23512 This child of @code{Ada.Command_Line}
23513 provides a mechanism for obtaining environment values on systems
23514 where this concept makes sense.
23516 @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
23517 @anchor{gnat_rm/the_gnat_library id19}@anchor{2f6}@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2f7}
23518 @section @code{Ada.Command_Line.Remove} (@code{a-colire.ads})
23521 @geindex Ada.Command_Line.Remove (a-colire.ads)
23523 @geindex Removing command line arguments
23525 @geindex Command line
23526 @geindex argument removal
23528 This child of @code{Ada.Command_Line}
23529 provides a mechanism for logically removing
23530 arguments from the argument list. Once removed, an argument is not visible
23531 to further calls on the subprograms in @code{Ada.Command_Line} will not
23532 see the removed argument.
23534 @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
23535 @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}
23536 @section @code{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
23539 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
23541 @geindex Response file for command line
23543 @geindex Command line
23544 @geindex response file
23546 @geindex Command line
23547 @geindex handling long command lines
23549 This child of @code{Ada.Command_Line} provides a mechanism facilities for
23550 getting command line arguments from a text file, called a "response file".
23551 Using a response file allow passing a set of arguments to an executable longer
23552 than the maximum allowed by the system on the command line.
23554 @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
23555 @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}
23556 @section @code{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
23559 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
23562 @geindex Interfacing with Direct_IO
23564 This package provides subprograms that allow interfacing between
23565 C streams and @code{Direct_IO}. The stream identifier can be
23566 extracted from a file opened on the Ada side, and an Ada file
23567 can be constructed from a stream opened on the C side.
23569 @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
23570 @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}
23571 @section @code{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
23574 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
23576 @geindex Null_Occurrence
23577 @geindex testing for
23579 This child subprogram provides a way of testing for the null
23580 exception occurrence (@code{Null_Occurrence}) without raising
23583 @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
23584 @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}
23585 @section @code{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
23588 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
23590 @geindex Null_Occurrence
23591 @geindex testing for
23593 This child subprogram is used for handling otherwise unhandled
23594 exceptions (hence the name last chance), and perform clean ups before
23595 terminating the program. Note that this subprogram never returns.
23597 @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
23598 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{300}@anchor{gnat_rm/the_gnat_library id24}@anchor{301}
23599 @section @code{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
23602 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
23604 @geindex Traceback for Exception Occurrence
23606 This child package provides the subprogram (@code{Tracebacks}) to
23607 give a traceback array of addresses based on an exception
23610 @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
23611 @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}
23612 @section @code{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
23615 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
23618 @geindex Interfacing with Sequential_IO
23620 This package provides subprograms that allow interfacing between
23621 C streams and @code{Sequential_IO}. The stream identifier can be
23622 extracted from a file opened on the Ada side, and an Ada file
23623 can be constructed from a stream opened on the C side.
23625 @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
23626 @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}
23627 @section @code{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
23630 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
23633 @geindex Interfacing with Stream_IO
23635 This package provides subprograms that allow interfacing between
23636 C streams and @code{Stream_IO}. The stream identifier can be
23637 extracted from a file opened on the Ada side, and an Ada file
23638 can be constructed from a stream opened on the C side.
23640 @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
23641 @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}
23642 @section @code{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
23645 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
23647 @geindex Unbounded_String
23648 @geindex IO support
23651 @geindex extensions for unbounded strings
23653 This package provides subprograms for Text_IO for unbounded
23654 strings, avoiding the necessity for an intermediate operation
23655 with ordinary strings.
23657 @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
23658 @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}
23659 @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
23662 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
23664 @geindex Unbounded_Wide_String
23665 @geindex IO support
23668 @geindex extensions for unbounded wide strings
23670 This package provides subprograms for Text_IO for unbounded
23671 wide strings, avoiding the necessity for an intermediate operation
23672 with ordinary wide strings.
23674 @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
23675 @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}
23676 @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
23679 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
23681 @geindex Unbounded_Wide_Wide_String
23682 @geindex IO support
23685 @geindex extensions for unbounded wide wide strings
23687 This package provides subprograms for Text_IO for unbounded
23688 wide wide strings, avoiding the necessity for an intermediate operation
23689 with ordinary wide wide strings.
23691 @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
23692 @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}
23693 @section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
23696 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
23699 @geindex Interfacing with `@w{`}Text_IO`@w{`}
23701 This package provides subprograms that allow interfacing between
23702 C streams and @code{Text_IO}. The stream identifier can be
23703 extracted from a file opened on the Ada side, and an Ada file
23704 can be constructed from a stream opened on the C side.
23706 @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
23707 @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}
23708 @section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
23711 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
23713 @geindex Text_IO resetting standard files
23715 This procedure is used to reset the status of the standard files used
23716 by Ada.Text_IO. This is useful in a situation (such as a restart in an
23717 embedded application) where the status of the files may change during
23718 execution (for example a standard input file may be redefined to be
23721 @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
23722 @anchor{gnat_rm/the_gnat_library id32}@anchor{310}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{311}
23723 @section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
23726 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
23728 @geindex Unicode categorization
23729 @geindex Wide_Character
23731 This package provides subprograms that allow categorization of
23732 Wide_Character values according to Unicode categories.
23734 @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
23735 @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}
23736 @section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
23739 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
23742 @geindex Interfacing with `@w{`}Wide_Text_IO`@w{`}
23744 This package provides subprograms that allow interfacing between
23745 C streams and @code{Wide_Text_IO}. The stream identifier can be
23746 extracted from a file opened on the Ada side, and an Ada file
23747 can be constructed from a stream opened on the C side.
23749 @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
23750 @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}
23751 @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
23754 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
23756 @geindex Wide_Text_IO resetting standard files
23758 This procedure is used to reset the status of the standard files used
23759 by Ada.Wide_Text_IO. This is useful in a situation (such as a restart in an
23760 embedded application) where the status of the files may change during
23761 execution (for example a standard input file may be redefined to be
23764 @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
23765 @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}
23766 @section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
23769 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
23771 @geindex Unicode categorization
23772 @geindex Wide_Wide_Character
23774 This package provides subprograms that allow categorization of
23775 Wide_Wide_Character values according to Unicode categories.
23777 @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
23778 @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}
23779 @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
23782 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
23785 @geindex Interfacing with `@w{`}Wide_Wide_Text_IO`@w{`}
23787 This package provides subprograms that allow interfacing between
23788 C streams and @code{Wide_Wide_Text_IO}. The stream identifier can be
23789 extracted from a file opened on the Ada side, and an Ada file
23790 can be constructed from a stream opened on the C side.
23792 @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
23793 @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}
23794 @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23797 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23799 @geindex Wide_Wide_Text_IO resetting standard files
23801 This procedure is used to reset the status of the standard files used
23802 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23803 restart in an embedded application) where the status of the files may
23804 change during execution (for example a standard input file may be
23805 redefined to be interactive).
23807 @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
23808 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{31c}@anchor{gnat_rm/the_gnat_library id38}@anchor{31d}
23809 @section @code{GNAT.Altivec} (@code{g-altive.ads})
23812 @geindex GNAT.Altivec (g-altive.ads)
23816 This is the root package of the GNAT AltiVec binding. It provides
23817 definitions of constants and types common to all the versions of the
23820 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23821 @anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{31e}@anchor{gnat_rm/the_gnat_library id39}@anchor{31f}
23822 @section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23825 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23829 This package provides the Vector/View conversion routines.
23831 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23832 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{320}@anchor{gnat_rm/the_gnat_library id40}@anchor{321}
23833 @section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23836 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23840 This package exposes the Ada interface to the AltiVec operations on
23841 vector objects. A soft emulation is included by default in the GNAT
23842 library. The hard binding is provided as a separate package. This unit
23843 is common to both bindings.
23845 @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
23846 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{322}@anchor{gnat_rm/the_gnat_library id41}@anchor{323}
23847 @section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23850 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23854 This package exposes the various vector types part of the Ada binding
23855 to AltiVec facilities.
23857 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23858 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{324}@anchor{gnat_rm/the_gnat_library id42}@anchor{325}
23859 @section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23862 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23866 This package provides public 'View' data types from/to which private
23867 vector representations can be converted via
23868 GNAT.Altivec.Conversions. This allows convenient access to individual
23869 vector elements and provides a simple way to initialize vector
23872 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23873 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{326}@anchor{gnat_rm/the_gnat_library id43}@anchor{327}
23874 @section @code{GNAT.Array_Split} (@code{g-arrspl.ads})
23877 @geindex GNAT.Array_Split (g-arrspl.ads)
23879 @geindex Array splitter
23881 Useful array-manipulation routines: given a set of separators, split
23882 an array wherever the separators appear, and provide direct access
23883 to the resulting slices.
23885 @node GNAT AWK g-awk ads,GNAT Bind_Environment g-binenv ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23886 @anchor{gnat_rm/the_gnat_library id44}@anchor{328}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{329}
23887 @section @code{GNAT.AWK} (@code{g-awk.ads})
23890 @geindex GNAT.AWK (g-awk.ads)
23896 Provides AWK-like parsing functions, with an easy interface for parsing one
23897 or more files containing formatted data. The file is viewed as a database
23898 where each record is a line and a field is a data element in this line.
23900 @node GNAT Bind_Environment g-binenv ads,GNAT Branch_Prediction g-brapre ads,GNAT AWK g-awk ads,The GNAT Library
23901 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{32a}@anchor{gnat_rm/the_gnat_library id45}@anchor{32b}
23902 @section @code{GNAT.Bind_Environment} (@code{g-binenv.ads})
23905 @geindex GNAT.Bind_Environment (g-binenv.ads)
23907 @geindex Bind environment
23909 Provides access to key=value associations captured at bind time.
23910 These associations can be specified using the @code{-V} binder command
23913 @node GNAT Branch_Prediction g-brapre ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
23914 @anchor{gnat_rm/the_gnat_library id46}@anchor{32c}@anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{32d}
23915 @section @code{GNAT.Branch_Prediction} (@code{g-brapre.ads})
23918 @geindex GNAT.Branch_Prediction (g-brapre.ads)
23920 @geindex Branch Prediction
23922 Provides routines giving hints to the branch predictor of the code generator.
23924 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Branch_Prediction g-brapre ads,The GNAT Library
23925 @anchor{gnat_rm/the_gnat_library id47}@anchor{32e}@anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{32f}
23926 @section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
23929 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
23933 @geindex Bounded Buffers
23935 Provides a concurrent generic bounded buffer abstraction. Instances are
23936 useful directly or as parts of the implementations of other abstractions,
23939 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
23940 @anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{330}@anchor{gnat_rm/the_gnat_library id48}@anchor{331}
23941 @section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
23944 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
23950 Provides a thread-safe asynchronous intertask mailbox communication facility.
23952 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
23953 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{332}@anchor{gnat_rm/the_gnat_library id49}@anchor{333}
23954 @section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
23957 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
23961 @geindex Bubble sort
23963 Provides a general implementation of bubble sort usable for sorting arbitrary
23964 data items. Exchange and comparison procedures are provided by passing
23965 access-to-procedure values.
23967 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
23968 @anchor{gnat_rm/the_gnat_library id50}@anchor{334}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{335}
23969 @section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
23972 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
23976 @geindex Bubble sort
23978 Provides a general implementation of bubble sort usable for sorting arbitrary
23979 data items. Move and comparison procedures are provided by passing
23980 access-to-procedure values. This is an older version, retained for
23981 compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
23983 @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
23984 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{336}@anchor{gnat_rm/the_gnat_library id51}@anchor{337}
23985 @section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
23988 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
23992 @geindex Bubble sort
23994 Similar to @code{Bubble_Sort_A} except that the move and sorting procedures
23995 are provided as generic parameters, this improves efficiency, especially
23996 if the procedures can be inlined, at the expense of duplicating code for
23997 multiple instantiations.
23999 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
24000 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{338}@anchor{gnat_rm/the_gnat_library id52}@anchor{339}
24001 @section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
24004 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
24006 @geindex UTF-8 representation
24008 @geindex Wide characte representations
24010 Provides a routine which given a string, reads the start of the string to
24011 see whether it is one of the standard byte order marks (BOM's) which signal
24012 the encoding of the string. The routine includes detection of special XML
24013 sequences for various UCS input formats.
24015 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
24016 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{33a}@anchor{gnat_rm/the_gnat_library id53}@anchor{33b}
24017 @section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
24020 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
24022 @geindex Byte swapping
24024 @geindex Endianness
24026 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
24027 Machine-specific implementations are available in some cases.
24029 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
24030 @anchor{gnat_rm/the_gnat_library id54}@anchor{33c}@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{33d}
24031 @section @code{GNAT.Calendar} (@code{g-calend.ads})
24034 @geindex GNAT.Calendar (g-calend.ads)
24038 Extends the facilities provided by @code{Ada.Calendar} to include handling
24039 of days of the week, an extended @code{Split} and @code{Time_Of} capability.
24040 Also provides conversion of @code{Ada.Calendar.Time} values to and from the
24041 C @code{timeval} format.
24043 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
24044 @anchor{gnat_rm/the_gnat_library id55}@anchor{33e}@anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{33f}
24045 @section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
24052 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
24054 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
24055 @anchor{gnat_rm/the_gnat_library id56}@anchor{340}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{341}
24056 @section @code{GNAT.CRC32} (@code{g-crc32.ads})
24059 @geindex GNAT.CRC32 (g-crc32.ads)
24063 @geindex Cyclic Redundancy Check
24065 This package implements the CRC-32 algorithm. For a full description
24066 of this algorithm see
24067 @emph{Computation of Cyclic Redundancy Checks via Table Look-Up},
24068 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
24069 Aug. 1988. Sarwate, D.V.
24071 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
24072 @anchor{gnat_rm/the_gnat_library id57}@anchor{342}@anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{343}
24073 @section @code{GNAT.Case_Util} (@code{g-casuti.ads})
24076 @geindex GNAT.Case_Util (g-casuti.ads)
24078 @geindex Casing utilities
24080 @geindex Character handling (`@w{`}GNAT.Case_Util`@w{`})
24082 A set of simple routines for handling upper and lower casing of strings
24083 without the overhead of the full casing tables
24084 in @code{Ada.Characters.Handling}.
24086 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
24087 @anchor{gnat_rm/the_gnat_library id58}@anchor{344}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{345}
24088 @section @code{GNAT.CGI} (@code{g-cgi.ads})
24091 @geindex GNAT.CGI (g-cgi.ads)
24093 @geindex CGI (Common Gateway Interface)
24095 This is a package for interfacing a GNAT program with a Web server via the
24096 Common Gateway Interface (CGI). Basically this package parses the CGI
24097 parameters, which are a set of key/value pairs sent by the Web server. It
24098 builds a table whose index is the key and provides some services to deal
24101 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
24102 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{346}@anchor{gnat_rm/the_gnat_library id59}@anchor{347}
24103 @section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
24106 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
24108 @geindex CGI (Common Gateway Interface) cookie support
24110 @geindex Cookie support in CGI
24112 This is a package to interface a GNAT program with a Web server via the
24113 Common Gateway Interface (CGI). It exports services to deal with Web
24114 cookies (piece of information kept in the Web client software).
24116 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
24117 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{348}@anchor{gnat_rm/the_gnat_library id60}@anchor{349}
24118 @section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads})
24121 @geindex GNAT.CGI.Debug (g-cgideb.ads)
24123 @geindex CGI (Common Gateway Interface) debugging
24125 This is a package to help debugging CGI (Common Gateway Interface)
24126 programs written in Ada.
24128 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
24129 @anchor{gnat_rm/the_gnat_library id61}@anchor{34a}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{34b}
24130 @section @code{GNAT.Command_Line} (@code{g-comlin.ads})
24133 @geindex GNAT.Command_Line (g-comlin.ads)
24135 @geindex Command line
24137 Provides a high level interface to @code{Ada.Command_Line} facilities,
24138 including the ability to scan for named switches with optional parameters
24139 and expand file names using wildcard notations.
24141 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
24142 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{34c}@anchor{gnat_rm/the_gnat_library id62}@anchor{34d}
24143 @section @code{GNAT.Compiler_Version} (@code{g-comver.ads})
24146 @geindex GNAT.Compiler_Version (g-comver.ads)
24148 @geindex Compiler Version
24151 @geindex of compiler
24153 Provides a routine for obtaining the version of the compiler used to
24154 compile the program. More accurately this is the version of the binder
24155 used to bind the program (this will normally be the same as the version
24156 of the compiler if a consistent tool set is used to compile all units
24159 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
24160 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{34e}@anchor{gnat_rm/the_gnat_library id63}@anchor{34f}
24161 @section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
24164 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
24168 Provides a simple interface to handle Ctrl-C keyboard events.
24170 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
24171 @anchor{gnat_rm/the_gnat_library id64}@anchor{350}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{351}
24172 @section @code{GNAT.Current_Exception} (@code{g-curexc.ads})
24175 @geindex GNAT.Current_Exception (g-curexc.ads)
24177 @geindex Current exception
24179 @geindex Exception retrieval
24181 Provides access to information on the current exception that has been raised
24182 without the need for using the Ada 95 / Ada 2005 exception choice parameter
24183 specification syntax.
24184 This is particularly useful in simulating typical facilities for
24185 obtaining information about exceptions provided by Ada 83 compilers.
24187 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
24188 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{352}@anchor{gnat_rm/the_gnat_library id65}@anchor{353}
24189 @section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads})
24192 @geindex GNAT.Debug_Pools (g-debpoo.ads)
24196 @geindex Debug pools
24198 @geindex Memory corruption debugging
24200 Provide a debugging storage pools that helps tracking memory corruption
24202 See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
24204 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
24205 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{354}@anchor{gnat_rm/the_gnat_library id66}@anchor{355}
24206 @section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads})
24209 @geindex GNAT.Debug_Utilities (g-debuti.ads)
24213 Provides a few useful utilities for debugging purposes, including conversion
24214 to and from string images of address values. Supports both C and Ada formats
24215 for hexadecimal literals.
24217 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
24218 @anchor{gnat_rm/the_gnat_library id67}@anchor{356}@anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{357}
24219 @section @code{GNAT.Decode_String} (@code{g-decstr.ads})
24222 @geindex GNAT.Decode_String (g-decstr.ads)
24224 @geindex Decoding strings
24226 @geindex String decoding
24228 @geindex Wide character encoding
24234 A generic package providing routines for decoding wide character and wide wide
24235 character strings encoded as sequences of 8-bit characters using a specified
24236 encoding method. Includes validation routines, and also routines for stepping
24237 to next or previous encoded character in an encoded string.
24238 Useful in conjunction with Unicode character coding. Note there is a
24239 preinstantiation for UTF-8. See next entry.
24241 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
24242 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{358}@anchor{gnat_rm/the_gnat_library id68}@anchor{359}
24243 @section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
24246 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
24248 @geindex Decoding strings
24250 @geindex Decoding UTF-8 strings
24252 @geindex UTF-8 string decoding
24254 @geindex Wide character decoding
24260 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
24262 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
24263 @anchor{gnat_rm/the_gnat_library id69}@anchor{35a}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{35b}
24264 @section @code{GNAT.Directory_Operations} (@code{g-dirope.ads})
24267 @geindex GNAT.Directory_Operations (g-dirope.ads)
24269 @geindex Directory operations
24271 Provides a set of routines for manipulating directories, including changing
24272 the current directory, making new directories, and scanning the files in a
24275 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
24276 @anchor{gnat_rm/the_gnat_library id70}@anchor{35c}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{35d}
24277 @section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
24280 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
24282 @geindex Directory operations iteration
24284 A child unit of GNAT.Directory_Operations providing additional operations
24285 for iterating through directories.
24287 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
24288 @anchor{gnat_rm/the_gnat_library id71}@anchor{35e}@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{35f}
24289 @section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
24292 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
24294 @geindex Hash tables
24296 A generic implementation of hash tables that can be used to hash arbitrary
24297 data. Provided in two forms, a simple form with built in hash functions,
24298 and a more complex form in which the hash function is supplied.
24300 This package provides a facility similar to that of @code{GNAT.HTable},
24301 except that this package declares a type that can be used to define
24302 dynamic instances of the hash table, while an instantiation of
24303 @code{GNAT.HTable} creates a single instance of the hash table.
24305 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
24306 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{360}@anchor{gnat_rm/the_gnat_library id72}@anchor{361}
24307 @section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
24310 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
24312 @geindex Table implementation
24315 @geindex extendable
24317 A generic package providing a single dimension array abstraction where the
24318 length of the array can be dynamically modified.
24320 This package provides a facility similar to that of @code{GNAT.Table},
24321 except that this package declares a type that can be used to define
24322 dynamic instances of the table, while an instantiation of
24323 @code{GNAT.Table} creates a single instance of the table type.
24325 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
24326 @anchor{gnat_rm/the_gnat_library id73}@anchor{362}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{363}
24327 @section @code{GNAT.Encode_String} (@code{g-encstr.ads})
24330 @geindex GNAT.Encode_String (g-encstr.ads)
24332 @geindex Encoding strings
24334 @geindex String encoding
24336 @geindex Wide character encoding
24342 A generic package providing routines for encoding wide character and wide
24343 wide character strings as sequences of 8-bit characters using a specified
24344 encoding method. Useful in conjunction with Unicode character coding.
24345 Note there is a preinstantiation for UTF-8. See next entry.
24347 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
24348 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{364}@anchor{gnat_rm/the_gnat_library id74}@anchor{365}
24349 @section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
24352 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
24354 @geindex Encoding strings
24356 @geindex Encoding UTF-8 strings
24358 @geindex UTF-8 string encoding
24360 @geindex Wide character encoding
24366 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
24368 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
24369 @anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{366}@anchor{gnat_rm/the_gnat_library id75}@anchor{367}
24370 @section @code{GNAT.Exception_Actions} (@code{g-excact.ads})
24373 @geindex GNAT.Exception_Actions (g-excact.ads)
24375 @geindex Exception actions
24377 Provides callbacks when an exception is raised. Callbacks can be registered
24378 for specific exceptions, or when any exception is raised. This
24379 can be used for instance to force a core dump to ease debugging.
24381 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library
24382 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{368}@anchor{gnat_rm/the_gnat_library id76}@anchor{369}
24383 @section @code{GNAT.Exception_Traces} (@code{g-exctra.ads})
24386 @geindex GNAT.Exception_Traces (g-exctra.ads)
24388 @geindex Exception traces
24392 Provides an interface allowing to control automatic output upon exception
24395 @node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
24396 @anchor{gnat_rm/the_gnat_library id77}@anchor{36a}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{36b}
24397 @section @code{GNAT.Exceptions} (@code{g-except.ads})
24400 @geindex GNAT.Exceptions (g-except.ads)
24402 @geindex Exceptions
24405 @geindex Pure packages
24406 @geindex exceptions
24408 Normally it is not possible to raise an exception with
24409 a message from a subprogram in a pure package, since the
24410 necessary types and subprograms are in @code{Ada.Exceptions}
24411 which is not a pure unit. @code{GNAT.Exceptions} provides a
24412 facility for getting around this limitation for a few
24413 predefined exceptions, and for example allow raising
24414 @code{Constraint_Error} with a message from a pure subprogram.
24416 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library
24417 @anchor{gnat_rm/the_gnat_library id78}@anchor{36c}@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{36d}
24418 @section @code{GNAT.Expect} (@code{g-expect.ads})
24421 @geindex GNAT.Expect (g-expect.ads)
24423 Provides a set of subprograms similar to what is available
24424 with the standard Tcl Expect tool.
24425 It allows you to easily spawn and communicate with an external process.
24426 You can send commands or inputs to the process, and compare the output
24427 with some expected regular expression. Currently @code{GNAT.Expect}
24428 is implemented on all native GNAT ports.
24429 It is not implemented for cross ports, and in particular is not
24430 implemented for VxWorks or LynxOS.
24432 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
24433 @anchor{gnat_rm/the_gnat_library id79}@anchor{36e}@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{36f}
24434 @section @code{GNAT.Expect.TTY} (@code{g-exptty.ads})
24437 @geindex GNAT.Expect.TTY (g-exptty.ads)
24439 As GNAT.Expect but using pseudo-terminal.
24440 Currently @code{GNAT.Expect.TTY} is implemented on all native GNAT
24441 ports. It is not implemented for cross ports, and
24442 in particular is not implemented for VxWorks or LynxOS.
24444 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
24445 @anchor{gnat_rm/the_gnat_library id80}@anchor{370}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{371}
24446 @section @code{GNAT.Float_Control} (@code{g-flocon.ads})
24449 @geindex GNAT.Float_Control (g-flocon.ads)
24451 @geindex Floating-Point Processor
24453 Provides an interface for resetting the floating-point processor into the
24454 mode required for correct semantic operation in Ada. Some third party
24455 library calls may cause this mode to be modified, and the Reset procedure
24456 in this package can be used to reestablish the required mode.
24458 @node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
24459 @anchor{gnat_rm/the_gnat_library id81}@anchor{372}@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{373}
24460 @section @code{GNAT.Formatted_String} (@code{g-forstr.ads})
24463 @geindex GNAT.Formatted_String (g-forstr.ads)
24465 @geindex Formatted String
24467 Provides support for C/C++ printf() formatted strings. The format is
24468 copied from the printf() routine and should therefore gives identical
24469 output. Some generic routines are provided to be able to use types
24470 derived from Integer, Float or enumerations as values for the
24473 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
24474 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{374}@anchor{gnat_rm/the_gnat_library id82}@anchor{375}
24475 @section @code{GNAT.Heap_Sort} (@code{g-heasor.ads})
24478 @geindex GNAT.Heap_Sort (g-heasor.ads)
24482 Provides a general implementation of heap sort usable for sorting arbitrary
24483 data items. Exchange and comparison procedures are provided by passing
24484 access-to-procedure values. The algorithm used is a modified heap sort
24485 that performs approximately N*log(N) comparisons in the worst case.
24487 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
24488 @anchor{gnat_rm/the_gnat_library id83}@anchor{376}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{377}
24489 @section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
24492 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
24496 Provides a general implementation of heap sort usable for sorting arbitrary
24497 data items. Move and comparison procedures are provided by passing
24498 access-to-procedure values. The algorithm used is a modified heap sort
24499 that performs approximately N*log(N) comparisons in the worst case.
24500 This differs from @code{GNAT.Heap_Sort} in having a less convenient
24501 interface, but may be slightly more efficient.
24503 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
24504 @anchor{gnat_rm/the_gnat_library id84}@anchor{378}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{379}
24505 @section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
24508 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
24512 Similar to @code{Heap_Sort_A} except that the move and sorting procedures
24513 are provided as generic parameters, this improves efficiency, especially
24514 if the procedures can be inlined, at the expense of duplicating code for
24515 multiple instantiations.
24517 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
24518 @anchor{gnat_rm/the_gnat_library id85}@anchor{37a}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{37b}
24519 @section @code{GNAT.HTable} (@code{g-htable.ads})
24522 @geindex GNAT.HTable (g-htable.ads)
24524 @geindex Hash tables
24526 A generic implementation of hash tables that can be used to hash arbitrary
24527 data. Provides two approaches, one a simple static approach, and the other
24528 allowing arbitrary dynamic hash tables.
24530 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
24531 @anchor{gnat_rm/the_gnat_library id86}@anchor{37c}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{37d}
24532 @section @code{GNAT.IO} (@code{g-io.ads})
24535 @geindex GNAT.IO (g-io.ads)
24537 @geindex Simple I/O
24539 @geindex Input/Output facilities
24541 A simple preelaborable input-output package that provides a subset of
24542 simple Text_IO functions for reading characters and strings from
24543 Standard_Input, and writing characters, strings and integers to either
24544 Standard_Output or Standard_Error.
24546 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
24547 @anchor{gnat_rm/the_gnat_library id87}@anchor{37e}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{37f}
24548 @section @code{GNAT.IO_Aux} (@code{g-io_aux.ads})
24551 @geindex GNAT.IO_Aux (g-io_aux.ads)
24555 @geindex Input/Output facilities
24557 Provides some auxiliary functions for use with Text_IO, including a test
24558 for whether a file exists, and functions for reading a line of text.
24560 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
24561 @anchor{gnat_rm/the_gnat_library id88}@anchor{380}@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{381}
24562 @section @code{GNAT.Lock_Files} (@code{g-locfil.ads})
24565 @geindex GNAT.Lock_Files (g-locfil.ads)
24567 @geindex File locking
24569 @geindex Locking using files
24571 Provides a general interface for using files as locks. Can be used for
24572 providing program level synchronization.
24574 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
24575 @anchor{gnat_rm/the_gnat_library id89}@anchor{382}@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{383}
24576 @section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
24579 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
24581 @geindex Random number generation
24583 The original implementation of @code{Ada.Numerics.Discrete_Random}. Uses
24584 a modified version of the Blum-Blum-Shub generator.
24586 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
24587 @anchor{gnat_rm/the_gnat_library id90}@anchor{384}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{385}
24588 @section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
24591 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
24593 @geindex Random number generation
24595 The original implementation of @code{Ada.Numerics.Float_Random}. Uses
24596 a modified version of the Blum-Blum-Shub generator.
24598 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
24599 @anchor{gnat_rm/the_gnat_library id91}@anchor{386}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{387}
24600 @section @code{GNAT.MD5} (@code{g-md5.ads})
24603 @geindex GNAT.MD5 (g-md5.ads)
24605 @geindex Message Digest MD5
24607 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
24608 the HMAC-MD5 message authentication function as described in RFC 2104 and
24611 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
24612 @anchor{gnat_rm/the_gnat_library id92}@anchor{388}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{389}
24613 @section @code{GNAT.Memory_Dump} (@code{g-memdum.ads})
24616 @geindex GNAT.Memory_Dump (g-memdum.ads)
24618 @geindex Dump Memory
24620 Provides a convenient routine for dumping raw memory to either the
24621 standard output or standard error files. Uses GNAT.IO for actual
24624 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
24625 @anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{38a}@anchor{gnat_rm/the_gnat_library id93}@anchor{38b}
24626 @section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
24629 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
24632 @geindex obtaining most recent
24634 Provides access to the most recently raised exception. Can be used for
24635 various logging purposes, including duplicating functionality of some
24636 Ada 83 implementation dependent extensions.
24638 @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
24639 @anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{38c}@anchor{gnat_rm/the_gnat_library id94}@anchor{38d}
24640 @section @code{GNAT.OS_Lib} (@code{g-os_lib.ads})
24643 @geindex GNAT.OS_Lib (g-os_lib.ads)
24645 @geindex Operating System interface
24647 @geindex Spawn capability
24649 Provides a range of target independent operating system interface functions,
24650 including time/date management, file operations, subprocess management,
24651 including a portable spawn procedure, and access to environment variables
24652 and error return codes.
24654 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
24655 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{38e}@anchor{gnat_rm/the_gnat_library id95}@anchor{38f}
24656 @section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
24659 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
24661 @geindex Hash functions
24663 Provides a generator of static minimal perfect hash functions. No
24664 collisions occur and each item can be retrieved from the table in one
24665 probe (perfect property). The hash table size corresponds to the exact
24666 size of the key set and no larger (minimal property). The key set has to
24667 be know in advance (static property). The hash functions are also order
24668 preserving. If w2 is inserted after w1 in the generator, their
24669 hashcode are in the same order. These hashing functions are very
24670 convenient for use with realtime applications.
24672 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
24673 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{390}@anchor{gnat_rm/the_gnat_library id96}@anchor{391}
24674 @section @code{GNAT.Random_Numbers} (@code{g-rannum.ads})
24677 @geindex GNAT.Random_Numbers (g-rannum.ads)
24679 @geindex Random number generation
24681 Provides random number capabilities which extend those available in the
24682 standard Ada library and are more convenient to use.
24684 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
24685 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{259}@anchor{gnat_rm/the_gnat_library id97}@anchor{392}
24686 @section @code{GNAT.Regexp} (@code{g-regexp.ads})
24689 @geindex GNAT.Regexp (g-regexp.ads)
24691 @geindex Regular expressions
24693 @geindex Pattern matching
24695 A simple implementation of regular expressions, using a subset of regular
24696 expression syntax copied from familiar Unix style utilities. This is the
24697 simplest of the three pattern matching packages provided, and is particularly
24698 suitable for 'file globbing' applications.
24700 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
24701 @anchor{gnat_rm/the_gnat_library id98}@anchor{393}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{394}
24702 @section @code{GNAT.Registry} (@code{g-regist.ads})
24705 @geindex GNAT.Registry (g-regist.ads)
24707 @geindex Windows Registry
24709 This is a high level binding to the Windows registry. It is possible to
24710 do simple things like reading a key value, creating a new key. For full
24711 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
24712 package provided with the Win32Ada binding
24714 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
24715 @anchor{gnat_rm/the_gnat_library id99}@anchor{395}@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{396}
24716 @section @code{GNAT.Regpat} (@code{g-regpat.ads})
24719 @geindex GNAT.Regpat (g-regpat.ads)
24721 @geindex Regular expressions
24723 @geindex Pattern matching
24725 A complete implementation of Unix-style regular expression matching, copied
24726 from the original V7 style regular expression library written in C by
24727 Henry Spencer (and binary compatible with this C library).
24729 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
24730 @anchor{gnat_rm/the_gnat_library id100}@anchor{397}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{398}
24731 @section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
24734 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
24736 @geindex Rewrite data
24738 A unit to rewrite on-the-fly string occurrences in a stream of
24739 data. The implementation has a very minimal memory footprint as the
24740 full content to be processed is not loaded into memory all at once. This makes
24741 this interface usable for large files or socket streams.
24743 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
24744 @anchor{gnat_rm/the_gnat_library id101}@anchor{399}@anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{39a}
24745 @section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
24748 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
24750 @geindex Secondary Stack Info
24752 Provide the capability to query the high water mark of the current task's
24755 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
24756 @anchor{gnat_rm/the_gnat_library id102}@anchor{39b}@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{39c}
24757 @section @code{GNAT.Semaphores} (@code{g-semaph.ads})
24760 @geindex GNAT.Semaphores (g-semaph.ads)
24762 @geindex Semaphores
24764 Provides classic counting and binary semaphores using protected types.
24766 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
24767 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{39d}@anchor{gnat_rm/the_gnat_library id103}@anchor{39e}
24768 @section @code{GNAT.Serial_Communications} (@code{g-sercom.ads})
24771 @geindex GNAT.Serial_Communications (g-sercom.ads)
24773 @geindex Serial_Communications
24775 Provides a simple interface to send and receive data over a serial
24776 port. This is only supported on GNU/Linux and Windows.
24778 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
24779 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{39f}@anchor{gnat_rm/the_gnat_library id104}@anchor{3a0}
24780 @section @code{GNAT.SHA1} (@code{g-sha1.ads})
24783 @geindex GNAT.SHA1 (g-sha1.ads)
24785 @geindex Secure Hash Algorithm SHA-1
24787 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
24788 and RFC 3174, and the HMAC-SHA1 message authentication function as described
24789 in RFC 2104 and FIPS PUB 198.
24791 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
24792 @anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{3a1}@anchor{gnat_rm/the_gnat_library id105}@anchor{3a2}
24793 @section @code{GNAT.SHA224} (@code{g-sha224.ads})
24796 @geindex GNAT.SHA224 (g-sha224.ads)
24798 @geindex Secure Hash Algorithm SHA-224
24800 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24801 and the HMAC-SHA224 message authentication function as described
24802 in RFC 2104 and FIPS PUB 198.
24804 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24805 @anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{3a3}@anchor{gnat_rm/the_gnat_library id106}@anchor{3a4}
24806 @section @code{GNAT.SHA256} (@code{g-sha256.ads})
24809 @geindex GNAT.SHA256 (g-sha256.ads)
24811 @geindex Secure Hash Algorithm SHA-256
24813 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24814 and the HMAC-SHA256 message authentication function as described
24815 in RFC 2104 and FIPS PUB 198.
24817 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24818 @anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{3a5}@anchor{gnat_rm/the_gnat_library id107}@anchor{3a6}
24819 @section @code{GNAT.SHA384} (@code{g-sha384.ads})
24822 @geindex GNAT.SHA384 (g-sha384.ads)
24824 @geindex Secure Hash Algorithm SHA-384
24826 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24827 and the HMAC-SHA384 message authentication function as described
24828 in RFC 2104 and FIPS PUB 198.
24830 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24831 @anchor{gnat_rm/the_gnat_library id108}@anchor{3a7}@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3a8}
24832 @section @code{GNAT.SHA512} (@code{g-sha512.ads})
24835 @geindex GNAT.SHA512 (g-sha512.ads)
24837 @geindex Secure Hash Algorithm SHA-512
24839 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24840 and the HMAC-SHA512 message authentication function as described
24841 in RFC 2104 and FIPS PUB 198.
24843 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24844 @anchor{gnat_rm/the_gnat_library id109}@anchor{3a9}@anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3aa}
24845 @section @code{GNAT.Signals} (@code{g-signal.ads})
24848 @geindex GNAT.Signals (g-signal.ads)
24852 Provides the ability to manipulate the blocked status of signals on supported
24855 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24856 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3ab}@anchor{gnat_rm/the_gnat_library id110}@anchor{3ac}
24857 @section @code{GNAT.Sockets} (@code{g-socket.ads})
24860 @geindex GNAT.Sockets (g-socket.ads)
24864 A high level and portable interface to develop sockets based applications.
24865 This package is based on the sockets thin binding found in
24866 @code{GNAT.Sockets.Thin}. Currently @code{GNAT.Sockets} is implemented
24867 on all native GNAT ports and on VxWorks cross prots. It is not implemented for
24868 the LynxOS cross port.
24870 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
24871 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3ad}@anchor{gnat_rm/the_gnat_library id111}@anchor{3ae}
24872 @section @code{GNAT.Source_Info} (@code{g-souinf.ads})
24875 @geindex GNAT.Source_Info (g-souinf.ads)
24877 @geindex Source Information
24879 Provides subprograms that give access to source code information known at
24880 compile time, such as the current file name and line number. Also provides
24881 subprograms yielding the date and time of the current compilation (like the
24882 C macros @code{__DATE__} and @code{__TIME__})
24884 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
24885 @anchor{gnat_rm/the_gnat_library id112}@anchor{3af}@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3b0}
24886 @section @code{GNAT.Spelling_Checker} (@code{g-speche.ads})
24889 @geindex GNAT.Spelling_Checker (g-speche.ads)
24891 @geindex Spell checking
24893 Provides a function for determining whether one string is a plausible
24894 near misspelling of another string.
24896 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
24897 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3b1}@anchor{gnat_rm/the_gnat_library id113}@anchor{3b2}
24898 @section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
24901 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
24903 @geindex Spell checking
24905 Provides a generic function that can be instantiated with a string type for
24906 determining whether one string is a plausible near misspelling of another
24909 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
24910 @anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3b3}@anchor{gnat_rm/the_gnat_library id114}@anchor{3b4}
24911 @section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
24914 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
24916 @geindex SPITBOL pattern matching
24918 @geindex Pattern matching
24920 A complete implementation of SNOBOL4 style pattern matching. This is the
24921 most elaborate of the pattern matching packages provided. It fully duplicates
24922 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
24923 efficient algorithm developed by Robert Dewar for the SPITBOL system.
24925 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
24926 @anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3b5}@anchor{gnat_rm/the_gnat_library id115}@anchor{3b6}
24927 @section @code{GNAT.Spitbol} (@code{g-spitbo.ads})
24930 @geindex GNAT.Spitbol (g-spitbo.ads)
24932 @geindex SPITBOL interface
24934 The top level package of the collection of SPITBOL-style functionality, this
24935 package provides basic SNOBOL4 string manipulation functions, such as
24936 Pad, Reverse, Trim, Substr capability, as well as a generic table function
24937 useful for constructing arbitrary mappings from strings in the style of
24938 the SNOBOL4 TABLE function.
24940 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
24941 @anchor{gnat_rm/the_gnat_library id116}@anchor{3b7}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3b8}
24942 @section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
24945 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
24947 @geindex Sets of strings
24949 @geindex SPITBOL Tables
24951 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24952 for type @code{Standard.Boolean}, giving an implementation of sets of
24955 @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
24956 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3b9}@anchor{gnat_rm/the_gnat_library id117}@anchor{3ba}
24957 @section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
24960 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
24962 @geindex Integer maps
24966 @geindex SPITBOL Tables
24968 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24969 for type @code{Standard.Integer}, giving an implementation of maps
24970 from string to integer values.
24972 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
24973 @anchor{gnat_rm/the_gnat_library id118}@anchor{3bb}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3bc}
24974 @section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
24977 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
24979 @geindex String maps
24983 @geindex SPITBOL Tables
24985 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table} for
24986 a variable length string type, giving an implementation of general
24987 maps from strings to strings.
24989 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
24990 @anchor{gnat_rm/the_gnat_library id119}@anchor{3bd}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3be}
24991 @section @code{GNAT.SSE} (@code{g-sse.ads})
24994 @geindex GNAT.SSE (g-sse.ads)
24996 Root of a set of units aimed at offering Ada bindings to a subset of
24997 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
24998 targets. It exposes vector component types together with a general
24999 introduction to the binding contents and use.
25001 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
25002 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3bf}@anchor{gnat_rm/the_gnat_library id120}@anchor{3c0}
25003 @section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
25006 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
25008 SSE vector types for use with SSE related intrinsics.
25010 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
25011 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3c1}@anchor{gnat_rm/the_gnat_library id121}@anchor{3c2}
25012 @section @code{GNAT.String_Hash} (@code{g-strhas.ads})
25015 @geindex GNAT.String_Hash (g-strhas.ads)
25017 @geindex Hash functions
25019 Provides a generic hash function working on arrays of scalars. Both the scalar
25020 type and the hash result type are parameters.
25022 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
25023 @anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3c3}@anchor{gnat_rm/the_gnat_library id122}@anchor{3c4}
25024 @section @code{GNAT.Strings} (@code{g-string.ads})
25027 @geindex GNAT.Strings (g-string.ads)
25029 Common String access types and related subprograms. Basically it
25030 defines a string access and an array of string access types.
25032 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
25033 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3c5}@anchor{gnat_rm/the_gnat_library id123}@anchor{3c6}
25034 @section @code{GNAT.String_Split} (@code{g-strspl.ads})
25037 @geindex GNAT.String_Split (g-strspl.ads)
25039 @geindex String splitter
25041 Useful string manipulation routines: given a set of separators, split
25042 a string wherever the separators appear, and provide direct access
25043 to the resulting slices. This package is instantiated from
25044 @code{GNAT.Array_Split}.
25046 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
25047 @anchor{gnat_rm/the_gnat_library id124}@anchor{3c7}@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3c8}
25048 @section @code{GNAT.Table} (@code{g-table.ads})
25051 @geindex GNAT.Table (g-table.ads)
25053 @geindex Table implementation
25056 @geindex extendable
25058 A generic package providing a single dimension array abstraction where the
25059 length of the array can be dynamically modified.
25061 This package provides a facility similar to that of @code{GNAT.Dynamic_Tables},
25062 except that this package declares a single instance of the table type,
25063 while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
25064 used to define dynamic instances of the table.
25066 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
25067 @anchor{gnat_rm/the_gnat_library id125}@anchor{3c9}@anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3ca}
25068 @section @code{GNAT.Task_Lock} (@code{g-tasloc.ads})
25071 @geindex GNAT.Task_Lock (g-tasloc.ads)
25073 @geindex Task synchronization
25075 @geindex Task locking
25079 A very simple facility for locking and unlocking sections of code using a
25080 single global task lock. Appropriate for use in situations where contention
25081 between tasks is very rarely expected.
25083 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
25084 @anchor{gnat_rm/the_gnat_library id126}@anchor{3cb}@anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3cc}
25085 @section @code{GNAT.Time_Stamp} (@code{g-timsta.ads})
25088 @geindex GNAT.Time_Stamp (g-timsta.ads)
25090 @geindex Time stamp
25092 @geindex Current time
25094 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
25095 represents the current date and time in ISO 8601 format. This is a very simple
25096 routine with minimal code and there are no dependencies on any other unit.
25098 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
25099 @anchor{gnat_rm/the_gnat_library id127}@anchor{3cd}@anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3ce}
25100 @section @code{GNAT.Threads} (@code{g-thread.ads})
25103 @geindex GNAT.Threads (g-thread.ads)
25105 @geindex Foreign threads
25110 Provides facilities for dealing with foreign threads which need to be known
25111 by the GNAT run-time system. Consult the documentation of this package for
25112 further details if your program has threads that are created by a non-Ada
25113 environment which then accesses Ada code.
25115 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
25116 @anchor{gnat_rm/the_gnat_library id128}@anchor{3cf}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3d0}
25117 @section @code{GNAT.Traceback} (@code{g-traceb.ads})
25120 @geindex GNAT.Traceback (g-traceb.ads)
25122 @geindex Trace back facilities
25124 Provides a facility for obtaining non-symbolic traceback information, useful
25125 in various debugging situations.
25127 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
25128 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3d1}@anchor{gnat_rm/the_gnat_library id129}@anchor{3d2}
25129 @section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
25132 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
25134 @geindex Trace back facilities
25136 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
25137 @anchor{gnat_rm/the_gnat_library id130}@anchor{3d3}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3d4}
25138 @section @code{GNAT.UTF_32} (@code{g-table.ads})
25141 @geindex GNAT.UTF_32 (g-table.ads)
25143 @geindex Wide character codes
25145 This is a package intended to be used in conjunction with the
25146 @code{Wide_Character} type in Ada 95 and the
25147 @code{Wide_Wide_Character} type in Ada 2005 (available
25148 in @code{GNAT} in Ada 2005 mode). This package contains
25149 Unicode categorization routines, as well as lexical
25150 categorization routines corresponding to the Ada 2005
25151 lexical rules for identifiers and strings, and also a
25152 lower case to upper case fold routine corresponding to
25153 the Ada 2005 rules for identifier equivalence.
25155 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
25156 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3d5}@anchor{gnat_rm/the_gnat_library id131}@anchor{3d6}
25157 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
25160 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
25162 @geindex Spell checking
25164 Provides a function for determining whether one wide wide string is a plausible
25165 near misspelling of another wide wide string, where the strings are represented
25166 using the UTF_32_String type defined in System.Wch_Cnv.
25168 @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
25169 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3d7}@anchor{gnat_rm/the_gnat_library id132}@anchor{3d8}
25170 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
25173 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
25175 @geindex Spell checking
25177 Provides a function for determining whether one wide string is a plausible
25178 near misspelling of another wide string.
25180 @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
25181 @anchor{gnat_rm/the_gnat_library id133}@anchor{3d9}@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3da}
25182 @section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
25185 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
25187 @geindex Wide_String splitter
25189 Useful wide string manipulation routines: given a set of separators, split
25190 a wide string wherever the separators appear, and provide direct access
25191 to the resulting slices. This package is instantiated from
25192 @code{GNAT.Array_Split}.
25194 @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
25195 @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}
25196 @section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
25199 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
25201 @geindex Spell checking
25203 Provides a function for determining whether one wide wide string is a plausible
25204 near misspelling of another wide wide string.
25206 @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
25207 @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}
25208 @section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
25211 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
25213 @geindex Wide_Wide_String splitter
25215 Useful wide wide string manipulation routines: given a set of separators, split
25216 a wide wide string wherever the separators appear, and provide direct access
25217 to the resulting slices. This package is instantiated from
25218 @code{GNAT.Array_Split}.
25220 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
25221 @anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3df}@anchor{gnat_rm/the_gnat_library id136}@anchor{3e0}
25222 @section @code{Interfaces.C.Extensions} (@code{i-cexten.ads})
25225 @geindex Interfaces.C.Extensions (i-cexten.ads)
25227 This package contains additional C-related definitions, intended
25228 for use with either manually or automatically generated bindings
25231 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
25232 @anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3e1}@anchor{gnat_rm/the_gnat_library id137}@anchor{3e2}
25233 @section @code{Interfaces.C.Streams} (@code{i-cstrea.ads})
25236 @geindex Interfaces.C.Streams (i-cstrea.ads)
25239 @geindex interfacing
25241 This package is a binding for the most commonly used operations
25244 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
25245 @anchor{gnat_rm/the_gnat_library id138}@anchor{3e3}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3e4}
25246 @section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
25249 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
25251 @geindex IBM Packed Format
25253 @geindex Packed Decimal
25255 This package provides a set of routines for conversions to and
25256 from a packed decimal format compatible with that used on IBM
25259 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
25260 @anchor{gnat_rm/the_gnat_library id139}@anchor{3e5}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3e6}
25261 @section @code{Interfaces.VxWorks} (@code{i-vxwork.ads})
25264 @geindex Interfaces.VxWorks (i-vxwork.ads)
25266 @geindex Interfacing to VxWorks
25269 @geindex interfacing
25271 This package provides a limited binding to the VxWorks API.
25272 In particular, it interfaces with the
25273 VxWorks hardware interrupt facilities.
25275 @node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
25276 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3e7}@anchor{gnat_rm/the_gnat_library id140}@anchor{3e8}
25277 @section @code{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads})
25280 @geindex Interfaces.VxWorks.Int_Connection (i-vxinco.ads)
25282 @geindex Interfacing to VxWorks
25285 @geindex interfacing
25287 This package provides a way for users to replace the use of
25288 intConnect() with a custom routine for installing interrupt
25291 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library
25292 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3e9}@anchor{gnat_rm/the_gnat_library id141}@anchor{3ea}
25293 @section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
25296 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
25298 @geindex Interfacing to VxWorks' I/O
25301 @geindex I/O interfacing
25304 @geindex Get_Immediate
25306 @geindex Get_Immediate
25309 This package provides a binding to the ioctl (IO/Control)
25310 function of VxWorks, defining a set of option values and
25311 function codes. A particular use of this package is
25312 to enable the use of Get_Immediate under VxWorks.
25314 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
25315 @anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3eb}@anchor{gnat_rm/the_gnat_library id142}@anchor{3ec}
25316 @section @code{System.Address_Image} (@code{s-addima.ads})
25319 @geindex System.Address_Image (s-addima.ads)
25321 @geindex Address image
25324 @geindex of an address
25326 This function provides a useful debugging
25327 function that gives an (implementation dependent)
25328 string which identifies an address.
25330 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
25331 @anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3ed}@anchor{gnat_rm/the_gnat_library id143}@anchor{3ee}
25332 @section @code{System.Assertions} (@code{s-assert.ads})
25335 @geindex System.Assertions (s-assert.ads)
25337 @geindex Assertions
25339 @geindex Assert_Failure
25342 This package provides the declaration of the exception raised
25343 by an run-time assertion failure, as well as the routine that
25344 is used internally to raise this assertion.
25346 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
25347 @anchor{gnat_rm/the_gnat_library id144}@anchor{3ef}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3f0}
25348 @section @code{System.Atomic_Counters} (@code{s-atocou.ads})
25351 @geindex System.Atomic_Counters (s-atocou.ads)
25353 This package provides the declaration of an atomic counter type,
25354 together with efficient routines (using hardware
25355 synchronization primitives) for incrementing, decrementing,
25356 and testing of these counters. This package is implemented
25357 on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
25358 x86, and x86_64 platforms.
25360 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
25361 @anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3f1}@anchor{gnat_rm/the_gnat_library id145}@anchor{3f2}
25362 @section @code{System.Memory} (@code{s-memory.ads})
25365 @geindex System.Memory (s-memory.ads)
25367 @geindex Memory allocation
25369 This package provides the interface to the low level routines used
25370 by the generated code for allocation and freeing storage for the
25371 default storage pool (analogous to the C routines malloc and free.
25372 It also provides a reallocation interface analogous to the C routine
25373 realloc. The body of this unit may be modified to provide alternative
25374 allocation mechanisms for the default pool, and in addition, direct
25375 calls to this unit may be made for low level allocation uses (for
25376 example see the body of @code{GNAT.Tables}).
25378 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
25379 @anchor{gnat_rm/the_gnat_library id146}@anchor{3f3}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3f4}
25380 @section @code{System.Multiprocessors} (@code{s-multip.ads})
25383 @geindex System.Multiprocessors (s-multip.ads)
25385 @geindex Multiprocessor interface
25387 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25388 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25389 technically an implementation-defined addition).
25391 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
25392 @anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3f5}@anchor{gnat_rm/the_gnat_library id147}@anchor{3f6}
25393 @section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
25396 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
25398 @geindex Multiprocessor interface
25400 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25401 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25402 technically an implementation-defined addition).
25404 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
25405 @anchor{gnat_rm/the_gnat_library id148}@anchor{3f7}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3f8}
25406 @section @code{System.Partition_Interface} (@code{s-parint.ads})
25409 @geindex System.Partition_Interface (s-parint.ads)
25411 @geindex Partition interfacing functions
25413 This package provides facilities for partition interfacing. It
25414 is used primarily in a distribution context when using Annex E
25417 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
25418 @anchor{gnat_rm/the_gnat_library id149}@anchor{3f9}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3fa}
25419 @section @code{System.Pool_Global} (@code{s-pooglo.ads})
25422 @geindex System.Pool_Global (s-pooglo.ads)
25424 @geindex Storage pool
25427 @geindex Global storage pool
25429 This package provides a storage pool that is equivalent to the default
25430 storage pool used for access types for which no pool is specifically
25431 declared. It uses malloc/free to allocate/free and does not attempt to
25432 do any automatic reclamation.
25434 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
25435 @anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3fb}@anchor{gnat_rm/the_gnat_library id150}@anchor{3fc}
25436 @section @code{System.Pool_Local} (@code{s-pooloc.ads})
25439 @geindex System.Pool_Local (s-pooloc.ads)
25441 @geindex Storage pool
25444 @geindex Local storage pool
25446 This package provides a storage pool that is intended for use with locally
25447 defined access types. It uses malloc/free for allocate/free, and maintains
25448 a list of allocated blocks, so that all storage allocated for the pool can
25449 be freed automatically when the pool is finalized.
25451 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
25452 @anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3fd}@anchor{gnat_rm/the_gnat_library id151}@anchor{3fe}
25453 @section @code{System.Restrictions} (@code{s-restri.ads})
25456 @geindex System.Restrictions (s-restri.ads)
25458 @geindex Run-time restrictions access
25460 This package provides facilities for accessing at run time
25461 the status of restrictions specified at compile time for
25462 the partition. Information is available both with regard
25463 to actual restrictions specified, and with regard to
25464 compiler determined information on which restrictions
25465 are violated by one or more packages in the partition.
25467 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
25468 @anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3ff}@anchor{gnat_rm/the_gnat_library id152}@anchor{400}
25469 @section @code{System.Rident} (@code{s-rident.ads})
25472 @geindex System.Rident (s-rident.ads)
25474 @geindex Restrictions definitions
25476 This package provides definitions of the restrictions
25477 identifiers supported by GNAT, and also the format of
25478 the restrictions provided in package System.Restrictions.
25479 It is not normally necessary to @code{with} this generic package
25480 since the necessary instantiation is included in
25481 package System.Restrictions.
25483 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
25484 @anchor{gnat_rm/the_gnat_library id153}@anchor{401}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{402}
25485 @section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads})
25488 @geindex System.Strings.Stream_Ops (s-ststop.ads)
25490 @geindex Stream operations
25492 @geindex String stream operations
25494 This package provides a set of stream subprograms for standard string types.
25495 It is intended primarily to support implicit use of such subprograms when
25496 stream attributes are applied to string types, but the subprograms in this
25497 package can be used directly by application programs.
25499 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
25500 @anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{403}@anchor{gnat_rm/the_gnat_library id154}@anchor{404}
25501 @section @code{System.Unsigned_Types} (@code{s-unstyp.ads})
25504 @geindex System.Unsigned_Types (s-unstyp.ads)
25506 This package contains definitions of standard unsigned types that
25507 correspond in size to the standard signed types declared in Standard,
25508 and (unlike the types in Interfaces) have corresponding names. It
25509 also contains some related definitions for other specialized types
25510 used by the compiler in connection with packed array types.
25512 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
25513 @anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{405}@anchor{gnat_rm/the_gnat_library id155}@anchor{406}
25514 @section @code{System.Wch_Cnv} (@code{s-wchcnv.ads})
25517 @geindex System.Wch_Cnv (s-wchcnv.ads)
25519 @geindex Wide Character
25520 @geindex Representation
25522 @geindex Wide String
25523 @geindex Conversion
25525 @geindex Representation of wide characters
25527 This package provides routines for converting between
25528 wide and wide wide characters and a representation as a value of type
25529 @code{Standard.String}, using a specified wide character
25530 encoding method. It uses definitions in
25531 package @code{System.Wch_Con}.
25533 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
25534 @anchor{gnat_rm/the_gnat_library id156}@anchor{407}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{408}
25535 @section @code{System.Wch_Con} (@code{s-wchcon.ads})
25538 @geindex System.Wch_Con (s-wchcon.ads)
25540 This package provides definitions and descriptions of
25541 the various methods used for encoding wide characters
25542 in ordinary strings. These definitions are used by
25543 the package @code{System.Wch_Cnv}.
25545 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
25546 @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}
25547 @chapter Interfacing to Other Languages
25550 The facilities in Annex B of the Ada Reference Manual are fully
25551 implemented in GNAT, and in addition, a full interface to C++ is
25555 * Interfacing to C::
25556 * Interfacing to C++::
25557 * Interfacing to COBOL::
25558 * Interfacing to Fortran::
25559 * Interfacing to non-GNAT Ada code::
25563 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
25564 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{40b}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{40c}
25565 @section Interfacing to C
25568 Interfacing to C with GNAT can use one of two approaches:
25574 The types in the package @code{Interfaces.C} may be used.
25577 Standard Ada types may be used directly. This may be less portable to
25578 other compilers, but will work on all GNAT compilers, which guarantee
25579 correspondence between the C and Ada types.
25582 Pragma @code{Convention C} may be applied to Ada types, but mostly has no
25583 effect, since this is the default. The following table shows the
25584 correspondence between Ada scalar types and the corresponding C types.
25587 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
25606 @code{Short_Integer}
25614 @code{Short_Short_Integer}
25622 @code{Long_Integer}
25630 @code{Long_Long_Integer}
25662 @code{Long_Long_Float}
25666 This is the longest floating-point type supported by the hardware.
25671 Additionally, there are the following general correspondences between Ada
25678 Ada enumeration types map to C enumeration types directly if pragma
25679 @code{Convention C} is specified, which causes them to have a length of
25680 32 bits, except for boolean types which map to C99 @code{bool} and for
25681 which the length is 8 bits.
25682 Without pragma @code{Convention C}, Ada enumeration types map to
25683 8, 16, or 32 bits (i.e., C types @code{signed char}, @code{short},
25684 @code{int}, respectively) depending on the number of values passed.
25685 This is the only case in which pragma @code{Convention C} affects the
25686 representation of an Ada type.
25689 Ada access types map to C pointers, except for the case of pointers to
25690 unconstrained types in Ada, which have no direct C equivalent.
25693 Ada arrays map directly to C arrays.
25696 Ada records map directly to C structures.
25699 Packed Ada records map to C structures where all members are bit fields
25700 of the length corresponding to the @code{type'Size} value in Ada.
25703 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
25704 @anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{40d}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{4a}
25705 @section Interfacing to C++
25708 The interface to C++ makes use of the following pragmas, which are
25709 primarily intended to be constructed automatically using a binding generator
25710 tool, although it is possible to construct them by hand.
25712 Using these pragmas it is possible to achieve complete
25713 inter-operability between Ada tagged types and C++ class definitions.
25714 See @ref{7,,Implementation Defined Pragmas}, for more details.
25719 @item @code{pragma CPP_Class ([Entity =>] @emph{LOCAL_NAME})}
25721 The argument denotes an entity in the current declarative region that is
25722 declared as a tagged or untagged record type. It indicates that the type
25723 corresponds to an externally declared C++ class type, and is to be laid
25724 out the same way that C++ would lay out the type.
25726 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
25727 for backward compatibility but its functionality is available
25728 using pragma @code{Import} with @code{Convention} = @code{CPP}.
25730 @item @code{pragma CPP_Constructor ([Entity =>] @emph{LOCAL_NAME})}
25732 This pragma identifies an imported function (imported in the usual way
25733 with pragma @code{Import}) as corresponding to a C++ constructor.
25736 A few restrictions are placed on the use of the @code{Access} attribute
25737 in conjunction with subprograms subject to convention @code{CPP}: the
25738 attribute may be used neither on primitive operations of a tagged
25739 record type with convention @code{CPP}, imported or not, nor on
25740 subprograms imported with pragma @code{CPP_Constructor}.
25742 In addition, C++ exceptions are propagated and can be handled in an
25743 @code{others} choice of an exception handler. The corresponding Ada
25744 occurrence has no message, and the simple name of the exception identity
25745 contains @code{Foreign_Exception}. Finalization and awaiting dependent
25746 tasks works properly when such foreign exceptions are propagated.
25748 It is also possible to import a C++ exception using the following syntax:
25751 LOCAL_NAME : exception;
25752 pragma Import (Cpp,
25753 [Entity =>] LOCAL_NAME,
25754 [External_Name =>] static_string_EXPRESSION);
25757 The @code{External_Name} is the name of the C++ RTTI symbol. You can then
25758 cover a specific C++ exception in an exception handler.
25760 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
25761 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{40e}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{40f}
25762 @section Interfacing to COBOL
25765 Interfacing to COBOL is achieved as described in section B.4 of
25766 the Ada Reference Manual.
25768 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
25769 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{410}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{411}
25770 @section Interfacing to Fortran
25773 Interfacing to Fortran is achieved as described in section B.5 of the
25774 Ada Reference Manual. The pragma @code{Convention Fortran}, applied to a
25775 multi-dimensional array causes the array to be stored in column-major
25776 order as required for convenient interface to Fortran.
25778 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
25779 @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}
25780 @section Interfacing to non-GNAT Ada code
25783 It is possible to specify the convention @code{Ada} in a pragma
25784 @code{Import} or pragma @code{Export}. However this refers to
25785 the calling conventions used by GNAT, which may or may not be
25786 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
25787 compiler to allow interoperation.
25789 If arguments types are kept simple, and if the foreign compiler generally
25790 follows system calling conventions, then it may be possible to integrate
25791 files compiled by other Ada compilers, provided that the elaboration
25792 issues are adequately addressed (for example by eliminating the
25793 need for any load time elaboration).
25795 In particular, GNAT running on VMS is designed to
25796 be highly compatible with the DEC Ada 83 compiler, so this is one
25797 case in which it is possible to import foreign units of this type,
25798 provided that the data items passed are restricted to simple scalar
25799 values or simple record types without variants, or simple array
25800 types with fixed bounds.
25802 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
25803 @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}
25804 @chapter Specialized Needs Annexes
25807 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
25808 required in all implementations. However, as described in this chapter,
25809 GNAT implements all of these annexes:
25814 @item @emph{Systems Programming (Annex C)}
25816 The Systems Programming Annex is fully implemented.
25818 @item @emph{Real-Time Systems (Annex D)}
25820 The Real-Time Systems Annex is fully implemented.
25822 @item @emph{Distributed Systems (Annex E)}
25824 Stub generation is fully implemented in the GNAT compiler. In addition,
25825 a complete compatible PCS is available as part of the GLADE system,
25826 a separate product. When the two
25827 products are used in conjunction, this annex is fully implemented.
25829 @item @emph{Information Systems (Annex F)}
25831 The Information Systems annex is fully implemented.
25833 @item @emph{Numerics (Annex G)}
25835 The Numerics Annex is fully implemented.
25837 @item @emph{Safety and Security / High-Integrity Systems (Annex H)}
25839 The Safety and Security Annex (termed the High-Integrity Systems Annex
25840 in Ada 2005) is fully implemented.
25843 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25844 @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}
25845 @chapter Implementation of Specific Ada Features
25848 This chapter describes the GNAT implementation of several Ada language
25852 * Machine Code Insertions::
25853 * GNAT Implementation of Tasking::
25854 * GNAT Implementation of Shared Passive Packages::
25855 * Code Generation for Array Aggregates::
25856 * The Size of Discriminated Records with Default Discriminants::
25857 * Strict Conformance to the Ada Reference Manual::
25861 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25862 @anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{16c}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{418}
25863 @section Machine Code Insertions
25866 @geindex Machine Code insertions
25868 Package @code{Machine_Code} provides machine code support as described
25869 in the Ada Reference Manual in two separate forms:
25875 Machine code statements, consisting of qualified expressions that
25876 fit the requirements of RM section 13.8.
25879 An intrinsic callable procedure, providing an alternative mechanism of
25880 including machine instructions in a subprogram.
25883 The two features are similar, and both are closely related to the mechanism
25884 provided by the asm instruction in the GNU C compiler. Full understanding
25885 and use of the facilities in this package requires understanding the asm
25886 instruction, see the section on Extended Asm in
25887 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
25889 Calls to the function @code{Asm} and the procedure @code{Asm} have identical
25890 semantic restrictions and effects as described below. Both are provided so
25891 that the procedure call can be used as a statement, and the function call
25892 can be used to form a code_statement.
25894 Consider this C @code{asm} instruction:
25897 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
25900 The equivalent can be written for GNAT as:
25903 Asm ("fsinx %1 %0",
25904 My_Float'Asm_Output ("=f", result),
25905 My_Float'Asm_Input ("f", angle));
25908 The first argument to @code{Asm} is the assembler template, and is
25909 identical to what is used in GNU C. This string must be a static
25910 expression. The second argument is the output operand list. It is
25911 either a single @code{Asm_Output} attribute reference, or a list of such
25912 references enclosed in parentheses (technically an array aggregate of
25915 The @code{Asm_Output} attribute denotes a function that takes two
25916 parameters. The first is a string, the second is the name of a variable
25917 of the type designated by the attribute prefix. The first (string)
25918 argument is required to be a static expression and designates the
25919 constraint (see the section on Constraints in
25920 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
25921 for the parameter; e.g., what kind of register is required. The second
25922 argument is the variable to be written or updated with the
25923 result. The possible values for constraint are the same as those used in
25924 the RTL, and are dependent on the configuration file used to build the
25925 GCC back end. If there are no output operands, then this argument may
25926 either be omitted, or explicitly given as @code{No_Output_Operands}.
25927 No support is provided for GNU C's symbolic names for output parameters.
25929 The second argument of @code{my_float'Asm_Output} functions as
25930 though it were an @code{out} parameter, which is a little curious, but
25931 all names have the form of expressions, so there is no syntactic
25932 irregularity, even though normally functions would not be permitted
25933 @code{out} parameters. The third argument is the list of input
25934 operands. It is either a single @code{Asm_Input} attribute reference, or
25935 a list of such references enclosed in parentheses (technically an array
25936 aggregate of such references).
25938 The @code{Asm_Input} attribute denotes a function that takes two
25939 parameters. The first is a string, the second is an expression of the
25940 type designated by the prefix. The first (string) argument is required
25941 to be a static expression, and is the constraint for the parameter,
25942 (e.g., what kind of register is required). The second argument is the
25943 value to be used as the input argument. The possible values for the
25944 constraint are the same as those used in the RTL, and are dependent on
25945 the configuration file used to built the GCC back end.
25946 No support is provided for GNU C's symbolic names for input parameters.
25948 If there are no input operands, this argument may either be omitted, or
25949 explicitly given as @code{No_Input_Operands}. The fourth argument, not
25950 present in the above example, is a list of register names, called the
25951 @emph{clobber} argument. This argument, if given, must be a static string
25952 expression, and is a space or comma separated list of names of registers
25953 that must be considered destroyed as a result of the @code{Asm} call. If
25954 this argument is the null string (the default value), then the code
25955 generator assumes that no additional registers are destroyed.
25956 In addition to registers, the special clobbers @code{memory} and
25957 @code{cc} as described in the GNU C docs are both supported.
25959 The fifth argument, not present in the above example, called the
25960 @emph{volatile} argument, is by default @code{False}. It can be set to
25961 the literal value @code{True} to indicate to the code generator that all
25962 optimizations with respect to the instruction specified should be
25963 suppressed, and in particular an instruction that has outputs
25964 will still be generated, even if none of the outputs are
25965 used. See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
25966 for the full description.
25967 Generally it is strongly advisable to use Volatile for any ASM statement
25968 that is missing either input or output operands or to avoid unwanted
25969 optimizations. A warning is generated if this advice is not followed.
25971 No support is provided for GNU C's @code{asm goto} feature.
25973 The @code{Asm} subprograms may be used in two ways. First the procedure
25974 forms can be used anywhere a procedure call would be valid, and
25975 correspond to what the RM calls 'intrinsic' routines. Such calls can
25976 be used to intersperse machine instructions with other Ada statements.
25977 Second, the function forms, which return a dummy value of the limited
25978 private type @code{Asm_Insn}, can be used in code statements, and indeed
25979 this is the only context where such calls are allowed. Code statements
25980 appear as aggregates of the form:
25983 Asm_Insn'(Asm (...));
25984 Asm_Insn'(Asm_Volatile (...));
25987 In accordance with RM rules, such code statements are allowed only
25988 within subprograms whose entire body consists of such statements. It is
25989 not permissible to intermix such statements with other Ada statements.
25991 Typically the form using intrinsic procedure calls is more convenient
25992 and more flexible. The code statement form is provided to meet the RM
25993 suggestion that such a facility should be made available. The following
25994 is the exact syntax of the call to @code{Asm}. As usual, if named notation
25995 is used, the arguments may be given in arbitrary order, following the
25996 normal rules for use of positional and named arguments:
26000 [Template =>] static_string_EXPRESSION
26001 [,[Outputs =>] OUTPUT_OPERAND_LIST ]
26002 [,[Inputs =>] INPUT_OPERAND_LIST ]
26003 [,[Clobber =>] static_string_EXPRESSION ]
26004 [,[Volatile =>] static_boolean_EXPRESSION] )
26006 OUTPUT_OPERAND_LIST ::=
26007 [PREFIX.]No_Output_Operands
26008 | OUTPUT_OPERAND_ATTRIBUTE
26009 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
26011 OUTPUT_OPERAND_ATTRIBUTE ::=
26012 SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
26014 INPUT_OPERAND_LIST ::=
26015 [PREFIX.]No_Input_Operands
26016 | INPUT_OPERAND_ATTRIBUTE
26017 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
26019 INPUT_OPERAND_ATTRIBUTE ::=
26020 SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
26023 The identifiers @code{No_Input_Operands} and @code{No_Output_Operands}
26024 are declared in the package @code{Machine_Code} and must be referenced
26025 according to normal visibility rules. In particular if there is no
26026 @code{use} clause for this package, then appropriate package name
26027 qualification is required.
26029 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
26030 @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}
26031 @section GNAT Implementation of Tasking
26034 This chapter outlines the basic GNAT approach to tasking (in particular,
26035 a multi-layered library for portability) and discusses issues related
26036 to compliance with the Real-Time Systems Annex.
26039 * Mapping Ada Tasks onto the Underlying Kernel Threads::
26040 * Ensuring Compliance with the Real-Time Annex::
26041 * Support for Locking Policies::
26045 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
26046 @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}
26047 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
26050 GNAT's run-time support comprises two layers:
26056 GNARL (GNAT Run-time Layer)
26059 GNULL (GNAT Low-level Library)
26062 In GNAT, Ada's tasking services rely on a platform and OS independent
26063 layer known as GNARL. This code is responsible for implementing the
26064 correct semantics of Ada's task creation, rendezvous, protected
26067 GNARL decomposes Ada's tasking semantics into simpler lower level
26068 operations such as create a thread, set the priority of a thread,
26069 yield, create a lock, lock/unlock, etc. The spec for these low-level
26070 operations constitutes GNULLI, the GNULL Interface. This interface is
26071 directly inspired from the POSIX real-time API.
26073 If the underlying executive or OS implements the POSIX standard
26074 faithfully, the GNULL Interface maps as is to the services offered by
26075 the underlying kernel. Otherwise, some target dependent glue code maps
26076 the services offered by the underlying kernel to the semantics expected
26079 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
26080 key point is that each Ada task is mapped on a thread in the underlying
26081 kernel. For example, in the case of VxWorks, one Ada task = one VxWorks task.
26083 In addition Ada task priorities map onto the underlying thread priorities.
26084 Mapping Ada tasks onto the underlying kernel threads has several advantages:
26090 The underlying scheduler is used to schedule the Ada tasks. This
26091 makes Ada tasks as efficient as kernel threads from a scheduling
26095 Interaction with code written in C containing threads is eased
26096 since at the lowest level Ada tasks and C threads map onto the same
26097 underlying kernel concept.
26100 When an Ada task is blocked during I/O the remaining Ada tasks are
26104 On multiprocessor systems Ada tasks can execute in parallel.
26107 Some threads libraries offer a mechanism to fork a new process, with the
26108 child process duplicating the threads from the parent.
26110 support this functionality when the parent contains more than one task.
26112 @geindex Forking a new process
26114 @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
26115 @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}
26116 @subsection Ensuring Compliance with the Real-Time Annex
26119 @geindex Real-Time Systems Annex compliance
26121 Although mapping Ada tasks onto
26122 the underlying threads has significant advantages, it does create some
26123 complications when it comes to respecting the scheduling semantics
26124 specified in the real-time annex (Annex D).
26126 For instance the Annex D requirement for the @code{FIFO_Within_Priorities}
26127 scheduling policy states:
26131 @emph{When the active priority of a ready task that is not running
26132 changes, or the setting of its base priority takes effect, the
26133 task is removed from the ready queue for its old active priority
26134 and is added at the tail of the ready queue for its new active
26135 priority, except in the case where the active priority is lowered
26136 due to the loss of inherited priority, in which case the task is
26137 added at the head of the ready queue for its new active priority.}
26140 While most kernels do put tasks at the end of the priority queue when
26141 a task changes its priority, (which respects the main
26142 FIFO_Within_Priorities requirement), almost none keep a thread at the
26143 beginning of its priority queue when its priority drops from the loss
26144 of inherited priority.
26146 As a result most vendors have provided incomplete Annex D implementations.
26148 The GNAT run-time, has a nice cooperative solution to this problem
26149 which ensures that accurate FIFO_Within_Priorities semantics are
26152 The principle is as follows. When an Ada task T is about to start
26153 running, it checks whether some other Ada task R with the same
26154 priority as T has been suspended due to the loss of priority
26155 inheritance. If this is the case, T yields and is placed at the end of
26156 its priority queue. When R arrives at the front of the queue it
26159 Note that this simple scheme preserves the relative order of the tasks
26160 that were ready to execute in the priority queue where R has been
26163 @c Support_for_Locking_Policies
26165 @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
26166 @anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{41f}
26167 @subsection Support for Locking Policies
26170 This section specifies which policies specified by pragma Locking_Policy
26171 are supported on which platforms.
26173 GNAT supports the standard @code{Ceiling_Locking} policy, and the
26174 implementation defined @code{Inheritance_Locking} and
26175 @code{Concurrent_Readers_Locking} policies.
26177 @code{Ceiling_Locking} is supported on all platforms if the operating system
26178 supports it. In particular, @code{Ceiling_Locking} is not supported on
26180 @code{Inheritance_Locking} is supported on
26185 @code{Concurrent_Readers_Locking} is supported on Linux.
26187 Notes about @code{Ceiling_Locking} on Linux:
26188 If the process is running as 'root', ceiling locking is used.
26189 If the capabilities facility is installed
26190 ("sudo apt-get --assume-yes install libcap-dev" on Ubuntu,
26192 and the program is linked against that library
26194 and the executable file has the cap_sys_nice capability
26195 ("sudo /sbin/setcap cap_sys_nice=ep executable_file_name"),
26196 then ceiling locking is used.
26197 Otherwise, the @code{Ceiling_Locking} policy is ignored.
26199 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
26200 @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}
26201 @section GNAT Implementation of Shared Passive Packages
26204 @geindex Shared passive packages
26206 GNAT fully implements the
26207 @geindex pragma Shared_Passive
26209 @code{Shared_Passive} for
26210 the purpose of designating shared passive packages.
26211 This allows the use of passive partitions in the
26212 context described in the Ada Reference Manual; i.e., for communication
26213 between separate partitions of a distributed application using the
26214 features in Annex E.
26218 @geindex Distribution Systems Annex
26220 However, the implementation approach used by GNAT provides for more
26221 extensive usage as follows:
26226 @item @emph{Communication between separate programs}
26228 This allows separate programs to access the data in passive
26229 partitions, using protected objects for synchronization where
26230 needed. The only requirement is that the two programs have a
26231 common shared file system. It is even possible for programs
26232 running on different machines with different architectures
26233 (e.g., different endianness) to communicate via the data in
26234 a passive partition.
26236 @item @emph{Persistence between program runs}
26238 The data in a passive package can persist from one run of a
26239 program to another, so that a later program sees the final
26240 values stored by a previous run of the same program.
26243 The implementation approach used is to store the data in files. A
26244 separate stream file is created for each object in the package, and
26245 an access to an object causes the corresponding file to be read or
26248 @geindex SHARED_MEMORY_DIRECTORY environment variable
26250 The environment variable @code{SHARED_MEMORY_DIRECTORY} should be
26251 set to the directory to be used for these files.
26252 The files in this directory
26253 have names that correspond to their fully qualified names. For
26254 example, if we have the package
26258 pragma Shared_Passive (X);
26264 and the environment variable is set to @code{/stemp/}, then the files created
26265 will have the names:
26272 These files are created when a value is initially written to the object, and
26273 the files are retained until manually deleted. This provides the persistence
26274 semantics. If no file exists, it means that no partition has assigned a value
26275 to the variable; in this case the initial value declared in the package
26276 will be used. This model ensures that there are no issues in synchronizing
26277 the elaboration process, since elaboration of passive packages elaborates the
26278 initial values, but does not create the files.
26280 The files are written using normal @code{Stream_IO} access.
26281 If you want to be able
26282 to communicate between programs or partitions running on different
26283 architectures, then you should use the XDR versions of the stream attribute
26284 routines, since these are architecture independent.
26286 If active synchronization is required for access to the variables in the
26287 shared passive package, then as described in the Ada Reference Manual, the
26288 package may contain protected objects used for this purpose. In this case
26289 a lock file (whose name is @code{___lock} (three underscores)
26290 is created in the shared memory directory.
26292 @geindex ___lock file (for shared passive packages)
26294 This is used to provide the required locking
26295 semantics for proper protected object synchronization.
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
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.
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.
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::
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
26333 For the declarations:
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);
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:
26344 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
26345 Cr3 : constant One_Dim := (others => 7777);
26348 The same is true for multidimensional constant arrays such as:
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));
26355 The same is true for arrays of one-dimensional arrays: the following are
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
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:
26371 Zero1: constant two_dim := (1..3 => (1..3 => 0));
26372 Zero2: constant two_dim := (others => (others => 0));
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
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:
26386 type One_Unc is array (natural range <>) of integer;
26387 Cr_Unc : constant One_Unc := (12,24,36);
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
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
26401 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
26402 Cr_Var2 : One_Dim := (others > -1);
26405 generate the equivalent of
26413 for I in Cr_Var2'range loop
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
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.
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
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:
26443 This cannot be converted into:
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:
26459 The bounds of the aggregate are static, and the associations are static.
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.
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.
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
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
26481 type Size is range 1..100;
26483 type Rec (D : Size := 15) is record
26484 Name : String (1..D);
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
26497 Word := (3, "yes");
26499 Word := (5, "maybe");
26501 Word := (5, "no"); -- raises Constraint_Error
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
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.
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
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
26528 type Rec (D : Positive := 15) is record
26529 Name : String (1..D);
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
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}
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,
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
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).
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}).
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.
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
26583 @geindex Ada 2012 implementation status
26585 @geindex -gnat12 option (gcc)
26587 @geindex pragma Ada_2012
26589 @geindex configuration pragma Ada_2012
26591 @geindex Ada_2012 configuration pragma
26593 This chapter contains a complete list of Ada 2012 features that have been
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.
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.
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.
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.
26619 A complete description of the AIs may be found in
26620 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
26622 @geindex AI-0176 (Ada 2012 feature)
26628 @emph{AI-0176 Quantified expressions (2010-09-29)}
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.
26634 RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0)
26637 @geindex AI-0079 (Ada 2012 feature)
26643 @emph{AI-0079 Allow other_format characters in source (2010-07-10)}
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.
26648 RM References: 2.01 (4/2) 2.02 (7)
26651 @geindex AI-0091 (Ada 2012 feature)
26657 @emph{AI-0091 Do not allow other_format in identifiers (0000-00-00)}
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.
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)
26667 @geindex AI-0100 (Ada 2012 feature)
26673 @emph{AI-0100 Placement of pragmas (2010-07-01)}
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.
26679 RM References: 2.08 (7)
26682 @geindex AI-0163 (Ada 2012 feature)
26688 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
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.
26693 RM References: 2.08 (7) 2.08 (16)
26696 @geindex AI-0080 (Ada 2012 feature)
26702 @emph{AI-0080 'View of' not needed if clear from context (0000-00-00)}
26704 This is an editorial change only, described as non-testable in the AI.
26706 RM References: 3.01 (7)
26709 @geindex AI-0183 (Ada 2012 feature)
26715 @emph{AI-0183 Aspect specifications (2010-08-16)}
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)
26724 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx}
26769 @code{Atomic_Components}
26781 @code{Component_Size}
26787 @code{Contract_Cases}
26795 @code{Discard_Names}
26801 @code{External_Tag}
26807 @code{Favor_Top_Level}
26821 @code{Inline_Always}
26837 @code{Machine_Radix}
26863 @code{Persistent_BSS}
26889 @code{Preelaborable_Initialization}
26895 @code{Pure_Function}
26903 @code{Remote_Access_Type}
26925 @code{Storage_Pool}
26931 @code{Storage_Size}
26949 @code{Suppress_Debug_Info}
26965 @code{Thread_Local_Storage}
26973 @code{Type_Invariant}
26979 @code{Unchecked_Union}
26985 @code{Universal_Aliasing}
27001 @code{Unreferenced}
27009 @code{Unreferenced_Objects}
27037 @code{Volatile_Components}
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).
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)
27067 @geindex AI-0128 (Ada 2012 feature)
27073 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
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.
27080 RM References: 3.02.03 (6) 6.06 (6)
27083 @geindex AI-0003 (Ada 2012 feature)
27089 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
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.
27095 RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3)
27099 @geindex AI-0120 (Ada 2012 feature)
27105 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
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
27112 RM References: 3.03 (21)
27115 @geindex AI-0008 (Ada 2012 feature)
27121 @emph{AI-0008 General access to constrained objects (0000-00-00)}
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.
27128 RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2)
27131 @geindex AI-0093 (Ada 2012 feature)
27137 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
27139 This is an editorial change only, to make more widespread use of the Ada 2012
27140 'immutably limited'.
27142 RM References: 3.03 (23.4/3)
27145 @geindex AI-0096 (Ada 2012 feature)
27151 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
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.
27159 RM References: 3.04 (5.1/2) 6.02 (7)
27162 @geindex AI-0181 (Ada 2012 feature)
27168 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
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.
27176 RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21)
27179 @geindex AI-0182 (Ada 2012 feature)
27185 @emph{AI-0182 Additional forms for} @code{Character'Value} @emph{(0000-00-00)}
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
27194 RM References: 3.05 (56/2)
27197 @geindex AI-0214 (Ada 2012 feature)
27203 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
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.
27210 RM References: 3.07 (9.1/2) 3.07.02 (3)
27213 @geindex AI-0102 (Ada 2012 feature)
27219 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
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.
27225 RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2)
27228 @geindex AI-0158 (Ada 2012 feature)
27234 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
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
27241 RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27)
27244 @geindex AI-0173 (Ada 2012 feature)
27250 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
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.
27255 RM References: 3.09 (7.4/2) 3.09 (12.4/2)
27258 @geindex AI-0076 (Ada 2012 feature)
27264 @emph{AI-0076 function with controlling result (0000-00-00)}
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.
27270 RM References: 3.09.02 (2/2)
27273 @geindex AI-0126 (Ada 2012 feature)
27279 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
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.
27286 RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2)
27289 @geindex AI-0097 (Ada 2012 feature)
27295 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
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.
27302 RM References: 3.09.03 (4/2)
27305 @geindex AI-0203 (Ada 2012 feature)
27311 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
27313 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
27314 permitted such usage.
27316 RM References: 3.09.03 (8/3)
27319 @geindex AI-0198 (Ada 2012 feature)
27325 @emph{AI-0198 Inheriting abstract operators (0000-00-00)}
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.
27332 RM References: 3.09.03 (4/3)
27335 @geindex AI-0073 (Ada 2012 feature)
27341 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
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.
27350 RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2)
27353 @geindex AI-0070 (Ada 2012 feature)
27359 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
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.
27364 RM References: 3.09.04 (18/2)
27367 @geindex AI-0208 (Ada 2012 feature)
27373 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
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.
27380 RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2)
27383 @geindex AI-0162 (Ada 2012 feature)
27389 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
27391 Incomplete types are made more useful by allowing them to be completed by
27392 private types and private extensions.
27394 RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2)
27397 @geindex AI-0098 (Ada 2012 feature)
27403 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
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.
27409 RM References: 3.10.01 (6) 3.10.01 (9.2/2)
27412 @geindex AI-0199 (Ada 2012 feature)
27418 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
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
27424 RM References: 4.03.01 (16)
27427 @geindex AI-0220 (Ada 2012 feature)
27433 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
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.
27439 RM References: 4.03.01 (17)
27442 @geindex AI-0147 (Ada 2012 feature)
27448 @emph{AI-0147 Conditional expressions (2009-03-29)}
27450 Conditional expressions are permitted. The form of such an expression is:
27453 (if expr then expr @{elsif expr then expr@} [else expr])
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.
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)
27466 @geindex AI-0037 (Ada 2012 feature)
27472 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
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.
27480 RM References: 4.03.03 (29)
27483 @geindex AI-0123 (Ada 2012 feature)
27489 @emph{AI-0123 Composability of equality (2010-04-13)}
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.
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.
27505 RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24)
27509 @geindex AI-0088 (Ada 2012 feature)
27515 @emph{AI-0088 The value of exponentiation (0000-00-00)}
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.
27523 RM References: 4.05.06 (11)
27526 @geindex AI-0188 (Ada 2012 feature)
27532 @emph{AI-0188 Case expressions (2010-01-09)}
27534 Case expressions are permitted. This allows use of constructs such as:
27537 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
27540 RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33)
27543 @geindex AI-0104 (Ada 2012 feature)
27549 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
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.
27555 RM References: 4.08 (2)
27558 @geindex AI-0157 (Ada 2012 feature)
27564 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
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.
27571 RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17)
27574 @geindex AI-0179 (Ada 2012 feature)
27580 @emph{AI-0179 Statement not required after label (2010-04-10)}
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.
27587 RM References: 5.01 (2)
27590 @geindex AI-0139-2 (Ada 2012 feature)
27596 @emph{AI-0139-2 Syntactic sugar for iterators (2010-09-29)}
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}.
27602 RM References: 5.05
27605 @geindex AI-0134 (Ada 2012 feature)
27611 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
27613 For full conformance, the profiles of anonymous-access-to-subprogram
27614 parameters must match. GNAT has always enforced this rule.
27616 RM References: 6.03.01 (18)
27619 @geindex AI-0207 (Ada 2012 feature)
27625 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
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.
27631 RM References: 6.03.01 (16/2)
27634 @geindex AI-0046 (Ada 2012 feature)
27640 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
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}).
27645 RM References: 6.03.02 (18)
27648 @geindex AI-0118 (Ada 2012 feature)
27654 @emph{AI-0118 The association of parameter associations (0000-00-00)}
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.
27659 RM References: 6.04.01 (2) 12.03 (9)
27662 @geindex AI-0196 (Ada 2012 feature)
27668 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
27670 Null exclusion checks are not made for @code{out} parameters when
27671 evaluating the actual parameters. GNAT has never generated these checks.
27673 RM References: 6.04.01 (13)
27676 @geindex AI-0015 (Ada 2012 feature)
27682 @emph{AI-0015 Constant return objects (0000-00-00)}
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.
27687 RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2)
27691 @geindex AI-0032 (Ada 2012 feature)
27697 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
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.
27705 RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2)
27709 @geindex AI-0103 (Ada 2012 feature)
27715 @emph{AI-0103 Static matching for extended return (2010-07-23)}
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.
27721 RM References: 6.05 (5.2/2)
27724 @geindex AI-0058 (Ada 2012 feature)
27730 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
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.
27736 RM References: 6.05 (22/2)
27739 @geindex AI-0050 (Ada 2012 feature)
27745 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
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.
27752 RM References: 6.05 (24/2)
27755 @geindex AI-0125 (Ada 2012 feature)
27761 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
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.
27767 RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2)
27770 @geindex AI-0062 (Ada 2012 feature)
27776 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
27778 A full constant may have a null exclusion even if its associated deferred
27779 constant does not. GNAT has always allowed this.
27781 RM References: 7.04 (6/2) 7.04 (7.1/2)
27784 @geindex AI-0178 (Ada 2012 feature)
27790 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
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.
27795 RM References: 7.05 (3/2) 7.05 (6/2)
27798 @geindex AI-0087 (Ada 2012 feature)
27804 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
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.
27810 RM References: 7.05 (5/2) 12.05.01 (5.1/2)
27813 @geindex AI-0099 (Ada 2012 feature)
27819 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
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{'}.
27826 RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2)
27829 @geindex AI-0064 (Ada 2012 feature)
27835 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
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.
27840 RM References: 7.06.01 (17.1/1)
27843 @geindex AI-0026 (Ada 2012 feature)
27849 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
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.
27859 RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2)
27862 @geindex AI-0205 (Ada 2012 feature)
27868 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
27870 This AI corrects a simple omission in the RM. Return objects have always
27871 been visible within an extended return statement.
27873 RM References: 8.03 (17)
27876 @geindex AI-0042 (Ada 2012 feature)
27882 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
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
27890 RM References: 9.01 (9.2/2) 9.04 (11.1/2)
27893 @geindex AI-0030 (Ada 2012 feature)
27899 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
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.
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)
27912 @geindex AI-0201 (Ada 2012 feature)
27918 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
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.
27928 RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2)
27931 @geindex AI-0009 (Ada 2012 feature)
27937 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
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.
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)
27948 @geindex AI-0072 (Ada 2012 feature)
27954 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
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.
27960 RM References: 9.10 (6.1/1)
27963 @geindex AI-0108 (Ada 2012 feature)
27969 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
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.
27974 RM References: 10.01.01 (12.3/2)
27977 @geindex AI-0129 (Ada 2012 feature)
27983 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
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.
27991 RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2)
27994 @geindex AI-0077 (Ada 2012 feature)
28000 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
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.
28007 RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2)
28010 @geindex AI-0122 (Ada 2012 feature)
28016 @emph{AI-0122 Private with and children of generics (0000-00-00)}
28018 This AI clarifies the visibility of private children of generic units within
28019 instantiations of a parent. GNAT has always handled this correctly.
28021 RM References: 10.01.02 (12/2)
28024 @geindex AI-0040 (Ada 2012 feature)
28030 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
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.
28035 RM References: 10.01.02 (20/2)
28038 @geindex AI-0132 (Ada 2012 feature)
28044 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
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.
28050 RM References: 10.01.05 (7)
28053 @geindex AI-0034 (Ada 2012 feature)
28059 @emph{AI-0034 Categorization of limited views (0000-00-00)}
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.
28065 RM References: 10.02.01 (11/1) 10.02.01 (17/2)
28068 @geindex AI-0035 (Ada 2012 feature)
28074 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
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.
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)
28085 @geindex AI-0219 (Ada 2012 feature)
28091 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
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.
28097 RM References: 10.02.01 (18/2)
28100 @geindex AI-0043 (Ada 2012 feature)
28106 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
28108 This AI covers various omissions in the RM regarding the raising of
28109 exceptions. GNAT has always implemented the intended semantics.
28111 RM References: 11.04.01 (10.1/2) 11 (2)
28114 @geindex AI-0200 (Ada 2012 feature)
28120 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
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.
28125 RM References: 12.07 (16)
28128 @geindex AI-0112 (Ada 2012 feature)
28134 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
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.
28143 RM References: 13.01 (8)
28146 @geindex AI-0106 (Ada 2012 feature)
28152 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
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.
28157 RM References: 13.01 (9.1/1)
28160 @geindex AI-0012 (Ada 2012 feature)
28166 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
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
28173 RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21)
28176 @geindex AI-0039 (Ada 2012 feature)
28182 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
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.
28188 RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2)
28191 @geindex AI-0095 (Ada 2012 feature)
28197 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
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
28204 RM References: 13.03 (11/1)
28207 @geindex AI-0116 (Ada 2012 feature)
28213 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
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
28219 RM References: 13.03 (29) 13.11 (16)
28222 @geindex AI-0146 (Ada 2012 feature)
28228 @emph{AI-0146 Type invariants (2009-09-21)}
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}.
28243 RM References: 13.03.03 (00)
28246 @geindex AI-0078 (Ada 2012 feature)
28252 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
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).
28259 RM References: 13.09 (7)
28262 @geindex AI-0195 (Ada 2012 feature)
28268 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
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.
28279 RM References: 13.09.01 (10)
28282 @geindex AI-0193 (Ada 2012 feature)
28288 @emph{AI-0193 Alignment of allocators (2010-09-16)}
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
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)
28298 @geindex AI-0177 (Ada 2012 feature)
28304 @emph{AI-0177 Parameterized expressions (2010-07-10)}
28306 The new Ada 2012 notion of parameterized expressions is implemented. The form
28310 function-specification is (expression)
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.
28317 RM References: 13.11.01 (3/2)
28320 @geindex AI-0033 (Ada 2012 feature)
28326 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
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.
28331 RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2)
28334 @geindex AI-0161 (Ada 2012 feature)
28340 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
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.
28347 RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2)
28350 @geindex AI-0194 (Ada 2012 feature)
28356 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
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.
28364 RM References: 13.13.02 (1.2/2)
28367 @geindex AI-0109 (Ada 2012 feature)
28373 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
28375 This AI is an editorial change only. It removes the need for a tag check
28376 that can never fail.
28378 RM References: 13.13.02 (34/2)
28381 @geindex AI-0007 (Ada 2012 feature)
28387 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
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.
28393 RM References: 13.13.02 (50/2) 13.13.02 (51/2)
28396 @geindex AI-0065 (Ada 2012 feature)
28402 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
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.
28408 RM References: 13.13.02 (52/2)
28411 @geindex AI-0019 (Ada 2012 feature)
28417 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
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.
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)
28427 @geindex AI-0017 (Ada 2012 feature)
28433 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
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.
28439 RM References: 13.14 (3/1)
28442 @geindex AI-0060 (Ada 2012 feature)
28448 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
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.
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)
28457 @geindex AI-0114 (Ada 2012 feature)
28463 @emph{AI-0114 Classification of letters (0000-00-00)}
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.
28473 RM References: A.03.02 (59) A.04.06 (7)
28476 @geindex AI-0185 (Ada 2012 feature)
28482 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
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}.
28490 RM References: A.03.05 (0) A.03.06 (0)
28493 @geindex AI-0031 (Ada 2012 feature)
28499 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
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.
28509 RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51)
28513 @geindex AI-0056 (Ada 2012 feature)
28519 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
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.
28527 RM References: A.04.03 (56.2/2) A.04.03 (58.5/2)
28530 @geindex AI-0137 (Ada 2012 feature)
28536 @emph{AI-0137 String encoding package (2010-03-25)}
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}).
28553 RM References: A.04.11
28556 @geindex AI-0038 (Ada 2012 feature)
28562 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
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.
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)
28571 @geindex AI-0044 (Ada 2012 feature)
28577 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
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.
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)
28586 @geindex AI-0127 (Ada 2012 feature)
28592 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
28594 This package provides an interface for identifying the current locale.
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
28600 @geindex AI-0002 (Ada 2012 feature)
28606 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
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
28615 RM References: B.01 (17) B.03 (62) B.03 (71.1/2)
28618 @geindex AI05-0216 (Ada 2012 feature)
28624 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
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.
28632 RM References: D.07 (3/3)
28635 @geindex AI-0211 (Ada 2012 feature)
28641 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
28643 The restriction @code{No_Relative_Delays} forbids any calls to the subprogram
28644 @code{Ada.Real_Time.Timing_Events.Set_Handler}.
28646 RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2)
28649 @geindex AI-0190 (Ada 2012 feature)
28655 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
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
28664 RM References: D.07 (8)
28667 @geindex AI-0189 (Ada 2012 feature)
28673 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
28675 This AI introduces a new restriction @code{No_Allocators_After_Elaboration},
28676 which says that no dynamic allocation will occur once elaboration is
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
28683 RM References: D.07 (19.1/2) H.04 (23.3/2)
28686 @geindex AI-0171 (Ada 2012 feature)
28692 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
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.
28699 RM References: D.13.01 (4/2) D.16
28702 @geindex AI-0210 (Ada 2012 feature)
28708 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
28710 This is a documentation only issue regarding wording of metric requirements,
28711 that does not affect the implementation of the compiler.
28713 RM References: D.15 (24/2)
28716 @geindex AI-0206 (Ada 2012 feature)
28722 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
28724 Remote types packages are now allowed to depend on preelaborated packages.
28725 This was formerly considered illegal.
28727 RM References: E.02.02 (6)
28730 @geindex AI-0152 (Ada 2012 feature)
28736 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
28738 Restriction @code{No_Anonymous_Allocators} prevents the use of allocators
28739 where the type of the returned value is an anonymous access type.
28741 RM References: H.04 (8/1)
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
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.
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.
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
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.
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
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.
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
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.
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
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.
28808 pragma Task_Info (EXPRESSION);
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
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})
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.
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
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.
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::
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
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
28863 type F1 is delta 1.0 range -128.0 .. +128.0;
28866 then the implementation is allowed to choose -128.0 .. +127.0 if it
28867 likes, but is not required to do so.
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.
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.
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:
28886 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
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:
28895 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
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
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:
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,
28915 those that will narrow only if forced to by a @code{'Size} clause, and
28918 those that will never narrow.
28921 Now if we are language theoreticians, we can imagine a fourth
28922 approach: to narrow all the time, e.g. to treat
28925 type F3 is delta 1.0 range -10.0 .. +23.0;
28928 as though it had been written:
28931 type F3 is delta 1.0 range -9.0 .. +22.0;
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.
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:
28944 My_Small : constant := 2.0**(-15);
28945 My_First : constant := -1.0;
28946 My_Last : constant := +1.0 - My_Small;
28948 type F2 is delta My_Small range My_First .. My_Last;
28954 for F2'Small use my_Small;
28955 for F2'Size use 16;
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
28964 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
28965 Test2 : constant := 1 / Boolean'Pos (F2'Last = My_Last);
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.
28972 If you follow this scheme you will be guaranteed that your fixed-point
28973 types will be portable.
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
28980 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
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.
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.
28993 following subsections treat the most likely issues to be encountered.
28996 * Legal Ada 83 programs that are illegal in Ada 95::
28997 * More deterministic semantics::
28998 * Changed semantics::
28999 * Other language compatibility issues::
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
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:
29015 @emph{Character literals}
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.
29023 for Char in 'A' .. 'Z' loop ... end loop;
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.:
29031 for Char in Character range 'A' .. 'Z' loop ... end loop;
29035 @emph{New reserved words}
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.
29043 @emph{Freezing rules}
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.
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.
29057 @emph{Optional bodies for library packages}
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.
29074 @emph{Numeric_Error is the same exception as Constraint_Error}
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).
29083 @emph{Indefinite subtypes in generics}
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.
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
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.
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.
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
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.
29151 @emph{Range of type `@w{`}Character`@w{`}}
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.
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
29182 @emph{-gnat83} switch
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}.
29195 Support for removed Ada 83 pragmas and attributes
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.
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
29211 @geindex Compatibility between Ada 95 and Ada 2005
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}.
29223 @emph{New reserved words.}
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
29231 @emph{New declarations in predefined packages.}
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.
29243 @emph{Access parameters.}
29245 A nondispatching subprogram with an access parameter cannot be renamed
29246 as a dispatching operation. This was permitted in Ada 95.
29249 @emph{Access types, discriminants, and constraints.}
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.
29255 @emph{Aggregates for limited types.}
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.
29262 @emph{Fixed-point multiplication and division.}
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,
29267 The ambiguity may be resolved either by applying a type conversion to the
29268 expression, or by explicitly invoking the operation from package
29272 @emph{Return-by-reference types.}
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.
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
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.
29293 * Implementation-defined pragmas::
29294 * Implementation-defined attributes::
29296 * Elaboration order::
29297 * Target-specific aspects::
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
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
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.
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
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
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
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:
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
29355 If the source code for the specs but not the bodies are
29356 available, then you can reimplement the bodies.
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.
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
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:
29390 Modify the program to eliminate the circularities, e.g., by moving
29391 elaboration-time code into explicitly-invoked procedures
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).
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
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}.
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
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.)
29437 @emph{Ada 83 Pragmas and Attributes}
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.
29446 @emph{Specialized Needs Annexes}
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.
29454 @emph{Representation Clauses}
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.
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
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.
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.
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.
29486 @emph{Implicit Packing}
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.
29502 @emph{Meaning of Size Attribute}
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.
29515 @emph{Size of Access Types}
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.
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:
29534 type X is access all String;
29535 for X'Size use Standard'Address_Size;
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.
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.
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
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.
29568 @emph{Default floating-point representation}
29570 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
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.
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
29589 Version 1.3, 3 November 2008
29591 Copyright 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc
29592 @indicateurl{http://fsf.org/}
29594 Everyone is permitted to copy and distribute verbatim copies of this
29595 license document, but changing it is not allowed.
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.
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.
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.
29620 @strong{1. APPLICABILITY AND DEFINITIONS}
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.
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.
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
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.
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.
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}.
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.
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.
29691 The "@strong{publisher}" means any person or entity that distributes
29692 copies of the Document to the public.
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.
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.
29710 @strong{2. VERBATIM COPYING}
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.
29722 You may also lend copies, under the same conditions stated above, and
29723 you may publicly display copies.
29725 @strong{3. COPYING IN QUANTITY}
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.
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
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.
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.
29762 @strong{4. MODIFICATIONS}
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:
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.
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.
29789 State on the Title page the name of the publisher of the
29790 Modified Version, as the publisher.
29793 Preserve all the copyright notices of the Document.
29796 Add an appropriate copyright notice for your modifications
29797 adjacent to the other copyright notices.
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.
29805 Preserve in that license notice the full lists of Invariant Sections
29806 and required Cover Texts given in the Document's license notice.
29809 Include an unaltered copy of this License.
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.
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.
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.
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.
29841 Delete any section Entitled "Endorsements". Such a section
29842 may not be included in the Modified Version.
29845 Do not retitle any existing section to be Entitled "Endorsements"
29846 or to conflict in title with any Invariant Section.
29849 Preserve any Warranty Disclaimers.
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.
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
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.
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.
29879 @strong{5. COMBINING DOCUMENTS}
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.
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.
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".
29903 @strong{6. COLLECTIONS OF DOCUMENTS}
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.
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.
29916 @strong{7. AGGREGATION WITH INDEPENDENT WORKS}
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.
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
29935 @strong{8. TRANSLATION}
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.
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
29955 @strong{9. TERMINATION}
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.
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.
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.
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.
29982 @strong{10. FUTURE REVISIONS OF THIS LICENSE}
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/}.
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
30003 @strong{11. RELICENSING}
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
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.
30019 "Incorporate" means to publish or republish a Document, in whole or
30020 in part, as part of another Document.
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.
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.
30032 @strong{ADDENDUM: How to use this License for your documents}
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:
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".
30049 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
30050 replace the "with ... Texts." line with this:
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.
30058 If you have Invariant Sections without Cover Texts, or some other
30059 combination of the three, merge those two alternatives to suit the
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.
30067 @node Index,,GNU Free Documentation License,Top