1 \input texinfo @c -*-texinfo-*-
3 @setfilename gnat_rm.info
4 @documentencoding UTF-8
6 @*Generated by Sphinx 5.1.1.@*
8 @settitle GNAT Reference Manual
13 @dircategory GNU Ada Tools
15 * gnat_rm: (gnat_rm.info). gnat_rm
22 GNAT Reference Manual , Aug 25, 2022
26 Copyright @copyright{} 2008-2022, Free Software Foundation
32 @title GNAT Reference Manual
37 @c %** start of user preamble
39 @c %** end of user preamble
43 @top GNAT Reference Manual
48 @anchor{gnat_rm doc}@anchor{0}
49 `GNAT, The GNU Ada Development Environment'
52 @include gcc-common.texi
53 GCC version @value{version-GCC}@*
56 Permission is granted to copy, distribute and/or modify this document
57 under the terms of the GNU Free Documentation License, Version 1.3 or
58 any later version published by the Free Software Foundation; with no
59 Invariant Sections, with the Front-Cover Texts being “GNAT Reference
60 Manual”, and with no Back-Cover Texts. A copy of the license is
61 included in the section entitled @ref{1,,GNU Free Documentation License}.
65 * Implementation Defined Pragmas::
66 * Implementation Defined Aspects::
67 * Implementation Defined Attributes::
68 * Standard and Implementation Defined Restrictions::
69 * Implementation Advice::
70 * Implementation Defined Characteristics::
71 * Intrinsic Subprograms::
72 * Representation Clauses and Pragmas::
73 * Standard Library Routines::
74 * The Implementation of Standard I/O::
76 * Interfacing to Other Languages::
77 * Specialized Needs Annexes::
78 * Implementation of Specific Ada Features::
79 * Implementation of Ada 2012 Features::
80 * Security Hardening Features::
81 * Obsolescent Features::
82 * Compatibility and Porting Guide::
83 * GNU Free Documentation License::
87 --- The Detailed Node Listing ---
91 * What This Reference Manual Contains::
93 * Related Information::
95 Implementation Defined Pragmas
97 * Pragma Abort_Defer::
98 * Pragma Abstract_State::
106 * Pragma Aggregate_Individually_Assign::
107 * Pragma Allow_Integer_Address::
110 * Pragma Assert_And_Cut::
111 * Pragma Assertion_Policy::
113 * Pragma Assume_No_Invalid_Values::
114 * Pragma Async_Readers::
115 * Pragma Async_Writers::
116 * Pragma Attribute_Definition::
117 * Pragma C_Pass_By_Copy::
119 * Pragma Check_Float_Overflow::
120 * Pragma Check_Name::
121 * Pragma Check_Policy::
123 * Pragma Common_Object::
124 * Pragma Compile_Time_Error::
125 * Pragma Compile_Time_Warning::
126 * Pragma Complete_Representation::
127 * Pragma Complex_Representation::
128 * Pragma Component_Alignment::
129 * Pragma Constant_After_Elaboration::
130 * Pragma Contract_Cases::
131 * Pragma Convention_Identifier::
133 * Pragma CPP_Constructor::
134 * Pragma CPP_Virtual::
135 * Pragma CPP_Vtable::
137 * Pragma Deadline_Floor::
138 * Pragma Default_Initial_Condition::
140 * Pragma Debug_Policy::
141 * Pragma Default_Scalar_Storage_Order::
142 * Pragma Default_Storage_Pool::
144 * Pragma Detect_Blocking::
145 * Pragma Disable_Atomic_Synchronization::
146 * Pragma Dispatching_Domain::
147 * Pragma Effective_Reads::
148 * Pragma Effective_Writes::
149 * Pragma Elaboration_Checks::
151 * Pragma Enable_Atomic_Synchronization::
152 * Pragma Export_Function::
153 * Pragma Export_Object::
154 * Pragma Export_Procedure::
155 * Pragma Export_Valued_Procedure::
156 * Pragma Extend_System::
157 * Pragma Extensions_Allowed::
158 * Pragma Extensions_Visible::
160 * Pragma External_Name_Casing::
162 * Pragma Favor_Top_Level::
163 * Pragma Finalize_Storage_Only::
164 * Pragma Float_Representation::
168 * Pragma Ignore_Pragma::
169 * Pragma Implementation_Defined::
170 * Pragma Implemented::
171 * Pragma Implicit_Packing::
172 * Pragma Import_Function::
173 * Pragma Import_Object::
174 * Pragma Import_Procedure::
175 * Pragma Import_Valued_Procedure::
176 * Pragma Independent::
177 * Pragma Independent_Components::
178 * Pragma Initial_Condition::
179 * Pragma Initialize_Scalars::
180 * Pragma Initializes::
181 * Pragma Inline_Always::
182 * Pragma Inline_Generic::
184 * Pragma Interface_Name::
185 * Pragma Interrupt_Handler::
186 * Pragma Interrupt_State::
188 * Pragma Keep_Names::
191 * Pragma Linker_Alias::
192 * Pragma Linker_Constructor::
193 * Pragma Linker_Destructor::
194 * Pragma Linker_Section::
196 * Pragma Loop_Invariant::
197 * Pragma Loop_Optimize::
198 * Pragma Loop_Variant::
199 * Pragma Machine_Attribute::
201 * Pragma Main_Storage::
202 * Pragma Max_Queue_Length::
204 * Pragma No_Caching::
205 * Pragma No_Component_Reordering::
206 * Pragma No_Elaboration_Code_All::
207 * Pragma No_Heap_Finalization::
210 * Pragma No_Strict_Aliasing::
211 * Pragma No_Tagged_Streams::
212 * Pragma Normalize_Scalars::
213 * Pragma Obsolescent::
214 * Pragma Optimize_Alignment::
216 * Pragma Overflow_Mode::
217 * Pragma Overriding_Renamings::
218 * Pragma Partition_Elaboration_Policy::
221 * Pragma Persistent_BSS::
223 * Pragma Postcondition::
224 * Pragma Post_Class::
226 * Pragma Precondition::
228 * Pragma Predicate_Failure::
229 * Pragma Preelaborable_Initialization::
230 * Pragma Prefix_Exception_Messages::
232 * Pragma Priority_Specific_Dispatching::
234 * Pragma Profile_Warnings::
235 * Pragma Propagate_Exceptions::
236 * Pragma Provide_Shift_Operators::
237 * Pragma Psect_Object::
238 * Pragma Pure_Function::
241 * Pragma Refined_Depends::
242 * Pragma Refined_Global::
243 * Pragma Refined_Post::
244 * Pragma Refined_State::
245 * Pragma Relative_Deadline::
246 * Pragma Remote_Access_Type::
247 * Pragma Rename_Pragma::
248 * Pragma Restricted_Run_Time::
249 * Pragma Restriction_Warnings::
250 * Pragma Reviewable::
251 * Pragma Secondary_Stack_Size::
252 * Pragma Share_Generic::
254 * Pragma Short_Circuit_And_Or::
255 * Pragma Short_Descriptors::
256 * Pragma Simple_Storage_Pool_Type::
257 * Pragma Source_File_Name::
258 * Pragma Source_File_Name_Project::
259 * Pragma Source_Reference::
260 * Pragma SPARK_Mode::
261 * Pragma Static_Elaboration_Desired::
262 * Pragma Stream_Convert::
263 * Pragma Style_Checks::
266 * Pragma Suppress_All::
267 * Pragma Suppress_Debug_Info::
268 * Pragma Suppress_Exception_Locations::
269 * Pragma Suppress_Initialization::
271 * Pragma Task_Storage::
273 * Pragma Thread_Local_Storage::
274 * Pragma Time_Slice::
276 * Pragma Type_Invariant::
277 * Pragma Type_Invariant_Class::
278 * Pragma Unchecked_Union::
279 * Pragma Unevaluated_Use_Of_Old::
280 * Pragma Unimplemented_Unit::
281 * Pragma Universal_Aliasing::
282 * Pragma Unmodified::
283 * Pragma Unreferenced::
284 * Pragma Unreferenced_Objects::
285 * Pragma Unreserve_All_Interrupts::
286 * Pragma Unsuppress::
287 * Pragma Use_VADS_Size::
289 * Pragma Validity_Checks::
291 * Pragma Volatile_Full_Access::
292 * Pragma Volatile_Function::
293 * Pragma Warning_As_Error::
295 * Pragma Weak_External::
296 * Pragma Wide_Character_Encoding::
298 Implementation Defined Aspects
300 * Aspect Abstract_State::
302 * Aspect Async_Readers::
303 * Aspect Async_Writers::
304 * Aspect Constant_After_Elaboration::
305 * Aspect Contract_Cases::
307 * Aspect Default_Initial_Condition::
309 * Aspect Dimension_System::
310 * Aspect Disable_Controlled::
311 * Aspect Effective_Reads::
312 * Aspect Effective_Writes::
313 * Aspect Extensions_Visible::
314 * Aspect Favor_Top_Level::
317 * Aspect Initial_Condition::
318 * Aspect Initializes::
319 * Aspect Inline_Always::
321 * Aspect Invariant’Class::
323 * Aspect Linker_Section::
325 * Aspect Max_Queue_Length::
326 * Aspect No_Caching::
327 * Aspect No_Elaboration_Code_All::
329 * Aspect No_Tagged_Streams::
330 * Aspect No_Task_Parts::
331 * Aspect Object_Size::
332 * Aspect Obsolescent::
334 * Aspect Persistent_BSS::
336 * Aspect Pure_Function::
337 * Aspect Refined_Depends::
338 * Aspect Refined_Global::
339 * Aspect Refined_Post::
340 * Aspect Refined_State::
341 * Aspect Relaxed_Initialization::
342 * Aspect Remote_Access_Type::
343 * Aspect Secondary_Stack_Size::
344 * Aspect Scalar_Storage_Order::
346 * Aspect Simple_Storage_Pool::
347 * Aspect Simple_Storage_Pool_Type::
348 * Aspect SPARK_Mode::
349 * Aspect Suppress_Debug_Info::
350 * Aspect Suppress_Initialization::
352 * Aspect Thread_Local_Storage::
353 * Aspect Universal_Aliasing::
354 * Aspect Unmodified::
355 * Aspect Unreferenced::
356 * Aspect Unreferenced_Objects::
357 * Aspect Value_Size::
358 * Aspect Volatile_Full_Access::
359 * Aspect Volatile_Function::
362 Implementation Defined Attributes
364 * Attribute Abort_Signal::
365 * Attribute Address_Size::
366 * Attribute Asm_Input::
367 * Attribute Asm_Output::
368 * Attribute Atomic_Always_Lock_Free::
370 * Attribute Bit_Position::
371 * Attribute Code_Address::
372 * Attribute Compiler_Version::
373 * Attribute Constrained::
374 * Attribute Default_Bit_Order::
375 * Attribute Default_Scalar_Storage_Order::
377 * Attribute Descriptor_Size::
378 * Attribute Elaborated::
379 * Attribute Elab_Body::
380 * Attribute Elab_Spec::
381 * Attribute Elab_Subp_Body::
383 * Attribute Enabled::
384 * Attribute Enum_Rep::
385 * Attribute Enum_Val::
386 * Attribute Epsilon::
387 * Attribute Fast_Math::
388 * Attribute Finalization_Size::
389 * Attribute Fixed_Value::
390 * Attribute From_Any::
391 * Attribute Has_Access_Values::
392 * Attribute Has_Discriminants::
393 * Attribute Has_Tagged_Values::
395 * Attribute Initialized::
396 * Attribute Integer_Value::
397 * Attribute Invalid_Value::
398 * Attribute Iterable::
400 * Attribute Library_Level::
401 * Attribute Lock_Free::
402 * Attribute Loop_Entry::
403 * Attribute Machine_Size::
404 * Attribute Mantissa::
405 * Attribute Maximum_Alignment::
406 * Attribute Max_Integer_Size::
407 * Attribute Mechanism_Code::
408 * Attribute Null_Parameter::
409 * Attribute Object_Size::
411 * Attribute Passed_By_Reference::
412 * Attribute Pool_Address::
413 * Attribute Range_Length::
414 * Attribute Restriction_Set::
416 * Attribute Safe_Emax::
417 * Attribute Safe_Large::
418 * Attribute Safe_Small::
419 * Attribute Scalar_Storage_Order::
420 * Attribute Simple_Storage_Pool::
422 * Attribute Small_Denominator::
423 * Attribute Small_Numerator::
424 * Attribute Storage_Unit::
425 * Attribute Stub_Type::
426 * Attribute System_Allocator_Alignment::
427 * Attribute Target_Name::
428 * Attribute To_Address::
430 * Attribute Type_Class::
431 * Attribute Type_Key::
432 * Attribute TypeCode::
433 * Attribute Unconstrained_Array::
434 * Attribute Universal_Literal_String::
435 * Attribute Unrestricted_Access::
437 * Attribute Valid_Image::
438 * Attribute Valid_Scalars::
439 * Attribute VADS_Size::
440 * Attribute Value_Size::
441 * Attribute Wchar_T_Size::
442 * Attribute Word_Size::
444 Standard and Implementation Defined Restrictions
446 * Partition-Wide Restrictions::
447 * Program Unit Level Restrictions::
449 Partition-Wide Restrictions
451 * Immediate_Reclamation::
452 * Max_Asynchronous_Select_Nesting::
453 * Max_Entry_Queue_Length::
454 * Max_Protected_Entries::
455 * Max_Select_Alternatives::
456 * Max_Storage_At_Blocking::
459 * No_Abort_Statements::
460 * No_Access_Parameter_Allocators::
461 * No_Access_Subprograms::
463 * No_Anonymous_Allocators::
464 * No_Asynchronous_Control::
467 * No_Default_Initialization::
470 * No_Direct_Boolean_Operators::
472 * No_Dispatching_Calls::
473 * No_Dynamic_Attachment::
474 * No_Dynamic_Priorities::
475 * No_Entry_Calls_In_Elaboration_Code::
476 * No_Enumeration_Maps::
477 * No_Exception_Handlers::
478 * No_Exception_Propagation::
479 * No_Exception_Registration::
483 * No_Floating_Point::
484 * No_Implicit_Conditionals::
485 * No_Implicit_Dynamic_Code::
486 * No_Implicit_Heap_Allocations::
487 * No_Implicit_Protected_Object_Allocations::
488 * No_Implicit_Task_Allocations::
489 * No_Initialize_Scalars::
491 * No_Local_Allocators::
492 * No_Local_Protected_Objects::
493 * No_Local_Tagged_Types::
494 * No_Local_Timing_Events::
495 * No_Long_Long_Integers::
496 * No_Multiple_Elaboration::
497 * No_Nested_Finalization::
498 * No_Protected_Type_Allocators::
499 * No_Protected_Types::
502 * No_Relative_Delay::
503 * No_Requeue_Statements::
504 * No_Secondary_Stack::
505 * No_Select_Statements::
506 * No_Specific_Termination_Handlers::
507 * No_Specification_of_Aspect::
508 * No_Standard_Allocators_After_Elaboration::
509 * No_Standard_Storage_Pools::
510 * No_Stream_Optimizations::
512 * No_Tagged_Type_Registration::
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_Accessibility_Checks::
533 * No_Dynamic_Sized_Objects::
535 * No_Implementation_Aspect_Specifications::
536 * No_Implementation_Attributes::
537 * No_Implementation_Identifiers::
538 * No_Implementation_Pragmas::
539 * No_Implementation_Restrictions::
540 * No_Implementation_Units::
541 * No_Implicit_Aliasing::
542 * No_Implicit_Loops::
543 * No_Obsolescent_Features::
544 * No_Wide_Characters::
545 * Static_Dispatch_Tables::
548 Implementation Advice
550 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection.
551 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units.
552 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors.
553 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas.
554 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas.
555 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets.
556 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types.
557 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types.
558 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values.
559 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types.
560 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays.
561 * RM 9.6(30-31); Duration’Small: RM 9 6 30-31 Duration’Small.
562 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation.
563 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information.
564 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks.
565 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses.
566 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types.
567 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses.
568 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses.
569 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses.
570 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses.
571 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses.
572 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses.
573 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses.
574 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes.
575 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering.
576 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private.
577 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations.
578 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion.
579 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage.
580 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation.
581 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes.
582 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types.
583 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling.
584 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling.
585 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation.
586 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate.
587 * RM A.18; Containers: RM A 18 Containers.
588 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export.
589 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces.
590 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C.
591 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL.
592 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran.
593 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations.
594 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations.
595 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support.
596 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers.
597 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts.
598 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements.
599 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names.
600 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes.
601 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies.
602 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies.
603 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort.
604 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions.
605 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time.
606 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem.
607 * RM F(7); COBOL Support: RM F 7 COBOL Support.
608 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support.
609 * RM G; Numerics: RM G Numerics.
610 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types.
611 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions.
612 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements.
613 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy.
614 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy.
616 Intrinsic Subprograms
618 * Intrinsic Operators::
619 * Compilation_ISO_Date::
623 * Exception_Information::
624 * Exception_Message::
628 * Shifts and Rotates::
631 Representation Clauses and Pragmas
633 * Alignment Clauses::
635 * Storage_Size Clauses::
636 * Size of Variant Record Objects::
637 * Biased Representation::
638 * Value_Size and Object_Size Clauses::
639 * Component_Size Clauses::
640 * Bit_Order Clauses::
641 * Effect of Bit_Order on Byte Ordering::
642 * Pragma Pack for Arrays::
643 * Pragma Pack for Records::
644 * Record Representation Clauses::
645 * Handling of Records with Holes::
646 * Enumeration Clauses::
648 * Use of Address Clauses for Memory-Mapped I/O::
649 * Effect of Convention on Representation::
650 * Conventions and Anonymous Access Types::
651 * Determining the Representations chosen by GNAT::
653 The Implementation of Standard I/O
655 * Standard I/O Packages::
661 * Wide_Wide_Text_IO::
665 * Filenames encoding::
666 * File content encoding::
668 * Operations on C Streams::
669 * Interfacing to C Streams::
673 * Stream Pointer Positioning::
674 * Reading and Writing Non-Regular Files::
676 * Treating Text_IO Files as Streams::
677 * Text_IO Extensions::
678 * Text_IO Facilities for Unbounded Strings::
682 * Stream Pointer Positioning: Stream Pointer Positioning<2>.
683 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>.
687 * Stream Pointer Positioning: Stream Pointer Positioning<3>.
688 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>.
692 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads.
693 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads.
694 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads.
695 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads.
696 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads.
697 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads.
698 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads.
699 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads.
700 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads.
701 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads.
702 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads.
703 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads.
704 * Ada.Containers.Functional_Infinite_Sequences (a-cfinse.ads): Ada Containers Functional_Infinite_Sequences a-cfinse ads.
705 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads.
706 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads.
707 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads.
708 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads.
709 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads.
710 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads.
711 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads.
712 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads.
713 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads.
714 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads.
715 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads.
716 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads.
717 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads.
718 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
719 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
720 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
721 * Ada.Task_Initialization (a-tasini.ads): Ada Task_Initialization a-tasini ads.
722 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
723 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
724 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
725 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads.
726 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads.
727 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads.
728 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads.
729 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads.
730 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads.
731 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads.
732 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads.
733 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads.
734 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads.
735 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads.
736 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads.
737 * GNAT.Binary_Search (g-binsea.ads): GNAT Binary_Search g-binsea ads.
738 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads.
739 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads.
740 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads.
741 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads.
742 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads.
743 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads.
744 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads.
745 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads.
746 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads.
747 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads.
748 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads.
749 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads.
750 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads.
751 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads.
752 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads.
753 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads.
754 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads.
755 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads.
756 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads.
757 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads.
758 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads.
759 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads.
760 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads.
761 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads.
762 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads.
763 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads.
764 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads.
765 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads.
766 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads.
767 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads.
768 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads.
769 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads.
770 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads.
771 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads.
772 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads.
773 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads.
774 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads.
775 * GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads): GNAT Generic_Fast_Math_Functions g-gfmafu ads.
776 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads.
777 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads.
778 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads.
779 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads.
780 * GNAT.IO (g-io.ads): GNAT IO g-io ads.
781 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads.
782 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads.
783 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads.
784 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads.
785 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads.
786 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads.
787 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads.
788 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads.
789 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads.
790 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads.
791 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads.
792 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads.
793 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads.
794 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads.
795 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads.
796 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads.
797 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads.
798 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads.
799 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads.
800 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads.
801 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads.
802 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads.
803 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads.
804 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads.
805 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads.
806 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads.
807 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads.
808 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads.
809 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads.
810 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads.
811 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads.
812 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads.
813 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads.
814 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads.
815 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads.
816 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads.
817 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads.
818 * GNAT.Table (g-table.ads): GNAT Table g-table ads.
819 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads.
820 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads.
821 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads.
822 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads.
823 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads.
824 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads.
825 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads.
826 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads.
827 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads.
828 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads.
829 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads.
830 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads.
831 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads.
832 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads.
833 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads.
834 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads.
835 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads.
836 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads.
837 * System.Assertions (s-assert.ads): System Assertions s-assert ads.
838 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads.
839 * System.Memory (s-memory.ads): System Memory s-memory ads.
840 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads.
841 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads.
842 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads.
843 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads.
844 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads.
845 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads.
846 * System.Rident (s-rident.ads): System Rident s-rident ads.
847 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads.
848 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads.
849 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads.
850 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads.
852 Interfacing to Other Languages
855 * Interfacing to C++::
856 * Interfacing to COBOL::
857 * Interfacing to Fortran::
858 * Interfacing to non-GNAT Ada code::
860 Implementation of Specific Ada Features
862 * Machine Code Insertions::
863 * GNAT Implementation of Tasking::
864 * GNAT Implementation of Shared Passive Packages::
865 * Code Generation for Array Aggregates::
866 * The Size of Discriminated Records with Default Discriminants::
867 * Image Values For Nonscalar Types::
868 * Strict Conformance to the Ada Reference Manual::
870 GNAT Implementation of Tasking
872 * Mapping Ada Tasks onto the Underlying Kernel Threads::
873 * Ensuring Compliance with the Real-Time Annex::
874 * Support for Locking Policies::
876 Code Generation for Array Aggregates
878 * Static constant aggregates with static bounds::
879 * Constant aggregates with unconstrained nominal types::
880 * Aggregates with static bounds::
881 * Aggregates with nonstatic bounds::
882 * Aggregates in assignment statements::
884 Security Hardening Features
886 * Register Scrubbing::
888 * Hardened Conditionals::
889 * Hardened Booleans::
890 * Control Flow Redundancy::
894 * pragma No_Run_Time::
896 * pragma Restricted_Run_Time::
898 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads.
900 Compatibility and Porting Guide
902 * Writing Portable Fixed-Point Declarations::
903 * Compatibility with Ada 83::
904 * Compatibility between Ada 95 and Ada 2005::
905 * Implementation-dependent characteristics::
906 * Compatibility with Other Ada Systems::
907 * Representation Clauses::
908 * Compatibility with HP Ada 83::
910 Compatibility with Ada 83
912 * Legal Ada 83 programs that are illegal in Ada 95::
913 * More deterministic semantics::
914 * Changed semantics::
915 * Other language compatibility issues::
917 Implementation-dependent characteristics
919 * Implementation-defined pragmas::
920 * Implementation-defined attributes::
922 * Elaboration order::
923 * Target-specific aspects::
928 @node About This Guide,Implementation Defined Pragmas,Top,Top
929 @anchor{gnat_rm/about_this_guide doc}@anchor{2}@anchor{gnat_rm/about_this_guide about-this-guide}@anchor{3}@anchor{gnat_rm/about_this_guide gnat-reference-manual}@anchor{4}@anchor{gnat_rm/about_this_guide id1}@anchor{5}
930 @chapter About This Guide
934 This manual contains useful information in writing programs using the
935 GNAT compiler. It includes information on implementation dependent
936 characteristics of GNAT, including all the information required by
937 Annex M of the Ada language standard.
939 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
940 invoked in Ada 83 compatibility mode.
941 By default, GNAT assumes Ada 2012,
942 but you can override with a compiler switch
943 to explicitly specify the language version.
944 (Please refer to the `GNAT User’s Guide' for details on these switches.)
945 Throughout this manual, references to ‘Ada’ without a year suffix
946 apply to all the Ada versions of the language.
948 Ada is designed to be highly portable.
949 In general, a program will have the same effect even when compiled by
950 different compilers on different platforms.
951 However, since Ada is designed to be used in a
952 wide variety of applications, it also contains a number of system
953 dependent features to be used in interfacing to the external world.
955 @geindex Implementation-dependent features
959 Note: Any program that makes use of implementation-dependent features
960 may be non-portable. You should follow good programming practice and
961 isolate and clearly document any sections of your program that make use
962 of these features in a non-portable manner.
965 * What This Reference Manual Contains::
967 * Related Information::
971 @node What This Reference Manual Contains,Conventions,,About This Guide
972 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
973 @section What This Reference Manual Contains
976 This reference manual contains the following chapters:
982 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
983 pragmas, which can be used to extend and enhance the functionality of the
987 @ref{8,,Implementation Defined Attributes}, lists GNAT
988 implementation-dependent attributes, which can be used to extend and
989 enhance the functionality of the compiler.
992 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
993 implementation-dependent restrictions, which can be used to extend and
994 enhance the functionality of the compiler.
997 @ref{a,,Implementation Advice}, provides information on generally
998 desirable behavior which are not requirements that all compilers must
999 follow since it cannot be provided on all systems, or which may be
1000 undesirable on some systems.
1003 @ref{b,,Implementation Defined Characteristics}, provides a guide to
1004 minimizing implementation dependent features.
1007 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
1008 implemented by GNAT, and how they can be imported into user
1009 application programs.
1012 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
1013 way that GNAT represents data, and in particular the exact set
1014 of representation clauses and pragmas that is accepted.
1017 @ref{e,,Standard Library Routines}, provides a listing of packages and a
1018 brief description of the functionality that is provided by Ada’s
1019 extensive set of standard library routines as implemented by GNAT.
1022 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
1023 implementation of the input-output facilities.
1026 @ref{10,,The GNAT Library}, is a catalog of packages that complement
1027 the Ada predefined library.
1030 @ref{11,,Interfacing to Other Languages}, describes how programs
1031 written in Ada using GNAT can be interfaced to other programming
1035 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
1036 of the specialized needs annexes.
1039 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1040 to GNAT’s implementation of machine code insertions, tasking, and several
1044 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1045 GNAT implementation of the Ada 2012 language standard.
1048 @ref{15,,Security Hardening Features} documents GNAT extensions aimed
1049 at security hardening.
1052 @ref{16,,Obsolescent Features} documents implementation dependent features,
1053 including pragmas and attributes, which are considered obsolescent, since
1054 there are other preferred ways of achieving the same results. These
1055 obsolescent forms are retained for backwards compatibility.
1058 @ref{17,,Compatibility and Porting Guide} presents some guidelines for
1059 developing portable Ada code, describes the compatibility issues that
1060 may arise between GNAT and other Ada compilation systems (including those
1061 for Ada 83), and shows how GNAT can expedite porting applications
1062 developed in other Ada environments.
1065 @ref{1,,GNU Free Documentation License} contains the license for this document.
1068 @geindex Ada 95 Language Reference Manual
1070 @geindex Ada 2005 Language Reference Manual
1072 This reference manual assumes a basic familiarity with the Ada 95 language, as
1074 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1075 It does not require knowledge of the new features introduced by Ada 2005 or
1077 All three reference manuals are included in the GNAT documentation
1080 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1081 @anchor{gnat_rm/about_this_guide conventions}@anchor{18}
1082 @section Conventions
1085 @geindex Conventions
1086 @geindex typographical
1088 @geindex Typographical conventions
1090 Following are examples of the typographical and graphic conventions used
1097 @code{Functions}, @code{utility program names}, @code{standard names},
1113 [optional information or parameters]
1116 Examples are described by text
1119 and then shown this way.
1123 Commands that are entered by the user are shown as preceded by a prompt string
1124 comprising the @code{$} character followed by a space.
1127 @node Related Information,,Conventions,About This Guide
1128 @anchor{gnat_rm/about_this_guide related-information}@anchor{19}
1129 @section Related Information
1132 See the following documents for further information on GNAT:
1138 @cite{GNAT User’s Guide for Native Platforms},
1139 which provides information on how to use the
1140 GNAT development environment.
1143 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1146 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1147 of the Ada 95 standard. The annotations describe
1148 detailed aspects of the design decision, and in particular contain useful
1149 sections on Ada 83 compatibility.
1152 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1155 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1156 of the Ada 2005 standard. The annotations describe
1157 detailed aspects of the design decision.
1160 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1163 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1164 which contains specific information on compatibility between GNAT and
1168 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1169 describes in detail the pragmas and attributes provided by the DEC Ada 83
1173 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1174 @anchor{gnat_rm/implementation_defined_pragmas doc}@anchor{1a}@anchor{gnat_rm/implementation_defined_pragmas id1}@anchor{1b}@anchor{gnat_rm/implementation_defined_pragmas implementation-defined-pragmas}@anchor{7}
1175 @chapter Implementation Defined Pragmas
1178 Ada defines a set of pragmas that can be used to supply additional
1179 information to the compiler. These language defined pragmas are
1180 implemented in GNAT and work as described in the Ada Reference Manual.
1182 In addition, Ada allows implementations to define additional pragmas
1183 whose meaning is defined by the implementation. GNAT provides a number
1184 of these implementation-defined pragmas, which can be used to extend
1185 and enhance the functionality of the compiler. This section of the GNAT
1186 Reference Manual describes these additional pragmas.
1188 Note that any program using these pragmas might not be portable to other
1189 compilers (although GNAT implements this set of pragmas on all
1190 platforms). Therefore if portability to other compilers is an important
1191 consideration, the use of these pragmas should be minimized.
1194 * Pragma Abort_Defer::
1195 * Pragma Abstract_State::
1203 * Pragma Aggregate_Individually_Assign::
1204 * Pragma Allow_Integer_Address::
1207 * Pragma Assert_And_Cut::
1208 * Pragma Assertion_Policy::
1210 * Pragma Assume_No_Invalid_Values::
1211 * Pragma Async_Readers::
1212 * Pragma Async_Writers::
1213 * Pragma Attribute_Definition::
1214 * Pragma C_Pass_By_Copy::
1216 * Pragma Check_Float_Overflow::
1217 * Pragma Check_Name::
1218 * Pragma Check_Policy::
1220 * Pragma Common_Object::
1221 * Pragma Compile_Time_Error::
1222 * Pragma Compile_Time_Warning::
1223 * Pragma Complete_Representation::
1224 * Pragma Complex_Representation::
1225 * Pragma Component_Alignment::
1226 * Pragma Constant_After_Elaboration::
1227 * Pragma Contract_Cases::
1228 * Pragma Convention_Identifier::
1229 * Pragma CPP_Class::
1230 * Pragma CPP_Constructor::
1231 * Pragma CPP_Virtual::
1232 * Pragma CPP_Vtable::
1234 * Pragma Deadline_Floor::
1235 * Pragma Default_Initial_Condition::
1237 * Pragma Debug_Policy::
1238 * Pragma Default_Scalar_Storage_Order::
1239 * Pragma Default_Storage_Pool::
1241 * Pragma Detect_Blocking::
1242 * Pragma Disable_Atomic_Synchronization::
1243 * Pragma Dispatching_Domain::
1244 * Pragma Effective_Reads::
1245 * Pragma Effective_Writes::
1246 * Pragma Elaboration_Checks::
1247 * Pragma Eliminate::
1248 * Pragma Enable_Atomic_Synchronization::
1249 * Pragma Export_Function::
1250 * Pragma Export_Object::
1251 * Pragma Export_Procedure::
1252 * Pragma Export_Valued_Procedure::
1253 * Pragma Extend_System::
1254 * Pragma Extensions_Allowed::
1255 * Pragma Extensions_Visible::
1257 * Pragma External_Name_Casing::
1258 * Pragma Fast_Math::
1259 * Pragma Favor_Top_Level::
1260 * Pragma Finalize_Storage_Only::
1261 * Pragma Float_Representation::
1265 * Pragma Ignore_Pragma::
1266 * Pragma Implementation_Defined::
1267 * Pragma Implemented::
1268 * Pragma Implicit_Packing::
1269 * Pragma Import_Function::
1270 * Pragma Import_Object::
1271 * Pragma Import_Procedure::
1272 * Pragma Import_Valued_Procedure::
1273 * Pragma Independent::
1274 * Pragma Independent_Components::
1275 * Pragma Initial_Condition::
1276 * Pragma Initialize_Scalars::
1277 * Pragma Initializes::
1278 * Pragma Inline_Always::
1279 * Pragma Inline_Generic::
1280 * Pragma Interface::
1281 * Pragma Interface_Name::
1282 * Pragma Interrupt_Handler::
1283 * Pragma Interrupt_State::
1284 * Pragma Invariant::
1285 * Pragma Keep_Names::
1287 * Pragma Link_With::
1288 * Pragma Linker_Alias::
1289 * Pragma Linker_Constructor::
1290 * Pragma Linker_Destructor::
1291 * Pragma Linker_Section::
1292 * Pragma Lock_Free::
1293 * Pragma Loop_Invariant::
1294 * Pragma Loop_Optimize::
1295 * Pragma Loop_Variant::
1296 * Pragma Machine_Attribute::
1298 * Pragma Main_Storage::
1299 * Pragma Max_Queue_Length::
1301 * Pragma No_Caching::
1302 * Pragma No_Component_Reordering::
1303 * Pragma No_Elaboration_Code_All::
1304 * Pragma No_Heap_Finalization::
1305 * Pragma No_Inline::
1306 * Pragma No_Return::
1307 * Pragma No_Strict_Aliasing::
1308 * Pragma No_Tagged_Streams::
1309 * Pragma Normalize_Scalars::
1310 * Pragma Obsolescent::
1311 * Pragma Optimize_Alignment::
1313 * Pragma Overflow_Mode::
1314 * Pragma Overriding_Renamings::
1315 * Pragma Partition_Elaboration_Policy::
1318 * Pragma Persistent_BSS::
1320 * Pragma Postcondition::
1321 * Pragma Post_Class::
1323 * Pragma Precondition::
1324 * Pragma Predicate::
1325 * Pragma Predicate_Failure::
1326 * Pragma Preelaborable_Initialization::
1327 * Pragma Prefix_Exception_Messages::
1328 * Pragma Pre_Class::
1329 * Pragma Priority_Specific_Dispatching::
1331 * Pragma Profile_Warnings::
1332 * Pragma Propagate_Exceptions::
1333 * Pragma Provide_Shift_Operators::
1334 * Pragma Psect_Object::
1335 * Pragma Pure_Function::
1337 * Pragma Ravenscar::
1338 * Pragma Refined_Depends::
1339 * Pragma Refined_Global::
1340 * Pragma Refined_Post::
1341 * Pragma Refined_State::
1342 * Pragma Relative_Deadline::
1343 * Pragma Remote_Access_Type::
1344 * Pragma Rename_Pragma::
1345 * Pragma Restricted_Run_Time::
1346 * Pragma Restriction_Warnings::
1347 * Pragma Reviewable::
1348 * Pragma Secondary_Stack_Size::
1349 * Pragma Share_Generic::
1351 * Pragma Short_Circuit_And_Or::
1352 * Pragma Short_Descriptors::
1353 * Pragma Simple_Storage_Pool_Type::
1354 * Pragma Source_File_Name::
1355 * Pragma Source_File_Name_Project::
1356 * Pragma Source_Reference::
1357 * Pragma SPARK_Mode::
1358 * Pragma Static_Elaboration_Desired::
1359 * Pragma Stream_Convert::
1360 * Pragma Style_Checks::
1363 * Pragma Suppress_All::
1364 * Pragma Suppress_Debug_Info::
1365 * Pragma Suppress_Exception_Locations::
1366 * Pragma Suppress_Initialization::
1367 * Pragma Task_Name::
1368 * Pragma Task_Storage::
1369 * Pragma Test_Case::
1370 * Pragma Thread_Local_Storage::
1371 * Pragma Time_Slice::
1373 * Pragma Type_Invariant::
1374 * Pragma Type_Invariant_Class::
1375 * Pragma Unchecked_Union::
1376 * Pragma Unevaluated_Use_Of_Old::
1377 * Pragma Unimplemented_Unit::
1378 * Pragma Universal_Aliasing::
1379 * Pragma Unmodified::
1380 * Pragma Unreferenced::
1381 * Pragma Unreferenced_Objects::
1382 * Pragma Unreserve_All_Interrupts::
1383 * Pragma Unsuppress::
1384 * Pragma Use_VADS_Size::
1386 * Pragma Validity_Checks::
1388 * Pragma Volatile_Full_Access::
1389 * Pragma Volatile_Function::
1390 * Pragma Warning_As_Error::
1392 * Pragma Weak_External::
1393 * Pragma Wide_Character_Encoding::
1397 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1398 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1c}
1399 @section Pragma Abort_Defer
1402 @geindex Deferring aborts
1410 This pragma must appear at the start of the statement sequence of a
1411 handled sequence of statements (right after the @code{begin}). It has
1412 the effect of deferring aborts for the sequence of statements (but not
1413 for the declarations or handlers, if any, associated with this statement
1414 sequence). This can also be useful for adding a polling point in Ada code,
1415 where asynchronous abort of tasks is checked when leaving the statement
1416 sequence, and is lighter than, for example, using @code{delay 0.0;}, since with
1417 zero-cost exception handling, propagating exceptions (implicitly used to
1418 implement task abort) cannot be done reliably in an asynchronous way.
1420 An example of usage would be:
1423 -- Add a polling point to check for task aborts
1430 @node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
1431 @anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}@anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1e}
1432 @section Pragma Abstract_State
1438 pragma Abstract_State (ABSTRACT_STATE_LIST);
1440 ABSTRACT_STATE_LIST ::=
1442 | STATE_NAME_WITH_OPTIONS
1443 | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1445 STATE_NAME_WITH_OPTIONS ::=
1447 | (STATE_NAME with OPTION_LIST)
1449 OPTION_LIST ::= OPTION @{, OPTION@}
1455 SIMPLE_OPTION ::= Ghost | Synchronous
1457 NAME_VALUE_OPTION ::=
1458 Part_Of => ABSTRACT_STATE
1459 | External [=> EXTERNAL_PROPERTY_LIST]
1461 EXTERNAL_PROPERTY_LIST ::=
1463 | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
1465 EXTERNAL_PROPERTY ::=
1466 Async_Readers [=> static_boolean_EXPRESSION]
1467 | Async_Writers [=> static_boolean_EXPRESSION]
1468 | Effective_Reads [=> static_boolean_EXPRESSION]
1469 | Effective_Writes [=> static_boolean_EXPRESSION]
1470 others => static_boolean_EXPRESSION
1472 STATE_NAME ::= defining_identifier
1474 ABSTRACT_STATE ::= name
1477 For the semantics of this pragma, see the entry for aspect @code{Abstract_State} in
1478 the SPARK 2014 Reference Manual, section 7.1.4.
1480 @node Pragma Ada_83,Pragma Ada_95,Pragma Abstract_State,Implementation Defined Pragmas
1481 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{1f}
1482 @section Pragma Ada_83
1491 A configuration pragma that establishes Ada 83 mode for the unit to
1492 which it applies, regardless of the mode set by the command line
1493 switches. In Ada 83 mode, GNAT attempts to be as compatible with
1494 the syntax and semantics of Ada 83, as defined in the original Ada
1495 83 Reference Manual as possible. In particular, the keywords added by Ada 95
1496 and Ada 2005 are not recognized, optional package bodies are allowed,
1497 and generics may name types with unknown discriminants without using
1498 the @code{(<>)} notation. In addition, some but not all of the additional
1499 restrictions of Ada 83 are enforced.
1501 Ada 83 mode is intended for two purposes. Firstly, it allows existing
1502 Ada 83 code to be compiled and adapted to GNAT with less effort.
1503 Secondly, it aids in keeping code backwards compatible with Ada 83.
1504 However, there is no guarantee that code that is processed correctly
1505 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1506 83 compiler, since GNAT does not enforce all the additional checks
1509 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1510 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{20}
1511 @section Pragma Ada_95
1520 A configuration pragma that establishes Ada 95 mode for the unit to which
1521 it applies, regardless of the mode set by the command line switches.
1522 This mode is set automatically for the @code{Ada} and @code{System}
1523 packages and their children, so you need not specify it in these
1524 contexts. This pragma is useful when writing a reusable component that
1525 itself uses Ada 95 features, but which is intended to be usable from
1526 either Ada 83 or Ada 95 programs.
1528 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1529 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{21}
1530 @section Pragma Ada_05
1537 pragma Ada_05 (local_NAME);
1540 A configuration pragma that establishes Ada 2005 mode for the unit to which
1541 it applies, regardless of the mode set by the command line switches.
1542 This pragma is useful when writing a reusable component that
1543 itself uses Ada 2005 features, but which is intended to be usable from
1544 either Ada 83 or Ada 95 programs.
1546 The one argument form (which is not a configuration pragma)
1547 is used for managing the transition from
1548 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1549 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1550 mode will generate a warning. In addition, in Ada_83 or Ada_95
1551 mode, a preference rule is established which does not choose
1552 such an entity unless it is unambiguously specified. This avoids
1553 extra subprograms marked this way from generating ambiguities in
1554 otherwise legal pre-Ada_2005 programs. The one argument form is
1555 intended for exclusive use in the GNAT run-time library.
1557 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1558 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{22}
1559 @section Pragma Ada_2005
1568 This configuration pragma is a synonym for pragma Ada_05 and has the
1569 same syntax and effect.
1571 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1572 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{23}
1573 @section Pragma Ada_12
1580 pragma Ada_12 (local_NAME);
1583 A configuration pragma that establishes Ada 2012 mode for the unit to which
1584 it applies, regardless of the mode set by the command line switches.
1585 This mode is set automatically for the @code{Ada} and @code{System}
1586 packages and their children, so you need not specify it in these
1587 contexts. This pragma is useful when writing a reusable component that
1588 itself uses Ada 2012 features, but which is intended to be usable from
1589 Ada 83, Ada 95, or Ada 2005 programs.
1591 The one argument form, which is not a configuration pragma,
1592 is used for managing the transition from Ada
1593 2005 to Ada 2012 in the run-time library. If an entity is marked
1594 as Ada_2012 only, then referencing the entity in any pre-Ada_2012
1595 mode will generate a warning. In addition, in any pre-Ada_2012
1596 mode, a preference rule is established which does not choose
1597 such an entity unless it is unambiguously specified. This avoids
1598 extra subprograms marked this way from generating ambiguities in
1599 otherwise legal pre-Ada_2012 programs. The one argument form is
1600 intended for exclusive use in the GNAT run-time library.
1602 @node Pragma Ada_2012,Pragma Ada_2022,Pragma Ada_12,Implementation Defined Pragmas
1603 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{24}
1604 @section Pragma Ada_2012
1613 This configuration pragma is a synonym for pragma Ada_12 and has the
1614 same syntax and effect.
1616 @node Pragma Ada_2022,Pragma Aggregate_Individually_Assign,Pragma Ada_2012,Implementation Defined Pragmas
1617 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2022}@anchor{25}
1618 @section Pragma Ada_2022
1625 pragma Ada_2022 (local_NAME);
1628 A configuration pragma that establishes Ada 2022 mode for the unit to which
1629 it applies, regardless of the mode set by the command line switches.
1630 This mode is set automatically for the @code{Ada} and @code{System}
1631 packages and their children, so you need not specify it in these
1632 contexts. This pragma is useful when writing a reusable component that
1633 itself uses Ada 2022 features, but which is intended to be usable from
1634 Ada 83, Ada 95, Ada 2005 or Ada 2012 programs.
1636 The one argument form, which is not a configuration pragma,
1637 is used for managing the transition from Ada
1638 2012 to Ada 2022 in the run-time library. If an entity is marked
1639 as Ada_2022 only, then referencing the entity in any pre-Ada_2022
1640 mode will generate a warning. In addition, in any pre-Ada_2012
1641 mode, a preference rule is established which does not choose
1642 such an entity unless it is unambiguously specified. This avoids
1643 extra subprograms marked this way from generating ambiguities in
1644 otherwise legal pre-Ada_2022 programs. The one argument form is
1645 intended for exclusive use in the GNAT run-time library.
1647 @node Pragma Aggregate_Individually_Assign,Pragma Allow_Integer_Address,Pragma Ada_2022,Implementation Defined Pragmas
1648 @anchor{gnat_rm/implementation_defined_pragmas pragma-aggregate-individually-assign}@anchor{26}
1649 @section Pragma Aggregate_Individually_Assign
1655 pragma Aggregate_Individually_Assign;
1658 Where possible, GNAT will store the binary representation of a record aggregate
1659 in memory for space and performance reasons. This configuration pragma changes
1660 this behavior so that record aggregates are instead always converted into
1661 individual assignment statements.
1663 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Aggregate_Individually_Assign,Implementation Defined Pragmas
1664 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{27}
1665 @section Pragma Allow_Integer_Address
1671 pragma Allow_Integer_Address;
1674 In almost all versions of GNAT, @code{System.Address} is a private
1675 type in accordance with the implementation advice in the RM. This
1676 means that integer values,
1677 in particular integer literals, are not allowed as address values.
1678 If the configuration pragma
1679 @code{Allow_Integer_Address} is given, then integer expressions may
1680 be used anywhere a value of type @code{System.Address} is required.
1681 The effect is to introduce an implicit unchecked conversion from the
1682 integer value to type @code{System.Address}. The reverse case of using
1683 an address where an integer type is required is handled analogously.
1684 The following example compiles without errors:
1687 pragma Allow_Integer_Address;
1688 with System; use System;
1689 package AddrAsInt is
1692 for X'Address use 16#1240#;
1693 for Y use at 16#3230#;
1694 m : Address := 16#4000#;
1695 n : constant Address := 4000;
1696 p : constant Address := Address (X + Y);
1697 v : Integer := y'Address;
1698 w : constant Integer := Integer (Y'Address);
1699 type R is new integer;
1702 for Z'Address use RR;
1706 Note that pragma @code{Allow_Integer_Address} is ignored if @code{System.Address}
1707 is not a private type. In implementations of @code{GNAT} where
1708 System.Address is a visible integer type,
1709 this pragma serves no purpose but is ignored
1710 rather than rejected to allow common sets of sources to be used
1711 in the two situations.
1713 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1714 @anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{28}@anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{29}
1715 @section Pragma Annotate
1721 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1723 ARG ::= NAME | EXPRESSION
1726 This pragma is used to annotate programs. IDENTIFIER identifies
1727 the type of annotation. GNAT verifies that it is an identifier, but does
1728 not otherwise analyze it. The second optional identifier is also left
1729 unanalyzed, and by convention is used to control the action of the tool to
1730 which the annotation is addressed. The remaining ARG arguments
1731 can be either string literals or more generally expressions.
1732 String literals (and concatenations of string literals) are assumed to be
1734 @code{Standard.String} or else @code{Wide_String} or @code{Wide_Wide_String}
1735 depending on the character literals they contain.
1736 All other kinds of arguments are analyzed as expressions, and must be
1737 unambiguous. The last argument if present must have the identifier
1738 @code{Entity} and GNAT verifies that a local name is given.
1740 The analyzed pragma is retained in the tree, but not otherwise processed
1741 by any part of the GNAT compiler, except to generate corresponding note
1742 lines in the generated ALI file. For the format of these note lines, see
1743 the compiler source file lib-writ.ads. This pragma is intended for use by
1744 external tools, including ASIS. The use of pragma Annotate does not
1745 affect the compilation process in any way. This pragma may be used as
1746 a configuration pragma.
1748 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1749 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{2a}
1750 @section Pragma Assert
1758 [, string_EXPRESSION]);
1761 The effect of this pragma depends on whether the corresponding command
1762 line switch is set to activate assertions. The pragma expands into code
1763 equivalent to the following:
1766 if assertions-enabled then
1767 if not boolean_EXPRESSION then
1768 System.Assertions.Raise_Assert_Failure
1769 (string_EXPRESSION);
1774 The string argument, if given, is the message that will be associated
1775 with the exception occurrence if the exception is raised. If no second
1776 argument is given, the default message is @code{file}:@code{nnn},
1777 where @code{file} is the name of the source file containing the assert,
1778 and @code{nnn} is the line number of the assert.
1780 Note that, as with the @code{if} statement to which it is equivalent, the
1781 type of the expression is either @code{Standard.Boolean}, or any type derived
1782 from this standard type.
1784 Assert checks can be either checked or ignored. By default they are ignored.
1785 They will be checked if either the command line switch `-gnata' is
1786 used, or if an @code{Assertion_Policy} or @code{Check_Policy} pragma is used
1787 to enable @code{Assert_Checks}.
1789 If assertions are ignored, then there
1790 is no run-time effect (and in particular, any side effects from the
1791 expression will not occur at run time). (The expression is still
1792 analyzed at compile time, and may cause types to be frozen if they are
1793 mentioned here for the first time).
1795 If assertions are checked, then the given expression is tested, and if
1796 it is @code{False} then @code{System.Assertions.Raise_Assert_Failure} is called
1797 which results in the raising of @code{Assert_Failure} with the given message.
1799 You should generally avoid side effects in the expression arguments of
1800 this pragma, because these side effects will turn on and off with the
1801 setting of the assertions mode, resulting in assertions that have an
1802 effect on the program. However, the expressions are analyzed for
1803 semantic correctness whether or not assertions are enabled, so turning
1804 assertions on and off cannot affect the legality of a program.
1806 Note that the implementation defined policy @code{DISABLE}, given in a
1807 pragma @code{Assertion_Policy}, can be used to suppress this semantic analysis.
1809 Note: this is a standard language-defined pragma in versions
1810 of Ada from 2005 on. In GNAT, it is implemented in all versions
1811 of Ada, and the DISABLE policy is an implementation-defined
1814 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1815 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{2b}
1816 @section Pragma Assert_And_Cut
1822 pragma Assert_And_Cut (
1824 [, string_EXPRESSION]);
1827 The effect of this pragma is identical to that of pragma @code{Assert},
1828 except that in an @code{Assertion_Policy} pragma, the identifier
1829 @code{Assert_And_Cut} is used to control whether it is ignored or checked
1832 The intention is that this be used within a subprogram when the
1833 given test expresion sums up all the work done so far in the
1834 subprogram, so that the rest of the subprogram can be verified
1835 (informally or formally) using only the entry preconditions,
1836 and the expression in this pragma. This allows dividing up
1837 a subprogram into sections for the purposes of testing or
1838 formal verification. The pragma also serves as useful
1841 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1842 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{2c}
1843 @section Pragma Assertion_Policy
1849 pragma Assertion_Policy (CHECK | DISABLE | IGNORE | SUPPRESSIBLE);
1851 pragma Assertion_Policy (
1852 ASSERTION_KIND => POLICY_IDENTIFIER
1853 @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1855 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1857 RM_ASSERTION_KIND ::= Assert |
1865 Type_Invariant'Class |
1866 Default_Initial_Condition
1868 ID_ASSERTION_KIND ::= Assertions |
1883 Statement_Assertions |
1886 POLICY_IDENTIFIER ::= Check | Disable | Ignore | Suppressible
1889 This is a standard Ada 2012 pragma that is available as an
1890 implementation-defined pragma in earlier versions of Ada.
1891 The assertion kinds @code{RM_ASSERTION_KIND} are those defined in
1892 the Ada standard. The assertion kinds @code{ID_ASSERTION_KIND}
1893 are implementation defined additions recognized by the GNAT compiler.
1895 The pragma applies in both cases to pragmas and aspects with matching
1896 names, e.g. @code{Pre} applies to the Pre aspect, and @code{Precondition}
1897 applies to both the @code{Precondition} pragma
1898 and the aspect @code{Precondition}. Note that the identifiers for
1899 pragmas Pre_Class and Post_Class are Pre’Class and Post’Class (not
1900 Pre_Class and Post_Class), since these pragmas are intended to be
1901 identical to the corresponding aspects.
1903 If the policy is @code{CHECK}, then assertions are enabled, i.e.
1904 the corresponding pragma or aspect is activated.
1905 If the policy is @code{IGNORE}, then assertions are ignored, i.e.
1906 the corresponding pragma or aspect is deactivated.
1907 This pragma overrides the effect of the `-gnata' switch on the
1909 If the policy is @code{SUPPRESSIBLE}, then assertions are enabled by default,
1910 however, if the `-gnatp' switch is specified all assertions are ignored.
1912 The implementation defined policy @code{DISABLE} is like
1913 @code{IGNORE} except that it completely disables semantic
1914 checking of the corresponding pragma or aspect. This is
1915 useful when the pragma or aspect argument references subprograms
1916 in a with’ed package which is replaced by a dummy package
1917 for the final build.
1919 The implementation defined assertion kind @code{Assertions} applies to all
1920 assertion kinds. The form with no assertion kind given implies this
1921 choice, so it applies to all assertion kinds (RM defined, and
1922 implementation defined).
1924 The implementation defined assertion kind @code{Statement_Assertions}
1925 applies to @code{Assert}, @code{Assert_And_Cut},
1926 @code{Assume}, @code{Loop_Invariant}, and @code{Loop_Variant}.
1928 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
1929 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2d}
1930 @section Pragma Assume
1938 [, string_EXPRESSION]);
1941 The effect of this pragma is identical to that of pragma @code{Assert},
1942 except that in an @code{Assertion_Policy} pragma, the identifier
1943 @code{Assume} is used to control whether it is ignored or checked
1946 The intention is that this be used for assumptions about the
1947 external environment. So you cannot expect to verify formally
1948 or informally that the condition is met, this must be
1949 established by examining things outside the program itself.
1950 For example, we may have code that depends on the size of
1951 @code{Long_Long_Integer} being at least 64. So we could write:
1954 pragma Assume (Long_Long_Integer'Size >= 64);
1957 This assumption cannot be proved from the program itself,
1958 but it acts as a useful run-time check that the assumption
1959 is met, and documents the need to ensure that it is met by
1960 reference to information outside the program.
1962 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
1963 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{2e}
1964 @section Pragma Assume_No_Invalid_Values
1967 @geindex Invalid representations
1969 @geindex Invalid values
1974 pragma Assume_No_Invalid_Values (On | Off);
1977 This is a configuration pragma that controls the assumptions made by the
1978 compiler about the occurrence of invalid representations (invalid values)
1981 The default behavior (corresponding to an Off argument for this pragma), is
1982 to assume that values may in general be invalid unless the compiler can
1983 prove they are valid. Consider the following example:
1986 V1 : Integer range 1 .. 10;
1987 V2 : Integer range 11 .. 20;
1989 for J in V2 .. V1 loop
1994 if V1 and V2 have valid values, then the loop is known at compile
1995 time not to execute since the lower bound must be greater than the
1996 upper bound. However in default mode, no such assumption is made,
1997 and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
1998 is given, the compiler will assume that any occurrence of a variable
1999 other than in an explicit @code{'Valid} test always has a valid
2000 value, and the loop above will be optimized away.
2002 The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
2003 you know your code is free of uninitialized variables and other
2004 possible sources of invalid representations, and may result in
2005 more efficient code. A program that accesses an invalid representation
2006 with this pragma in effect is erroneous, so no guarantees can be made
2009 It is peculiar though permissible to use this pragma in conjunction
2010 with validity checking (-gnatVa). In such cases, accessing invalid
2011 values will generally give an exception, though formally the program
2012 is erroneous so there are no guarantees that this will always be the
2013 case, and it is recommended that these two options not be used together.
2015 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
2016 @anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{2f}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{30}
2017 @section Pragma Async_Readers
2023 pragma Async_Readers [ (static_boolean_EXPRESSION) ];
2026 For the semantics of this pragma, see the entry for aspect @code{Async_Readers} in
2027 the SPARK 2014 Reference Manual, section 7.1.2.
2029 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
2030 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{31}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{32}
2031 @section Pragma Async_Writers
2037 pragma Async_Writers [ (static_boolean_EXPRESSION) ];
2040 For the semantics of this pragma, see the entry for aspect @code{Async_Writers} in
2041 the SPARK 2014 Reference Manual, section 7.1.2.
2043 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
2044 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{33}
2045 @section Pragma Attribute_Definition
2051 pragma Attribute_Definition
2052 ([Attribute =>] ATTRIBUTE_DESIGNATOR,
2053 [Entity =>] LOCAL_NAME,
2054 [Expression =>] EXPRESSION | NAME);
2057 If @code{Attribute} is a known attribute name, this pragma is equivalent to
2058 the attribute definition clause:
2061 for Entity'Attribute use Expression;
2064 If @code{Attribute} is not a recognized attribute name, the pragma is
2065 ignored, and a warning is emitted. This allows source
2066 code to be written that takes advantage of some new attribute, while remaining
2067 compilable with earlier compilers.
2069 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
2070 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{34}
2071 @section Pragma C_Pass_By_Copy
2074 @geindex Passing by copy
2079 pragma C_Pass_By_Copy
2080 ([Max_Size =>] static_integer_EXPRESSION);
2083 Normally the default mechanism for passing C convention records to C
2084 convention subprograms is to pass them by reference, as suggested by RM
2085 B.3(69). Use the configuration pragma @code{C_Pass_By_Copy} to change
2086 this default, by requiring that record formal parameters be passed by
2087 copy if all of the following conditions are met:
2093 The size of the record type does not exceed the value specified for
2097 The record type has @code{Convention C}.
2100 The formal parameter has this record type, and the subprogram has a
2101 foreign (non-Ada) convention.
2104 If these conditions are met the argument is passed by copy; i.e., in a
2105 manner consistent with what C expects if the corresponding formal in the
2106 C prototype is a struct (rather than a pointer to a struct).
2108 You can also pass records by copy by specifying the convention
2109 @code{C_Pass_By_Copy} for the record type, or by using the extended
2110 @code{Import} and @code{Export} pragmas, which allow specification of
2111 passing mechanisms on a parameter by parameter basis.
2113 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2114 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{35}
2115 @section Pragma Check
2120 @geindex Named assertions
2126 [Name =>] CHECK_KIND,
2127 [Check =>] Boolean_EXPRESSION
2128 [, [Message =>] string_EXPRESSION] );
2130 CHECK_KIND ::= IDENTIFIER |
2133 Type_Invariant'Class |
2137 This pragma is similar to the predefined pragma @code{Assert} except that an
2138 extra identifier argument is present. In conjunction with pragma
2139 @code{Check_Policy}, this can be used to define groups of assertions that can
2140 be independently controlled. The identifier @code{Assertion} is special, it
2141 refers to the normal set of pragma @code{Assert} statements.
2143 Checks introduced by this pragma are normally deactivated by default. They can
2144 be activated either by the command line option `-gnata', which turns on
2145 all checks, or individually controlled using pragma @code{Check_Policy}.
2147 The identifiers @code{Assertions} and @code{Statement_Assertions} are not
2148 permitted as check kinds, since this would cause confusion with the use
2149 of these identifiers in @code{Assertion_Policy} and @code{Check_Policy}
2150 pragmas, where they are used to refer to sets of assertions.
2152 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2153 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{36}
2154 @section Pragma Check_Float_Overflow
2157 @geindex Floating-point overflow
2162 pragma Check_Float_Overflow;
2165 In Ada, the predefined floating-point types (@code{Short_Float},
2166 @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
2167 defined to be `unconstrained'. This means that even though each
2168 has a well-defined base range, an operation that delivers a result
2169 outside this base range is not required to raise an exception.
2170 This implementation permission accommodates the notion
2171 of infinities in IEEE floating-point, and corresponds to the
2172 efficient execution mode on most machines. GNAT will not raise
2173 overflow exceptions on these machines; instead it will generate
2174 infinities and NaN’s as defined in the IEEE standard.
2176 Generating infinities, although efficient, is not always desirable.
2177 Often the preferable approach is to check for overflow, even at the
2178 (perhaps considerable) expense of run-time performance.
2179 This can be accomplished by defining your own constrained floating-point subtypes – i.e., by supplying explicit
2180 range constraints – and indeed such a subtype
2181 can have the same base range as its base type. For example:
2184 subtype My_Float is Float range Float'Range;
2187 Here @code{My_Float} has the same range as
2188 @code{Float} but is constrained, so operations on
2189 @code{My_Float} values will be checked for overflow
2192 This style will achieve the desired goal, but
2193 it is often more convenient to be able to simply use
2194 the standard predefined floating-point types as long
2195 as overflow checking could be guaranteed.
2196 The @code{Check_Float_Overflow}
2197 configuration pragma achieves this effect. If a unit is compiled
2198 subject to this configuration pragma, then all operations
2199 on predefined floating-point types including operations on
2200 base types of these floating-point types will be treated as
2201 though those types were constrained, and overflow checks
2202 will be generated. The @code{Constraint_Error}
2203 exception is raised if the result is out of range.
2205 This mode can also be set by use of the compiler
2208 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2209 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{37}
2210 @section Pragma Check_Name
2213 @geindex Defining check names
2215 @geindex Check names
2221 pragma Check_Name (check_name_IDENTIFIER);
2224 This is a configuration pragma that defines a new implementation
2225 defined check name (unless IDENTIFIER matches one of the predefined
2226 check names, in which case the pragma has no effect). Check names
2227 are global to a partition, so if two or more configuration pragmas
2228 are present in a partition mentioning the same name, only one new
2229 check name is introduced.
2231 An implementation defined check name introduced with this pragma may
2232 be used in only three contexts: @code{pragma Suppress},
2233 @code{pragma Unsuppress},
2234 and as the prefix of a @code{Check_Name'Enabled} attribute reference. For
2235 any of these three cases, the check name must be visible. A check
2236 name is visible if it is in the configuration pragmas applying to
2237 the current unit, or if it appears at the start of any unit that
2238 is part of the dependency set of the current unit (e.g., units that
2239 are mentioned in @code{with} clauses).
2241 Check names introduced by this pragma are subject to control by compiler
2242 switches (in particular -gnatp) in the usual manner.
2244 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2245 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{38}
2246 @section Pragma Check_Policy
2249 @geindex Controlling assertions
2254 @geindex Check pragma control
2256 @geindex Named assertions
2262 ([Name =>] CHECK_KIND,
2263 [Policy =>] POLICY_IDENTIFIER);
2265 pragma Check_Policy (
2266 CHECK_KIND => POLICY_IDENTIFIER
2267 @{, CHECK_KIND => POLICY_IDENTIFIER@});
2269 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2271 CHECK_KIND ::= IDENTIFIER |
2274 Type_Invariant'Class |
2277 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2278 avoids confusion between the two possible syntax forms for this pragma.
2280 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2283 This pragma is used to set the checking policy for assertions (specified
2284 by aspects or pragmas), the @code{Debug} pragma, or additional checks
2285 to be checked using the @code{Check} pragma. It may appear either as
2286 a configuration pragma, or within a declarative part of package. In the
2287 latter case, it applies from the point where it appears to the end of
2288 the declarative region (like pragma @code{Suppress}).
2290 The @code{Check_Policy} pragma is similar to the
2291 predefined @code{Assertion_Policy} pragma,
2292 and if the check kind corresponds to one of the assertion kinds that
2293 are allowed by @code{Assertion_Policy}, then the effect is identical.
2295 If the first argument is Debug, then the policy applies to Debug pragmas,
2296 disabling their effect if the policy is @code{OFF}, @code{DISABLE}, or
2297 @code{IGNORE}, and allowing them to execute with normal semantics if
2298 the policy is @code{ON} or @code{CHECK}. In addition if the policy is
2299 @code{DISABLE}, then the procedure call in @code{Debug} pragmas will
2300 be totally ignored and not analyzed semantically.
2302 Finally the first argument may be some other identifier than the above
2303 possibilities, in which case it controls a set of named assertions
2304 that can be checked using pragma @code{Check}. For example, if the pragma:
2307 pragma Check_Policy (Critical_Error, OFF);
2310 is given, then subsequent @code{Check} pragmas whose first argument is also
2311 @code{Critical_Error} will be disabled.
2313 The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
2314 to turn on corresponding checks. The default for a set of checks for which no
2315 @code{Check_Policy} is given is @code{OFF} unless the compiler switch
2316 `-gnata' is given, which turns on all checks by default.
2318 The check policy settings @code{CHECK} and @code{IGNORE} are recognized
2319 as synonyms for @code{ON} and @code{OFF}. These synonyms are provided for
2320 compatibility with the standard @code{Assertion_Policy} pragma. The check
2321 policy setting @code{DISABLE} causes the second argument of a corresponding
2322 @code{Check} pragma to be completely ignored and not analyzed.
2324 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2325 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{39}
2326 @section Pragma Comment
2332 pragma Comment (static_string_EXPRESSION);
2335 This is almost identical in effect to pragma @code{Ident}. It allows the
2336 placement of a comment into the object file and hence into the
2337 executable file if the operating system permits such usage. The
2338 difference is that @code{Comment}, unlike @code{Ident}, has
2339 no limitations on placement of the pragma (it can be placed
2340 anywhere in the main source unit), and if more than one pragma
2341 is used, all comments are retained.
2343 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2344 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{3a}
2345 @section Pragma Common_Object
2351 pragma Common_Object (
2352 [Internal =>] LOCAL_NAME
2353 [, [External =>] EXTERNAL_SYMBOL]
2354 [, [Size =>] EXTERNAL_SYMBOL] );
2358 | static_string_EXPRESSION
2361 This pragma enables the shared use of variables stored in overlaid
2362 linker areas corresponding to the use of @code{COMMON}
2363 in Fortran. The single
2364 object @code{LOCAL_NAME} is assigned to the area designated by
2365 the @code{External} argument.
2366 You may define a record to correspond to a series
2367 of fields. The @code{Size} argument
2368 is syntax checked in GNAT, but otherwise ignored.
2370 @code{Common_Object} is not supported on all platforms. If no
2371 support is available, then the code generator will issue a message
2372 indicating that the necessary attribute for implementation of this
2373 pragma is not available.
2375 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2376 @anchor{gnat_rm/implementation_defined_pragmas compile-time-error}@anchor{3b}@anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{3c}
2377 @section Pragma Compile_Time_Error
2383 pragma Compile_Time_Error
2384 (boolean_EXPRESSION, static_string_EXPRESSION);
2387 This pragma can be used to generate additional compile time
2389 is particularly useful in generics, where errors can be issued for
2390 specific problematic instantiations. The first parameter is a boolean
2391 expression. The pragma ensures that the value of an expression
2392 is known at compile time, and has the value False. The set of expressions
2393 whose values are known at compile time includes all static boolean
2394 expressions, and also other values which the compiler can determine
2395 at compile time (e.g., the size of a record type set by an explicit
2396 size representation clause, or the value of a variable which was
2397 initialized to a constant and is known not to have been modified).
2398 If these conditions are not met, an error message is generated using
2399 the value given as the second argument. This string value may contain
2400 embedded ASCII.LF characters to break the message into multiple lines.
2402 @node Pragma Compile_Time_Warning,Pragma Complete_Representation,Pragma Compile_Time_Error,Implementation Defined Pragmas
2403 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{3d}
2404 @section Pragma Compile_Time_Warning
2410 pragma Compile_Time_Warning
2411 (boolean_EXPRESSION, static_string_EXPRESSION);
2414 Same as pragma Compile_Time_Error, except a warning is issued instead
2415 of an error message. If switch `-gnatw_C' is used, a warning is only issued
2416 if the value of the expression is known to be True at compile time, not when
2417 the value of the expression is not known at compile time.
2418 Note that if this pragma is used in a package that
2419 is with’ed by a client, the client will get the warning even though it
2420 is issued by a with’ed package (normally warnings in with’ed units are
2421 suppressed, but this is a special exception to that rule).
2423 One typical use is within a generic where compile time known characteristics
2424 of formal parameters are tested, and warnings given appropriately. Another use
2425 with a first parameter of True is to warn a client about use of a package,
2426 for example that it is not fully implemented.
2428 In previous versions of the compiler, combining `-gnatwe' with
2429 Compile_Time_Warning resulted in a fatal error. Now the compiler always emits
2430 a warning. You can use @ref{3b,,Pragma Compile_Time_Error} to force the generation of
2433 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2434 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{3e}
2435 @section Pragma Complete_Representation
2441 pragma Complete_Representation;
2444 This pragma must appear immediately within a record representation
2445 clause. Typical placements are before the first component clause
2446 or after the last component clause. The effect is to give an error
2447 message if any component is missing a component clause. This pragma
2448 may be used to ensure that a record representation clause is
2449 complete, and that this invariant is maintained if fields are
2450 added to the record in the future.
2452 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2453 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{3f}
2454 @section Pragma Complex_Representation
2460 pragma Complex_Representation
2461 ([Entity =>] LOCAL_NAME);
2464 The @code{Entity} argument must be the name of a record type which has
2465 two fields of the same floating-point type. The effect of this pragma is
2466 to force gcc to use the special internal complex representation form for
2467 this record, which may be more efficient. Note that this may result in
2468 the code for this type not conforming to standard ABI (application
2469 binary interface) requirements for the handling of record types. For
2470 example, in some environments, there is a requirement for passing
2471 records by pointer, and the use of this pragma may result in passing
2472 this type in floating-point registers.
2474 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2475 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{40}
2476 @section Pragma Component_Alignment
2479 @geindex Alignments of components
2481 @geindex Pragma Component_Alignment
2486 pragma Component_Alignment (
2487 [Form =>] ALIGNMENT_CHOICE
2488 [, [Name =>] type_LOCAL_NAME]);
2490 ALIGNMENT_CHOICE ::=
2497 Specifies the alignment of components in array or record types.
2498 The meaning of the @code{Form} argument is as follows:
2502 @geindex Component_Size (in pragma Component_Alignment)
2508 @item `Component_Size'
2510 Aligns scalar components and subcomponents of the array or record type
2511 on boundaries appropriate to their inherent size (naturally
2512 aligned). For example, 1-byte components are aligned on byte boundaries,
2513 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2514 integer components are aligned on 4-byte boundaries and so on. These
2515 alignment rules correspond to the normal rules for C compilers on all
2516 machines except the VAX.
2518 @geindex Component_Size_4 (in pragma Component_Alignment)
2520 @item `Component_Size_4'
2522 Naturally aligns components with a size of four or fewer
2523 bytes. Components that are larger than 4 bytes are placed on the next
2526 @geindex Storage_Unit (in pragma Component_Alignment)
2528 @item `Storage_Unit'
2530 Specifies that array or record components are byte aligned, i.e.,
2531 aligned on boundaries determined by the value of the constant
2532 @code{System.Storage_Unit}.
2534 @geindex Default (in pragma Component_Alignment)
2538 Specifies that array or record components are aligned on default
2539 boundaries, appropriate to the underlying hardware or operating system or
2540 both. The @code{Default} choice is the same as @code{Component_Size} (natural
2544 If the @code{Name} parameter is present, @code{type_LOCAL_NAME} must
2545 refer to a local record or array type, and the specified alignment
2546 choice applies to the specified type. The use of
2547 @code{Component_Alignment} together with a pragma @code{Pack} causes the
2548 @code{Component_Alignment} pragma to be ignored. The use of
2549 @code{Component_Alignment} together with a record representation clause
2550 is only effective for fields not specified by the representation clause.
2552 If the @code{Name} parameter is absent, the pragma can be used as either
2553 a configuration pragma, in which case it applies to one or more units in
2554 accordance with the normal rules for configuration pragmas, or it can be
2555 used within a declarative part, in which case it applies to types that
2556 are declared within this declarative part, or within any nested scope
2557 within this declarative part. In either case it specifies the alignment
2558 to be applied to any record or array type which has otherwise standard
2561 If the alignment for a record or array type is not specified (using
2562 pragma @code{Pack}, pragma @code{Component_Alignment}, or a record rep
2563 clause), the GNAT uses the default alignment as described previously.
2565 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2566 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{41}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{42}
2567 @section Pragma Constant_After_Elaboration
2573 pragma Constant_After_Elaboration [ (static_boolean_EXPRESSION) ];
2576 For the semantics of this pragma, see the entry for aspect
2577 @code{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2579 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2580 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{43}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{44}
2581 @section Pragma Contract_Cases
2584 @geindex Contract cases
2589 pragma Contract_Cases (CONTRACT_CASE @{, CONTRACT_CASE@});
2591 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2593 CASE_GUARD ::= boolean_EXPRESSION | others
2595 CONSEQUENCE ::= boolean_EXPRESSION
2598 The @code{Contract_Cases} pragma allows defining fine-grain specifications
2599 that can complement or replace the contract given by a precondition and a
2600 postcondition. Additionally, the @code{Contract_Cases} pragma can be used
2601 by testing and formal verification tools. The compiler checks its validity and,
2602 depending on the assertion policy at the point of declaration of the pragma,
2603 it may insert a check in the executable. For code generation, the contract
2607 pragma Contract_Cases (
2615 C1 : constant Boolean := Cond1; -- evaluated at subprogram entry
2616 C2 : constant Boolean := Cond2; -- evaluated at subprogram entry
2617 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2618 pragma Postcondition (if C1 then Pred1);
2619 pragma Postcondition (if C2 then Pred2);
2622 The precondition ensures that one and only one of the case guards is
2623 satisfied on entry to the subprogram.
2624 The postcondition ensures that for the case guard that was True on entry,
2625 the corresponding consequence is True on exit. Other consequence expressions
2628 A precondition @code{P} and postcondition @code{Q} can also be
2629 expressed as contract cases:
2632 pragma Contract_Cases (P => Q);
2635 The placement and visibility rules for @code{Contract_Cases} pragmas are
2636 identical to those described for preconditions and postconditions.
2638 The compiler checks that boolean expressions given in case guards and
2639 consequences are valid, where the rules for case guards are the same as
2640 the rule for an expression in @code{Precondition} and the rules for
2641 consequences are the same as the rule for an expression in
2642 @code{Postcondition}. In particular, attributes @code{'Old} and
2643 @code{'Result} can only be used within consequence expressions.
2644 The case guard for the last contract case may be @code{others}, to denote
2645 any case not captured by the previous cases. The
2646 following is an example of use within a package spec:
2649 package Math_Functions is
2651 function Sqrt (Arg : Float) return Float;
2652 pragma Contract_Cases (((Arg in 0.0 .. 99.0) => Sqrt'Result < 10.0,
2653 Arg >= 100.0 => Sqrt'Result >= 10.0,
2654 others => Sqrt'Result = 0.0));
2659 The meaning of contract cases is that only one case should apply at each
2660 call, as determined by the corresponding case guard evaluating to True,
2661 and that the consequence for this case should hold when the subprogram
2664 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2665 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{45}
2666 @section Pragma Convention_Identifier
2669 @geindex Conventions
2675 pragma Convention_Identifier (
2676 [Name =>] IDENTIFIER,
2677 [Convention =>] convention_IDENTIFIER);
2680 This pragma provides a mechanism for supplying synonyms for existing
2681 convention identifiers. The @code{Name} identifier can subsequently
2682 be used as a synonym for the given convention in other pragmas (including
2683 for example pragma @code{Import} or another @code{Convention_Identifier}
2684 pragma). As an example of the use of this, suppose you had legacy code
2685 which used Fortran77 as the identifier for Fortran. Then the pragma:
2688 pragma Convention_Identifier (Fortran77, Fortran);
2691 would allow the use of the convention identifier @code{Fortran77} in
2692 subsequent code, avoiding the need to modify the sources. As another
2693 example, you could use this to parameterize convention requirements
2694 according to systems. Suppose you needed to use @code{Stdcall} on
2695 windows systems, and @code{C} on some other system, then you could
2696 define a convention identifier @code{Library} and use a single
2697 @code{Convention_Identifier} pragma to specify which convention
2698 would be used system-wide.
2700 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2701 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{46}
2702 @section Pragma CPP_Class
2705 @geindex Interfacing with C++
2710 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2713 The argument denotes an entity in the current declarative region that is
2714 declared as a record type. It indicates that the type corresponds to an
2715 externally declared C++ class type, and is to be laid out the same way
2716 that C++ would lay out the type. If the C++ class has virtual primitives
2717 then the record must be declared as a tagged record type.
2719 Types for which @code{CPP_Class} is specified do not have assignment or
2720 equality operators defined (such operations can be imported or declared
2721 as subprograms as required). Initialization is allowed only by constructor
2722 functions (see pragma @code{CPP_Constructor}). Such types are implicitly
2723 limited if not explicitly declared as limited or derived from a limited
2724 type, and an error is issued in that case.
2726 See @ref{47,,Interfacing to C++} for related information.
2728 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
2729 for backward compatibility but its functionality is available
2730 using pragma @code{Import} with @code{Convention} = @code{CPP}.
2732 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2733 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{48}
2734 @section Pragma CPP_Constructor
2737 @geindex Interfacing with C++
2742 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2743 [, [External_Name =>] static_string_EXPRESSION ]
2744 [, [Link_Name =>] static_string_EXPRESSION ]);
2747 This pragma identifies an imported function (imported in the usual way
2748 with pragma @code{Import}) as corresponding to a C++ constructor. If
2749 @code{External_Name} and @code{Link_Name} are not specified then the
2750 @code{Entity} argument is a name that must have been previously mentioned
2751 in a pragma @code{Import} with @code{Convention} = @code{CPP}. Such name
2752 must be of one of the following forms:
2758 `function' @code{Fname} `return' T`
2761 `function' @code{Fname} `return' T’Class
2764 `function' @code{Fname} (…) `return' T`
2767 `function' @code{Fname} (…) `return' T’Class
2770 where @code{T} is a limited record type imported from C++ with pragma
2771 @code{Import} and @code{Convention} = @code{CPP}.
2773 The first two forms import the default constructor, used when an object
2774 of type @code{T} is created on the Ada side with no explicit constructor.
2775 The latter two forms cover all the non-default constructors of the type.
2776 See the GNAT User’s Guide for details.
2778 If no constructors are imported, it is impossible to create any objects
2779 on the Ada side and the type is implicitly declared abstract.
2781 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
2782 using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
2784 See @ref{47,,Interfacing to C++} for more related information.
2786 Note: The use of functions returning class-wide types for constructors is
2787 currently obsolete. They are supported for backward compatibility. The
2788 use of functions returning the type T leave the Ada sources more clear
2789 because the imported C++ constructors always return an object of type T;
2790 that is, they never return an object whose type is a descendant of type T.
2792 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2793 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{49}
2794 @section Pragma CPP_Virtual
2797 @geindex Interfacing to C++
2799 This pragma is now obsolete and, other than generating a warning if warnings
2800 on obsolescent features are enabled, is completely ignored.
2801 It is retained for compatibility
2802 purposes. It used to be required to ensure compoatibility with C++, but
2803 is no longer required for that purpose because GNAT generates
2804 the same object layout as the G++ compiler by default.
2806 See @ref{47,,Interfacing to C++} for related information.
2808 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2809 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{4a}
2810 @section Pragma CPP_Vtable
2813 @geindex Interfacing with C++
2815 This pragma is now obsolete and, other than generating a warning if warnings
2816 on obsolescent features are enabled, is completely ignored.
2817 It used to be required to ensure compatibility with C++, but
2818 is no longer required for that purpose because GNAT generates
2819 the same object layout as the G++ compiler by default.
2821 See @ref{47,,Interfacing to C++} for related information.
2823 @node Pragma CPU,Pragma Deadline_Floor,Pragma CPP_Vtable,Implementation Defined Pragmas
2824 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{4b}
2831 pragma CPU (EXPRESSION);
2834 This pragma is standard in Ada 2012, but is available in all earlier
2835 versions of Ada as an implementation-defined pragma.
2836 See Ada 2012 Reference Manual for details.
2838 @node Pragma Deadline_Floor,Pragma Default_Initial_Condition,Pragma CPU,Implementation Defined Pragmas
2839 @anchor{gnat_rm/implementation_defined_pragmas pragma-deadline-floor}@anchor{4c}
2840 @section Pragma Deadline_Floor
2846 pragma Deadline_Floor (time_span_EXPRESSION);
2849 This pragma applies only to protected types and specifies the floor
2850 deadline inherited by a task when the task enters a protected object.
2851 It is effective only when the EDF scheduling policy is used.
2853 @node Pragma Default_Initial_Condition,Pragma Debug,Pragma Deadline_Floor,Implementation Defined Pragmas
2854 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{4d}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{4e}
2855 @section Pragma Default_Initial_Condition
2861 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2864 For the semantics of this pragma, see the entry for aspect
2865 @code{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2867 @node Pragma Debug,Pragma Debug_Policy,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2868 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{4f}
2869 @section Pragma Debug
2875 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2877 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2879 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2882 The procedure call argument has the syntactic form of an expression, meeting
2883 the syntactic requirements for pragmas.
2885 If debug pragmas are not enabled or if the condition is present and evaluates
2886 to False, this pragma has no effect. If debug pragmas are enabled, the
2887 semantics of the pragma is exactly equivalent to the procedure call statement
2888 corresponding to the argument with a terminating semicolon. Pragmas are
2889 permitted in sequences of declarations, so you can use pragma @code{Debug} to
2890 intersperse calls to debug procedures in the middle of declarations. Debug
2891 pragmas can be enabled either by use of the command line switch `-gnata'
2892 or by use of the pragma @code{Check_Policy} with a first argument of
2895 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
2896 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{50}
2897 @section Pragma Debug_Policy
2903 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2906 This pragma is equivalent to a corresponding @code{Check_Policy} pragma
2907 with a first argument of @code{Debug}. It is retained for historical
2908 compatibility reasons.
2910 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
2911 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{51}
2912 @section Pragma Default_Scalar_Storage_Order
2915 @geindex Default_Scalar_Storage_Order
2917 @geindex Scalar_Storage_Order
2922 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
2925 Normally if no explicit @code{Scalar_Storage_Order} is given for a record
2926 type or array type, then the scalar storage order defaults to the ordinary
2927 default for the target. But this default may be overridden using this pragma.
2928 The pragma may appear as a configuration pragma, or locally within a package
2929 spec or declarative part. In the latter case, it applies to all subsequent
2930 types declared within that package spec or declarative part.
2932 The following example shows the use of this pragma:
2935 pragma Default_Scalar_Storage_Order (High_Order_First);
2936 with System; use System;
2945 for L2'Scalar_Storage_Order use Low_Order_First;
2954 pragma Default_Scalar_Storage_Order (Low_Order_First);
2961 type H4a is new Inner.L4;
2969 In this example record types with names starting with `L' have @cite{Low_Order_First} scalar
2970 storage order, and record types with names starting with `H' have @code{High_Order_First}.
2971 Note that in the case of @code{H4a}, the order is not inherited
2972 from the parent type. Only an explicitly set @code{Scalar_Storage_Order}
2973 gets inherited on type derivation.
2975 If this pragma is used as a configuration pragma which appears within a
2976 configuration pragma file (as opposed to appearing explicitly at the start
2977 of a single unit), then the binder will require that all units in a partition
2978 be compiled in a similar manner, other than run-time units, which are not
2979 affected by this pragma. Note that the use of this form is discouraged because
2980 it may significantly degrade the run-time performance of the software, instead
2981 the default scalar storage order ought to be changed only on a local basis.
2983 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
2984 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{52}
2985 @section Pragma Default_Storage_Pool
2988 @geindex Default_Storage_Pool
2993 pragma Default_Storage_Pool (storage_pool_NAME | null);
2996 This pragma is standard in Ada 2012, but is available in all earlier
2997 versions of Ada as an implementation-defined pragma.
2998 See Ada 2012 Reference Manual for details.
3000 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
3001 @anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{53}@anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{54}
3002 @section Pragma Depends
3008 pragma Depends (DEPENDENCY_RELATION);
3010 DEPENDENCY_RELATION ::=
3012 | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
3014 DEPENDENCY_CLAUSE ::=
3015 OUTPUT_LIST =>[+] INPUT_LIST
3016 | NULL_DEPENDENCY_CLAUSE
3018 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
3020 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
3022 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
3024 OUTPUT ::= NAME | FUNCTION_RESULT
3027 where FUNCTION_RESULT is a function Result attribute_reference
3030 For the semantics of this pragma, see the entry for aspect @code{Depends} in the
3031 SPARK 2014 Reference Manual, section 6.1.5.
3033 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
3034 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{55}
3035 @section Pragma Detect_Blocking
3041 pragma Detect_Blocking;
3044 This is a standard pragma in Ada 2005, that is available in all earlier
3045 versions of Ada as an implementation-defined pragma.
3047 This is a configuration pragma that forces the detection of potentially
3048 blocking operations within a protected operation, and to raise Program_Error
3051 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
3052 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{56}
3053 @section Pragma Disable_Atomic_Synchronization
3056 @geindex Atomic Synchronization
3061 pragma Disable_Atomic_Synchronization [(Entity)];
3064 Ada requires that accesses (reads or writes) of an atomic variable be
3065 regarded as synchronization points in the case of multiple tasks.
3066 Particularly in the case of multi-processors this may require special
3067 handling, e.g. the generation of memory barriers. This capability may
3068 be turned off using this pragma in cases where it is known not to be
3071 The placement and scope rules for this pragma are the same as those
3072 for @code{pragma Suppress}. In particular it can be used as a
3073 configuration pragma, or in a declaration sequence where it applies
3074 till the end of the scope. If an @code{Entity} argument is present,
3075 the action applies only to that entity.
3077 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
3078 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{57}
3079 @section Pragma Dispatching_Domain
3085 pragma Dispatching_Domain (EXPRESSION);
3088 This pragma is standard in Ada 2012, but is available in all earlier
3089 versions of Ada as an implementation-defined pragma.
3090 See Ada 2012 Reference Manual for details.
3092 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
3093 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{58}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{59}
3094 @section Pragma Effective_Reads
3100 pragma Effective_Reads [ (static_boolean_EXPRESSION) ];
3103 For the semantics of this pragma, see the entry for aspect @code{Effective_Reads} in
3104 the SPARK 2014 Reference Manual, section 7.1.2.
3106 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3107 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{5a}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{5b}
3108 @section Pragma Effective_Writes
3114 pragma Effective_Writes [ (static_boolean_EXPRESSION) ];
3117 For the semantics of this pragma, see the entry for aspect @code{Effective_Writes}
3118 in the SPARK 2014 Reference Manual, section 7.1.2.
3120 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3121 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{5c}
3122 @section Pragma Elaboration_Checks
3125 @geindex Elaboration control
3130 pragma Elaboration_Checks (Dynamic | Static);
3133 This is a configuration pragma which specifies the elaboration model to be
3134 used during compilation. For more information on the elaboration models of
3135 GNAT, consult the chapter on elaboration order handling in the `GNAT User’s
3138 The pragma may appear in the following contexts:
3144 Configuration pragmas file
3147 Prior to the context clauses of a compilation unit’s initial declaration
3150 Any other placement of the pragma will result in a warning and the effects of
3151 the offending pragma will be ignored.
3153 If the pragma argument is @code{Dynamic}, then the dynamic elaboration model is in
3154 effect. If the pragma argument is @code{Static}, then the static elaboration model
3157 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3158 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{5d}
3159 @section Pragma Eliminate
3162 @geindex Elimination of unused subprograms
3168 [ Unit_Name => ] IDENTIFIER | SELECTED_COMPONENT ,
3169 [ Entity => ] IDENTIFIER |
3170 SELECTED_COMPONENT |
3172 [, Source_Location => SOURCE_TRACE ] );
3174 SOURCE_TRACE ::= STRING_LITERAL
3177 This pragma indicates that the given entity is not used in the program to be
3178 compiled and built, thus allowing the compiler to
3179 eliminate the code or data associated with the named entity. Any reference to
3180 an eliminated entity causes a compile-time or link-time error.
3182 The pragma has the following semantics, where @code{U} is the unit specified by
3183 the @code{Unit_Name} argument and @code{E} is the entity specified by the @code{Entity}
3190 @code{E} must be a subprogram that is explicitly declared either:
3199 Within a generic package that is instantiated in @code{U}, or
3202 As an instance of generic subprogram instantiated in @code{U}.
3205 Otherwise the pragma is ignored.
3208 If @code{E} is overloaded within @code{U} then, in the absence of a
3209 @code{Source_Location} argument, all overloadings are eliminated.
3212 If @code{E} is overloaded within @code{U} and only some overloadings
3213 are to be eliminated, then each overloading to be eliminated
3214 must be specified in a corresponding pragma @code{Eliminate}
3215 with a @code{Source_Location} argument identifying the line where the
3216 declaration appears, as described below.
3219 If @code{E} is declared as the result of a generic instantiation, then
3220 a @code{Source_Location} argument is needed, as described below.
3223 Pragma @code{Eliminate} allows a program to be compiled in a system-independent
3224 manner, so that unused entities are eliminated but without
3225 needing to modify the source text. Normally the required set of
3226 @code{Eliminate} pragmas is constructed automatically using the @code{gnatelim} tool.
3228 Any source file change that removes, splits, or
3229 adds lines may make the set of @code{Eliminate} pragmas invalid because their
3230 @code{Source_Location} argument values may get out of date.
3232 Pragma @code{Eliminate} may be used where the referenced entity is a dispatching
3233 operation. In this case all the subprograms to which the given operation can
3234 dispatch are considered to be unused (are never called as a result of a direct
3235 or a dispatching call).
3237 The string literal given for the source location specifies the line number
3238 of the declaration of the entity, using the following syntax for @code{SOURCE_TRACE}:
3241 SOURCE_TRACE ::= SOURCE_REFERENCE [ LBRACKET SOURCE_TRACE RBRACKET ]
3246 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3248 LINE_NUMBER ::= DIGIT @{DIGIT@}
3251 Spaces around the colon in a @code{SOURCE_REFERENCE} are optional.
3253 The source trace that is given as the @code{Source_Location} must obey the
3254 following rules (or else the pragma is ignored), where @code{U} is
3255 the unit @code{U} specified by the @code{Unit_Name} argument and @code{E} is the
3256 subprogram specified by the @code{Entity} argument:
3262 @code{FILE_NAME} is the short name (with no directory
3263 information) of the Ada source file for @code{U}, using the required syntax
3264 for the underlying file system (e.g. case is significant if the underlying
3265 operating system is case sensitive).
3266 If @code{U} is a package and @code{E} is a subprogram declared in the package
3267 specification and its full declaration appears in the package body,
3268 then the relevant source file is the one for the package specification;
3269 analogously if @code{U} is a generic package.
3272 If @code{E} is not declared in a generic instantiation (this includes
3273 generic subprogram instances), the source trace includes only one source
3274 line reference. @code{LINE_NUMBER} gives the line number of the occurrence
3275 of the declaration of @code{E} within the source file (as a decimal literal
3276 without an exponent or point).
3279 If @code{E} is declared by a generic instantiation, its source trace
3280 (from left to right) starts with the source location of the
3281 declaration of @code{E} in the generic unit and ends with the source
3282 location of the instantiation, given in square brackets. This approach is
3283 applied recursively with nested instantiations: the rightmost (nested
3284 most deeply in square brackets) element of the source trace is the location
3285 of the outermost instantiation, and the leftmost element (that is, outside
3286 of any square brackets) is the location of the declaration of @code{E} in
3295 pragma Eliminate (Pkg0, Proc);
3296 -- Eliminate (all overloadings of) Proc in Pkg0
3298 pragma Eliminate (Pkg1, Proc,
3299 Source_Location => "pkg1.ads:8");
3300 -- Eliminate overloading of Proc at line 8 in pkg1.ads
3302 -- Assume the following file contents:
3305 -- 2: type T is private;
3306 -- 3: package Gen_Pkg is
3307 -- 4: procedure Proc(N : T);
3313 -- 2: procedure Q is
3314 -- 3: package Inst_Pkg is new Gen_Pkg(Integer);
3315 -- ... -- No calls on Inst_Pkg.Proc
3318 -- The following pragma eliminates Inst_Pkg.Proc from Q
3319 pragma Eliminate (Q, Proc,
3320 Source_Location => "gen_pkg.ads:4[q.adb:3]");
3324 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3325 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{5e}
3326 @section Pragma Enable_Atomic_Synchronization
3329 @geindex Atomic Synchronization
3334 pragma Enable_Atomic_Synchronization [(Entity)];
3337 Ada requires that accesses (reads or writes) of an atomic variable be
3338 regarded as synchronization points in the case of multiple tasks.
3339 Particularly in the case of multi-processors this may require special
3340 handling, e.g. the generation of memory barriers. This synchronization
3341 is performed by default, but can be turned off using
3342 @code{pragma Disable_Atomic_Synchronization}. The
3343 @code{Enable_Atomic_Synchronization} pragma can be used to turn
3346 The placement and scope rules for this pragma are the same as those
3347 for @code{pragma Unsuppress}. In particular it can be used as a
3348 configuration pragma, or in a declaration sequence where it applies
3349 till the end of the scope. If an @code{Entity} argument is present,
3350 the action applies only to that entity.
3352 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3353 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{5f}
3354 @section Pragma Export_Function
3357 @geindex Argument passing mechanisms
3362 pragma Export_Function (
3363 [Internal =>] LOCAL_NAME
3364 [, [External =>] EXTERNAL_SYMBOL]
3365 [, [Parameter_Types =>] PARAMETER_TYPES]
3366 [, [Result_Type =>] result_SUBTYPE_MARK]
3367 [, [Mechanism =>] MECHANISM]
3368 [, [Result_Mechanism =>] MECHANISM_NAME]);
3372 | static_string_EXPRESSION
3377 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3381 | subtype_Name ' Access
3385 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3387 MECHANISM_ASSOCIATION ::=
3388 [formal_parameter_NAME =>] MECHANISM_NAME
3390 MECHANISM_NAME ::= Value | Reference
3393 Use this pragma to make a function externally callable and optionally
3394 provide information on mechanisms to be used for passing parameter and
3395 result values. We recommend, for the purposes of improving portability,
3396 this pragma always be used in conjunction with a separate pragma
3397 @code{Export}, which must precede the pragma @code{Export_Function}.
3398 GNAT does not require a separate pragma @code{Export}, but if none is
3399 present, @code{Convention Ada} is assumed, which is usually
3400 not what is wanted, so it is usually appropriate to use this
3401 pragma in conjunction with a @code{Export} or @code{Convention}
3402 pragma that specifies the desired foreign convention.
3403 Pragma @code{Export_Function}
3404 (and @code{Export}, if present) must appear in the same declarative
3405 region as the function to which they apply.
3407 The @code{internal_name} must uniquely designate the function to which the
3408 pragma applies. If more than one function name exists of this name in
3409 the declarative part you must use the @code{Parameter_Types} and
3410 @code{Result_Type} parameters to achieve the required
3411 unique designation. The @cite{subtype_mark}s in these parameters must
3412 exactly match the subtypes in the corresponding function specification,
3413 using positional notation to match parameters with subtype marks.
3414 The form with an @code{'Access} attribute can be used to match an
3415 anonymous access parameter.
3417 @geindex Suppressing external name
3419 Special treatment is given if the EXTERNAL is an explicit null
3420 string or a static string expressions that evaluates to the null
3421 string. In this case, no external name is generated. This form
3422 still allows the specification of parameter mechanisms.
3424 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3425 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{60}
3426 @section Pragma Export_Object
3432 pragma Export_Object (
3433 [Internal =>] LOCAL_NAME
3434 [, [External =>] EXTERNAL_SYMBOL]
3435 [, [Size =>] EXTERNAL_SYMBOL]);
3439 | static_string_EXPRESSION
3442 This pragma designates an object as exported, and apart from the
3443 extended rules for external symbols, is identical in effect to the use of
3444 the normal @code{Export} pragma applied to an object. You may use a
3445 separate Export pragma (and you probably should from the point of view
3446 of portability), but it is not required. @code{Size} is syntax checked,
3447 but otherwise ignored by GNAT.
3449 @node Pragma Export_Procedure,Pragma Export_Valued_Procedure,Pragma Export_Object,Implementation Defined Pragmas
3450 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{61}
3451 @section Pragma Export_Procedure
3457 pragma Export_Procedure (
3458 [Internal =>] LOCAL_NAME
3459 [, [External =>] EXTERNAL_SYMBOL]
3460 [, [Parameter_Types =>] PARAMETER_TYPES]
3461 [, [Mechanism =>] MECHANISM]);
3465 | static_string_EXPRESSION
3470 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3474 | subtype_Name ' Access
3478 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3480 MECHANISM_ASSOCIATION ::=
3481 [formal_parameter_NAME =>] MECHANISM_NAME
3483 MECHANISM_NAME ::= Value | Reference
3486 This pragma is identical to @code{Export_Function} except that it
3487 applies to a procedure rather than a function and the parameters
3488 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
3489 GNAT does not require a separate pragma @code{Export}, but if none is
3490 present, @code{Convention Ada} is assumed, which is usually
3491 not what is wanted, so it is usually appropriate to use this
3492 pragma in conjunction with a @code{Export} or @code{Convention}
3493 pragma that specifies the desired foreign convention.
3495 @geindex Suppressing external name
3497 Special treatment is given if the EXTERNAL is an explicit null
3498 string or a static string expressions that evaluates to the null
3499 string. In this case, no external name is generated. This form
3500 still allows the specification of parameter mechanisms.
3502 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Procedure,Implementation Defined Pragmas
3503 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{62}
3504 @section Pragma Export_Valued_Procedure
3510 pragma Export_Valued_Procedure (
3511 [Internal =>] LOCAL_NAME
3512 [, [External =>] EXTERNAL_SYMBOL]
3513 [, [Parameter_Types =>] PARAMETER_TYPES]
3514 [, [Mechanism =>] MECHANISM]);
3518 | static_string_EXPRESSION
3523 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3527 | subtype_Name ' Access
3531 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3533 MECHANISM_ASSOCIATION ::=
3534 [formal_parameter_NAME =>] MECHANISM_NAME
3536 MECHANISM_NAME ::= Value | Reference
3539 This pragma is identical to @code{Export_Procedure} except that the
3540 first parameter of @code{LOCAL_NAME}, which must be present, must be of
3541 mode @code{out}, and externally the subprogram is treated as a function
3542 with this parameter as the result of the function. GNAT provides for
3543 this capability to allow the use of @code{out} and @code{in out}
3544 parameters in interfacing to external functions (which are not permitted
3546 GNAT does not require a separate pragma @code{Export}, but if none is
3547 present, @code{Convention Ada} is assumed, which is almost certainly
3548 not what is wanted since the whole point of this pragma is to interface
3549 with foreign language functions, so it is usually appropriate to use this
3550 pragma in conjunction with a @code{Export} or @code{Convention}
3551 pragma that specifies the desired foreign convention.
3553 @geindex Suppressing external name
3555 Special treatment is given if the EXTERNAL is an explicit null
3556 string or a static string expressions that evaluates to the null
3557 string. In this case, no external name is generated. This form
3558 still allows the specification of parameter mechanisms.
3560 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3561 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{63}
3562 @section Pragma Extend_System
3573 pragma Extend_System ([Name =>] IDENTIFIER);
3576 This pragma is used to provide backwards compatibility with other
3577 implementations that extend the facilities of package @code{System}. In
3578 GNAT, @code{System} contains only the definitions that are present in
3579 the Ada RM. However, other implementations, notably the DEC Ada 83
3580 implementation, provide many extensions to package @code{System}.
3582 For each such implementation accommodated by this pragma, GNAT provides a
3583 package @code{Aux_@var{xxx}}, e.g., @code{Aux_DEC} for the DEC Ada 83
3584 implementation, which provides the required additional definitions. You
3585 can use this package in two ways. You can @code{with} it in the normal
3586 way and access entities either by selection or using a @code{use}
3587 clause. In this case no special processing is required.
3589 However, if existing code contains references such as
3590 @code{System.@var{xxx}} where `xxx' is an entity in the extended
3591 definitions provided in package @code{System}, you may use this pragma
3592 to extend visibility in @code{System} in a non-standard way that
3593 provides greater compatibility with the existing code. Pragma
3594 @code{Extend_System} is a configuration pragma whose single argument is
3595 the name of the package containing the extended definition
3596 (e.g., @code{Aux_DEC} for the DEC Ada case). A unit compiled under
3597 control of this pragma will be processed using special visibility
3598 processing that looks in package @code{System.Aux_@var{xxx}} where
3599 @code{Aux_@var{xxx}} is the pragma argument for any entity referenced in
3600 package @code{System}, but not found in package @code{System}.
3602 You can use this pragma either to access a predefined @code{System}
3603 extension supplied with the compiler, for example @code{Aux_DEC} or
3604 you can construct your own extension unit following the above
3605 definition. Note that such a package is a child of @code{System}
3606 and thus is considered part of the implementation.
3607 To compile it you will have to use the `-gnatg' switch
3608 for compiling System units, as explained in the
3611 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3612 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{64}
3613 @section Pragma Extensions_Allowed
3616 @geindex Ada Extensions
3618 @geindex GNAT Extensions
3623 pragma Extensions_Allowed (On | Off);
3626 This configuration pragma enables or disables the implementation
3627 extension mode (the use of Off as a parameter cancels the effect
3628 of the `-gnatX' command switch).
3630 In extension mode, the latest version of the Ada language is
3631 implemented (currently Ada 2022), and in addition a number
3632 of GNAT specific extensions are recognized as follows:
3638 Constrained attribute for generic objects
3640 The @code{Constrained} attribute is permitted for objects of
3641 generic types. The result indicates if the corresponding actual
3645 @code{Static} aspect on intrinsic functions
3647 The Ada 202x @code{Static} aspect can be specified on Intrinsic imported
3648 functions and the compiler will evaluate some of these intrinsic statically,
3649 in particular the @code{Shift_Left} and @code{Shift_Right} intrinsics.
3652 @code{'Reduce} attribute
3654 This attribute part of the Ada 202x language definition is provided for
3655 now under -gnatX to confirm and potentially refine its usage and syntax.
3658 @code{[]} aggregates
3660 This new aggregate syntax for arrays and containers is provided under -gnatX
3661 to experiment and confirm this new language syntax.
3664 Additional @code{when} constructs
3666 In addition to the @code{exit when CONDITION} control structure, several
3667 additional constructs are allowed following this format. Including
3668 @code{return when CONDITION}, @code{goto when CONDITION}, and
3669 @code{raise [with EXCEPTION_MESSAGE] when CONDITION.}
3674 return Result when Variable > 10;
3676 raise Program_Error with "Element is null" when Element = null;
3678 goto End_Of_Subprogram when Variable = -1;
3682 Casing on composite values (aka pattern matching)
3684 The selector for a case statement may be of a composite type, subject to
3685 some restrictions (described below). Aggregate syntax is used for choices
3686 of such a case statement; however, in cases where a “normal” aggregate would
3687 require a discrete value, a discrete subtype may be used instead; box
3688 notation can also be used to match all values.
3690 Consider this example:
3697 procedure Caser_1 (X : Rec) is
3700 when (F1 => Positive, F2 => Positive) =>
3702 when (F1 => Natural, F2 => <>) | (F1 => <>, F2 => Natural) =>
3710 If Caser_1 is called and both components of X are positive, then
3711 Do_This will be called; otherwise, if either component is nonnegative
3712 then Do_That will be called; otherwise, Do_The_Other_Thing will be called.
3714 If the set of values that match the choice(s) of an earlier alternative
3715 overlaps the corresponding set of a later alternative, then the first
3716 set shall be a proper subset of the second (and the later alternative
3717 will not be executed if the earlier alternative “matches”). All possible
3718 values of the composite type shall be covered. The composite type of the
3719 selector shall be an array or record type that is neither limited
3722 If a subcomponent’s subtype does not meet certain restrictions, then
3723 the only value that can be specified for that subcomponent in a case
3724 choice expression is a “box” component association (which matches all
3725 possible values for the subcomponent). This restriction applies if
3731 the component subtype is not a record, array, or discrete type; or
3734 the component subtype is subject to a non-static constraint or
3738 the component type is an enumeration type that is subject to an
3739 enumeration representation clause; or
3742 the component type is a multidimensional array type or an
3743 array type with a nonstatic index subtype.
3746 Support for casing on arrays (and on records that contain arrays) is
3747 currently subject to some restrictions. Non-positional
3748 array aggregates are not supported as (or within) case choices. Likewise
3749 for array type and subtype names. The current implementation exceeds
3750 compile-time capacity limits in some annoyingly common scenarios; the
3751 message generated in such cases is usually “Capacity exceeded in compiling
3752 case statement with composite selector type”.
3754 In addition, pattern bindings are supported. This is a mechanism
3755 for binding a name to a component of a matching value for use within
3756 an alternative of a case statement. For a component association
3757 that occurs within a case choice, the expression may be followed by
3758 “is <identifier>”. In the special case of a “box” component association,
3759 the identifier may instead be provided within the box. Either of these
3760 indicates that the given identifer denotes (a constant view of) the matching
3761 subcomponent of the case selector. Binding is not yet supported for arrays
3762 or subcomponents thereof.
3764 Consider this example (which uses type Rec from the previous example):
3767 procedure Caser_2 (X : Rec) is
3770 when (F1 => Positive is Abc, F2 => Positive) =>
3772 when (F1 => Natural is N1, F2 => <N2>) |
3773 (F1 => <N2>, F2 => Natural is N1) =>
3774 Do_That (Param_1 => N1, Param_2 => N2);
3781 This example is the same as the previous one with respect to
3782 determining whether Do_This, Do_That, or Do_The_Other_Thing will
3783 be called. But for this version, Do_This takes a parameter and Do_That
3784 takes two parameters. If Do_This is called, the actual parameter in the
3787 If Do_That is called, the situation is more complex because there are two
3788 choices for that alternative. If Do_That is called because the first choice
3789 matched (i.e., because X.F1 is nonnegative and either X.F1 or X.F2 is zero
3790 or negative), then the actual parameters of the call will be (in order)
3791 X.F1 and X.F2. If Do_That is called because the second choice matched (and
3792 the first one did not), then the actual parameters will be reversed.
3794 Within the choice list for single alternative, each choice must
3795 define the same set of bindings and the component subtypes for
3796 for a given identifer must all statically match. Currently, the case
3797 of a binding for a nondiscrete component is not implemented.
3800 Fixed lower bounds for array types and subtypes
3802 Unconstrained array types and subtypes can be specified with a lower bound
3803 that is fixed to a certain value, by writing an index range that uses the
3804 syntax “<lower-bound-expression> .. <>”. This guarantees that all objects
3805 of the type or subtype will have the specified lower bound.
3807 For example, a matrix type with fixed lower bounds of zero for each
3808 dimension can be declared by the following:
3812 array (Natural range 0 .. <>, Natural range 0 .. <>) of Integer;
3815 Objects of type Matrix declared with an index constraint must have index
3816 ranges starting at zero:
3819 M1 : Matrix (0 .. 9, 0 .. 19);
3820 M2 : Matrix (2 .. 11, 3 .. 22); -- Warning about bounds; will raise CE
3823 Similarly, a subtype of String can be declared that specifies the lower
3824 bound of objects of that subtype to be 1:
3829 subtype String_1 is String (1 .. <>);
3833 If a string slice is passed to a formal of subtype String_1 in a call to
3834 a subprogram S, the slice’s bounds will “slide” so that the lower bound
3835 is 1. Within S, the lower bound of the formal is known to be 1, so, unlike
3836 a normal unconstrained String formal, there is no need to worry about
3837 accounting for other possible lower-bound values. Sliding of bounds also
3838 occurs in other contexts, such as for object declarations with an
3839 unconstrained subtype with fixed lower bound, as well as in subtype
3842 Use of this feature increases safety by simplifying code, and can also
3843 improve the efficiency of indexing operations, since the compiler statically
3844 knows the lower bound of unconstrained array formals when the formal’s
3845 subtype has index ranges with static fixed lower bounds.
3848 Prefixed-view notation for calls to primitive subprograms of untagged types
3850 Since Ada 2005, calls to primitive subprograms of a tagged type that
3851 have a “prefixed view” (see RM 4.1.3(9.2)) have been allowed to be
3852 written using the form of a selected_component, with the first actual
3853 parameter given as the prefix and the name of the subprogram as a
3854 selector. This prefixed-view notation for calls is extended so as to
3855 also allow such syntax for calls to primitive subprograms of untagged
3856 types. The primitives of an untagged type T that have a prefixed view
3857 are those where the first formal parameter of the subprogram either
3858 is of type T or is an anonymous access parameter whose designated type
3859 is T. For a type that has a component that happens to have the same
3860 simple name as one of the type’s primitive subprograms, where the
3861 component is visible at the point of a selected_component using that
3862 name, preference is given to the component in a selected_component
3863 (as is currently the case for tagged types with such component names).
3866 Expression defaults for generic formal functions
3868 The declaration of a generic formal function is allowed to specify
3869 an expression as a default, using the syntax of an expression function.
3871 Here is an example of this feature:
3876 with function Copy (Item : T) return T is (Item); -- Defaults to Item
3879 type Stack is limited private;
3881 procedure Push (S : in out Stack; X : T); -- Calls Copy on X
3883 function Pop (S : in out Stack) return T; -- Calls Copy to return item
3891 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3892 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{65}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{66}
3893 @section Pragma Extensions_Visible
3899 pragma Extensions_Visible [ (static_boolean_EXPRESSION) ];
3902 For the semantics of this pragma, see the entry for aspect @code{Extensions_Visible}
3903 in the SPARK 2014 Reference Manual, section 6.1.7.
3905 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3906 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{67}
3907 @section Pragma External
3914 [ Convention =>] convention_IDENTIFIER,
3915 [ Entity =>] LOCAL_NAME
3916 [, [External_Name =>] static_string_EXPRESSION ]
3917 [, [Link_Name =>] static_string_EXPRESSION ]);
3920 This pragma is identical in syntax and semantics to pragma
3921 @code{Export} as defined in the Ada Reference Manual. It is
3922 provided for compatibility with some Ada 83 compilers that
3923 used this pragma for exactly the same purposes as pragma
3924 @code{Export} before the latter was standardized.
3926 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3927 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{68}
3928 @section Pragma External_Name_Casing
3931 @geindex Dec Ada 83 casing compatibility
3933 @geindex External Names
3936 @geindex Casing of External names
3941 pragma External_Name_Casing (
3942 Uppercase | Lowercase
3943 [, Uppercase | Lowercase | As_Is]);
3946 This pragma provides control over the casing of external names associated
3947 with Import and Export pragmas. There are two cases to consider:
3953 Implicit external names
3955 Implicit external names are derived from identifiers. The most common case
3956 arises when a standard Ada Import or Export pragma is used with only two
3960 pragma Import (C, C_Routine);
3963 Since Ada is a case-insensitive language, the spelling of the identifier in
3964 the Ada source program does not provide any information on the desired
3965 casing of the external name, and so a convention is needed. In GNAT the
3966 default treatment is that such names are converted to all lower case
3967 letters. This corresponds to the normal C style in many environments.
3968 The first argument of pragma @code{External_Name_Casing} can be used to
3969 control this treatment. If @code{Uppercase} is specified, then the name
3970 will be forced to all uppercase letters. If @code{Lowercase} is specified,
3971 then the normal default of all lower case letters will be used.
3973 This same implicit treatment is also used in the case of extended DEC Ada 83
3974 compatible Import and Export pragmas where an external name is explicitly
3975 specified using an identifier rather than a string.
3978 Explicit external names
3980 Explicit external names are given as string literals. The most common case
3981 arises when a standard Ada Import or Export pragma is used with three
3985 pragma Import (C, C_Routine, "C_routine");
3988 In this case, the string literal normally provides the exact casing required
3989 for the external name. The second argument of pragma
3990 @code{External_Name_Casing} may be used to modify this behavior.
3991 If @code{Uppercase} is specified, then the name
3992 will be forced to all uppercase letters. If @code{Lowercase} is specified,
3993 then the name will be forced to all lowercase letters. A specification of
3994 @code{As_Is} provides the normal default behavior in which the casing is
3995 taken from the string provided.
3998 This pragma may appear anywhere that a pragma is valid. In particular, it
3999 can be used as a configuration pragma in the @code{gnat.adc} file, in which
4000 case it applies to all subsequent compilations, or it can be used as a program
4001 unit pragma, in which case it only applies to the current unit, or it can
4002 be used more locally to control individual Import/Export pragmas.
4004 It was primarily intended for use with OpenVMS systems, where many
4005 compilers convert all symbols to upper case by default. For interfacing to
4006 such compilers (e.g., the DEC C compiler), it may be convenient to use
4010 pragma External_Name_Casing (Uppercase, Uppercase);
4013 to enforce the upper casing of all external symbols.
4015 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
4016 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{69}
4017 @section Pragma Fast_Math
4026 This is a configuration pragma which activates a mode in which speed is
4027 considered more important for floating-point operations than absolutely
4028 accurate adherence to the requirements of the standard. Currently the
4029 following operations are affected:
4034 @item `Complex Multiplication'
4036 The normal simple formula for complex multiplication can result in intermediate
4037 overflows for numbers near the end of the range. The Ada standard requires that
4038 this situation be detected and corrected by scaling, but in Fast_Math mode such
4039 cases will simply result in overflow. Note that to take advantage of this you
4040 must instantiate your own version of @code{Ada.Numerics.Generic_Complex_Types}
4041 under control of the pragma, rather than use the preinstantiated versions.
4044 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
4045 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{6a}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{6b}
4046 @section Pragma Favor_Top_Level
4052 pragma Favor_Top_Level (type_NAME);
4055 The argument of pragma @code{Favor_Top_Level} must be a named access-to-subprogram
4056 type. This pragma is an efficiency hint to the compiler, regarding the use of
4057 @code{'Access} or @code{'Unrestricted_Access} on nested (non-library-level) subprograms.
4058 The pragma means that nested subprograms are not used with this type, or are
4059 rare, so that the generated code should be efficient in the top-level case.
4060 When this pragma is used, dynamically generated trampolines may be used on some
4061 targets for nested subprograms. See restriction @code{No_Implicit_Dynamic_Code}.
4063 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
4064 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{6c}
4065 @section Pragma Finalize_Storage_Only
4071 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
4074 The argument of pragma @code{Finalize_Storage_Only} must denote a local type which
4075 is derived from @code{Ada.Finalization.Controlled} or @code{Limited_Controlled}. The
4076 pragma suppresses the call to @code{Finalize} for declared library-level objects
4077 of the argument type. This is mostly useful for types where finalization is
4078 only used to deal with storage reclamation since in most environments it is
4079 not necessary to reclaim memory just before terminating execution, hence the
4080 name. Note that this pragma does not suppress Finalize calls for library-level
4081 heap-allocated objects (see pragma @code{No_Heap_Finalization}).
4083 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
4084 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{6d}
4085 @section Pragma Float_Representation
4091 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
4093 FLOAT_REP ::= VAX_Float | IEEE_Float
4096 In the one argument form, this pragma is a configuration pragma which
4097 allows control over the internal representation chosen for the predefined
4098 floating point types declared in the packages @code{Standard} and
4099 @code{System}. This pragma is only provided for compatibility and has no effect.
4101 The two argument form specifies the representation to be used for
4102 the specified floating-point type. The argument must
4103 be @code{IEEE_Float} to specify the use of IEEE format, as follows:
4109 For a digits value of 6, 32-bit IEEE short format will be used.
4112 For a digits value of 15, 64-bit IEEE long format will be used.
4115 No other value of digits is permitted.
4118 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
4119 @anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{6e}@anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{6f}
4120 @section Pragma Ghost
4126 pragma Ghost [ (static_boolean_EXPRESSION) ];
4129 For the semantics of this pragma, see the entry for aspect @code{Ghost} in the SPARK
4130 2014 Reference Manual, section 6.9.
4132 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
4133 @anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{70}@anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{71}
4134 @section Pragma Global
4140 pragma Global (GLOBAL_SPECIFICATION);
4142 GLOBAL_SPECIFICATION ::=
4145 | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
4147 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
4149 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
4150 GLOBAL_LIST ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
4151 GLOBAL_ITEM ::= NAME
4154 For the semantics of this pragma, see the entry for aspect @code{Global} in the
4155 SPARK 2014 Reference Manual, section 6.1.4.
4157 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
4158 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{72}
4159 @section Pragma Ident
4165 pragma Ident (static_string_EXPRESSION);
4168 This pragma is identical in effect to pragma @code{Comment}. It is provided
4169 for compatibility with other Ada compilers providing this pragma.
4171 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
4172 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{73}
4173 @section Pragma Ignore_Pragma
4179 pragma Ignore_Pragma (pragma_IDENTIFIER);
4182 This is a configuration pragma
4183 that takes a single argument that is a simple identifier. Any subsequent
4184 use of a pragma whose pragma identifier matches this argument will be
4185 silently ignored. This may be useful when legacy code or code intended
4186 for compilation with some other compiler contains pragmas that match the
4187 name, but not the exact implementation, of a GNAT pragma. The use of this
4188 pragma allows such pragmas to be ignored, which may be useful in CodePeer
4189 mode, or during porting of legacy code.
4191 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
4192 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{74}
4193 @section Pragma Implementation_Defined
4199 pragma Implementation_Defined (local_NAME);
4202 This pragma marks a previously declared entity as implementation-defined.
4203 For an overloaded entity, applies to the most recent homonym.
4206 pragma Implementation_Defined;
4209 The form with no arguments appears anywhere within a scope, most
4210 typically a package spec, and indicates that all entities that are
4211 defined within the package spec are Implementation_Defined.
4213 This pragma is used within the GNAT runtime library to identify
4214 implementation-defined entities introduced in language-defined units,
4215 for the purpose of implementing the No_Implementation_Identifiers
4218 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
4219 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{75}
4220 @section Pragma Implemented
4226 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
4228 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
4231 This is an Ada 2012 representation pragma which applies to protected, task
4232 and synchronized interface primitives. The use of pragma Implemented provides
4233 a way to impose a static requirement on the overriding operation by adhering
4234 to one of the three implementation kinds: entry, protected procedure or any of
4235 the above. This pragma is available in all earlier versions of Ada as an
4236 implementation-defined pragma.
4239 type Synch_Iface is synchronized interface;
4240 procedure Prim_Op (Obj : in out Iface) is abstract;
4241 pragma Implemented (Prim_Op, By_Protected_Procedure);
4243 protected type Prot_1 is new Synch_Iface with
4244 procedure Prim_Op; -- Legal
4247 protected type Prot_2 is new Synch_Iface with
4248 entry Prim_Op; -- Illegal
4251 task type Task_Typ is new Synch_Iface with
4252 entry Prim_Op; -- Illegal
4256 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
4257 Implemented determines the runtime behavior of the requeue. Implementation kind
4258 By_Entry guarantees that the action of requeueing will proceed from an entry to
4259 another entry. Implementation kind By_Protected_Procedure transforms the
4260 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
4261 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
4262 the target’s overriding subprogram kind.
4264 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
4265 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{76}
4266 @section Pragma Implicit_Packing
4269 @geindex Rational Profile
4274 pragma Implicit_Packing;
4277 This is a configuration pragma that requests implicit packing for packed
4278 arrays for which a size clause is given but no explicit pragma Pack or
4279 specification of Component_Size is present. It also applies to records
4280 where no record representation clause is present. Consider this example:
4283 type R is array (0 .. 7) of Boolean;
4287 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
4288 does not change the layout of a composite object. So the Size clause in the
4289 above example is normally rejected, since the default layout of the array uses
4290 8-bit components, and thus the array requires a minimum of 64 bits.
4292 If this declaration is compiled in a region of code covered by an occurrence
4293 of the configuration pragma Implicit_Packing, then the Size clause in this
4294 and similar examples will cause implicit packing and thus be accepted. For
4295 this implicit packing to occur, the type in question must be an array of small
4296 components whose size is known at compile time, and the Size clause must
4297 specify the exact size that corresponds to the number of elements in the array
4298 multiplied by the size in bits of the component type (both single and
4299 multi-dimensioned arrays can be controlled with this pragma).
4301 @geindex Array packing
4303 Similarly, the following example shows the use in the record case
4307 a, b, c, d, e, f, g, h : boolean;
4313 Without a pragma Pack, each Boolean field requires 8 bits, so the
4314 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
4315 sufficient. The use of pragma Implicit_Packing allows this record
4316 declaration to compile without an explicit pragma Pack.
4318 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
4319 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{77}
4320 @section Pragma Import_Function
4326 pragma Import_Function (
4327 [Internal =>] LOCAL_NAME,
4328 [, [External =>] EXTERNAL_SYMBOL]
4329 [, [Parameter_Types =>] PARAMETER_TYPES]
4330 [, [Result_Type =>] SUBTYPE_MARK]
4331 [, [Mechanism =>] MECHANISM]
4332 [, [Result_Mechanism =>] MECHANISM_NAME]);
4336 | static_string_EXPRESSION
4340 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4344 | subtype_Name ' Access
4348 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4350 MECHANISM_ASSOCIATION ::=
4351 [formal_parameter_NAME =>] MECHANISM_NAME
4358 This pragma is used in conjunction with a pragma @code{Import} to
4359 specify additional information for an imported function. The pragma
4360 @code{Import} (or equivalent pragma @code{Interface}) must precede the
4361 @code{Import_Function} pragma and both must appear in the same
4362 declarative part as the function specification.
4364 The @code{Internal} argument must uniquely designate
4365 the function to which the
4366 pragma applies. If more than one function name exists of this name in
4367 the declarative part you must use the @code{Parameter_Types} and
4368 @code{Result_Type} parameters to achieve the required unique
4369 designation. Subtype marks in these parameters must exactly match the
4370 subtypes in the corresponding function specification, using positional
4371 notation to match parameters with subtype marks.
4372 The form with an @code{'Access} attribute can be used to match an
4373 anonymous access parameter.
4375 You may optionally use the @code{Mechanism} and @code{Result_Mechanism}
4376 parameters to specify passing mechanisms for the
4377 parameters and result. If you specify a single mechanism name, it
4378 applies to all parameters. Otherwise you may specify a mechanism on a
4379 parameter by parameter basis using either positional or named
4380 notation. If the mechanism is not specified, the default mechanism
4383 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
4384 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{78}
4385 @section Pragma Import_Object
4391 pragma Import_Object (
4392 [Internal =>] LOCAL_NAME
4393 [, [External =>] EXTERNAL_SYMBOL]
4394 [, [Size =>] EXTERNAL_SYMBOL]);
4398 | static_string_EXPRESSION
4401 This pragma designates an object as imported, and apart from the
4402 extended rules for external symbols, is identical in effect to the use of
4403 the normal @code{Import} pragma applied to an object. Unlike the
4404 subprogram case, you need not use a separate @code{Import} pragma,
4405 although you may do so (and probably should do so from a portability
4406 point of view). @code{size} is syntax checked, but otherwise ignored by
4409 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
4410 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{79}
4411 @section Pragma Import_Procedure
4417 pragma Import_Procedure (
4418 [Internal =>] LOCAL_NAME
4419 [, [External =>] EXTERNAL_SYMBOL]
4420 [, [Parameter_Types =>] PARAMETER_TYPES]
4421 [, [Mechanism =>] MECHANISM]);
4425 | static_string_EXPRESSION
4429 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4433 | subtype_Name ' Access
4437 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4439 MECHANISM_ASSOCIATION ::=
4440 [formal_parameter_NAME =>] MECHANISM_NAME
4442 MECHANISM_NAME ::= Value | Reference
4445 This pragma is identical to @code{Import_Function} except that it
4446 applies to a procedure rather than a function and the parameters
4447 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
4449 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4450 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{7a}
4451 @section Pragma Import_Valued_Procedure
4457 pragma Import_Valued_Procedure (
4458 [Internal =>] LOCAL_NAME
4459 [, [External =>] EXTERNAL_SYMBOL]
4460 [, [Parameter_Types =>] PARAMETER_TYPES]
4461 [, [Mechanism =>] MECHANISM]);
4465 | static_string_EXPRESSION
4469 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4473 | subtype_Name ' Access
4477 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4479 MECHANISM_ASSOCIATION ::=
4480 [formal_parameter_NAME =>] MECHANISM_NAME
4482 MECHANISM_NAME ::= Value | Reference
4485 This pragma is identical to @code{Import_Procedure} except that the
4486 first parameter of @code{LOCAL_NAME}, which must be present, must be of
4487 mode @code{out}, and externally the subprogram is treated as a function
4488 with this parameter as the result of the function. The purpose of this
4489 capability is to allow the use of @code{out} and @code{in out}
4490 parameters in interfacing to external functions (which are not permitted
4491 in Ada functions). You may optionally use the @code{Mechanism}
4492 parameters to specify passing mechanisms for the parameters.
4493 If you specify a single mechanism name, it applies to all parameters.
4494 Otherwise you may specify a mechanism on a parameter by parameter
4495 basis using either positional or named notation. If the mechanism is not
4496 specified, the default mechanism is used.
4498 Note that it is important to use this pragma in conjunction with a separate
4499 pragma Import that specifies the desired convention, since otherwise the
4500 default convention is Ada, which is almost certainly not what is required.
4502 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4503 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{7b}
4504 @section Pragma Independent
4510 pragma Independent (Local_NAME);
4513 This pragma is standard in Ada 2012 mode (which also provides an aspect
4514 of the same name). It is also available as an implementation-defined
4515 pragma in all earlier versions. It specifies that the
4516 designated object or all objects of the designated type must be
4517 independently addressable. This means that separate tasks can safely
4518 manipulate such objects. For example, if two components of a record are
4519 independent, then two separate tasks may access these two components.
4521 constraints on the representation of the object (for instance prohibiting
4524 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4525 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{7c}
4526 @section Pragma Independent_Components
4532 pragma Independent_Components (Local_NAME);
4535 This pragma is standard in Ada 2012 mode (which also provides an aspect
4536 of the same name). It is also available as an implementation-defined
4537 pragma in all earlier versions. It specifies that the components of the
4538 designated object, or the components of each object of the designated
4540 independently addressable. This means that separate tasks can safely
4541 manipulate separate components in the composite object. This may place
4542 constraints on the representation of the object (for instance prohibiting
4545 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4546 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{7d}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{7e}
4547 @section Pragma Initial_Condition
4553 pragma Initial_Condition (boolean_EXPRESSION);
4556 For the semantics of this pragma, see the entry for aspect @code{Initial_Condition}
4557 in the SPARK 2014 Reference Manual, section 7.1.6.
4559 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4560 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{7f}
4561 @section Pragma Initialize_Scalars
4564 @geindex debugging with Initialize_Scalars
4569 pragma Initialize_Scalars
4570 [ ( TYPE_VALUE_PAIR @{, TYPE_VALUE_PAIR@} ) ];
4573 SCALAR_TYPE => static_EXPRESSION
4590 This pragma is similar to @code{Normalize_Scalars} conceptually but has two
4591 important differences.
4593 First, there is no requirement for the pragma to be used uniformly in all units
4594 of a partition. In particular, it is fine to use this just for some or all of
4595 the application units of a partition, without needing to recompile the run-time
4596 library. In the case where some units are compiled with the pragma, and some
4597 without, then a declaration of a variable where the type is defined in package
4598 Standard or is locally declared will always be subject to initialization, as
4599 will any declaration of a scalar variable. For composite variables, whether the
4600 variable is initialized may also depend on whether the package in which the
4601 type of the variable is declared is compiled with the pragma.
4603 The other important difference is that the programmer can control the value
4604 used for initializing scalar objects. This effect can be achieved in several
4611 At compile time, the programmer can specify the invalid value for a
4612 particular family of scalar types using the optional arguments of the pragma.
4614 The compile-time approach is intended to optimize the generated code for the
4615 pragma, by possibly using fast operations such as @code{memset}. Note that such
4616 optimizations require using values where the bytes all have the same binary
4620 At bind time, the programmer has several options:
4626 Initialization with invalid values (similar to Normalize_Scalars, though
4627 for Initialize_Scalars it is not always possible to determine the invalid
4628 values in complex cases like signed component fields with nonstandard
4632 Initialization with high values.
4635 Initialization with low values.
4638 Initialization with a specific bit pattern.
4641 See the GNAT User’s Guide for binder options for specifying these cases.
4643 The bind-time approach is intended to provide fast turnaround for testing
4644 with different values, without having to recompile the program.
4647 At execution time, the programmer can specify the invalid values using an
4648 environment variable. See the GNAT User’s Guide for details.
4650 The execution-time approach is intended to provide fast turnaround for
4651 testing with different values, without having to recompile and rebind the
4655 Note that pragma @code{Initialize_Scalars} is particularly useful in conjunction
4656 with the enhanced validity checking that is now provided in GNAT, which checks
4657 for invalid values under more conditions. Using this feature (see description
4658 of the `-gnatV' flag in the GNAT User’s Guide) in conjunction with pragma
4659 @code{Initialize_Scalars} provides a powerful new tool to assist in the detection
4660 of problems caused by uninitialized variables.
4662 Note: the use of @code{Initialize_Scalars} has a fairly extensive effect on the
4663 generated code. This may cause your code to be substantially larger. It may
4664 also cause an increase in the amount of stack required, so it is probably a
4665 good idea to turn on stack checking (see description of stack checking in the
4666 GNAT User’s Guide) when using this pragma.
4668 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4669 @anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{80}@anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{81}
4670 @section Pragma Initializes
4676 pragma Initializes (INITIALIZATION_LIST);
4678 INITIALIZATION_LIST ::=
4680 | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4682 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4687 | (INPUT @{, INPUT@})
4692 For the semantics of this pragma, see the entry for aspect @code{Initializes} in the
4693 SPARK 2014 Reference Manual, section 7.1.5.
4695 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4696 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{82}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{83}
4697 @section Pragma Inline_Always
4703 pragma Inline_Always (NAME [, NAME]);
4706 Similar to pragma @code{Inline} except that inlining is unconditional.
4707 Inline_Always instructs the compiler to inline every direct call to the
4708 subprogram or else to emit a compilation error, independently of any
4709 option, in particular `-gnatn' or `-gnatN' or the optimization level.
4710 It is an error to take the address or access of @code{NAME}. It is also an error to
4711 apply this pragma to a primitive operation of a tagged type. Thanks to such
4712 restrictions, the compiler is allowed to remove the out-of-line body of @code{NAME}.
4714 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4715 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{84}
4716 @section Pragma Inline_Generic
4722 pragma Inline_Generic (GNAME @{, GNAME@});
4724 GNAME ::= generic_unit_NAME | generic_instance_NAME
4727 This pragma is provided for compatibility with Dec Ada 83. It has
4728 no effect in GNAT (which always inlines generics), other
4729 than to check that the given names are all names of generic units or
4732 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4733 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{85}
4734 @section Pragma Interface
4741 [Convention =>] convention_identifier,
4742 [Entity =>] local_NAME
4743 [, [External_Name =>] static_string_expression]
4744 [, [Link_Name =>] static_string_expression]);
4747 This pragma is identical in syntax and semantics to
4748 the standard Ada pragma @code{Import}. It is provided for compatibility
4749 with Ada 83. The definition is upwards compatible both with pragma
4750 @code{Interface} as defined in the Ada 83 Reference Manual, and also
4751 with some extended implementations of this pragma in certain Ada 83
4752 implementations. The only difference between pragma @code{Interface}
4753 and pragma @code{Import} is that there is special circuitry to allow
4754 both pragmas to appear for the same subprogram entity (normally it
4755 is illegal to have multiple @code{Import} pragmas). This is useful in
4756 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4759 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4760 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{86}
4761 @section Pragma Interface_Name
4767 pragma Interface_Name (
4768 [Entity =>] LOCAL_NAME
4769 [, [External_Name =>] static_string_EXPRESSION]
4770 [, [Link_Name =>] static_string_EXPRESSION]);
4773 This pragma provides an alternative way of specifying the interface name
4774 for an interfaced subprogram, and is provided for compatibility with Ada
4775 83 compilers that use the pragma for this purpose. You must provide at
4776 least one of @code{External_Name} or @code{Link_Name}.
4778 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4779 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{87}
4780 @section Pragma Interrupt_Handler
4786 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4789 This program unit pragma is supported for parameterless protected procedures
4790 as described in Annex C of the Ada Reference Manual.
4792 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4793 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{88}
4794 @section Pragma Interrupt_State
4800 pragma Interrupt_State
4802 [State =>] SYSTEM | RUNTIME | USER);
4805 Normally certain interrupts are reserved to the implementation. Any attempt
4806 to attach an interrupt causes Program_Error to be raised, as described in
4807 RM C.3.2(22). A typical example is the @code{SIGINT} interrupt used in
4808 many systems for an @code{Ctrl-C} interrupt. Normally this interrupt is
4809 reserved to the implementation, so that @code{Ctrl-C} can be used to
4810 interrupt execution. Additionally, signals such as @code{SIGSEGV},
4811 @code{SIGABRT}, @code{SIGFPE} and @code{SIGILL} are often mapped to specific
4812 Ada exceptions, or used to implement run-time functions such as the
4813 @code{abort} statement and stack overflow checking.
4815 Pragma @code{Interrupt_State} provides a general mechanism for overriding
4816 such uses of interrupts. It subsumes the functionality of pragma
4817 @code{Unreserve_All_Interrupts}. Pragma @code{Interrupt_State} is not
4818 available on Windows. On all other platforms than VxWorks,
4819 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4820 and may be used to mark interrupts required by the board support package
4823 Interrupts can be in one of three states:
4831 The interrupt is reserved (no Ada handler can be installed), and the
4832 Ada run-time may not install a handler. As a result you are guaranteed
4833 standard system default action if this interrupt is raised. This also allows
4834 installing a low level handler via C APIs such as sigaction(), outside
4840 The interrupt is reserved (no Ada handler can be installed). The run time
4841 is allowed to install a handler for internal control purposes, but is
4842 not required to do so.
4847 The interrupt is unreserved. The user may install an Ada handler via
4848 Ada.Interrupts and pragma Interrupt_Handler or Attach_Handler to provide
4852 These states are the allowed values of the @code{State} parameter of the
4853 pragma. The @code{Name} parameter is a value of the type
4854 @code{Ada.Interrupts.Interrupt_ID}. Typically, it is a name declared in
4855 @code{Ada.Interrupts.Names}.
4857 This is a configuration pragma, and the binder will check that there
4858 are no inconsistencies between different units in a partition in how a
4859 given interrupt is specified. It may appear anywhere a pragma is legal.
4861 The effect is to move the interrupt to the specified state.
4863 By declaring interrupts to be SYSTEM, you guarantee the standard system
4864 action, such as a core dump.
4866 By declaring interrupts to be USER, you guarantee that you can install
4869 Note that certain signals on many operating systems cannot be caught and
4870 handled by applications. In such cases, the pragma is ignored. See the
4871 operating system documentation, or the value of the array @code{Reserved}
4872 declared in the spec of package @code{System.OS_Interface}.
4874 Overriding the default state of signals used by the Ada runtime may interfere
4875 with an application’s runtime behavior in the cases of the synchronous signals,
4876 and in the case of the signal used to implement the @code{abort} statement.
4878 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupt_State,Implementation Defined Pragmas
4879 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{89}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{8a}
4880 @section Pragma Invariant
4887 ([Entity =>] private_type_LOCAL_NAME,
4888 [Check =>] EXPRESSION
4889 [,[Message =>] String_Expression]);
4892 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4893 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4894 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4895 requires the use of the aspect syntax, which is not available except in 2012
4896 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4897 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4898 note that the aspect Invariant is a synonym in GNAT for the aspect
4899 Type_Invariant, but there is no pragma Type_Invariant.
4901 The pragma must appear within the visible part of the package specification,
4902 after the type to which its Entity argument appears. As with the Invariant
4903 aspect, the Check expression is not analyzed until the end of the visible
4904 part of the package, so it may contain forward references. The Message
4905 argument, if present, provides the exception message used if the invariant
4906 is violated. If no Message parameter is provided, a default message that
4907 identifies the line on which the pragma appears is used.
4909 It is permissible to have multiple Invariants for the same type entity, in
4910 which case they are and’ed together. It is permissible to use this pragma
4911 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4912 invariant pragma for the same entity.
4914 For further details on the use of this pragma, see the Ada 2012 documentation
4915 of the Type_Invariant aspect.
4917 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4918 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{8b}
4919 @section Pragma Keep_Names
4925 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4928 The @code{LOCAL_NAME} argument
4929 must refer to an enumeration first subtype
4930 in the current declarative part. The effect is to retain the enumeration
4931 literal names for use by @code{Image} and @code{Value} even if a global
4932 @code{Discard_Names} pragma applies. This is useful when you want to
4933 generally suppress enumeration literal names and for example you therefore
4934 use a @code{Discard_Names} pragma in the @code{gnat.adc} file, but you
4935 want to retain the names for specific enumeration types.
4937 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4938 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{8c}
4939 @section Pragma License
4942 @geindex License checking
4947 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4950 This pragma is provided to allow automated checking for appropriate license
4951 conditions with respect to the standard and modified GPL. A pragma
4952 @code{License}, which is a configuration pragma that typically appears at
4953 the start of a source file or in a separate @code{gnat.adc} file, specifies
4954 the licensing conditions of a unit as follows:
4961 This is used for a unit that can be freely used with no license restrictions.
4962 Examples of such units are public domain units, and units from the Ada
4967 This is used for a unit that is licensed under the unmodified GPL, and which
4968 therefore cannot be @code{with}ed by a restricted unit.
4972 This is used for a unit licensed under the GNAT modified GPL that includes
4973 a special exception paragraph that specifically permits the inclusion of
4974 the unit in programs without requiring the entire program to be released
4979 This is used for a unit that is restricted in that it is not permitted to
4980 depend on units that are licensed under the GPL. Typical examples are
4981 proprietary code that is to be released under more restrictive license
4982 conditions. Note that restricted units are permitted to @code{with} units
4983 which are licensed under the modified GPL (this is the whole point of the
4987 Normally a unit with no @code{License} pragma is considered to have an
4988 unknown license, and no checking is done. However, standard GNAT headers
4989 are recognized, and license information is derived from them as follows.
4991 A GNAT license header starts with a line containing 78 hyphens. The following
4992 comment text is searched for the appearance of any of the following strings.
4994 If the string ‘GNU General Public License’ is found, then the unit is assumed
4995 to have GPL license, unless the string ‘As a special exception’ follows, in
4996 which case the license is assumed to be modified GPL.
4998 If one of the strings
4999 ‘This specification is adapted from the Ada Semantic Interface’ or
5000 ‘This specification is derived from the Ada Reference Manual’ is found
5001 then the unit is assumed to be unrestricted.
5003 These default actions means that a program with a restricted license pragma
5004 will automatically get warnings if a GPL unit is inappropriately
5005 @code{with}ed. For example, the program:
5010 procedure Secret_Stuff is
5015 if compiled with pragma @code{License} (@code{Restricted}) in a
5016 @code{gnat.adc} file will generate the warning:
5021 >>> license of withed unit "Sem_Ch3" is incompatible
5023 2. with GNAT.Sockets;
5024 3. procedure Secret_Stuff is
5027 Here we get a warning on @code{Sem_Ch3} since it is part of the GNAT
5028 compiler and is licensed under the
5029 GPL, but no warning for @code{GNAT.Sockets} which is part of the GNAT
5030 run time, and is therefore licensed under the modified GPL.
5032 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
5033 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{8d}
5034 @section Pragma Link_With
5040 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
5043 This pragma is provided for compatibility with certain Ada 83 compilers.
5044 It has exactly the same effect as pragma @code{Linker_Options} except
5045 that spaces occurring within one of the string expressions are treated
5046 as separators. For example, in the following case:
5049 pragma Link_With ("-labc -ldef");
5052 results in passing the strings @code{-labc} and @code{-ldef} as two
5053 separate arguments to the linker. In addition pragma Link_With allows
5054 multiple arguments, with the same effect as successive pragmas.
5056 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
5057 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{8e}
5058 @section Pragma Linker_Alias
5064 pragma Linker_Alias (
5065 [Entity =>] LOCAL_NAME,
5066 [Target =>] static_string_EXPRESSION);
5069 @code{LOCAL_NAME} must refer to an object that is declared at the library
5070 level. This pragma establishes the given entity as a linker alias for the
5071 given target. It is equivalent to @code{__attribute__((alias))} in GNU C
5072 and causes @code{LOCAL_NAME} to be emitted as an alias for the symbol
5073 @code{static_string_EXPRESSION} in the object file, that is to say no space
5074 is reserved for @code{LOCAL_NAME} by the assembler and it will be resolved
5075 to the same address as @code{static_string_EXPRESSION} by the linker.
5077 The actual linker name for the target must be used (e.g., the fully
5078 encoded name with qualification in Ada, or the mangled name in C++),
5079 or it must be declared using the C convention with @code{pragma Import}
5080 or @code{pragma Export}.
5082 Not all target machines support this pragma. On some of them it is accepted
5083 only if @code{pragma Weak_External} has been applied to @code{LOCAL_NAME}.
5086 -- Example of the use of pragma Linker_Alias
5090 pragma Export (C, i);
5092 new_name_for_i : Integer;
5093 pragma Linker_Alias (new_name_for_i, "i");
5097 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
5098 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{8f}
5099 @section Pragma Linker_Constructor
5105 pragma Linker_Constructor (procedure_LOCAL_NAME);
5108 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
5109 is declared at the library level. A procedure to which this pragma is
5110 applied will be treated as an initialization routine by the linker.
5111 It is equivalent to @code{__attribute__((constructor))} in GNU C and
5112 causes @code{procedure_LOCAL_NAME} to be invoked before the entry point
5113 of the executable is called (or immediately after the shared library is
5114 loaded if the procedure is linked in a shared library), in particular
5115 before the Ada run-time environment is set up.
5117 Because of these specific contexts, the set of operations such a procedure
5118 can perform is very limited and the type of objects it can manipulate is
5119 essentially restricted to the elementary types. In particular, it must only
5120 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
5122 This pragma is used by GNAT to implement auto-initialization of shared Stand
5123 Alone Libraries, which provides a related capability without the restrictions
5124 listed above. Where possible, the use of Stand Alone Libraries is preferable
5125 to the use of this pragma.
5127 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
5128 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{90}
5129 @section Pragma Linker_Destructor
5135 pragma Linker_Destructor (procedure_LOCAL_NAME);
5138 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
5139 is declared at the library level. A procedure to which this pragma is
5140 applied will be treated as a finalization routine by the linker.
5141 It is equivalent to @code{__attribute__((destructor))} in GNU C and
5142 causes @code{procedure_LOCAL_NAME} to be invoked after the entry point
5143 of the executable has exited (or immediately before the shared library
5144 is unloaded if the procedure is linked in a shared library), in particular
5145 after the Ada run-time environment is shut down.
5147 See @code{pragma Linker_Constructor} for the set of restrictions that apply
5148 because of these specific contexts.
5150 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
5151 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{91}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{92}
5152 @section Pragma Linker_Section
5158 pragma Linker_Section (
5159 [Entity =>] LOCAL_NAME,
5160 [Section =>] static_string_EXPRESSION);
5163 @code{LOCAL_NAME} must refer to an object, type, or subprogram that is
5164 declared at the library level. This pragma specifies the name of the
5165 linker section for the given entity. It is equivalent to
5166 @code{__attribute__((section))} in GNU C and causes @code{LOCAL_NAME} to
5167 be placed in the @code{static_string_EXPRESSION} section of the
5168 executable (assuming the linker doesn’t rename the section).
5169 GNAT also provides an implementation defined aspect of the same name.
5171 In the case of specifying this aspect for a type, the effect is to
5172 specify the corresponding section for all library-level objects of
5173 the type that do not have an explicit linker section set. Note that
5174 this only applies to whole objects, not to components of composite objects.
5176 In the case of a subprogram, the linker section applies to all previously
5177 declared matching overloaded subprograms in the current declarative part
5178 which do not already have a linker section assigned. The linker section
5179 aspect is useful in this case for specifying different linker sections
5180 for different elements of such an overloaded set.
5182 Note that an empty string specifies that no linker section is specified.
5183 This is not quite the same as omitting the pragma or aspect, since it
5184 can be used to specify that one element of an overloaded set of subprograms
5185 has the default linker section, or that one object of a type for which a
5186 linker section is specified should has the default linker section.
5188 The compiler normally places library-level entities in standard sections
5189 depending on the class: procedures and functions generally go in the
5190 @code{.text} section, initialized variables in the @code{.data} section
5191 and uninitialized variables in the @code{.bss} section.
5193 Other, special sections may exist on given target machines to map special
5194 hardware, for example I/O ports or flash memory. This pragma is a means to
5195 defer the final layout of the executable to the linker, thus fully working
5196 at the symbolic level with the compiler.
5198 Some file formats do not support arbitrary sections so not all target
5199 machines support this pragma. The use of this pragma may cause a program
5200 execution to be erroneous if it is used to place an entity into an
5201 inappropriate section (e.g., a modified variable into the @code{.text}
5202 section). See also @code{pragma Persistent_BSS}.
5205 -- Example of the use of pragma Linker_Section
5209 pragma Volatile (Port_A);
5210 pragma Linker_Section (Port_A, ".bss.port_a");
5213 pragma Volatile (Port_B);
5214 pragma Linker_Section (Port_B, ".bss.port_b");
5216 type Port_Type is new Integer with Linker_Section => ".bss";
5217 PA : Port_Type with Linker_Section => ".bss.PA";
5218 PB : Port_Type; -- ends up in linker section ".bss"
5220 procedure Q with Linker_Section => "Qsection";
5224 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
5225 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{93}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{94}
5226 @section Pragma Lock_Free
5230 This pragma may be specified for protected types or objects. It specifies that
5231 the implementation of protected operations must be implemented without locks.
5232 Compilation fails if the compiler cannot generate lock-free code for the
5235 The current conditions required to support this pragma are:
5241 Protected type declarations may not contain entries
5244 Protected subprogram declarations may not have nonelementary parameters
5247 In addition, each protected subprogram body must satisfy:
5253 May reference only one protected component
5256 May not reference nonconstant entities outside the protected subprogram
5260 May not contain address representation items, allocators, or quantified
5264 May not contain delay, goto, loop, or procedure-call statements.
5267 May not contain exported and imported entities
5270 May not dereferenced access values
5273 Function calls and attribute references must be static
5276 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
5277 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{95}
5278 @section Pragma Loop_Invariant
5284 pragma Loop_Invariant ( boolean_EXPRESSION );
5287 The effect of this pragma is similar to that of pragma @code{Assert},
5288 except that in an @code{Assertion_Policy} pragma, the identifier
5289 @code{Loop_Invariant} is used to control whether it is ignored or checked
5292 @code{Loop_Invariant} can only appear as one of the items in the sequence
5293 of statements of a loop body, or nested inside block statements that
5294 appear in the sequence of statements of a loop body.
5295 The intention is that it be used to
5296 represent a “loop invariant” assertion, i.e. something that is true each
5297 time through the loop, and which can be used to show that the loop is
5298 achieving its purpose.
5300 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5301 apply to the same loop should be grouped in the same sequence of
5304 To aid in writing such invariants, the special attribute @code{Loop_Entry}
5305 may be used to refer to the value of an expression on entry to the loop. This
5306 attribute can only be used within the expression of a @code{Loop_Invariant}
5307 pragma. For full details, see documentation of attribute @code{Loop_Entry}.
5309 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
5310 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{96}
5311 @section Pragma Loop_Optimize
5317 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
5319 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
5322 This pragma must appear immediately within a loop statement. It allows the
5323 programmer to specify optimization hints for the enclosing loop. The hints
5324 are not mutually exclusive and can be freely mixed, but not all combinations
5325 will yield a sensible outcome.
5327 There are five supported optimization hints for a loop:
5335 The programmer asserts that there are no loop-carried dependencies
5336 which would prevent consecutive iterations of the loop from being
5337 executed simultaneously.
5342 The loop must not be unrolled. This is a strong hint: the compiler will not
5343 unroll a loop marked with this hint.
5348 The loop should be unrolled. This is a weak hint: the compiler will try to
5349 apply unrolling to this loop preferably to other optimizations, notably
5350 vectorization, but there is no guarantee that the loop will be unrolled.
5355 The loop must not be vectorized. This is a strong hint: the compiler will not
5356 vectorize a loop marked with this hint.
5361 The loop should be vectorized. This is a weak hint: the compiler will try to
5362 apply vectorization to this loop preferably to other optimizations, notably
5363 unrolling, but there is no guarantee that the loop will be vectorized.
5366 These hints do not remove the need to pass the appropriate switches to the
5367 compiler in order to enable the relevant optimizations, that is to say
5368 `-funroll-loops' for unrolling and `-ftree-vectorize' for
5371 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
5372 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{97}
5373 @section Pragma Loop_Variant
5379 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
5380 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
5381 CHANGE_DIRECTION ::= Increases | Decreases
5384 @code{Loop_Variant} can only appear as one of the items in the sequence
5385 of statements of a loop body, or nested inside block statements that
5386 appear in the sequence of statements of a loop body.
5387 It allows the specification of quantities which must always
5388 decrease or increase in successive iterations of the loop. In its simplest
5389 form, just one expression is specified, whose value must increase or decrease
5390 on each iteration of the loop.
5392 In a more complex form, multiple arguments can be given which are intepreted
5393 in a nesting lexicographic manner. For example:
5396 pragma Loop_Variant (Increases => X, Decreases => Y);
5399 specifies that each time through the loop either X increases, or X stays
5400 the same and Y decreases. A @code{Loop_Variant} pragma ensures that the
5401 loop is making progress. It can be useful in helping to show informally
5402 or prove formally that the loop always terminates.
5404 @code{Loop_Variant} is an assertion whose effect can be controlled using
5405 an @code{Assertion_Policy} with a check name of @code{Loop_Variant}. The
5406 policy can be @code{Check} to enable the loop variant check, @code{Ignore}
5407 to ignore the check (in which case the pragma has no effect on the program),
5408 or @code{Disable} in which case the pragma is not even checked for correct
5411 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5412 apply to the same loop should be grouped in the same sequence of
5415 The @code{Loop_Entry} attribute may be used within the expressions of the
5416 @code{Loop_Variant} pragma to refer to values on entry to the loop.
5418 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
5419 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{98}
5420 @section Pragma Machine_Attribute
5426 pragma Machine_Attribute (
5427 [Entity =>] LOCAL_NAME,
5428 [Attribute_Name =>] static_string_EXPRESSION
5429 [, [Info =>] static_EXPRESSION @{, static_EXPRESSION@}] );
5432 Machine-dependent attributes can be specified for types and/or
5433 declarations. This pragma is semantically equivalent to
5434 @code{__attribute__((@var{attribute_name}))} (if @code{info} is not
5435 specified) or @code{__attribute__((@var{attribute_name(info})))}
5436 or @code{__attribute__((@var{attribute_name(info,...})))} in GNU C,
5437 where `attribute_name' is recognized by the compiler middle-end
5438 or the @code{TARGET_ATTRIBUTE_TABLE} machine specific macro. Note
5439 that a string literal for the optional parameter @code{info} or the
5440 following ones is transformed by default into an identifier,
5441 which may make this pragma unusable for some attributes.
5442 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
5444 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
5445 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{99}
5446 @section Pragma Main
5453 (MAIN_OPTION [, MAIN_OPTION]);
5456 [Stack_Size =>] static_integer_EXPRESSION
5457 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
5458 | [Time_Slicing_Enabled =>] static_boolean_EXPRESSION
5461 This pragma is provided for compatibility with OpenVMS VAX Systems. It has
5462 no effect in GNAT, other than being syntax checked.
5464 @node Pragma Main_Storage,Pragma Max_Queue_Length,Pragma Main,Implementation Defined Pragmas
5465 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{9a}
5466 @section Pragma Main_Storage
5473 (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
5475 MAIN_STORAGE_OPTION ::=
5476 [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
5477 | [TOP_GUARD =>] static_SIMPLE_EXPRESSION
5480 This pragma is provided for compatibility with OpenVMS VAX Systems. It has
5481 no effect in GNAT, other than being syntax checked.
5483 @node Pragma Max_Queue_Length,Pragma No_Body,Pragma Main_Storage,Implementation Defined Pragmas
5484 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{9b}@anchor{gnat_rm/implementation_defined_pragmas pragma-max-queue-length}@anchor{9c}
5485 @section Pragma Max_Queue_Length
5491 pragma Max_Entry_Queue (static_integer_EXPRESSION);
5494 This pragma is used to specify the maximum callers per entry queue for
5495 individual protected entries and entry families. It accepts a single
5496 integer (-1 or more) as a parameter and must appear after the declaration of an
5499 A value of -1 represents no additional restriction on queue length.
5501 @node Pragma No_Body,Pragma No_Caching,Pragma Max_Queue_Length,Implementation Defined Pragmas
5502 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{9d}
5503 @section Pragma No_Body
5512 There are a number of cases in which a package spec does not require a body,
5513 and in fact a body is not permitted. GNAT will not permit the spec to be
5514 compiled if there is a body around. The pragma No_Body allows you to provide
5515 a body file, even in a case where no body is allowed. The body file must
5516 contain only comments and a single No_Body pragma. This is recognized by
5517 the compiler as indicating that no body is logically present.
5519 This is particularly useful during maintenance when a package is modified in
5520 such a way that a body needed before is no longer needed. The provision of a
5521 dummy body with a No_Body pragma ensures that there is no interference from
5522 earlier versions of the package body.
5524 @node Pragma No_Caching,Pragma No_Component_Reordering,Pragma No_Body,Implementation Defined Pragmas
5525 @anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{9e}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-caching}@anchor{9f}
5526 @section Pragma No_Caching
5532 pragma No_Caching [ (static_boolean_EXPRESSION) ];
5535 For the semantics of this pragma, see the entry for aspect @code{No_Caching} in
5536 the SPARK 2014 Reference Manual, section 7.1.2.
5538 @node Pragma No_Component_Reordering,Pragma No_Elaboration_Code_All,Pragma No_Caching,Implementation Defined Pragmas
5539 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-component-reordering}@anchor{a0}
5540 @section Pragma No_Component_Reordering
5546 pragma No_Component_Reordering [([Entity =>] type_LOCAL_NAME)];
5549 @code{type_LOCAL_NAME} must refer to a record type declaration in the current
5550 declarative part. The effect is to preclude any reordering of components
5551 for the layout of the record, i.e. the record is laid out by the compiler
5552 in the order in which the components are declared textually. The form with
5553 no argument is a configuration pragma which applies to all record types
5554 declared in units to which the pragma applies and there is a requirement
5555 that this pragma be used consistently within a partition.
5557 @node Pragma No_Elaboration_Code_All,Pragma No_Heap_Finalization,Pragma No_Component_Reordering,Implementation Defined Pragmas
5558 @anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a1}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{a2}
5559 @section Pragma No_Elaboration_Code_All
5565 pragma No_Elaboration_Code_All [(program_unit_NAME)];
5568 This is a program unit pragma (there is also an equivalent aspect of the
5569 same name) that establishes the restriction @code{No_Elaboration_Code} for
5570 the current unit and any extended main source units (body and subunits).
5571 It also has the effect of enforcing a transitive application of this
5572 aspect, so that if any unit is implicitly or explicitly with’ed by the
5573 current unit, it must also have the No_Elaboration_Code_All aspect set.
5574 It may be applied to package or subprogram specs or their generic versions.
5576 @node Pragma No_Heap_Finalization,Pragma No_Inline,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5577 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-heap-finalization}@anchor{a3}
5578 @section Pragma No_Heap_Finalization
5584 pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ];
5587 Pragma @code{No_Heap_Finalization} may be used as a configuration pragma or as a
5588 type-specific pragma.
5590 In its configuration form, the pragma must appear within a configuration file
5591 such as gnat.adc, without an argument. The pragma suppresses the call to
5592 @code{Finalize} for heap-allocated objects created through library-level named
5593 access-to-object types in cases where the designated type requires finalization
5596 In its type-specific form, the argument of the pragma must denote a
5597 library-level named access-to-object type. The pragma suppresses the call to
5598 @code{Finalize} for heap-allocated objects created through the specific access type
5599 in cases where the designated type requires finalization actions.
5601 It is still possible to finalize such heap-allocated objects by explicitly
5604 A library-level named access-to-object type declared within a generic unit will
5605 lose its @code{No_Heap_Finalization} pragma when the corresponding instance does not
5606 appear at the library level.
5608 @node Pragma No_Inline,Pragma No_Return,Pragma No_Heap_Finalization,Implementation Defined Pragmas
5609 @anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{a4}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{a5}
5610 @section Pragma No_Inline
5616 pragma No_Inline (NAME @{, NAME@});
5619 This pragma suppresses inlining for the callable entity or the instances of
5620 the generic subprogram designated by @code{NAME}, including inlining that
5621 results from the use of pragma @code{Inline}. This pragma is always active,
5622 in particular it is not subject to the use of option `-gnatn' or
5623 `-gnatN'. It is illegal to specify both pragma @code{No_Inline} and
5624 pragma @code{Inline_Always} for the same @code{NAME}.
5626 @node Pragma No_Return,Pragma No_Strict_Aliasing,Pragma No_Inline,Implementation Defined Pragmas
5627 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{a6}
5628 @section Pragma No_Return
5634 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5637 Each @code{procedure_LOCAL_NAME} argument must refer to one or more procedure
5638 declarations in the current declarative part. A procedure to which this
5639 pragma is applied may not contain any explicit @code{return} statements.
5640 In addition, if the procedure contains any implicit returns from falling
5641 off the end of a statement sequence, then execution of that implicit
5642 return will cause Program_Error to be raised.
5644 One use of this pragma is to identify procedures whose only purpose is to raise
5645 an exception. Another use of this pragma is to suppress incorrect warnings
5646 about missing returns in functions, where the last statement of a function
5647 statement sequence is a call to such a procedure.
5649 Note that in Ada 2005 mode, this pragma is part of the language. It is
5650 available in all earlier versions of Ada as an implementation-defined
5653 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Return,Implementation Defined Pragmas
5654 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{a7}
5655 @section Pragma No_Strict_Aliasing
5661 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5664 @code{type_LOCAL_NAME} must refer to an access type
5665 declaration in the current declarative part. The effect is to inhibit
5666 strict aliasing optimization for the given type. The form with no
5667 arguments is a configuration pragma which applies to all access types
5668 declared in units to which the pragma applies. For a detailed
5669 description of the strict aliasing optimization, and the situations
5670 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5671 in the @cite{GNAT User’s Guide}.
5673 This pragma currently has no effects on access to unconstrained array types.
5675 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5676 @anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{a8}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{a9}
5677 @section Pragma No_Tagged_Streams
5683 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5686 Normally when a tagged type is introduced using a full type declaration,
5687 part of the processing includes generating stream access routines to be
5688 used by stream attributes referencing the type (or one of its subtypes
5689 or derived types). This can involve the generation of significant amounts
5690 of code which is wasted space if stream routines are not needed for the
5693 The @code{No_Tagged_Streams} pragma causes the generation of these stream
5694 routines to be skipped, and any attempt to use stream operations on
5695 types subject to this pragma will be statically rejected as illegal.
5697 There are two forms of the pragma. The form with no arguments must appear
5698 in a declarative sequence or in the declarations of a package spec. This
5699 pragma affects all subsequent root tagged types declared in the declaration
5700 sequence, and specifies that no stream routines be generated. The form with
5701 an argument (for which there is also a corresponding aspect) specifies a
5702 single root tagged type for which stream routines are not to be generated.
5704 Once the pragma has been given for a particular root tagged type, all subtypes
5705 and derived types of this type inherit the pragma automatically, so the effect
5706 applies to a complete hierarchy (this is necessary to deal with the class-wide
5707 dispatching versions of the stream routines).
5709 When pragmas @code{Discard_Names} and @code{No_Tagged_Streams} are simultaneously
5710 applied to a tagged type its Expanded_Name and External_Tag are initialized
5711 with empty strings. This is useful to avoid exposing entity names at binary
5712 level but has a negative impact on the debuggability of tagged types.
5714 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5715 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{aa}
5716 @section Pragma Normalize_Scalars
5722 pragma Normalize_Scalars;
5725 This is a language defined pragma which is fully implemented in GNAT. The
5726 effect is to cause all scalar objects that are not otherwise initialized
5727 to be initialized. The initial values are implementation dependent and
5733 @item `Standard.Character'
5735 Objects whose root type is Standard.Character are initialized to
5736 Character’Last unless the subtype range excludes NUL (in which case
5737 NUL is used). This choice will always generate an invalid value if
5740 @item `Standard.Wide_Character'
5742 Objects whose root type is Standard.Wide_Character are initialized to
5743 Wide_Character’Last unless the subtype range excludes NUL (in which case
5744 NUL is used). This choice will always generate an invalid value if
5747 @item `Standard.Wide_Wide_Character'
5749 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5750 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5751 which case NUL is used). This choice will always generate an invalid value if
5754 @item `Integer types'
5756 Objects of an integer type are treated differently depending on whether
5757 negative values are present in the subtype. If no negative values are
5758 present, then all one bits is used as the initial value except in the
5759 special case where zero is excluded from the subtype, in which case
5760 all zero bits are used. This choice will always generate an invalid
5761 value if one exists.
5763 For subtypes with negative values present, the largest negative number
5764 is used, except in the unusual case where this largest negative number
5765 is in the subtype, and the largest positive number is not, in which case
5766 the largest positive value is used. This choice will always generate
5767 an invalid value if one exists.
5769 @item `Floating-Point Types'
5771 Objects of all floating-point types are initialized to all 1-bits. For
5772 standard IEEE format, this corresponds to a NaN (not a number) which is
5773 indeed an invalid value.
5775 @item `Fixed-Point Types'
5777 Objects of all fixed-point types are treated as described above for integers,
5778 with the rules applying to the underlying integer value used to represent
5779 the fixed-point value.
5781 @item `Modular types'
5783 Objects of a modular type are initialized to all one bits, except in
5784 the special case where zero is excluded from the subtype, in which
5785 case all zero bits are used. This choice will always generate an
5786 invalid value if one exists.
5788 @item `Enumeration types'
5790 Objects of an enumeration type are initialized to all one-bits, i.e., to
5791 the value @code{2 ** typ'Size - 1} unless the subtype excludes the literal
5792 whose Pos value is zero, in which case a code of zero is used. This choice
5793 will always generate an invalid value if one exists.
5796 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5797 @anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{ab}@anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{ac}
5798 @section Pragma Obsolescent
5806 pragma Obsolescent (
5807 [Message =>] static_string_EXPRESSION
5808 [,[Version =>] Ada_05]);
5810 pragma Obsolescent (
5812 [,[Message =>] static_string_EXPRESSION
5813 [,[Version =>] Ada_05]]);
5816 This pragma can occur immediately following a declaration of an entity,
5817 including the case of a record component. If no Entity argument is present,
5818 then this declaration is the one to which the pragma applies. If an Entity
5819 parameter is present, it must either match the name of the entity in this
5820 declaration, or alternatively, the pragma can immediately follow an enumeration
5821 type declaration, where the Entity argument names one of the enumeration
5824 This pragma is used to indicate that the named entity
5825 is considered obsolescent and should not be used. Typically this is
5826 used when an API must be modified by eventually removing or modifying
5827 existing subprograms or other entities. The pragma can be used at an
5828 intermediate stage when the entity is still present, but will be
5831 The effect of this pragma is to output a warning message on a reference to
5832 an entity thus marked that the subprogram is obsolescent if the appropriate
5833 warning option in the compiler is activated. If the @code{Message} parameter is
5834 present, then a second warning message is given containing this text. In
5835 addition, a reference to the entity is considered to be a violation of pragma
5836 @code{Restrictions (No_Obsolescent_Features)}.
5838 This pragma can also be used as a program unit pragma for a package,
5839 in which case the entity name is the name of the package, and the
5840 pragma indicates that the entire package is considered
5841 obsolescent. In this case a client @code{with}ing such a package
5842 violates the restriction, and the @code{with} clause is
5843 flagged with warnings if the warning option is set.
5845 If the @code{Version} parameter is present (which must be exactly
5846 the identifier @code{Ada_05}, no other argument is allowed), then the
5847 indication of obsolescence applies only when compiling in Ada 2005
5848 mode. This is primarily intended for dealing with the situations
5849 in the predefined library where subprograms or packages
5850 have become defined as obsolescent in Ada 2005
5851 (e.g., in @code{Ada.Characters.Handling}), but may be used anywhere.
5853 The following examples show typical uses of this pragma:
5857 pragma Obsolescent (p, Message => "use pp instead of p");
5862 pragma Obsolescent ("use q2new instead");
5864 type R is new integer;
5867 Message => "use RR in Ada 2005",
5877 type E is (a, bc, 'd', quack);
5878 pragma Obsolescent (Entity => bc)
5879 pragma Obsolescent (Entity => 'd')
5882 (a, b : character) return character;
5883 pragma Obsolescent (Entity => "+");
5887 Note that, as for all pragmas, if you use a pragma argument identifier,
5888 then all subsequent parameters must also use a pragma argument identifier.
5889 So if you specify @code{Entity =>} for the @code{Entity} argument, and a @code{Message}
5890 argument is present, it must be preceded by @code{Message =>}.
5892 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5893 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{ad}
5894 @section Pragma Optimize_Alignment
5898 @geindex default settings
5903 pragma Optimize_Alignment (TIME | SPACE | OFF);
5906 This is a configuration pragma which affects the choice of default alignments
5907 for types and objects where no alignment is explicitly specified. There is a
5908 time/space trade-off in the selection of these values. Large alignments result
5909 in more efficient code, at the expense of larger data space, since sizes have
5910 to be increased to match these alignments. Smaller alignments save space, but
5911 the access code is slower. The normal choice of default alignments for types
5912 and individual alignment promotions for objects (which is what you get if you
5913 do not use this pragma, or if you use an argument of OFF), tries to balance
5914 these two requirements.
5916 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5917 First any packed record is given an alignment of 1. Second, if a size is given
5918 for the type, then the alignment is chosen to avoid increasing this size. For
5930 In the default mode, this type gets an alignment of 4, so that access to the
5931 Integer field X are efficient. But this means that objects of the type end up
5932 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5933 allowed to be bigger than the size of the type, but it can waste space if for
5934 example fields of type R appear in an enclosing record. If the above type is
5935 compiled in @code{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5937 However, there is one case in which SPACE is ignored. If a variable length
5938 record (that is a discriminated record with a component which is an array
5939 whose length depends on a discriminant), has a pragma Pack, then it is not
5940 in general possible to set the alignment of such a record to one, so the
5941 pragma is ignored in this case (with a warning).
5943 Specifying SPACE also disables alignment promotions for standalone objects,
5944 which occur when the compiler increases the alignment of a specific object
5945 without changing the alignment of its type.
5947 Specifying SPACE also disables component reordering in unpacked record types,
5948 which can result in larger sizes in order to meet alignment requirements.
5950 Specifying TIME causes larger default alignments to be chosen in the case of
5951 small types with sizes that are not a power of 2. For example, consider:
5964 The default alignment for this record is normally 1, but if this type is
5965 compiled in @code{Optimize_Alignment (Time)} mode, then the alignment is set
5966 to 4, which wastes space for objects of the type, since they are now 4 bytes
5967 long, but results in more efficient access when the whole record is referenced.
5969 As noted above, this is a configuration pragma, and there is a requirement
5970 that all units in a partition be compiled with a consistent setting of the
5971 optimization setting. This would normally be achieved by use of a configuration
5972 pragma file containing the appropriate setting. The exception to this rule is
5973 that units with an explicit configuration pragma in the same file as the source
5974 unit are excluded from the consistency check, as are all predefined units. The
5975 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5976 pragma appears at the start of the file.
5978 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5979 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{ae}
5980 @section Pragma Ordered
5986 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5989 Most enumeration types are from a conceptual point of view unordered.
5990 For example, consider:
5993 type Color is (Red, Blue, Green, Yellow);
5996 By Ada semantics @code{Blue > Red} and @code{Green > Blue},
5997 but really these relations make no sense; the enumeration type merely
5998 specifies a set of possible colors, and the order is unimportant.
6000 For unordered enumeration types, it is generally a good idea if
6001 clients avoid comparisons (other than equality or inequality) and
6002 explicit ranges. (A `client' is a unit where the type is referenced,
6003 other than the unit where the type is declared, its body, and its subunits.)
6004 For example, if code buried in some client says:
6007 if Current_Color < Yellow then ...
6008 if Current_Color in Blue .. Green then ...
6011 then the client code is relying on the order, which is undesirable.
6012 It makes the code hard to read and creates maintenance difficulties if
6013 entries have to be added to the enumeration type. Instead,
6014 the code in the client should list the possibilities, or an
6015 appropriate subtype should be declared in the unit that declares
6016 the original enumeration type. E.g., the following subtype could
6017 be declared along with the type @code{Color}:
6020 subtype RBG is Color range Red .. Green;
6023 and then the client could write:
6026 if Current_Color in RBG then ...
6027 if Current_Color = Blue or Current_Color = Green then ...
6030 However, some enumeration types are legitimately ordered from a conceptual
6031 point of view. For example, if you declare:
6034 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
6037 then the ordering imposed by the language is reasonable, and
6038 clients can depend on it, writing for example:
6041 if D in Mon .. Fri then ...
6045 The pragma `Ordered' is provided to mark enumeration types that
6046 are conceptually ordered, alerting the reader that clients may depend
6047 on the ordering. GNAT provides a pragma to mark enumerations as ordered
6048 rather than one to mark them as unordered, since in our experience,
6049 the great majority of enumeration types are conceptually unordered.
6051 The types @code{Boolean}, @code{Character}, @code{Wide_Character},
6052 and @code{Wide_Wide_Character}
6053 are considered to be ordered types, so each is declared with a
6054 pragma @code{Ordered} in package @code{Standard}.
6056 Normally pragma @code{Ordered} serves only as documentation and a guide for
6057 coding standards, but GNAT provides a warning switch `-gnatw.u' that
6058 requests warnings for inappropriate uses (comparisons and explicit
6059 subranges) for unordered types. If this switch is used, then any
6060 enumeration type not marked with pragma @code{Ordered} will be considered
6061 as unordered, and will generate warnings for inappropriate uses.
6063 Note that generic types are not considered ordered or unordered (since the
6064 template can be instantiated for both cases), so we never generate warnings
6065 for the case of generic enumerated types.
6067 For additional information please refer to the description of the
6068 `-gnatw.u' switch in the GNAT User’s Guide.
6070 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
6071 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{af}
6072 @section Pragma Overflow_Mode
6078 pragma Overflow_Mode
6080 [,[Assertions =>] MODE]);
6082 MODE ::= STRICT | MINIMIZED | ELIMINATED
6085 This pragma sets the current overflow mode to the given setting. For details
6086 of the meaning of these modes, please refer to the
6087 ‘Overflow Check Handling in GNAT’ appendix in the
6088 GNAT User’s Guide. If only the @code{General} parameter is present,
6089 the given mode applies to all expressions. If both parameters are present,
6090 the @code{General} mode applies to expressions outside assertions, and
6091 the @code{Eliminated} mode applies to expressions within assertions.
6093 The case of the @code{MODE} parameter is ignored,
6094 so @code{MINIMIZED}, @code{Minimized} and
6095 @code{minimized} all have the same effect.
6097 The @code{Overflow_Mode} pragma has the same scoping and placement
6098 rules as pragma @code{Suppress}, so it can occur either as a
6099 configuration pragma, specifying a default for the whole
6100 program, or in a declarative scope, where it applies to the
6101 remaining declarations and statements in that scope.
6103 The pragma @code{Suppress (Overflow_Check)} suppresses
6104 overflow checking, but does not affect the overflow mode.
6106 The pragma @code{Unsuppress (Overflow_Check)} unsuppresses (enables)
6107 overflow checking, but does not affect the overflow mode.
6109 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
6110 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{b0}
6111 @section Pragma Overriding_Renamings
6114 @geindex Rational profile
6116 @geindex Rational compatibility
6121 pragma Overriding_Renamings;
6124 This is a GNAT configuration pragma to simplify porting
6125 legacy code accepted by the Rational
6126 Ada compiler. In the presence of this pragma, a renaming declaration that
6127 renames an inherited operation declared in the same scope is legal if selected
6128 notation is used as in:
6131 pragma Overriding_Renamings;
6136 function F (..) renames R.F;
6141 RM 8.3 (15) stipulates that an overridden operation is not visible within the
6142 declaration of the overriding operation.
6144 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
6145 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{b1}
6146 @section Pragma Partition_Elaboration_Policy
6152 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
6154 POLICY_IDENTIFIER ::= Concurrent | Sequential
6157 This pragma is standard in Ada 2005, but is available in all earlier
6158 versions of Ada as an implementation-defined pragma.
6159 See Ada 2012 Reference Manual for details.
6161 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
6162 @anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{b2}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{b3}
6163 @section Pragma Part_Of
6169 pragma Part_Of (ABSTRACT_STATE);
6171 ABSTRACT_STATE ::= NAME
6174 For the semantics of this pragma, see the entry for aspect @code{Part_Of} in the
6175 SPARK 2014 Reference Manual, section 7.2.6.
6177 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
6178 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{b4}
6179 @section Pragma Passive
6185 pragma Passive [(Semaphore | No)];
6188 Syntax checked, but otherwise ignored by GNAT. This is recognized for
6189 compatibility with DEC Ada 83 implementations, where it is used within a
6190 task definition to request that a task be made passive. If the argument
6191 @code{Semaphore} is present, or the argument is omitted, then DEC Ada 83
6192 treats the pragma as an assertion that the containing task is passive
6193 and that optimization of context switch with this task is permitted and
6194 desired. If the argument @code{No} is present, the task must not be
6195 optimized. GNAT does not attempt to optimize any tasks in this manner
6196 (since protected objects are available in place of passive tasks).
6198 For more information on the subject of passive tasks, see the section
6199 ‘Passive Task Optimization’ in the GNAT Users Guide.
6201 @node Pragma Persistent_BSS,Pragma Post,Pragma Passive,Implementation Defined Pragmas
6202 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{b5}@anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{b6}
6203 @section Pragma Persistent_BSS
6209 pragma Persistent_BSS [(LOCAL_NAME)]
6212 This pragma allows selected objects to be placed in the @code{.persistent_bss}
6213 section. On some targets the linker and loader provide for special
6214 treatment of this section, allowing a program to be reloaded without
6215 affecting the contents of this data (hence the name persistent).
6217 There are two forms of usage. If an argument is given, it must be the
6218 local name of a library-level object, with no explicit initialization
6219 and whose type is potentially persistent. If no argument is given, then
6220 the pragma is a configuration pragma, and applies to all library-level
6221 objects with no explicit initialization of potentially persistent types.
6223 A potentially persistent type is a scalar type, or an untagged,
6224 non-discriminated record, all of whose components have no explicit
6225 initialization and are themselves of a potentially persistent type,
6226 or an array, all of whose constraints are static, and whose component
6227 type is potentially persistent.
6229 If this pragma is used on a target where this feature is not supported,
6230 then the pragma will be ignored. See also @code{pragma Linker_Section}.
6232 @node Pragma Post,Pragma Postcondition,Pragma Persistent_BSS,Implementation Defined Pragmas
6233 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{b7}
6234 @section Pragma Post
6240 @geindex postconditions
6245 pragma Post (Boolean_Expression);
6248 The @code{Post} pragma is intended to be an exact replacement for
6249 the language-defined
6250 @code{Post} aspect, and shares its restrictions and semantics.
6251 It must appear either immediately following the corresponding
6252 subprogram declaration (only other pragmas may intervene), or
6253 if there is no separate subprogram declaration, then it can
6254 appear at the start of the declarations in a subprogram body
6255 (preceded only by other pragmas).
6257 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
6258 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{b8}
6259 @section Pragma Postcondition
6262 @geindex Postcondition
6265 @geindex postconditions
6270 pragma Postcondition (
6271 [Check =>] Boolean_Expression
6272 [,[Message =>] String_Expression]);
6275 The @code{Postcondition} pragma allows specification of automatic
6276 postcondition checks for subprograms. These checks are similar to
6277 assertions, but are automatically inserted just prior to the return
6278 statements of the subprogram with which they are associated (including
6279 implicit returns at the end of procedure bodies and associated
6280 exception handlers).
6282 In addition, the boolean expression which is the condition which
6283 must be true may contain references to function’Result in the case
6284 of a function to refer to the returned value.
6286 @code{Postcondition} pragmas may appear either immediately following the
6287 (separate) declaration of a subprogram, or at the start of the
6288 declarations of a subprogram body. Only other pragmas may intervene
6289 (that is appear between the subprogram declaration and its
6290 postconditions, or appear before the postcondition in the
6291 declaration sequence in a subprogram body). In the case of a
6292 postcondition appearing after a subprogram declaration, the
6293 formal arguments of the subprogram are visible, and can be
6294 referenced in the postcondition expressions.
6296 The postconditions are collected and automatically tested just
6297 before any return (implicit or explicit) in the subprogram body.
6298 A postcondition is only recognized if postconditions are active
6299 at the time the pragma is encountered. The compiler switch `gnata'
6300 turns on all postconditions by default, and pragma @code{Check_Policy}
6301 with an identifier of @code{Postcondition} can also be used to
6302 control whether postconditions are active.
6304 The general approach is that postconditions are placed in the spec
6305 if they represent functional aspects which make sense to the client.
6306 For example we might have:
6309 function Direction return Integer;
6310 pragma Postcondition
6311 (Direction'Result = +1
6313 Direction'Result = -1);
6316 which serves to document that the result must be +1 or -1, and
6317 will test that this is the case at run time if postcondition
6320 Postconditions within the subprogram body can be used to
6321 check that some internal aspect of the implementation,
6322 not visible to the client, is operating as expected.
6323 For instance if a square root routine keeps an internal
6324 counter of the number of times it is called, then we
6325 might have the following postcondition:
6328 Sqrt_Calls : Natural := 0;
6330 function Sqrt (Arg : Float) return Float is
6331 pragma Postcondition
6332 (Sqrt_Calls = Sqrt_Calls'Old + 1);
6337 As this example, shows, the use of the @code{Old} attribute
6338 is often useful in postconditions to refer to the state on
6339 entry to the subprogram.
6341 Note that postconditions are only checked on normal returns
6342 from the subprogram. If an abnormal return results from
6343 raising an exception, then the postconditions are not checked.
6345 If a postcondition fails, then the exception
6346 @code{System.Assertions.Assert_Failure} is raised. If
6347 a message argument was supplied, then the given string
6348 will be used as the exception message. If no message
6349 argument was supplied, then the default message has
6350 the form “Postcondition failed at file_name:line”. The
6351 exception is raised in the context of the subprogram
6352 body, so it is possible to catch postcondition failures
6353 within the subprogram body itself.
6355 Within a package spec, normal visibility rules
6356 in Ada would prevent forward references within a
6357 postcondition pragma to functions defined later in
6358 the same package. This would introduce undesirable
6359 ordering constraints. To avoid this problem, all
6360 postcondition pragmas are analyzed at the end of
6361 the package spec, allowing forward references.
6363 The following example shows that this even allows
6364 mutually recursive postconditions as in:
6367 package Parity_Functions is
6368 function Odd (X : Natural) return Boolean;
6369 pragma Postcondition
6373 (x /= 0 and then Even (X - 1))));
6375 function Even (X : Natural) return Boolean;
6376 pragma Postcondition
6380 (x /= 1 and then Odd (X - 1))));
6382 end Parity_Functions;
6385 There are no restrictions on the complexity or form of
6386 conditions used within @code{Postcondition} pragmas.
6387 The following example shows that it is even possible
6388 to verify performance behavior.
6393 Performance : constant Float;
6394 -- Performance constant set by implementation
6395 -- to match target architecture behavior.
6397 procedure Treesort (Arg : String);
6398 -- Sorts characters of argument using N*logN sort
6399 pragma Postcondition
6400 (Float (Clock - Clock'Old) <=
6401 Float (Arg'Length) *
6402 log (Float (Arg'Length)) *
6407 Note: postcondition pragmas associated with subprograms that are
6408 marked as Inline_Always, or those marked as Inline with front-end
6409 inlining (-gnatN option set) are accepted and legality-checked
6410 by the compiler, but are ignored at run-time even if postcondition
6411 checking is enabled.
6413 Note that pragma @code{Postcondition} differs from the language-defined
6414 @code{Post} aspect (and corresponding @code{Post} pragma) in allowing
6415 multiple occurrences, allowing occurences in the body even if there
6416 is a separate spec, and allowing a second string parameter, and the
6417 use of the pragma identifier @code{Check}. Historically, pragma
6418 @code{Postcondition} was implemented prior to the development of
6419 Ada 2012, and has been retained in its original form for
6420 compatibility purposes.
6422 @node Pragma Post_Class,Pragma Pre,Pragma Postcondition,Implementation Defined Pragmas
6423 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{b9}
6424 @section Pragma Post_Class
6430 @geindex postconditions
6435 pragma Post_Class (Boolean_Expression);
6438 The @code{Post_Class} pragma is intended to be an exact replacement for
6439 the language-defined
6440 @code{Post'Class} aspect, and shares its restrictions and semantics.
6441 It must appear either immediately following the corresponding
6442 subprogram declaration (only other pragmas may intervene), or
6443 if there is no separate subprogram declaration, then it can
6444 appear at the start of the declarations in a subprogram body
6445 (preceded only by other pragmas).
6447 Note: This pragma is called @code{Post_Class} rather than
6448 @code{Post'Class} because the latter would not be strictly
6449 conforming to the allowed syntax for pragmas. The motivation
6450 for provinding pragmas equivalent to the aspects is to allow a program
6451 to be written using the pragmas, and then compiled if necessary
6452 using an Ada compiler that does not recognize the pragmas or
6453 aspects, but is prepared to ignore the pragmas. The assertion
6454 policy that controls this pragma is @code{Post'Class}, not
6457 @node Pragma Pre,Pragma Precondition,Pragma Post_Class,Implementation Defined Pragmas
6458 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{ba}
6465 @geindex preconditions
6470 pragma Pre (Boolean_Expression);
6473 The @code{Pre} pragma is intended to be an exact replacement for
6474 the language-defined
6475 @code{Pre} aspect, and shares its restrictions and semantics.
6476 It must appear either immediately following the corresponding
6477 subprogram declaration (only other pragmas may intervene), or
6478 if there is no separate subprogram declaration, then it can
6479 appear at the start of the declarations in a subprogram body
6480 (preceded only by other pragmas).
6482 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
6483 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{bb}
6484 @section Pragma Precondition
6487 @geindex Preconditions
6490 @geindex preconditions
6495 pragma Precondition (
6496 [Check =>] Boolean_Expression
6497 [,[Message =>] String_Expression]);
6500 The @code{Precondition} pragma is similar to @code{Postcondition}
6501 except that the corresponding checks take place immediately upon
6502 entry to the subprogram, and if a precondition fails, the exception
6503 is raised in the context of the caller, and the attribute ‘Result
6504 cannot be used within the precondition expression.
6506 Otherwise, the placement and visibility rules are identical to those
6507 described for postconditions. The following is an example of use
6508 within a package spec:
6511 package Math_Functions is
6513 function Sqrt (Arg : Float) return Float;
6514 pragma Precondition (Arg >= 0.0)
6519 @code{Precondition} pragmas may appear either immediately following the
6520 (separate) declaration of a subprogram, or at the start of the
6521 declarations of a subprogram body. Only other pragmas may intervene
6522 (that is appear between the subprogram declaration and its
6523 postconditions, or appear before the postcondition in the
6524 declaration sequence in a subprogram body).
6526 Note: precondition pragmas associated with subprograms that are
6527 marked as Inline_Always, or those marked as Inline with front-end
6528 inlining (-gnatN option set) are accepted and legality-checked
6529 by the compiler, but are ignored at run-time even if precondition
6530 checking is enabled.
6532 Note that pragma @code{Precondition} differs from the language-defined
6533 @code{Pre} aspect (and corresponding @code{Pre} pragma) in allowing
6534 multiple occurrences, allowing occurences in the body even if there
6535 is a separate spec, and allowing a second string parameter, and the
6536 use of the pragma identifier @code{Check}. Historically, pragma
6537 @code{Precondition} was implemented prior to the development of
6538 Ada 2012, and has been retained in its original form for
6539 compatibility purposes.
6541 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
6542 @anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{bc}@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{bd}
6543 @section Pragma Predicate
6550 ([Entity =>] type_LOCAL_NAME,
6551 [Check =>] EXPRESSION);
6554 This pragma (available in all versions of Ada in GNAT) encompasses both
6555 the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
6556 Ada 2012. A predicate is regarded as static if it has an allowed form
6557 for @code{Static_Predicate} and is otherwise treated as a
6558 @code{Dynamic_Predicate}. Otherwise, predicates specified by this
6559 pragma behave exactly as described in the Ada 2012 reference manual.
6560 For example, if we have
6563 type R is range 1 .. 10;
6565 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6567 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6570 the effect is identical to the following Ada 2012 code:
6573 type R is range 1 .. 10;
6575 Static_Predicate => S not in 4 .. 6;
6577 Dynamic_Predicate => F(Q) or G(Q);
6580 Note that there are no pragmas @code{Dynamic_Predicate}
6581 or @code{Static_Predicate}. That is
6582 because these pragmas would affect legality and semantics of
6583 the program and thus do not have a neutral effect if ignored.
6584 The motivation behind providing pragmas equivalent to
6585 corresponding aspects is to allow a program to be written
6586 using the pragmas, and then compiled with a compiler that
6587 will ignore the pragmas. That doesn’t work in the case of
6588 static and dynamic predicates, since if the corresponding
6589 pragmas are ignored, then the behavior of the program is
6590 fundamentally changed (for example a membership test
6591 @code{A in B} would not take into account a predicate
6592 defined for subtype B). When following this approach, the
6593 use of predicates should be avoided.
6595 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6596 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{be}
6597 @section Pragma Predicate_Failure
6603 pragma Predicate_Failure
6604 ([Entity =>] type_LOCAL_NAME,
6605 [Message =>] String_Expression);
6608 The @code{Predicate_Failure} pragma is intended to be an exact replacement for
6609 the language-defined
6610 @code{Predicate_Failure} aspect, and shares its restrictions and semantics.
6612 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6613 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{bf}
6614 @section Pragma Preelaborable_Initialization
6620 pragma Preelaborable_Initialization (DIRECT_NAME);
6623 This pragma is standard in Ada 2005, but is available in all earlier
6624 versions of Ada as an implementation-defined pragma.
6625 See Ada 2012 Reference Manual for details.
6627 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6628 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c0}
6629 @section Pragma Prefix_Exception_Messages
6632 @geindex Prefix_Exception_Messages
6636 @geindex Exception_Message
6641 pragma Prefix_Exception_Messages;
6644 This is an implementation-defined configuration pragma that affects the
6645 behavior of raise statements with a message given as a static string
6646 constant (typically a string literal). In such cases, the string will
6647 be automatically prefixed by the name of the enclosing entity (giving
6648 the package and subprogram containing the raise statement). This helps
6649 to identify where messages are coming from, and this mode is automatic
6650 for the run-time library.
6652 The pragma has no effect if the message is computed with an expression other
6653 than a static string constant, since the assumption in this case is that
6654 the program computes exactly the string it wants. If you still want the
6655 prefixing in this case, you can always call
6656 @code{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6658 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6659 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c1}
6660 @section Pragma Pre_Class
6666 @geindex preconditions
6671 pragma Pre_Class (Boolean_Expression);
6674 The @code{Pre_Class} pragma is intended to be an exact replacement for
6675 the language-defined
6676 @code{Pre'Class} aspect, and shares its restrictions and semantics.
6677 It must appear either immediately following the corresponding
6678 subprogram declaration (only other pragmas may intervene), or
6679 if there is no separate subprogram declaration, then it can
6680 appear at the start of the declarations in a subprogram body
6681 (preceded only by other pragmas).
6683 Note: This pragma is called @code{Pre_Class} rather than
6684 @code{Pre'Class} because the latter would not be strictly
6685 conforming to the allowed syntax for pragmas. The motivation
6686 for providing pragmas equivalent to the aspects is to allow a program
6687 to be written using the pragmas, and then compiled if necessary
6688 using an Ada compiler that does not recognize the pragmas or
6689 aspects, but is prepared to ignore the pragmas. The assertion
6690 policy that controls this pragma is @code{Pre'Class}, not
6693 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6694 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c2}
6695 @section Pragma Priority_Specific_Dispatching
6701 pragma Priority_Specific_Dispatching (
6703 first_priority_EXPRESSION,
6704 last_priority_EXPRESSION)
6706 POLICY_IDENTIFIER ::=
6707 EDF_Across_Priorities |
6708 FIFO_Within_Priorities |
6709 Non_Preemptive_Within_Priorities |
6710 Round_Robin_Within_Priorities
6713 This pragma is standard in Ada 2005, but is available in all earlier
6714 versions of Ada as an implementation-defined pragma.
6715 See Ada 2012 Reference Manual for details.
6717 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6718 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c3}
6719 @section Pragma Profile
6725 pragma Profile (Ravenscar | Restricted | Rational | Jorvik |
6726 GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
6729 This pragma is standard in Ada 2005, but is available in all earlier
6730 versions of Ada as an implementation-defined pragma. This is a
6731 configuration pragma that establishes a set of configuration pragmas
6732 that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
6733 @code{Jorvik} is standard in Ada 202x.
6734 The other possibilities (@code{Restricted}, @code{Rational},
6735 @code{GNAT_Extended_Ravenscar}, @code{GNAT_Ravenscar_EDF})
6736 are implementation-defined. @code{GNAT_Extended_Ravenscar} is an alias for @code{Jorvik}.
6738 The set of configuration pragmas is defined in the following sections.
6744 Pragma Profile (Ravenscar)
6746 The @code{Ravenscar} profile is standard in Ada 2005,
6747 but is available in all earlier
6748 versions of Ada as an implementation-defined pragma. This profile
6749 establishes the following set of configuration pragmas:
6755 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6757 [RM D.2.2] Tasks are dispatched following a preemptive
6758 priority-ordered scheduling policy.
6761 @code{Locking_Policy (Ceiling_Locking)}
6763 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6764 the ceiling priority of the corresponding protected object.
6767 @code{Detect_Blocking}
6769 This pragma forces the detection of potentially blocking operations within a
6770 protected operation, and to raise Program_Error if that happens.
6773 plus the following set of restrictions:
6779 @code{Max_Entry_Queue_Length => 1}
6781 No task can be queued on a protected entry.
6784 @code{Max_Protected_Entries => 1}
6787 @code{Max_Task_Entries => 0}
6789 No rendezvous statements are allowed.
6792 @code{No_Abort_Statements}
6795 @code{No_Dynamic_Attachment}
6798 @code{No_Dynamic_Priorities}
6801 @code{No_Implicit_Heap_Allocations}
6804 @code{No_Local_Protected_Objects}
6807 @code{No_Local_Timing_Events}
6810 @code{No_Protected_Type_Allocators}
6813 @code{No_Relative_Delay}
6816 @code{No_Requeue_Statements}
6819 @code{No_Select_Statements}
6822 @code{No_Specific_Termination_Handlers}
6825 @code{No_Task_Allocators}
6828 @code{No_Task_Hierarchy}
6831 @code{No_Task_Termination}
6834 @code{Simple_Barriers}
6837 The Ravenscar profile also includes the following restrictions that specify
6838 that there are no semantic dependencies on the corresponding predefined
6845 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6848 @code{No_Dependence => Ada.Calendar}
6851 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6854 @code{No_Dependence => Ada.Execution_Time.Timers}
6857 @code{No_Dependence => Ada.Task_Attributes}
6860 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6863 This set of configuration pragmas and restrictions correspond to the
6864 definition of the ‘Ravenscar Profile’ for limited tasking, devised and
6865 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6866 A description is also available at
6867 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6869 The original definition of the profile was revised at subsequent IRTAW
6870 meetings. It has been included in the ISO
6871 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6872 and was made part of the Ada 2005 standard.
6873 The formal definition given by
6874 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6875 AI-305) available at
6876 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6877 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6879 The above set is a superset of the restrictions provided by pragma
6880 @code{Profile (Restricted)}, it includes six additional restrictions
6881 (@code{Simple_Barriers}, @code{No_Select_Statements},
6882 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6883 @code{No_Relative_Delay} and @code{No_Task_Termination}). This means
6884 that pragma @code{Profile (Ravenscar)}, like the pragma
6885 @code{Profile (Restricted)},
6886 automatically causes the use of a simplified,
6887 more efficient version of the tasking run-time library.
6890 Pragma Profile (Jorvik)
6892 @code{Jorvik} is the new profile added to the Ada 202x draft standard,
6893 previously implemented under the name @code{GNAT_Extended_Ravenscar}.
6895 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6896 by @code{No_Implicit_Task_Allocations} and
6897 @code{No_Implicit_Protected_Object_Allocations}.
6899 The @code{Simple_Barriers} restriction has been replaced by
6900 @code{Pure_Barriers}.
6902 The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
6903 @code{No_Relative_Delay} restrictions have been removed.
6905 Details on the rationale for @code{Jorvik} and implications for use may be
6906 found in @cite{A New Ravenscar-Based Profile} by P. Rogers, J. Ruiz,
6907 T. Gingold and P. Bernardi, in @cite{Reliable Software Technologies – Ada Europe 2017}, Springer-Verlag Lecture Notes in Computer Science,
6911 Pragma Profile (GNAT_Ravenscar_EDF)
6913 This profile corresponds to the Ravenscar profile but using
6914 EDF_Across_Priority as the Task_Scheduling_Policy.
6917 Pragma Profile (Restricted)
6919 This profile corresponds to the GNAT restricted run time. It
6920 establishes the following set of restrictions:
6926 @code{No_Abort_Statements}
6929 @code{No_Entry_Queue}
6932 @code{No_Task_Hierarchy}
6935 @code{No_Task_Allocators}
6938 @code{No_Dynamic_Priorities}
6941 @code{No_Terminate_Alternatives}
6944 @code{No_Dynamic_Attachment}
6947 @code{No_Protected_Type_Allocators}
6950 @code{No_Local_Protected_Objects}
6953 @code{No_Requeue_Statements}
6956 @code{No_Task_Attributes_Package}
6959 @code{Max_Asynchronous_Select_Nesting = 0}
6962 @code{Max_Task_Entries = 0}
6965 @code{Max_Protected_Entries = 1}
6968 @code{Max_Select_Alternatives = 0}
6971 This set of restrictions causes the automatic selection of a simplified
6972 version of the run time that provides improved performance for the
6973 limited set of tasking functionality permitted by this set of restrictions.
6976 Pragma Profile (Rational)
6978 The Rational profile is intended to facilitate porting legacy code that
6979 compiles with the Rational APEX compiler, even when the code includes non-
6980 conforming Ada constructs. The profile enables the following three pragmas:
6986 @code{pragma Implicit_Packing}
6989 @code{pragma Overriding_Renamings}
6992 @code{pragma Use_VADS_Size}
6996 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6997 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{c4}
6998 @section Pragma Profile_Warnings
7004 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
7007 This is an implementation-defined pragma that is similar in
7008 effect to @code{pragma Profile} except that instead of
7009 generating @code{Restrictions} pragmas, it generates
7010 @code{Restriction_Warnings} pragmas. The result is that
7011 violations of the profile generate warning messages instead
7014 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
7015 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{c5}
7016 @section Pragma Propagate_Exceptions
7019 @geindex Interfacing to C++
7024 pragma Propagate_Exceptions;
7027 This pragma is now obsolete and, other than generating a warning if warnings
7028 on obsolescent features are enabled, is ignored.
7029 It is retained for compatibility
7030 purposes. It used to be used in connection with optimization of
7031 a now-obsolete mechanism for implementation of exceptions.
7033 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
7034 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{c6}
7035 @section Pragma Provide_Shift_Operators
7038 @geindex Shift operators
7043 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
7046 This pragma can be applied to a first subtype local name that specifies
7047 either an unsigned or signed type. It has the effect of providing the
7048 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
7049 Rotate_Left and Rotate_Right) for the given type. It is similar to
7050 including the function declarations for these five operators, together
7051 with the pragma Import (Intrinsic, …) statements.
7053 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
7054 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{c7}
7055 @section Pragma Psect_Object
7061 pragma Psect_Object (
7062 [Internal =>] LOCAL_NAME,
7063 [, [External =>] EXTERNAL_SYMBOL]
7064 [, [Size =>] EXTERNAL_SYMBOL]);
7068 | static_string_EXPRESSION
7071 This pragma is identical in effect to pragma @code{Common_Object}.
7073 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
7074 @anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{c8}@anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{c9}
7075 @section Pragma Pure_Function
7081 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
7084 This pragma appears in the same declarative part as a function
7085 declaration (or a set of function declarations if more than one
7086 overloaded declaration exists, in which case the pragma applies
7087 to all entities). It specifies that the function @code{Entity} is
7088 to be considered pure for the purposes of code generation. This means
7089 that the compiler can assume that there are no side effects, and
7090 in particular that two identical calls produce the same result in
7091 the same context. It also means that the function can be used in
7094 Note that, quite deliberately, there are no static checks to try
7095 to ensure that this promise is met, so @code{Pure_Function} can be used
7096 with functions that are conceptually pure, even if they do modify
7097 global variables. For example, a square root function that is
7098 instrumented to count the number of times it is called is still
7099 conceptually pure, and can still be optimized, even though it
7100 modifies a global variable (the count). Memo functions are another
7101 example (where a table of previous calls is kept and consulted to
7102 avoid re-computation).
7104 Note also that the normal rules excluding optimization of subprograms
7105 in pure units (when parameter types are descended from System.Address,
7106 or when the full view of a parameter type is limited), do not apply
7107 for the Pure_Function case. If you explicitly specify Pure_Function,
7108 the compiler may optimize away calls with identical arguments, and
7109 if that results in unexpected behavior, the proper action is not to
7110 use the pragma for subprograms that are not (conceptually) pure.
7112 Note: Most functions in a @code{Pure} package are automatically pure, and
7113 there is no need to use pragma @code{Pure_Function} for such functions. One
7114 exception is any function that has at least one formal of type
7115 @code{System.Address} or a type derived from it. Such functions are not
7116 considered pure by default, since the compiler assumes that the
7117 @code{Address} parameter may be functioning as a pointer and that the
7118 referenced data may change even if the address value does not.
7119 Similarly, imported functions are not considered to be pure by default,
7120 since there is no way of checking that they are in fact pure. The use
7121 of pragma @code{Pure_Function} for such a function will override these default
7122 assumption, and cause the compiler to treat a designated subprogram as pure
7125 Note: If pragma @code{Pure_Function} is applied to a renamed function, it
7126 applies to the underlying renamed function. This can be used to
7127 disambiguate cases of overloading where some but not all functions
7128 in a set of overloaded functions are to be designated as pure.
7130 If pragma @code{Pure_Function} is applied to a library-level function, the
7131 function is also considered pure from an optimization point of view, but the
7132 unit is not a Pure unit in the categorization sense. So for example, a function
7133 thus marked is free to @code{with} non-pure units.
7135 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
7136 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{ca}
7137 @section Pragma Rational
7146 This pragma is considered obsolescent, but is retained for
7147 compatibility purposes. It is equivalent to:
7150 pragma Profile (Rational);
7153 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
7154 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{cb}
7155 @section Pragma Ravenscar
7164 This pragma is considered obsolescent, but is retained for
7165 compatibility purposes. It is equivalent to:
7168 pragma Profile (Ravenscar);
7171 which is the preferred method of setting the @code{Ravenscar} profile.
7173 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
7174 @anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{cc}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{cd}
7175 @section Pragma Refined_Depends
7181 pragma Refined_Depends (DEPENDENCY_RELATION);
7183 DEPENDENCY_RELATION ::=
7185 | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
7187 DEPENDENCY_CLAUSE ::=
7188 OUTPUT_LIST =>[+] INPUT_LIST
7189 | NULL_DEPENDENCY_CLAUSE
7191 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
7193 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
7195 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
7197 OUTPUT ::= NAME | FUNCTION_RESULT
7200 where FUNCTION_RESULT is a function Result attribute_reference
7203 For the semantics of this pragma, see the entry for aspect @code{Refined_Depends} in
7204 the SPARK 2014 Reference Manual, section 6.1.5.
7206 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
7207 @anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{ce}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{cf}
7208 @section Pragma Refined_Global
7214 pragma Refined_Global (GLOBAL_SPECIFICATION);
7216 GLOBAL_SPECIFICATION ::=
7219 | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
7221 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
7223 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
7224 GLOBAL_LIST ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
7225 GLOBAL_ITEM ::= NAME
7228 For the semantics of this pragma, see the entry for aspect @code{Refined_Global} in
7229 the SPARK 2014 Reference Manual, section 6.1.4.
7231 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
7232 @anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d0}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d1}
7233 @section Pragma Refined_Post
7239 pragma Refined_Post (boolean_EXPRESSION);
7242 For the semantics of this pragma, see the entry for aspect @code{Refined_Post} in
7243 the SPARK 2014 Reference Manual, section 7.2.7.
7245 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
7246 @anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d2}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{d3}
7247 @section Pragma Refined_State
7253 pragma Refined_State (REFINEMENT_LIST);
7256 (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
7258 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
7260 CONSTITUENT_LIST ::=
7263 | (CONSTITUENT @{, CONSTITUENT@})
7265 CONSTITUENT ::= object_NAME | state_NAME
7268 For the semantics of this pragma, see the entry for aspect @code{Refined_State} in
7269 the SPARK 2014 Reference Manual, section 7.2.2.
7271 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
7272 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{d4}
7273 @section Pragma Relative_Deadline
7279 pragma Relative_Deadline (time_span_EXPRESSION);
7282 This pragma is standard in Ada 2005, but is available in all earlier
7283 versions of Ada as an implementation-defined pragma.
7284 See Ada 2012 Reference Manual for details.
7286 @node Pragma Remote_Access_Type,Pragma Rename_Pragma,Pragma Relative_Deadline,Implementation Defined Pragmas
7287 @anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{d5}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{d6}
7288 @section Pragma Remote_Access_Type
7294 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
7297 This pragma appears in the formal part of a generic declaration.
7298 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
7299 the use of a remote access to class-wide type as actual for a formal
7302 When this pragma applies to a formal access type @code{Entity}, that
7303 type is treated as a remote access to class-wide type in the generic.
7304 It must be a formal general access type, and its designated type must
7305 be the class-wide type of a formal tagged limited private type from the
7306 same generic declaration.
7308 In the generic unit, the formal type is subject to all restrictions
7309 pertaining to remote access to class-wide types. At instantiation, the
7310 actual type must be a remote access to class-wide type.
7312 @node Pragma Rename_Pragma,Pragma Restricted_Run_Time,Pragma Remote_Access_Type,Implementation Defined Pragmas
7313 @anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{d7}
7314 @section Pragma Rename_Pragma
7323 pragma Rename_Pragma (
7324 [New_Name =>] IDENTIFIER,
7325 [Renamed =>] pragma_IDENTIFIER);
7328 This pragma provides a mechanism for supplying new names for existing
7329 pragmas. The @code{New_Name} identifier can subsequently be used as a synonym for
7330 the Renamed pragma. For example, suppose you have code that was originally
7331 developed on a compiler that supports Inline_Only as an implementation defined
7332 pragma. And suppose the semantics of pragma Inline_Only are identical to (or at
7333 least very similar to) the GNAT implementation defined pragma
7334 Inline_Always. You could globally replace Inline_Only with Inline_Always.
7336 However, to avoid that source modification, you could instead add a
7337 configuration pragma:
7340 pragma Rename_Pragma (
7341 New_Name => Inline_Only,
7342 Renamed => Inline_Always);
7345 Then GNAT will treat “pragma Inline_Only …” as if you had written
7346 “pragma Inline_Always …”.
7348 Pragma Inline_Only will not necessarily mean the same thing as the other Ada
7349 compiler; it’s up to you to make sure the semantics are close enough.
7351 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Rename_Pragma,Implementation Defined Pragmas
7352 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{d8}
7353 @section Pragma Restricted_Run_Time
7359 pragma Restricted_Run_Time;
7362 This pragma is considered obsolescent, but is retained for
7363 compatibility purposes. It is equivalent to:
7366 pragma Profile (Restricted);
7369 which is the preferred method of setting the restricted run time
7372 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
7373 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{d9}
7374 @section Pragma Restriction_Warnings
7380 pragma Restriction_Warnings
7381 (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
7384 This pragma allows a series of restriction identifiers to be
7385 specified (the list of allowed identifiers is the same as for
7386 pragma @code{Restrictions}). For each of these identifiers
7387 the compiler checks for violations of the restriction, but
7388 generates a warning message rather than an error message
7389 if the restriction is violated.
7391 One use of this is in situations where you want to know
7392 about violations of a restriction, but you want to ignore some of
7393 these violations. Consider this example, where you want to set
7394 Ada_95 mode and enable style checks, but you want to know about
7395 any other use of implementation pragmas:
7398 pragma Restriction_Warnings (No_Implementation_Pragmas);
7399 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
7401 pragma Style_Checks ("2bfhkM160");
7402 pragma Warnings (On, "violation of No_Implementation_Pragmas");
7405 By including the above lines in a configuration pragmas file,
7406 the Ada_95 and Style_Checks pragmas are accepted without
7407 generating a warning, but any other use of implementation
7408 defined pragmas will cause a warning to be generated.
7410 @node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
7411 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{da}
7412 @section Pragma Reviewable
7421 This pragma is an RM-defined standard pragma, but has no effect on the
7422 program being compiled, or on the code generated for the program.
7424 To obtain the required output specified in RM H.3.1, the compiler must be
7425 run with various special switches as follows:
7431 `Where compiler-generated run-time checks remain'
7433 The switch `-gnatGL'
7434 may be used to list the expanded code in pseudo-Ada form.
7435 Runtime checks show up in the listing either as explicit
7436 checks or operators marked with @{@} to indicate a check is present.
7439 `An identification of known exceptions at compile time'
7441 If the program is compiled with `-gnatwa',
7442 the compiler warning messages will indicate all cases where the compiler
7443 detects that an exception is certain to occur at run time.
7446 `Possible reads of uninitialized variables'
7448 The compiler warns of many such cases, but its output is incomplete.
7452 A supplemental static analysis tool
7453 may be used to obtain a comprehensive list of all
7454 possible points at which uninitialized data may be read.
7460 `Where run-time support routines are implicitly invoked'
7462 In the output from `-gnatGL',
7463 run-time calls are explicitly listed as calls to the relevant
7467 `Object code listing'
7469 This may be obtained either by using the `-S' switch,
7470 or the objdump utility.
7473 `Constructs known to be erroneous at compile time'
7475 These are identified by warnings issued by the compiler (use `-gnatwa').
7478 `Stack usage information'
7480 Static stack usage data (maximum per-subprogram) can be obtained via the
7481 `-fstack-usage' switch to the compiler.
7482 Dynamic stack usage data (per task) can be obtained via the `-u' switch
7491 `Object code listing of entire partition'
7493 This can be obtained by compiling the partition with `-S',
7494 or by applying objdump
7495 to all the object files that are part of the partition.
7498 `A description of the run-time model'
7500 The full sources of the run-time are available, and the documentation of
7501 these routines describes how these run-time routines interface to the
7502 underlying operating system facilities.
7505 `Control and data-flow information'
7509 A supplemental static analysis tool
7510 may be used to obtain complete control and data-flow information, as well as
7511 comprehensive messages identifying possible problems based on this
7514 @node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
7515 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{db}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{dc}
7516 @section Pragma Secondary_Stack_Size
7522 pragma Secondary_Stack_Size (integer_EXPRESSION);
7525 This pragma appears within the task definition of a single task declaration
7526 or a task type declaration (like pragma @code{Storage_Size}) and applies to all
7527 task objects of that type. The argument specifies the size of the secondary
7528 stack to be used by these task objects, and must be of an integer type. The
7529 secondary stack is used to handle functions that return a variable-sized
7530 result, for example a function returning an unconstrained String.
7532 Note this pragma only applies to targets using fixed secondary stacks, like
7533 VxWorks 653 and bare board targets, where a fixed block for the
7534 secondary stack is allocated from the primary stack of the task. By default,
7535 these targets assign a percentage of the primary stack for the secondary stack,
7536 as defined by @code{System.Parameter.Sec_Stack_Percentage}. With this pragma,
7537 an @code{integer_EXPRESSION} of bytes is assigned from the primary stack instead.
7539 For most targets, the pragma does not apply as the secondary stack grows on
7540 demand: allocated as a chain of blocks in the heap. The default size of these
7541 blocks can be modified via the @code{-D} binder option as described in
7542 @cite{GNAT User’s Guide}.
7544 Note that no check is made to see if the secondary stack can fit inside the
7547 Note the pragma cannot appear when the restriction @code{No_Secondary_Stack}
7550 @node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
7551 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{dd}
7552 @section Pragma Share_Generic
7558 pragma Share_Generic (GNAME @{, GNAME@});
7560 GNAME ::= generic_unit_NAME | generic_instance_NAME
7563 This pragma is provided for compatibility with Dec Ada 83. It has
7564 no effect in GNAT (which does not implement shared generics), other
7565 than to check that the given names are all names of generic units or
7568 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
7569 @anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{de}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{df}
7570 @section Pragma Shared
7573 This pragma is provided for compatibility with Ada 83. The syntax and
7574 semantics are identical to pragma Atomic.
7576 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
7577 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{e0}
7578 @section Pragma Short_Circuit_And_Or
7584 pragma Short_Circuit_And_Or;
7587 This configuration pragma causes any occurrence of the AND operator applied to
7588 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
7589 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
7590 may be useful in the context of certification protocols requiring the use of
7591 short-circuited logical operators. If this configuration pragma occurs locally
7592 within the file being compiled, it applies only to the file being compiled.
7593 There is no requirement that all units in a partition use this option.
7595 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
7596 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e1}
7597 @section Pragma Short_Descriptors
7603 pragma Short_Descriptors;
7606 This pragma is provided for compatibility with other Ada implementations. It
7607 is recognized but ignored by all current versions of GNAT.
7609 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
7610 @anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e2}@anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{e3}
7611 @section Pragma Simple_Storage_Pool_Type
7614 @geindex Storage pool
7617 @geindex Simple storage pool
7622 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
7625 A type can be established as a ‘simple storage pool type’ by applying
7626 the representation pragma @code{Simple_Storage_Pool_Type} to the type.
7627 A type named in the pragma must be a library-level immutably limited record
7628 type or limited tagged type declared immediately within a package declaration.
7629 The type can also be a limited private type whose full type is allowed as
7630 a simple storage pool type.
7632 For a simple storage pool type @code{SSP}, nonabstract primitive subprograms
7633 @code{Allocate}, @code{Deallocate}, and @code{Storage_Size} can be declared that
7634 are subtype conformant with the following subprogram declarations:
7639 Storage_Address : out System.Address;
7640 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7641 Alignment : System.Storage_Elements.Storage_Count);
7643 procedure Deallocate
7645 Storage_Address : System.Address;
7646 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7647 Alignment : System.Storage_Elements.Storage_Count);
7649 function Storage_Size (Pool : SSP)
7650 return System.Storage_Elements.Storage_Count;
7653 Procedure @code{Allocate} must be declared, whereas @code{Deallocate} and
7654 @code{Storage_Size} are optional. If @code{Deallocate} is not declared, then
7655 applying an unchecked deallocation has no effect other than to set its actual
7656 parameter to null. If @code{Storage_Size} is not declared, then the
7657 @code{Storage_Size} attribute applied to an access type associated with
7658 a pool object of type SSP returns zero. Additional operations can be declared
7659 for a simple storage pool type (such as for supporting a mark/release
7660 storage-management discipline).
7662 An object of a simple storage pool type can be associated with an access
7663 type by specifying the attribute
7664 @ref{e4,,Simple_Storage_Pool}. For example:
7667 My_Pool : My_Simple_Storage_Pool_Type;
7669 type Acc is access My_Data_Type;
7671 for Acc'Simple_Storage_Pool use My_Pool;
7674 See attribute @ref{e4,,Simple_Storage_Pool}
7675 for further details.
7677 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7678 @anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{e5}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{e6}
7679 @section Pragma Source_File_Name
7685 pragma Source_File_Name (
7686 [Unit_Name =>] unit_NAME,
7687 Spec_File_Name => STRING_LITERAL,
7688 [Index => INTEGER_LITERAL]);
7690 pragma Source_File_Name (
7691 [Unit_Name =>] unit_NAME,
7692 Body_File_Name => STRING_LITERAL,
7693 [Index => INTEGER_LITERAL]);
7696 Use this to override the normal naming convention. It is a configuration
7697 pragma, and so has the usual applicability of configuration pragmas
7698 (i.e., it applies to either an entire partition, or to all units in a
7699 compilation, or to a single unit, depending on how it is used).
7700 @code{unit_name} is mapped to @code{file_name_literal}. The identifier for
7701 the second argument is required, and indicates whether this is the file
7702 name for the spec or for the body.
7704 The optional Index argument should be used when a file contains multiple
7705 units, and when you do not want to use @code{gnatchop} to separate then
7706 into multiple files (which is the recommended procedure to limit the
7707 number of recompilations that are needed when some sources change).
7708 For instance, if the source file @code{source.ada} contains
7722 you could use the following configuration pragmas:
7725 pragma Source_File_Name
7726 (B, Spec_File_Name => "source.ada", Index => 1);
7727 pragma Source_File_Name
7728 (A, Body_File_Name => "source.ada", Index => 2);
7731 Note that the @code{gnatname} utility can also be used to generate those
7732 configuration pragmas.
7734 Another form of the @code{Source_File_Name} pragma allows
7735 the specification of patterns defining alternative file naming schemes
7736 to apply to all files.
7739 pragma Source_File_Name
7740 ( [Spec_File_Name =>] STRING_LITERAL
7741 [,[Casing =>] CASING_SPEC]
7742 [,[Dot_Replacement =>] STRING_LITERAL]);
7744 pragma Source_File_Name
7745 ( [Body_File_Name =>] STRING_LITERAL
7746 [,[Casing =>] CASING_SPEC]
7747 [,[Dot_Replacement =>] STRING_LITERAL]);
7749 pragma Source_File_Name
7750 ( [Subunit_File_Name =>] STRING_LITERAL
7751 [,[Casing =>] CASING_SPEC]
7752 [,[Dot_Replacement =>] STRING_LITERAL]);
7754 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7757 The first argument is a pattern that contains a single asterisk indicating
7758 the point at which the unit name is to be inserted in the pattern string
7759 to form the file name. The second argument is optional. If present it
7760 specifies the casing of the unit name in the resulting file name string.
7761 The default is lower case. Finally the third argument allows for systematic
7762 replacement of any dots in the unit name by the specified string literal.
7764 Note that Source_File_Name pragmas should not be used if you are using
7765 project files. The reason for this rule is that the project manager is not
7766 aware of these pragmas, and so other tools that use the projet file would not
7767 be aware of the intended naming conventions. If you are using project files,
7768 file naming is controlled by Source_File_Name_Project pragmas, which are
7769 usually supplied automatically by the project manager. A pragma
7770 Source_File_Name cannot appear after a @ref{e7,,Pragma Source_File_Name_Project}.
7772 For more details on the use of the @code{Source_File_Name} pragma, see the
7773 sections on @cite{Using Other File Names} and @cite{Alternative File Naming Schemes}
7774 in the @cite{GNAT User’s Guide}.
7776 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7777 @anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{e8}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{e7}
7778 @section Pragma Source_File_Name_Project
7781 This pragma has the same syntax and semantics as pragma Source_File_Name.
7782 It is only allowed as a stand-alone configuration pragma.
7783 It cannot appear after a @ref{e6,,Pragma Source_File_Name}, and
7784 most importantly, once pragma Source_File_Name_Project appears,
7785 no further Source_File_Name pragmas are allowed.
7787 The intention is that Source_File_Name_Project pragmas are always
7788 generated by the Project Manager in a manner consistent with the naming
7789 specified in a project file, and when naming is controlled in this manner,
7790 it is not permissible to attempt to modify this naming scheme using
7791 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7792 known to the project manager).
7794 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7795 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{e9}
7796 @section Pragma Source_Reference
7802 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7805 This pragma must appear as the first line of a source file.
7806 @code{integer_literal} is the logical line number of the line following
7807 the pragma line (for use in error messages and debugging
7808 information). @code{string_literal} is a static string constant that
7809 specifies the file name to be used in error messages and debugging
7810 information. This is most notably used for the output of @code{gnatchop}
7811 with the `-r' switch, to make sure that the original unchopped
7812 source file is the one referred to.
7814 The second argument must be a string literal, it cannot be a static
7815 string expression other than a string literal. This is because its value
7816 is needed for error messages issued by all phases of the compiler.
7818 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7819 @anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{ea}@anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{eb}
7820 @section Pragma SPARK_Mode
7826 pragma SPARK_Mode [(On | Off)] ;
7829 In general a program can have some parts that are in SPARK 2014 (and
7830 follow all the rules in the SPARK Reference Manual), and some parts
7831 that are full Ada 2012.
7833 The SPARK_Mode pragma is used to identify which parts are in SPARK
7834 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7835 be used in the following places:
7841 As a configuration pragma, in which case it sets the default mode for
7842 all units compiled with this pragma.
7845 Immediately following a library-level subprogram spec
7848 Immediately within a library-level package body
7851 Immediately following the @code{private} keyword of a library-level
7855 Immediately following the @code{begin} keyword of a library-level
7859 Immediately within a library-level subprogram body
7862 Normally a subprogram or package spec/body inherits the current mode
7863 that is active at the point it is declared. But this can be overridden
7864 by pragma within the spec or body as above.
7866 The basic consistency rule is that you can’t turn SPARK_Mode back
7867 @code{On}, once you have explicitly (with a pragma) turned if
7868 @code{Off}. So the following rules apply:
7870 If a subprogram spec has SPARK_Mode @code{Off}, then the body must
7871 also have SPARK_Mode @code{Off}.
7873 For a package, we have four parts:
7879 the package public declarations
7882 the package private part
7885 the body of the package
7888 the elaboration code after @code{begin}
7891 For a package, the rule is that if you explicitly turn SPARK_Mode
7892 @code{Off} for any part, then all the following parts must have
7893 SPARK_Mode @code{Off}. Note that this may require repeating a pragma
7894 SPARK_Mode (@code{Off}) in the body. For example, if we have a
7895 configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
7896 default everywhere, and one particular package spec has pragma
7897 SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
7900 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7901 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{ec}
7902 @section Pragma Static_Elaboration_Desired
7908 pragma Static_Elaboration_Desired;
7911 This pragma is used to indicate that the compiler should attempt to initialize
7912 statically the objects declared in the library unit to which the pragma applies,
7913 when these objects are initialized (explicitly or implicitly) by an aggregate.
7914 In the absence of this pragma, aggregates in object declarations are expanded
7915 into assignments and loops, even when the aggregate components are static
7916 constants. When the aggregate is present the compiler builds a static expression
7917 that requires no run-time code, so that the initialized object can be placed in
7918 read-only data space. If the components are not static, or the aggregate has
7919 more that 100 components, the compiler emits a warning that the pragma cannot
7920 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7921 construction of larger aggregates with static components that include an others
7924 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7925 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{ed}
7926 @section Pragma Stream_Convert
7932 pragma Stream_Convert (
7933 [Entity =>] type_LOCAL_NAME,
7934 [Read =>] function_NAME,
7935 [Write =>] function_NAME);
7938 This pragma provides an efficient way of providing user-defined stream
7939 attributes. Not only is it simpler to use than specifying the attributes
7940 directly, but more importantly, it allows the specification to be made in such
7941 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7942 needed (i.e. unless the stream attributes are actually used); the use of
7943 the Stream_Convert pragma adds no overhead at all, unless the stream
7944 attributes are actually used on the designated type.
7946 The first argument specifies the type for which stream functions are
7947 provided. The second parameter provides a function used to read values
7948 of this type. It must name a function whose argument type may be any
7949 subtype, and whose returned type must be the type given as the first
7950 argument to the pragma.
7952 The meaning of the @code{Read} parameter is that if a stream attribute directly
7953 or indirectly specifies reading of the type given as the first parameter,
7954 then a value of the type given as the argument to the Read function is
7955 read from the stream, and then the Read function is used to convert this
7956 to the required target type.
7958 Similarly the @code{Write} parameter specifies how to treat write attributes
7959 that directly or indirectly apply to the type given as the first parameter.
7960 It must have an input parameter of the type specified by the first parameter,
7961 and the return type must be the same as the input type of the Read function.
7962 The effect is to first call the Write function to convert to the given stream
7963 type, and then write the result type to the stream.
7965 The Read and Write functions must not be overloaded subprograms. If necessary
7966 renamings can be supplied to meet this requirement.
7967 The usage of this attribute is best illustrated by a simple example, taken
7968 from the GNAT implementation of package Ada.Strings.Unbounded:
7971 function To_Unbounded (S : String) return Unbounded_String
7972 renames To_Unbounded_String;
7974 pragma Stream_Convert
7975 (Unbounded_String, To_Unbounded, To_String);
7978 The specifications of the referenced functions, as given in the Ada
7979 Reference Manual are:
7982 function To_Unbounded_String (Source : String)
7983 return Unbounded_String;
7985 function To_String (Source : Unbounded_String)
7989 The effect is that if the value of an unbounded string is written to a stream,
7990 then the representation of the item in the stream is in the same format that
7991 would be used for @code{Standard.String'Output}, and this same representation
7992 is expected when a value of this type is read from the stream. Note that the
7993 value written always includes the bounds, even for Unbounded_String’Write,
7994 since Unbounded_String is not an array type.
7996 Note that the @code{Stream_Convert} pragma is not effective in the case of
7997 a derived type of a non-limited tagged type. If such a type is specified then
7998 the pragma is silently ignored, and the default implementation of the stream
7999 attributes is used instead.
8001 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
8002 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{ee}
8003 @section Pragma Style_Checks
8009 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
8010 On | Off [, LOCAL_NAME]);
8013 This pragma is used in conjunction with compiler switches to control the
8014 built in style checking provided by GNAT. The compiler switches, if set,
8015 provide an initial setting for the switches, and this pragma may be used
8016 to modify these settings, or the settings may be provided entirely by
8017 the use of the pragma. This pragma can be used anywhere that a pragma
8018 is legal, including use as a configuration pragma (including use in
8019 the @code{gnat.adc} file).
8021 The form with a string literal specifies which style options are to be
8022 activated. These are additive, so they apply in addition to any previously
8023 set style check options. The codes for the options are the same as those
8024 used in the `-gnaty' switch to `gcc' or `gnatmake'.
8025 For example the following two methods can be used to enable
8033 pragma Style_Checks ("l");
8042 The form @code{ALL_CHECKS} activates all standard checks (its use is equivalent
8043 to the use of the @code{gnaty} switch with no options.
8044 See the @cite{GNAT User’s Guide} for details.)
8046 Note: the behavior is slightly different in GNAT mode (@code{-gnatg} used).
8047 In this case, @code{ALL_CHECKS} implies the standard set of GNAT mode style check
8048 options (i.e. equivalent to @code{-gnatyg}).
8050 The forms with @code{Off} and @code{On}
8051 can be used to temporarily disable style checks
8052 as shown in the following example:
8055 pragma Style_Checks ("k"); -- requires keywords in lower case
8056 pragma Style_Checks (Off); -- turn off style checks
8057 NULL; -- this will not generate an error message
8058 pragma Style_Checks (On); -- turn style checks back on
8059 NULL; -- this will generate an error message
8062 Finally the two argument form is allowed only if the first argument is
8063 @code{On} or @code{Off}. The effect is to turn of semantic style checks
8064 for the specified entity, as shown in the following example:
8067 pragma Style_Checks ("r"); -- require consistency of identifier casing
8069 Rf1 : Integer := ARG; -- incorrect, wrong case
8070 pragma Style_Checks (Off, Arg);
8071 Rf2 : Integer := ARG; -- OK, no error
8074 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
8075 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{ef}
8076 @section Pragma Subtitle
8082 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
8085 This pragma is recognized for compatibility with other Ada compilers
8086 but is ignored by GNAT.
8088 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
8089 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{f0}
8090 @section Pragma Suppress
8096 pragma Suppress (Identifier [, [On =>] Name]);
8099 This is a standard pragma, and supports all the check names required in
8100 the RM. It is included here because GNAT recognizes some additional check
8101 names that are implementation defined (as permitted by the RM):
8107 @code{Alignment_Check} can be used to suppress alignment checks
8108 on addresses used in address clauses. Such checks can also be suppressed
8109 by suppressing range checks, but the specific use of @code{Alignment_Check}
8110 allows suppression of alignment checks without suppressing other range checks.
8111 Note that @code{Alignment_Check} is suppressed by default on machines (such as
8112 the x86) with non-strict alignment.
8115 @code{Atomic_Synchronization} can be used to suppress the special memory
8116 synchronization instructions that are normally generated for access to
8117 @code{Atomic} variables to ensure correct synchronization between tasks
8118 that use such variables for synchronization purposes.
8121 @code{Duplicated_Tag_Check} Can be used to suppress the check that is generated
8122 for a duplicated tag value when a tagged type is declared.
8125 @code{Container_Checks} Can be used to suppress all checks within Ada.Containers
8126 and instances of its children, including Tampering_Check.
8129 @code{Tampering_Check} Can be used to suppress tampering check in the containers.
8132 @code{Predicate_Check} can be used to control whether predicate checks are
8133 active. It is applicable only to predicates for which the policy is
8134 @code{Check}. Unlike @code{Assertion_Policy}, which determines if a given
8135 predicate is ignored or checked for the whole program, the use of
8136 @code{Suppress} and @code{Unsuppress} with this check name allows a given
8137 predicate to be turned on and off at specific points in the program.
8140 @code{Validity_Check} can be used specifically to control validity checks.
8141 If @code{Suppress} is used to suppress validity checks, then no validity
8142 checks are performed, including those specified by the appropriate compiler
8143 switch or the @code{Validity_Checks} pragma.
8146 Additional check names previously introduced by use of the @code{Check_Name}
8147 pragma are also allowed.
8150 Note that pragma Suppress gives the compiler permission to omit
8151 checks, but does not require the compiler to omit checks. The compiler
8152 will generate checks if they are essentially free, even when they are
8153 suppressed. In particular, if the compiler can prove that a certain
8154 check will necessarily fail, it will generate code to do an
8155 unconditional ‘raise’, even if checks are suppressed. The compiler
8158 Of course, run-time checks are omitted whenever the compiler can prove
8159 that they will not fail, whether or not checks are suppressed.
8161 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
8162 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{f1}
8163 @section Pragma Suppress_All
8169 pragma Suppress_All;
8172 This pragma can appear anywhere within a unit.
8173 The effect is to apply @code{Suppress (All_Checks)} to the unit
8174 in which it appears. This pragma is implemented for compatibility with DEC
8175 Ada 83 usage where it appears at the end of a unit, and for compatibility
8176 with Rational Ada, where it appears as a program unit pragma.
8177 The use of the standard Ada pragma @code{Suppress (All_Checks)}
8178 as a normal configuration pragma is the preferred usage in GNAT.
8180 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
8181 @anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f2}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{f3}
8182 @section Pragma Suppress_Debug_Info
8188 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
8191 This pragma can be used to suppress generation of debug information
8192 for the specified entity. It is intended primarily for use in debugging
8193 the debugger, and navigating around debugger problems.
8195 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
8196 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f4}
8197 @section Pragma Suppress_Exception_Locations
8203 pragma Suppress_Exception_Locations;
8206 In normal mode, a raise statement for an exception by default generates
8207 an exception message giving the file name and line number for the location
8208 of the raise. This is useful for debugging and logging purposes, but this
8209 entails extra space for the strings for the messages. The configuration
8210 pragma @code{Suppress_Exception_Locations} can be used to suppress the
8211 generation of these strings, with the result that space is saved, but the
8212 exception message for such raises is null. This configuration pragma may
8213 appear in a global configuration pragma file, or in a specific unit as
8214 usual. It is not required that this pragma be used consistently within
8215 a partition, so it is fine to have some units within a partition compiled
8216 with this pragma and others compiled in normal mode without it.
8218 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
8219 @anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{f5}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{f6}
8220 @section Pragma Suppress_Initialization
8223 @geindex Suppressing initialization
8225 @geindex Initialization
8226 @geindex suppression of
8231 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
8234 Here variable_or_subtype_Name is the name introduced by a type declaration
8235 or subtype declaration or the name of a variable introduced by an
8238 In the case of a type or subtype
8239 this pragma suppresses any implicit or explicit initialization
8240 for all variables of the given type or subtype,
8241 including initialization resulting from the use of pragmas
8242 Normalize_Scalars or Initialize_Scalars.
8244 This is considered a representation item, so it cannot be given after
8245 the type is frozen. It applies to all subsequent object declarations,
8246 and also any allocator that creates objects of the type.
8248 If the pragma is given for the first subtype, then it is considered
8249 to apply to the base type and all its subtypes. If the pragma is given
8250 for other than a first subtype, then it applies only to the given subtype.
8251 The pragma may not be given after the type is frozen.
8253 Note that this includes eliminating initialization of discriminants
8254 for discriminated types, and tags for tagged types. In these cases,
8255 you will have to use some non-portable mechanism (e.g. address
8256 overlays or unchecked conversion) to achieve required initialization
8257 of these fields before accessing any object of the corresponding type.
8259 For the variable case, implicit initialization for the named variable
8260 is suppressed, just as though its subtype had been given in a pragma
8261 Suppress_Initialization, as described above.
8263 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
8264 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{f7}
8265 @section Pragma Task_Name
8271 pragma Task_Name (string_EXPRESSION);
8274 This pragma appears within a task definition (like pragma
8275 @code{Priority}) and applies to the task in which it appears. The
8276 argument must be of type String, and provides a name to be used for
8277 the task instance when the task is created. Note that this expression
8278 is not required to be static, and in particular, it can contain
8279 references to task discriminants. This facility can be used to
8280 provide different names for different tasks as they are created,
8281 as illustrated in the example below.
8283 The task name is recorded internally in the run-time structures
8284 and is accessible to tools like the debugger. In addition the
8285 routine @code{Ada.Task_Identification.Image} will return this
8286 string, with a unique task address appended.
8289 -- Example of the use of pragma Task_Name
8291 with Ada.Task_Identification;
8292 use Ada.Task_Identification;
8293 with Text_IO; use Text_IO;
8296 type Astring is access String;
8298 task type Task_Typ (Name : access String) is
8299 pragma Task_Name (Name.all);
8302 task body Task_Typ is
8303 Nam : constant String := Image (Current_Task);
8305 Put_Line ("-->" & Nam (1 .. 14) & "<--");
8308 type Ptr_Task is access Task_Typ;
8309 Task_Var : Ptr_Task;
8313 new Task_Typ (new String'("This is task 1"));
8315 new Task_Typ (new String'("This is task 2"));
8319 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
8320 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{f8}
8321 @section Pragma Task_Storage
8327 pragma Task_Storage (
8328 [Task_Type =>] LOCAL_NAME,
8329 [Top_Guard =>] static_integer_EXPRESSION);
8332 This pragma specifies the length of the guard area for tasks. The guard
8333 area is an additional storage area allocated to a task. A value of zero
8334 means that either no guard area is created or a minimal guard area is
8335 created, depending on the target. This pragma can appear anywhere a
8336 @code{Storage_Size} attribute definition clause is allowed for a task
8339 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
8340 @anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{f9}@anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{fa}
8341 @section Pragma Test_Case
8350 [Name =>] static_string_Expression
8351 ,[Mode =>] (Nominal | Robustness)
8352 [, Requires => Boolean_Expression]
8353 [, Ensures => Boolean_Expression]);
8356 The @code{Test_Case} pragma allows defining fine-grain specifications
8357 for use by testing tools.
8358 The compiler checks the validity of the @code{Test_Case} pragma, but its
8359 presence does not lead to any modification of the code generated by the
8362 @code{Test_Case} pragmas may only appear immediately following the
8363 (separate) declaration of a subprogram in a package declaration, inside
8364 a package spec unit. Only other pragmas may intervene (that is appear
8365 between the subprogram declaration and a test case).
8367 The compiler checks that boolean expressions given in @code{Requires} and
8368 @code{Ensures} are valid, where the rules for @code{Requires} are the
8369 same as the rule for an expression in @code{Precondition} and the rules
8370 for @code{Ensures} are the same as the rule for an expression in
8371 @code{Postcondition}. In particular, attributes @code{'Old} and
8372 @code{'Result} can only be used within the @code{Ensures}
8373 expression. The following is an example of use within a package spec:
8376 package Math_Functions is
8378 function Sqrt (Arg : Float) return Float;
8379 pragma Test_Case (Name => "Test 1",
8381 Requires => Arg < 10000.0,
8382 Ensures => Sqrt'Result < 10.0);
8387 The meaning of a test case is that there is at least one context where
8388 @code{Requires} holds such that, if the associated subprogram is executed in
8389 that context, then @code{Ensures} holds when the subprogram returns.
8390 Mode @code{Nominal} indicates that the input context should also satisfy the
8391 precondition of the subprogram, and the output context should also satisfy its
8392 postcondition. Mode @code{Robustness} indicates that the precondition and
8393 postcondition of the subprogram should be ignored for this test case.
8395 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
8396 @anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{fb}@anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{fc}
8397 @section Pragma Thread_Local_Storage
8400 @geindex Task specific storage
8402 @geindex TLS (Thread Local Storage)
8404 @geindex Task_Attributes
8409 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
8412 This pragma specifies that the specified entity, which must be
8413 a variable declared in a library-level package, is to be marked as
8414 “Thread Local Storage” (@code{TLS}). On systems supporting this (which
8415 include Windows, Solaris, GNU/Linux, and VxWorks 6), this causes each
8416 thread (and hence each Ada task) to see a distinct copy of the variable.
8418 The variable must not have default initialization, and if there is
8419 an explicit initialization, it must be either @code{null} for an
8420 access variable, a static expression for a scalar variable, or a fully
8421 static aggregate for a composite type, that is to say, an aggregate all
8422 of whose components are static, and which does not include packed or
8423 discriminated components.
8425 This provides a low-level mechanism similar to that provided by
8426 the @code{Ada.Task_Attributes} package, but much more efficient
8427 and is also useful in writing interface code that will interact
8428 with foreign threads.
8430 If this pragma is used on a system where @code{TLS} is not supported,
8431 then an error message will be generated and the program will be rejected.
8433 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
8434 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{fd}
8435 @section Pragma Time_Slice
8441 pragma Time_Slice (static_duration_EXPRESSION);
8444 For implementations of GNAT on operating systems where it is possible
8445 to supply a time slice value, this pragma may be used for this purpose.
8446 It is ignored if it is used in a system that does not allow this control,
8447 or if it appears in other than the main program unit.
8449 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
8450 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{fe}
8451 @section Pragma Title
8457 pragma Title (TITLING_OPTION [, TITLING OPTION]);
8460 [Title =>] STRING_LITERAL,
8461 | [Subtitle =>] STRING_LITERAL
8464 Syntax checked but otherwise ignored by GNAT. This is a listing control
8465 pragma used in DEC Ada 83 implementations to provide a title and/or
8466 subtitle for the program listing. The program listing generated by GNAT
8467 does not have titles or subtitles.
8469 Unlike other pragmas, the full flexibility of named notation is allowed
8470 for this pragma, i.e., the parameters may be given in any order if named
8471 notation is used, and named and positional notation can be mixed
8472 following the normal rules for procedure calls in Ada.
8474 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
8475 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{ff}
8476 @section Pragma Type_Invariant
8482 pragma Type_Invariant
8483 ([Entity =>] type_LOCAL_NAME,
8484 [Check =>] EXPRESSION);
8487 The @code{Type_Invariant} pragma is intended to be an exact
8488 replacement for the language-defined @code{Type_Invariant}
8489 aspect, and shares its restrictions and semantics. It differs
8490 from the language defined @code{Invariant} pragma in that it
8491 does not permit a string parameter, and it is
8492 controlled by the assertion identifier @code{Type_Invariant}
8493 rather than @code{Invariant}.
8495 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
8496 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{100}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{101}
8497 @section Pragma Type_Invariant_Class
8503 pragma Type_Invariant_Class
8504 ([Entity =>] type_LOCAL_NAME,
8505 [Check =>] EXPRESSION);
8508 The @code{Type_Invariant_Class} pragma is intended to be an exact
8509 replacement for the language-defined @code{Type_Invariant'Class}
8510 aspect, and shares its restrictions and semantics.
8512 Note: This pragma is called @code{Type_Invariant_Class} rather than
8513 @code{Type_Invariant'Class} because the latter would not be strictly
8514 conforming to the allowed syntax for pragmas. The motivation
8515 for providing pragmas equivalent to the aspects is to allow a program
8516 to be written using the pragmas, and then compiled if necessary
8517 using an Ada compiler that does not recognize the pragmas or
8518 aspects, but is prepared to ignore the pragmas. The assertion
8519 policy that controls this pragma is @code{Type_Invariant'Class},
8520 not @code{Type_Invariant_Class}.
8522 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
8523 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{102}
8524 @section Pragma Unchecked_Union
8527 @geindex Unions in C
8532 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
8535 This pragma is used to specify a representation of a record type that is
8536 equivalent to a C union. It was introduced as a GNAT implementation defined
8537 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
8538 pragma, making it language defined, and GNAT fully implements this extended
8539 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
8540 details, consult the Ada 2012 Reference Manual, section B.3.3.
8542 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
8543 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{103}
8544 @section Pragma Unevaluated_Use_Of_Old
8547 @geindex Attribute Old
8549 @geindex Attribute Loop_Entry
8551 @geindex Unevaluated_Use_Of_Old
8556 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
8559 This pragma controls the processing of attributes Old and Loop_Entry.
8560 If either of these attributes is used in a potentially unevaluated
8561 expression (e.g. the then or else parts of an if expression), then
8562 normally this usage is considered illegal if the prefix of the attribute
8563 is other than an entity name. The language requires this
8564 behavior for Old, and GNAT copies the same rule for Loop_Entry.
8566 The reason for this rule is that otherwise, we can have a situation
8567 where we save the Old value, and this results in an exception, even
8568 though we might not evaluate the attribute. Consider this example:
8571 package UnevalOld is
8573 procedure U (A : String; C : Boolean) -- ERROR
8574 with Post => (if C then A(1)'Old = K else True);
8578 If procedure U is called with a string with a lower bound of 2, and
8579 C false, then an exception would be raised trying to evaluate A(1)
8580 on entry even though the value would not be actually used.
8582 Although the rule guarantees against this possibility, it is sometimes
8583 too restrictive. For example if we know that the string has a lower
8584 bound of 1, then we will never raise an exception.
8585 The pragma @code{Unevaluated_Use_Of_Old} can be
8586 used to modify this behavior. If the argument is @code{Error} then an
8587 error is given (this is the default RM behavior). If the argument is
8588 @code{Warn} then the usage is allowed as legal but with a warning
8589 that an exception might be raised. If the argument is @code{Allow}
8590 then the usage is allowed as legal without generating a warning.
8592 This pragma may appear as a configuration pragma, or in a declarative
8593 part or package specification. In the latter case it applies to
8594 uses up to the end of the corresponding statement sequence or
8595 sequence of package declarations.
8597 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
8598 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{104}
8599 @section Pragma Unimplemented_Unit
8605 pragma Unimplemented_Unit;
8608 If this pragma occurs in a unit that is processed by the compiler, GNAT
8609 aborts with the message @code{xxx not implemented}, where
8610 @code{xxx} is the name of the current compilation unit. This pragma is
8611 intended to allow the compiler to handle unimplemented library units in
8614 The abort only happens if code is being generated. Thus you can use
8615 specs of unimplemented packages in syntax or semantic checking mode.
8617 @node Pragma Universal_Aliasing,Pragma Unmodified,Pragma Unimplemented_Unit,Implementation Defined Pragmas
8618 @anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{105}@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{106}
8619 @section Pragma Universal_Aliasing
8625 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
8628 @code{type_LOCAL_NAME} must refer to a type declaration in the current
8629 declarative part. The effect is to inhibit strict type-based aliasing
8630 optimization for the given type. In other words, the effect is as though
8631 access types designating this type were subject to pragma No_Strict_Aliasing.
8632 For a detailed description of the strict aliasing optimization, and the
8633 situations in which it must be suppressed, see the section on
8634 @code{Optimization and Strict Aliasing} in the @cite{GNAT User’s Guide}.
8636 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Aliasing,Implementation Defined Pragmas
8637 @anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{107}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{108}
8638 @section Pragma Unmodified
8647 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8650 This pragma signals that the assignable entities (variables,
8651 @code{out} parameters, @code{in out} parameters) whose names are listed are
8652 deliberately not assigned in the current source unit. This
8653 suppresses warnings about the
8654 entities being referenced but not assigned, and in addition a warning will be
8655 generated if one of these entities is in fact assigned in the
8656 same unit as the pragma (or in the corresponding body, or one
8659 This is particularly useful for clearly signaling that a particular
8660 parameter is not modified, even though the spec suggests that it might
8663 For the variable case, warnings are never given for unreferenced variables
8664 whose name contains one of the substrings
8665 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8666 are typically to be used in cases where such warnings are expected.
8667 Thus it is never necessary to use @code{pragma Unmodified} for such
8668 variables, though it is harmless to do so.
8670 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8671 @anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{109}@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{10a}
8672 @section Pragma Unreferenced
8676 @geindex unreferenced
8681 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8682 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8685 This pragma signals that the entities whose names are listed are
8686 deliberately not referenced in the current source unit after the
8687 occurrence of the pragma. This
8688 suppresses warnings about the
8689 entities being unreferenced, and in addition a warning will be
8690 generated if one of these entities is in fact subsequently referenced in the
8691 same unit as the pragma (or in the corresponding body, or one
8694 This is particularly useful for clearly signaling that a particular
8695 parameter is not referenced in some particular subprogram implementation
8696 and that this is deliberate. It can also be useful in the case of
8697 objects declared only for their initialization or finalization side
8700 If @code{LOCAL_NAME} identifies more than one matching homonym in the
8701 current scope, then the entity most recently declared is the one to which
8702 the pragma applies. Note that in the case of accept formals, the pragma
8703 Unreferenced may appear immediately after the keyword @code{do} which
8704 allows the indication of whether or not accept formals are referenced
8705 or not to be given individually for each accept statement.
8707 The left hand side of an assignment does not count as a reference for the
8708 purpose of this pragma. Thus it is fine to assign to an entity for which
8709 pragma Unreferenced is given. However, use of an entity as an actual for
8710 an out parameter does count as a reference unless warnings for unread output
8711 parameters are enabled via @code{-gnatw.o}.
8713 Note that if a warning is desired for all calls to a given subprogram,
8714 regardless of whether they occur in the same unit as the subprogram
8715 declaration, then this pragma should not be used (calls from another
8716 unit would not be flagged); pragma Obsolescent can be used instead
8717 for this purpose, see @ref{ac,,Pragma Obsolescent}.
8719 The second form of pragma @code{Unreferenced} is used within a context
8720 clause. In this case the arguments must be unit names of units previously
8721 mentioned in @code{with} clauses (similar to the usage of pragma
8722 @code{Elaborate_All}). The effect is to suppress warnings about unreferenced
8723 units and unreferenced entities within these units.
8725 For the variable case, warnings are never given for unreferenced variables
8726 whose name contains one of the substrings
8727 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8728 are typically to be used in cases where such warnings are expected.
8729 Thus it is never necessary to use @code{pragma Unreferenced} for such
8730 variables, though it is harmless to do so.
8732 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8733 @anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{10b}@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{10c}
8734 @section Pragma Unreferenced_Objects
8738 @geindex unreferenced
8743 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8746 This pragma signals that for the types or subtypes whose names are
8747 listed, objects which are declared with one of these types or subtypes may
8748 not be referenced, and if no references appear, no warnings are given.
8750 This is particularly useful for objects which are declared solely for their
8751 initialization and finalization effect. Such variables are sometimes referred
8752 to as RAII variables (Resource Acquisition Is Initialization). Using this
8753 pragma on the relevant type (most typically a limited controlled type), the
8754 compiler will automatically suppress unwanted warnings about these variables
8755 not being referenced.
8757 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8758 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{10d}
8759 @section Pragma Unreserve_All_Interrupts
8765 pragma Unreserve_All_Interrupts;
8768 Normally certain interrupts are reserved to the implementation. Any attempt
8769 to attach an interrupt causes Program_Error to be raised, as described in
8770 RM C.3.2(22). A typical example is the @code{SIGINT} interrupt used in
8771 many systems for a @code{Ctrl-C} interrupt. Normally this interrupt is
8772 reserved to the implementation, so that @code{Ctrl-C} can be used to
8773 interrupt execution.
8775 If the pragma @code{Unreserve_All_Interrupts} appears anywhere in any unit in
8776 a program, then all such interrupts are unreserved. This allows the
8777 program to handle these interrupts, but disables their standard
8778 functions. For example, if this pragma is used, then pressing
8779 @code{Ctrl-C} will not automatically interrupt execution. However,
8780 a program can then handle the @code{SIGINT} interrupt as it chooses.
8782 For a full list of the interrupts handled in a specific implementation,
8783 see the source code for the spec of @code{Ada.Interrupts.Names} in
8784 file @code{a-intnam.ads}. This is a target dependent file that contains the
8785 list of interrupts recognized for a given target. The documentation in
8786 this file also specifies what interrupts are affected by the use of
8787 the @code{Unreserve_All_Interrupts} pragma.
8789 For a more general facility for controlling what interrupts can be
8790 handled, see pragma @code{Interrupt_State}, which subsumes the functionality
8791 of the @code{Unreserve_All_Interrupts} pragma.
8793 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8794 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{10e}
8795 @section Pragma Unsuppress
8801 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8804 This pragma undoes the effect of a previous pragma @code{Suppress}. If
8805 there is no corresponding pragma @code{Suppress} in effect, it has no
8806 effect. The range of the effect is the same as for pragma
8807 @code{Suppress}. The meaning of the arguments is identical to that used
8808 in pragma @code{Suppress}.
8810 One important application is to ensure that checks are on in cases where
8811 code depends on the checks for its correct functioning, so that the code
8812 will compile correctly even if the compiler switches are set to suppress
8813 checks. For example, in a program that depends on external names of tagged
8814 types and wants to ensure that the duplicated tag check occurs even if all
8815 run-time checks are suppressed by a compiler switch, the following
8816 configuration pragma will ensure this test is not suppressed:
8819 pragma Unsuppress (Duplicated_Tag_Check);
8822 This pragma is standard in Ada 2005. It is available in all earlier versions
8823 of Ada as an implementation-defined pragma.
8825 Note that in addition to the checks defined in the Ada RM, GNAT recogizes a
8826 number of implementation-defined check names. See the description of pragma
8827 @code{Suppress} for full details.
8829 @node Pragma Use_VADS_Size,Pragma Unused,Pragma Unsuppress,Implementation Defined Pragmas
8830 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{10f}
8831 @section Pragma Use_VADS_Size
8835 @geindex VADS compatibility
8837 @geindex Rational profile
8842 pragma Use_VADS_Size;
8845 This is a configuration pragma. In a unit to which it applies, any use
8846 of the ‘Size attribute is automatically interpreted as a use of the
8847 ‘VADS_Size attribute. Note that this may result in incorrect semantic
8848 processing of valid Ada 95 or Ada 2005 programs. This is intended to aid in
8849 the handling of existing code which depends on the interpretation of Size
8850 as implemented in the VADS compiler. See description of the VADS_Size
8851 attribute for further details.
8853 @node Pragma Unused,Pragma Validity_Checks,Pragma Use_VADS_Size,Implementation Defined Pragmas
8854 @anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{110}@anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{111}
8855 @section Pragma Unused
8864 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8867 This pragma signals that the assignable entities (variables,
8868 @code{out} parameters, and @code{in out} parameters) whose names are listed
8869 deliberately do not get assigned or referenced in the current source unit
8870 after the occurrence of the pragma in the current source unit. This
8871 suppresses warnings about the entities that are unreferenced and/or not
8872 assigned, and, in addition, a warning will be generated if one of these
8873 entities gets assigned or subsequently referenced in the same unit as the
8874 pragma (in the corresponding body or one of its subunits).
8876 This is particularly useful for clearly signaling that a particular
8877 parameter is not modified or referenced, even though the spec suggests
8880 For the variable case, warnings are never given for unreferenced
8881 variables whose name contains one of the substrings
8882 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8883 are typically to be used in cases where such warnings are expected.
8884 Thus it is never necessary to use @code{pragma Unused} for such
8885 variables, though it is harmless to do so.
8887 @node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
8888 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{112}
8889 @section Pragma Validity_Checks
8895 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8898 This pragma is used in conjunction with compiler switches to control the
8899 built-in validity checking provided by GNAT. The compiler switches, if set
8900 provide an initial setting for the switches, and this pragma may be used
8901 to modify these settings, or the settings may be provided entirely by
8902 the use of the pragma. This pragma can be used anywhere that a pragma
8903 is legal, including use as a configuration pragma (including use in
8904 the @code{gnat.adc} file).
8906 The form with a string literal specifies which validity options are to be
8907 activated. The validity checks are first set to include only the default
8908 reference manual settings, and then a string of letters in the string
8909 specifies the exact set of options required. The form of this string
8910 is exactly as described for the `-gnatVx' compiler switch (see the
8911 GNAT User’s Guide for details). For example the following two
8912 methods can be used to enable validity checking for mode @code{in} and
8913 @code{in out} subprogram parameters:
8920 pragma Validity_Checks ("im");
8925 $ gcc -c -gnatVim ...
8929 The form ALL_CHECKS activates all standard checks (its use is equivalent
8930 to the use of the @code{gnatVa} switch).
8932 The forms with @code{Off} and @code{On} can be used to temporarily disable
8933 validity checks as shown in the following example:
8936 pragma Validity_Checks ("c"); -- validity checks for copies
8937 pragma Validity_Checks (Off); -- turn off validity checks
8938 A := B; -- B will not be validity checked
8939 pragma Validity_Checks (On); -- turn validity checks back on
8940 A := C; -- C will be validity checked
8943 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8944 @anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{113}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{114}
8945 @section Pragma Volatile
8951 pragma Volatile (LOCAL_NAME);
8954 This pragma is defined by the Ada Reference Manual, and the GNAT
8955 implementation is fully conformant with this definition. The reason it
8956 is mentioned in this section is that a pragma of the same name was supplied
8957 in some Ada 83 compilers, including DEC Ada 83. The Ada 95 / Ada 2005
8958 implementation of pragma Volatile is upwards compatible with the
8959 implementation in DEC Ada 83.
8961 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8962 @anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{115}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{116}
8963 @section Pragma Volatile_Full_Access
8969 pragma Volatile_Full_Access (LOCAL_NAME);
8972 This is similar in effect to pragma Volatile, except that any reference to the
8973 object is guaranteed to be done only with instructions that read or write all
8974 the bits of the object. Furthermore, if the object is of a composite type,
8975 then any reference to a subcomponent of the object is guaranteed to read
8976 and/or write all the bits of the object.
8978 The intention is that this be suitable for use with memory-mapped I/O devices
8979 on some machines. Note that there are two important respects in which this is
8980 different from @code{pragma Atomic}. First a reference to a @code{Volatile_Full_Access}
8981 object is not a sequential action in the RM 9.10 sense and, therefore, does
8982 not create a synchronization point. Second, in the case of @code{pragma Atomic},
8983 there is no guarantee that all the bits will be accessed if the reference
8984 is not to the whole object; the compiler is allowed (and generally will)
8985 access only part of the object in this case.
8987 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8988 @anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{117}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{118}
8989 @section Pragma Volatile_Function
8995 pragma Volatile_Function [ (static_boolean_EXPRESSION) ];
8998 For the semantics of this pragma, see the entry for aspect @code{Volatile_Function}
8999 in the SPARK 2014 Reference Manual, section 7.1.2.
9001 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
9002 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{119}
9003 @section Pragma Warning_As_Error
9009 pragma Warning_As_Error (static_string_EXPRESSION);
9012 This configuration pragma allows the programmer to specify a set
9013 of warnings that will be treated as errors. Any warning that
9014 matches the pattern given by the pragma argument will be treated
9015 as an error. This gives more precise control than -gnatwe,
9016 which treats warnings as errors.
9018 This pragma can apply to regular warnings (messages enabled by -gnatw)
9019 and to style warnings (messages that start with “(style)”,
9022 The pattern may contain asterisks, which match zero or more characters
9023 in the message. For example, you can use @code{pragma Warning_As_Error
9024 ("bits of*unused")} to treat the warning message @code{warning: 960 bits of
9025 "a" unused} as an error. All characters other than asterisk are treated
9026 as literal characters in the match. The match is case insensitive; for
9027 example XYZ matches xyz.
9029 Note that the pattern matches if it occurs anywhere within the warning
9030 message string (it is not necessary to put an asterisk at the start and
9031 the end of the message, since this is implied).
9033 Another possibility for the static_string_EXPRESSION which works whether
9034 or not error tags are enabled (`-gnatw.d') is to use a single
9035 `-gnatw' tag string, enclosed in brackets,
9036 as shown in the example below, to treat one category of warnings as errors.
9037 Note that if you want to treat multiple categories of warnings as errors,
9038 you can use multiple pragma Warning_As_Error.
9040 The above use of patterns to match the message applies only to warning
9041 messages generated by the front end. This pragma can also be applied to
9042 warnings provided by the back end and mentioned in @ref{11a,,Pragma Warnings}.
9043 By using a single full `-Wxxx' switch in the pragma, such warnings
9044 can also be treated as errors.
9046 The pragma can appear either in a global configuration pragma file
9047 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
9048 configuration pragma file containing:
9051 pragma Warning_As_Error ("[-gnatwj]");
9054 which will treat all obsolescent feature warnings as errors, the
9055 following program compiles as shown (compile options here are
9056 `-gnatwa.d -gnatl -gnatj55').
9059 1. pragma Warning_As_Error ("*never assigned*");
9060 2. function Warnerr return String is
9063 >>> error: variable "X" is never read and
9064 never assigned [-gnatwv] [warning-as-error]
9068 >>> warning: variable "Y" is assigned but
9069 never read [-gnatwu]
9075 >>> error: use of "%" is an obsolescent
9076 feature (RM J.2(4)), use """ instead
9077 [-gnatwj] [warning-as-error]
9081 8 lines: No errors, 3 warnings (2 treated as errors)
9084 Note that this pragma does not affect the set of warnings issued in
9085 any way, it merely changes the effect of a matching warning if one
9086 is produced as a result of other warnings options. As shown in this
9087 example, if the pragma results in a warning being treated as an error,
9088 the tag is changed from “warning:” to “error:” and the string
9089 “[warning-as-error]” is appended to the end of the message.
9091 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
9092 @anchor{gnat_rm/implementation_defined_pragmas id56}@anchor{11b}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{11a}
9093 @section Pragma Warnings
9099 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
9101 DETAILS ::= On | Off
9102 DETAILS ::= On | Off, local_NAME
9103 DETAILS ::= static_string_EXPRESSION
9104 DETAILS ::= On | Off, static_string_EXPRESSION
9106 TOOL_NAME ::= GNAT | GNATprove
9108 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
9111 Note: in Ada 83 mode, a string literal may be used in place of a static string
9112 expression (which does not exist in Ada 83).
9114 Note if the second argument of @code{DETAILS} is a @code{local_NAME} then the
9115 second form is always understood. If the intention is to use
9116 the fourth form, then you can write @code{NAME & ""} to force the
9117 intepretation as a `static_string_EXPRESSION'.
9119 Note: if the first argument is a valid @code{TOOL_NAME}, it will be interpreted
9120 that way. The use of the @code{TOOL_NAME} argument is relevant only to users
9121 of SPARK and GNATprove, see last part of this section for details.
9123 Normally warnings are enabled, with the output being controlled by
9124 the command line switch. Warnings (@code{Off}) turns off generation of
9125 warnings until a Warnings (@code{On}) is encountered or the end of the
9126 current unit. If generation of warnings is turned off using this
9127 pragma, then some or all of the warning messages are suppressed,
9128 regardless of the setting of the command line switches.
9130 The @code{Reason} parameter may optionally appear as the last argument
9131 in any of the forms of this pragma. It is intended purely for the
9132 purposes of documenting the reason for the @code{Warnings} pragma.
9133 The compiler will check that the argument is a static string but
9134 otherwise ignore this argument. Other tools may provide specialized
9135 processing for this string.
9137 The form with a single argument (or two arguments if Reason present),
9138 where the first argument is @code{ON} or @code{OFF}
9139 may be used as a configuration pragma.
9141 If the @code{LOCAL_NAME} parameter is present, warnings are suppressed for
9142 the specified entity. This suppression is effective from the point where
9143 it occurs till the end of the extended scope of the variable (similar to
9144 the scope of @code{Suppress}). This form cannot be used as a configuration
9147 In the case where the first argument is other than @code{ON} or
9149 the third form with a single static_string_EXPRESSION argument (and possible
9150 reason) provides more precise
9151 control over which warnings are active. The string is a list of letters
9152 specifying which warnings are to be activated and which deactivated. The
9153 code for these letters is the same as the string used in the command
9154 line switch controlling warnings. For a brief summary, use the gnatmake
9155 command with no arguments, which will generate usage information containing
9156 the list of warnings switches supported. For
9157 full details see the section on @code{Warning Message Control} in the
9158 @cite{GNAT User’s Guide}.
9159 This form can also be used as a configuration pragma.
9161 The warnings controlled by the @code{-gnatw} switch are generated by the
9162 front end of the compiler. The GCC back end can provide additional warnings
9163 and they are controlled by the @code{-W} switch. Such warnings can be
9164 identified by the appearance of a string of the form @code{[-W@{xxx@}]} in the
9165 message which designates the @code{-W`xxx'} switch that controls the message.
9166 The form with a single `static_string_EXPRESSION' argument also works for these
9167 warnings, but the string must be a single full @code{-W`xxx'} switch in this
9168 case. The above reference lists a few examples of these additional warnings.
9170 The specified warnings will be in effect until the end of the program
9171 or another pragma @code{Warnings} is encountered. The effect of the pragma is
9172 cumulative. Initially the set of warnings is the standard default set
9173 as possibly modified by compiler switches. Then each pragma Warning
9174 modifies this set of warnings as specified. This form of the pragma may
9175 also be used as a configuration pragma.
9177 The fourth form, with an @code{On|Off} parameter and a string, is used to
9178 control individual messages, based on their text. The string argument
9179 is a pattern that is used to match against the text of individual
9180 warning messages (not including the initial “warning: “ tag).
9182 The pattern may contain asterisks, which match zero or more characters in
9183 the message. For example, you can use
9184 @code{pragma Warnings (Off, "bits of*unused")} to suppress the warning
9185 message @code{warning: 960 bits of "a" unused}. No other regular
9186 expression notations are permitted. All characters other than asterisk in
9187 these three specific cases are treated as literal characters in the match.
9188 The match is case insensitive, for example XYZ matches xyz.
9190 Note that the pattern matches if it occurs anywhere within the warning
9191 message string (it is not necessary to put an asterisk at the start and
9192 the end of the message, since this is implied).
9194 The above use of patterns to match the message applies only to warning
9195 messages generated by the front end. This form of the pragma with a string
9196 argument can also be used to control warnings provided by the back end and
9197 mentioned above. By using a single full @code{-W`xxx'} switch in the pragma,
9198 such warnings can be turned on and off.
9200 There are two ways to use the pragma in this form. The OFF form can be used
9201 as a configuration pragma. The effect is to suppress all warnings (if any)
9202 that match the pattern string throughout the compilation (or match the
9203 -W switch in the back end case).
9205 The second usage is to suppress a warning locally, and in this case, two
9206 pragmas must appear in sequence:
9209 pragma Warnings (Off, Pattern);
9210 ... code where given warning is to be suppressed
9211 pragma Warnings (On, Pattern);
9214 In this usage, the pattern string must match in the Off and On
9215 pragmas, and (if `-gnatw.w' is given) at least one matching
9216 warning must be suppressed.
9218 Note: if the ON form is not found, then the effect of the OFF form extends
9219 until the end of the file (pragma Warnings is purely textual, so its effect
9220 does not stop at the end of the enclosing scope).
9222 Note: to write a string that will match any warning, use the string
9223 @code{"***"}. It will not work to use a single asterisk or two
9224 asterisks since this looks like an operator name. This form with three
9225 asterisks is similar in effect to specifying @code{pragma Warnings (Off)} except (if @code{-gnatw.w} is given) that a matching
9226 @code{pragma Warnings (On, "***")} will be required. This can be
9227 helpful in avoiding forgetting to turn warnings back on.
9229 Note: the debug flag @code{-gnatd.i} can be
9230 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
9231 be useful in checking whether obsolete pragmas in existing programs are hiding
9234 Note: pragma Warnings does not affect the processing of style messages. See
9235 separate entry for pragma Style_Checks for control of style messages.
9237 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
9238 use the version of the pragma with a @code{TOOL_NAME} parameter.
9240 If present, @code{TOOL_NAME} is the name of a tool, currently either @code{GNAT} for the
9241 compiler or @code{GNATprove} for the formal verification tool. A given tool only
9242 takes into account pragma Warnings that do not specify a tool name, or that
9243 specify the matching tool name. This makes it possible to disable warnings
9244 selectively for each tool, and as a consequence to detect useless pragma
9245 Warnings with switch @code{-gnatw.w}.
9247 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
9248 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{11c}
9249 @section Pragma Weak_External
9255 pragma Weak_External ([Entity =>] LOCAL_NAME);
9258 @code{LOCAL_NAME} must refer to an object that is declared at the library
9259 level. This pragma specifies that the given entity should be marked as a
9260 weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
9261 in GNU C and causes @code{LOCAL_NAME} to be emitted as a weak symbol instead
9262 of a regular symbol, that is to say a symbol that does not have to be
9263 resolved by the linker if used in conjunction with a pragma Import.
9265 When a weak symbol is not resolved by the linker, its address is set to
9266 zero. This is useful in writing interfaces to external modules that may
9267 or may not be linked in the final executable, for example depending on
9268 configuration settings.
9270 If a program references at run time an entity to which this pragma has been
9271 applied, and the corresponding symbol was not resolved at link time, then
9272 the execution of the program is erroneous. It is not erroneous to take the
9273 Address of such an entity, for example to guard potential references,
9274 as shown in the example below.
9276 Some file formats do not support weak symbols so not all target machines
9277 support this pragma.
9280 -- Example of the use of pragma Weak_External
9282 package External_Module is
9284 pragma Import (C, key);
9285 pragma Weak_External (key);
9286 function Present return boolean;
9287 end External_Module;
9289 with System; use System;
9290 package body External_Module is
9291 function Present return boolean is
9293 return key'Address /= System.Null_Address;
9295 end External_Module;
9298 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
9299 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{11d}
9300 @section Pragma Wide_Character_Encoding
9306 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
9309 This pragma specifies the wide character encoding to be used in program
9310 source text appearing subsequently. It is a configuration pragma, but may
9311 also be used at any point that a pragma is allowed, and it is permissible
9312 to have more than one such pragma in a file, allowing multiple encodings
9313 to appear within the same file.
9315 However, note that the pragma cannot immediately precede the relevant
9316 wide character, because then the previous encoding will still be in
9317 effect, causing “illegal character” errors.
9319 The argument can be an identifier or a character literal. In the identifier
9320 case, it is one of @code{HEX}, @code{UPPER}, @code{SHIFT_JIS},
9321 @code{EUC}, @code{UTF8}, or @code{BRACKETS}. In the character literal
9322 case it is correspondingly one of the characters @code{h}, @code{u},
9323 @code{s}, @code{e}, @code{8}, or @code{b}.
9325 Note that when the pragma is used within a file, it affects only the
9326 encoding within that file, and does not affect withed units, specs,
9329 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
9330 @anchor{gnat_rm/implementation_defined_aspects doc}@anchor{11e}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{11f}@anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{120}
9331 @chapter Implementation Defined Aspects
9334 Ada defines (throughout the Ada 2012 reference manual, summarized
9335 in Annex K) a set of aspects that can be specified for certain entities.
9336 These language defined aspects are implemented in GNAT in Ada 2012 mode
9337 and work as described in the Ada 2012 Reference Manual.
9339 In addition, Ada 2012 allows implementations to define additional aspects
9340 whose meaning is defined by the implementation. GNAT provides
9341 a number of these implementation-defined aspects which can be used
9342 to extend and enhance the functionality of the compiler. This section of
9343 the GNAT reference manual describes these additional aspects.
9345 Note that any program using these aspects may not be portable to
9346 other compilers (although GNAT implements this set of aspects on all
9347 platforms). Therefore if portability to other compilers is an important
9348 consideration, you should minimize the use of these aspects.
9350 Note that for many of these aspects, the effect is essentially similar
9351 to the use of a pragma or attribute specification with the same name
9352 applied to the entity. For example, if we write:
9355 type R is range 1 .. 100
9356 with Value_Size => 10;
9359 then the effect is the same as:
9362 type R is range 1 .. 100;
9363 for R'Value_Size use 10;
9369 type R is new Integer
9370 with Shared => True;
9373 then the effect is the same as:
9376 type R is new Integer;
9380 In the documentation below, such cases are simply marked
9381 as being boolean aspects equivalent to the corresponding pragma
9382 or attribute definition clause.
9385 * Aspect Abstract_State::
9387 * Aspect Async_Readers::
9388 * Aspect Async_Writers::
9389 * Aspect Constant_After_Elaboration::
9390 * Aspect Contract_Cases::
9392 * Aspect Default_Initial_Condition::
9393 * Aspect Dimension::
9394 * Aspect Dimension_System::
9395 * Aspect Disable_Controlled::
9396 * Aspect Effective_Reads::
9397 * Aspect Effective_Writes::
9398 * Aspect Extensions_Visible::
9399 * Aspect Favor_Top_Level::
9402 * Aspect Initial_Condition::
9403 * Aspect Initializes::
9404 * Aspect Inline_Always::
9405 * Aspect Invariant::
9406 * Aspect Invariant’Class::
9408 * Aspect Linker_Section::
9409 * Aspect Lock_Free::
9410 * Aspect Max_Queue_Length::
9411 * Aspect No_Caching::
9412 * Aspect No_Elaboration_Code_All::
9413 * Aspect No_Inline::
9414 * Aspect No_Tagged_Streams::
9415 * Aspect No_Task_Parts::
9416 * Aspect Object_Size::
9417 * Aspect Obsolescent::
9419 * Aspect Persistent_BSS::
9420 * Aspect Predicate::
9421 * Aspect Pure_Function::
9422 * Aspect Refined_Depends::
9423 * Aspect Refined_Global::
9424 * Aspect Refined_Post::
9425 * Aspect Refined_State::
9426 * Aspect Relaxed_Initialization::
9427 * Aspect Remote_Access_Type::
9428 * Aspect Secondary_Stack_Size::
9429 * Aspect Scalar_Storage_Order::
9431 * Aspect Simple_Storage_Pool::
9432 * Aspect Simple_Storage_Pool_Type::
9433 * Aspect SPARK_Mode::
9434 * Aspect Suppress_Debug_Info::
9435 * Aspect Suppress_Initialization::
9436 * Aspect Test_Case::
9437 * Aspect Thread_Local_Storage::
9438 * Aspect Universal_Aliasing::
9439 * Aspect Unmodified::
9440 * Aspect Unreferenced::
9441 * Aspect Unreferenced_Objects::
9442 * Aspect Value_Size::
9443 * Aspect Volatile_Full_Access::
9444 * Aspect Volatile_Function::
9449 @node Aspect Abstract_State,Aspect Annotate,,Implementation Defined Aspects
9450 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{121}
9451 @section Aspect Abstract_State
9454 @geindex Abstract_State
9456 This aspect is equivalent to @ref{1e,,pragma Abstract_State}.
9458 @node Aspect Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
9459 @anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{122}
9460 @section Aspect Annotate
9465 There are three forms of this aspect (where ID is an identifier,
9466 and ARG is a general expression),
9467 corresponding to @ref{29,,pragma Annotate}.
9472 @item `Annotate => ID'
9474 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9476 @item `Annotate => (ID)'
9478 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9480 @item `Annotate => (ID ,ID @{, ARG@})'
9482 Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
9485 @node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
9486 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{123}
9487 @section Aspect Async_Readers
9490 @geindex Async_Readers
9492 This boolean aspect is equivalent to @ref{30,,pragma Async_Readers}.
9494 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
9495 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{124}
9496 @section Aspect Async_Writers
9499 @geindex Async_Writers
9501 This boolean aspect is equivalent to @ref{32,,pragma Async_Writers}.
9503 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
9504 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{125}
9505 @section Aspect Constant_After_Elaboration
9508 @geindex Constant_After_Elaboration
9510 This aspect is equivalent to @ref{42,,pragma Constant_After_Elaboration}.
9512 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
9513 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{126}
9514 @section Aspect Contract_Cases
9517 @geindex Contract_Cases
9519 This aspect is equivalent to @ref{44,,pragma Contract_Cases}, the sequence
9520 of clauses being enclosed in parentheses so that syntactically it is an
9523 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
9524 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{127}
9525 @section Aspect Depends
9530 This aspect is equivalent to @ref{54,,pragma Depends}.
9532 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
9533 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{128}
9534 @section Aspect Default_Initial_Condition
9537 @geindex Default_Initial_Condition
9539 This aspect is equivalent to @ref{4e,,pragma Default_Initial_Condition}.
9541 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
9542 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{129}
9543 @section Aspect Dimension
9548 The @code{Dimension} aspect is used to specify the dimensions of a given
9549 subtype of a dimensioned numeric type. The aspect also specifies a symbol
9550 used when doing formatted output of dimensioned quantities. The syntax is:
9554 ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
9556 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
9560 | others => RATIONAL
9561 | DISCRETE_CHOICE_LIST => RATIONAL
9563 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
9566 This aspect can only be applied to a subtype whose parent type has
9567 a @code{Dimension_System} aspect. The aspect must specify values for
9568 all dimensions of the system. The rational values are the powers of the
9569 corresponding dimensions that are used by the compiler to verify that
9570 physical (numeric) computations are dimensionally consistent. For example,
9571 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
9572 For further examples of the usage
9573 of this aspect, see package @code{System.Dim.Mks}.
9574 Note that when the dimensioned type is an integer type, then any
9575 dimension value must be an integer literal.
9577 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
9578 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{12a}
9579 @section Aspect Dimension_System
9582 @geindex Dimension_System
9584 The @code{Dimension_System} aspect is used to define a system of
9585 dimensions that will be used in subsequent subtype declarations with
9586 @code{Dimension} aspects that reference this system. The syntax is:
9589 with Dimension_System => (DIMENSION @{, DIMENSION@});
9591 DIMENSION ::= ([Unit_Name =>] IDENTIFIER,
9592 [Unit_Symbol =>] SYMBOL,
9593 [Dim_Symbol =>] SYMBOL)
9595 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
9598 This aspect is applied to a type, which must be a numeric derived type
9599 (typically a floating-point type), that
9600 will represent values within the dimension system. Each @code{DIMENSION}
9601 corresponds to one particular dimension. A maximum of 7 dimensions may
9602 be specified. @code{Unit_Name} is the name of the dimension (for example
9603 @code{Meter}). @code{Unit_Symbol} is the shorthand used for quantities
9604 of this dimension (for example @code{m} for @code{Meter}).
9605 @code{Dim_Symbol} gives
9606 the identification within the dimension system (typically this is a
9607 single letter, e.g. @code{L} standing for length for unit name @code{Meter}).
9608 The @code{Unit_Symbol} is used in formatted output of dimensioned quantities.
9609 The @code{Dim_Symbol} is used in error messages when numeric operations have
9610 inconsistent dimensions.
9612 GNAT provides the standard definition of the International MKS system in
9613 the run-time package @code{System.Dim.Mks}. You can easily define
9614 similar packages for cgs units or British units, and define conversion factors
9615 between values in different systems. The MKS system is characterized by the
9619 type Mks_Type is new Long_Long_Float with
9620 Dimension_System => (
9621 (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'),
9622 (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'),
9623 (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'),
9624 (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'),
9625 (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => '@@'),
9626 (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'),
9627 (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J'));
9630 Note that in the above type definition, we use the @code{at} symbol (@code{@@}) to
9631 represent a theta character (avoiding the use of extended Latin-1
9632 characters in this context).
9634 See section ‘Performing Dimensionality Analysis in GNAT’ in the GNAT Users
9635 Guide for detailed examples of use of the dimension system.
9637 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
9638 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{12b}
9639 @section Aspect Disable_Controlled
9642 @geindex Disable_Controlled
9644 The aspect @code{Disable_Controlled} is defined for controlled record types. If
9645 active, this aspect causes suppression of all related calls to @code{Initialize},
9646 @code{Adjust}, and @code{Finalize}. The intended use is for conditional compilation,
9647 where for example you might want a record to be controlled or not depending on
9648 whether some run-time check is enabled or suppressed.
9650 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9651 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{12c}
9652 @section Aspect Effective_Reads
9655 @geindex Effective_Reads
9657 This aspect is equivalent to @ref{59,,pragma Effective_Reads}.
9659 @node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
9660 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{12d}
9661 @section Aspect Effective_Writes
9664 @geindex Effective_Writes
9666 This aspect is equivalent to @ref{5b,,pragma Effective_Writes}.
9668 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
9669 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{12e}
9670 @section Aspect Extensions_Visible
9673 @geindex Extensions_Visible
9675 This aspect is equivalent to @ref{66,,pragma Extensions_Visible}.
9677 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9678 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{12f}
9679 @section Aspect Favor_Top_Level
9682 @geindex Favor_Top_Level
9684 This boolean aspect is equivalent to @ref{6b,,pragma Favor_Top_Level}.
9686 @node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects
9687 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{130}
9688 @section Aspect Ghost
9693 This aspect is equivalent to @ref{6f,,pragma Ghost}.
9695 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects
9696 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{131}
9697 @section Aspect Global
9702 This aspect is equivalent to @ref{71,,pragma Global}.
9704 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9705 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{132}
9706 @section Aspect Initial_Condition
9709 @geindex Initial_Condition
9711 This aspect is equivalent to @ref{7e,,pragma Initial_Condition}.
9713 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9714 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{133}
9715 @section Aspect Initializes
9718 @geindex Initializes
9720 This aspect is equivalent to @ref{81,,pragma Initializes}.
9722 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9723 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{134}
9724 @section Aspect Inline_Always
9727 @geindex Inline_Always
9729 This boolean aspect is equivalent to @ref{83,,pragma Inline_Always}.
9731 @node Aspect Invariant,Aspect Invariant’Class,Aspect Inline_Always,Implementation Defined Aspects
9732 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{135}
9733 @section Aspect Invariant
9738 This aspect is equivalent to @ref{8a,,pragma Invariant}. It is a
9739 synonym for the language defined aspect @code{Type_Invariant} except
9740 that it is separately controllable using pragma @code{Assertion_Policy}.
9742 @node Aspect Invariant’Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9743 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{136}
9744 @section Aspect Invariant’Class
9747 @geindex Invariant'Class
9749 This aspect is equivalent to @ref{101,,pragma Type_Invariant_Class}. It is a
9750 synonym for the language defined aspect @code{Type_Invariant'Class} except
9751 that it is separately controllable using pragma @code{Assertion_Policy}.
9753 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant’Class,Implementation Defined Aspects
9754 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{137}
9755 @section Aspect Iterable
9760 This aspect provides a light-weight mechanism for loops and quantified
9761 expressions over container types, without the overhead imposed by the tampering
9762 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9763 with six named components, of which the last three are optional: @code{First},
9764 @code{Next}, @code{Has_Element}, @code{Element}, @code{Last}, and @code{Previous}.
9765 When only the first three components are specified, only the
9766 @code{for .. in} form of iteration over cursors is available. When @code{Element}
9767 is specified, both this form and the @code{for .. of} form of iteration over
9768 elements are available. If the last two components are specified, reverse
9769 iterations over the container can be specified (analogous to what can be done
9770 over predefined containers that support the @code{Reverse_Iterator} interface).
9771 The following is a typical example of use:
9774 type List is private with
9775 Iterable => (First => First_Cursor,
9777 Has_Element => Cursor_Has_Element
9778 [,Element => Get_Element]
9779 [,Last => Last_Cursor]
9780 [,Previous => Retreat]);
9787 The values of @code{First} and @code{Last} are primitive operations of the
9788 container type that return a @code{Cursor}, which must be a type declared in
9789 the container package or visible from it. For example:
9793 function First_Cursor (Cont : Container) return Cursor;
9794 function Last_Cursor (Cont : Container) return Cursor;
9801 The values of @code{Next} and @code{Previous} are primitive operations of the container type that take
9802 both a container and a cursor and yield a cursor. For example:
9806 function Advance (Cont : Container; Position : Cursor) return Cursor;
9807 function Retreat (Cont : Container; Position : Cursor) return Cursor;
9814 The value of @code{Has_Element} is a primitive operation of the container type
9815 that takes both a container and a cursor and yields a boolean. For example:
9819 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9826 The value of @code{Element} is a primitive operation of the container type that
9827 takes both a container and a cursor and yields an @code{Element_Type}, which must
9828 be a type declared in the container package or visible from it. For example:
9832 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9835 This aspect is used in the GNAT-defined formal container packages.
9837 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
9838 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{138}
9839 @section Aspect Linker_Section
9842 @geindex Linker_Section
9844 This aspect is equivalent to @ref{92,,pragma Linker_Section}.
9846 @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects
9847 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{139}
9848 @section Aspect Lock_Free
9853 This boolean aspect is equivalent to @ref{94,,pragma Lock_Free}.
9855 @node Aspect Max_Queue_Length,Aspect No_Caching,Aspect Lock_Free,Implementation Defined Aspects
9856 @anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{13a}
9857 @section Aspect Max_Queue_Length
9860 @geindex Max_Queue_Length
9862 This aspect is equivalent to @ref{9c,,pragma Max_Queue_Length}.
9864 @node Aspect No_Caching,Aspect No_Elaboration_Code_All,Aspect Max_Queue_Length,Implementation Defined Aspects
9865 @anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{13b}
9866 @section Aspect No_Caching
9871 This boolean aspect is equivalent to @ref{9f,,pragma No_Caching}.
9873 @node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect No_Caching,Implementation Defined Aspects
9874 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{13c}
9875 @section Aspect No_Elaboration_Code_All
9878 @geindex No_Elaboration_Code_All
9880 This aspect is equivalent to @ref{a2,,pragma No_Elaboration_Code_All}
9883 @node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9884 @anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{13d}
9885 @section Aspect No_Inline
9890 This boolean aspect is equivalent to @ref{a5,,pragma No_Inline}.
9892 @node Aspect No_Tagged_Streams,Aspect No_Task_Parts,Aspect No_Inline,Implementation Defined Aspects
9893 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{13e}
9894 @section Aspect No_Tagged_Streams
9897 @geindex No_Tagged_Streams
9899 This aspect is equivalent to @ref{a9,,pragma No_Tagged_Streams} with an
9900 argument specifying a root tagged type (thus this aspect can only be
9901 applied to such a type).
9903 @node Aspect No_Task_Parts,Aspect Object_Size,Aspect No_Tagged_Streams,Implementation Defined Aspects
9904 @anchor{gnat_rm/implementation_defined_aspects aspect-no-task-parts}@anchor{13f}
9905 @section Aspect No_Task_Parts
9908 @geindex No_Task_Parts
9910 Applies to a type. If True, requires that the type and any descendants
9911 do not have any task parts. The rules for this aspect are the same as
9912 for the language-defined No_Controlled_Parts aspect (see RM-H.4.1),
9913 replacing “controlled” with “task”.
9915 If No_Task_Parts is True for a type T, then the compiler can optimize
9916 away certain tasking-related code that would otherwise be needed
9917 for T’Class, because descendants of T might contain tasks.
9919 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Task_Parts,Implementation Defined Aspects
9920 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{140}
9921 @section Aspect Object_Size
9924 @geindex Object_Size
9926 This aspect is equivalent to @ref{141,,attribute Object_Size}.
9928 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9929 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{142}
9930 @section Aspect Obsolescent
9933 @geindex Obsolsecent
9935 This aspect is equivalent to @ref{ac,,pragma Obsolescent}. Note that the
9936 evaluation of this aspect happens at the point of occurrence, it is not
9937 delayed until the freeze point.
9939 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9940 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{143}
9941 @section Aspect Part_Of
9946 This aspect is equivalent to @ref{b3,,pragma Part_Of}.
9948 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9949 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{144}
9950 @section Aspect Persistent_BSS
9953 @geindex Persistent_BSS
9955 This boolean aspect is equivalent to @ref{b6,,pragma Persistent_BSS}.
9957 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9958 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{145}
9959 @section Aspect Predicate
9964 This aspect is equivalent to @ref{bd,,pragma Predicate}. It is thus
9965 similar to the language defined aspects @code{Dynamic_Predicate}
9966 and @code{Static_Predicate} except that whether the resulting
9967 predicate is static or dynamic is controlled by the form of the
9968 expression. It is also separately controllable using pragma
9969 @code{Assertion_Policy}.
9971 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9972 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{146}
9973 @section Aspect Pure_Function
9976 @geindex Pure_Function
9978 This boolean aspect is equivalent to @ref{c9,,pragma Pure_Function}.
9980 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
9981 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{147}
9982 @section Aspect Refined_Depends
9985 @geindex Refined_Depends
9987 This aspect is equivalent to @ref{cd,,pragma Refined_Depends}.
9989 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
9990 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{148}
9991 @section Aspect Refined_Global
9994 @geindex Refined_Global
9996 This aspect is equivalent to @ref{cf,,pragma Refined_Global}.
9998 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
9999 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{149}
10000 @section Aspect Refined_Post
10003 @geindex Refined_Post
10005 This aspect is equivalent to @ref{d1,,pragma Refined_Post}.
10007 @node Aspect Refined_State,Aspect Relaxed_Initialization,Aspect Refined_Post,Implementation Defined Aspects
10008 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{14a}
10009 @section Aspect Refined_State
10012 @geindex Refined_State
10014 This aspect is equivalent to @ref{d3,,pragma Refined_State}.
10016 @node Aspect Relaxed_Initialization,Aspect Remote_Access_Type,Aspect Refined_State,Implementation Defined Aspects
10017 @anchor{gnat_rm/implementation_defined_aspects aspect-relaxed-initialization}@anchor{14b}
10018 @section Aspect Relaxed_Initialization
10021 @geindex Refined_Initialization
10023 For the syntax and semantics of this aspect, see the SPARK 2014 Reference
10024 Manual, section 6.10.
10026 @node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Relaxed_Initialization,Implementation Defined Aspects
10027 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{14c}
10028 @section Aspect Remote_Access_Type
10031 @geindex Remote_Access_Type
10033 This aspect is equivalent to @ref{d6,,pragma Remote_Access_Type}.
10035 @node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects
10036 @anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{14d}
10037 @section Aspect Secondary_Stack_Size
10040 @geindex Secondary_Stack_Size
10042 This aspect is equivalent to @ref{dc,,pragma Secondary_Stack_Size}.
10044 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects
10045 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{14e}
10046 @section Aspect Scalar_Storage_Order
10049 @geindex Scalar_Storage_Order
10051 This aspect is equivalent to a @ref{14f,,attribute Scalar_Storage_Order}.
10053 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
10054 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{150}
10055 @section Aspect Shared
10060 This boolean aspect is equivalent to @ref{df,,pragma Shared}
10061 and is thus a synonym for aspect @code{Atomic}.
10063 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
10064 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{151}
10065 @section Aspect Simple_Storage_Pool
10068 @geindex Simple_Storage_Pool
10070 This aspect is equivalent to @ref{e4,,attribute Simple_Storage_Pool}.
10072 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
10073 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{152}
10074 @section Aspect Simple_Storage_Pool_Type
10077 @geindex Simple_Storage_Pool_Type
10079 This boolean aspect is equivalent to @ref{e3,,pragma Simple_Storage_Pool_Type}.
10081 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
10082 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{153}
10083 @section Aspect SPARK_Mode
10086 @geindex SPARK_Mode
10088 This aspect is equivalent to @ref{eb,,pragma SPARK_Mode} and
10089 may be specified for either or both of the specification and body
10090 of a subprogram or package.
10092 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
10093 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{154}
10094 @section Aspect Suppress_Debug_Info
10097 @geindex Suppress_Debug_Info
10099 This boolean aspect is equivalent to @ref{f3,,pragma Suppress_Debug_Info}.
10101 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
10102 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{155}
10103 @section Aspect Suppress_Initialization
10106 @geindex Suppress_Initialization
10108 This boolean aspect is equivalent to @ref{f6,,pragma Suppress_Initialization}.
10110 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
10111 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{156}
10112 @section Aspect Test_Case
10117 This aspect is equivalent to @ref{fa,,pragma Test_Case}.
10119 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
10120 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{157}
10121 @section Aspect Thread_Local_Storage
10124 @geindex Thread_Local_Storage
10126 This boolean aspect is equivalent to @ref{fc,,pragma Thread_Local_Storage}.
10128 @node Aspect Universal_Aliasing,Aspect Unmodified,Aspect Thread_Local_Storage,Implementation Defined Aspects
10129 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{158}
10130 @section Aspect Universal_Aliasing
10133 @geindex Universal_Aliasing
10135 This boolean aspect is equivalent to @ref{106,,pragma Universal_Aliasing}.
10137 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Aliasing,Implementation Defined Aspects
10138 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{159}
10139 @section Aspect Unmodified
10142 @geindex Unmodified
10144 This boolean aspect is equivalent to @ref{108,,pragma Unmodified}.
10146 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
10147 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{15a}
10148 @section Aspect Unreferenced
10151 @geindex Unreferenced
10153 This boolean aspect is equivalent to @ref{10a,,pragma Unreferenced}.
10155 When using the @code{-gnat2022} switch, this aspect is also supported on formal
10156 parameters, which is in particular the only form possible for expression
10159 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
10160 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{15b}
10161 @section Aspect Unreferenced_Objects
10164 @geindex Unreferenced_Objects
10166 This boolean aspect is equivalent to @ref{10c,,pragma Unreferenced_Objects}.
10168 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
10169 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{15c}
10170 @section Aspect Value_Size
10173 @geindex Value_Size
10175 This aspect is equivalent to @ref{15d,,attribute Value_Size}.
10177 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
10178 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{15e}
10179 @section Aspect Volatile_Full_Access
10182 @geindex Volatile_Full_Access
10184 This boolean aspect is equivalent to @ref{116,,pragma Volatile_Full_Access}.
10186 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
10187 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{15f}
10188 @section Aspect Volatile_Function
10191 @geindex Volatile_Function
10193 This boolean aspect is equivalent to @ref{118,,pragma Volatile_Function}.
10195 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
10196 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{160}
10197 @section Aspect Warnings
10202 This aspect is equivalent to the two argument form of @ref{11a,,pragma Warnings},
10203 where the first argument is @code{ON} or @code{OFF} and the second argument
10206 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
10207 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{161}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{162}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}
10208 @chapter Implementation Defined Attributes
10211 Ada defines (throughout the Ada reference manual,
10212 summarized in Annex K),
10213 a set of attributes that provide useful additional functionality in all
10214 areas of the language. These language defined attributes are implemented
10215 in GNAT and work as described in the Ada Reference Manual.
10217 In addition, Ada allows implementations to define additional
10218 attributes whose meaning is defined by the implementation. GNAT provides
10219 a number of these implementation-dependent attributes which can be used
10220 to extend and enhance the functionality of the compiler. This section of
10221 the GNAT reference manual describes these additional attributes. It also
10222 describes additional implementation-dependent features of standard
10223 language-defined attributes.
10225 Note that any program using these attributes may not be portable to
10226 other compilers (although GNAT implements this set of attributes on all
10227 platforms). Therefore if portability to other compilers is an important
10228 consideration, you should minimize the use of these attributes.
10231 * Attribute Abort_Signal::
10232 * Attribute Address_Size::
10233 * Attribute Asm_Input::
10234 * Attribute Asm_Output::
10235 * Attribute Atomic_Always_Lock_Free::
10237 * Attribute Bit_Position::
10238 * Attribute Code_Address::
10239 * Attribute Compiler_Version::
10240 * Attribute Constrained::
10241 * Attribute Default_Bit_Order::
10242 * Attribute Default_Scalar_Storage_Order::
10243 * Attribute Deref::
10244 * Attribute Descriptor_Size::
10245 * Attribute Elaborated::
10246 * Attribute Elab_Body::
10247 * Attribute Elab_Spec::
10248 * Attribute Elab_Subp_Body::
10250 * Attribute Enabled::
10251 * Attribute Enum_Rep::
10252 * Attribute Enum_Val::
10253 * Attribute Epsilon::
10254 * Attribute Fast_Math::
10255 * Attribute Finalization_Size::
10256 * Attribute Fixed_Value::
10257 * Attribute From_Any::
10258 * Attribute Has_Access_Values::
10259 * Attribute Has_Discriminants::
10260 * Attribute Has_Tagged_Values::
10262 * Attribute Initialized::
10263 * Attribute Integer_Value::
10264 * Attribute Invalid_Value::
10265 * Attribute Iterable::
10266 * Attribute Large::
10267 * Attribute Library_Level::
10268 * Attribute Lock_Free::
10269 * Attribute Loop_Entry::
10270 * Attribute Machine_Size::
10271 * Attribute Mantissa::
10272 * Attribute Maximum_Alignment::
10273 * Attribute Max_Integer_Size::
10274 * Attribute Mechanism_Code::
10275 * Attribute Null_Parameter::
10276 * Attribute Object_Size::
10278 * Attribute Passed_By_Reference::
10279 * Attribute Pool_Address::
10280 * Attribute Range_Length::
10281 * Attribute Restriction_Set::
10282 * Attribute Result::
10283 * Attribute Safe_Emax::
10284 * Attribute Safe_Large::
10285 * Attribute Safe_Small::
10286 * Attribute Scalar_Storage_Order::
10287 * Attribute Simple_Storage_Pool::
10288 * Attribute Small::
10289 * Attribute Small_Denominator::
10290 * Attribute Small_Numerator::
10291 * Attribute Storage_Unit::
10292 * Attribute Stub_Type::
10293 * Attribute System_Allocator_Alignment::
10294 * Attribute Target_Name::
10295 * Attribute To_Address::
10296 * Attribute To_Any::
10297 * Attribute Type_Class::
10298 * Attribute Type_Key::
10299 * Attribute TypeCode::
10300 * Attribute Unconstrained_Array::
10301 * Attribute Universal_Literal_String::
10302 * Attribute Unrestricted_Access::
10303 * Attribute Update::
10304 * Attribute Valid_Image::
10305 * Attribute Valid_Scalars::
10306 * Attribute VADS_Size::
10307 * Attribute Value_Size::
10308 * Attribute Wchar_T_Size::
10309 * Attribute Word_Size::
10313 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
10314 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{163}
10315 @section Attribute Abort_Signal
10318 @geindex Abort_Signal
10320 @code{Standard'Abort_Signal} (@code{Standard} is the only allowed
10321 prefix) provides the entity for the special exception used to signal
10322 task abort or asynchronous transfer of control. Normally this attribute
10323 should only be used in the tasking runtime (it is highly peculiar, and
10324 completely outside the normal semantics of Ada, for a user program to
10325 intercept the abort exception).
10327 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
10328 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{164}
10329 @section Attribute Address_Size
10332 @geindex Size of `@w{`}Address`@w{`}
10334 @geindex Address_Size
10336 @code{Standard'Address_Size} (@code{Standard} is the only allowed
10337 prefix) is a static constant giving the number of bits in an
10338 @code{Address}. It is the same value as System.Address’Size,
10339 but has the advantage of being static, while a direct
10340 reference to System.Address’Size is nonstatic because Address
10343 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
10344 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{165}
10345 @section Attribute Asm_Input
10350 The @code{Asm_Input} attribute denotes a function that takes two
10351 parameters. The first is a string, the second is an expression of the
10352 type designated by the prefix. The first (string) argument is required
10353 to be a static expression, and is the constraint for the parameter,
10354 (e.g., what kind of register is required). The second argument is the
10355 value to be used as the input argument. The possible values for the
10356 constant are the same as those used in the RTL, and are dependent on
10357 the configuration file used to built the GCC back end.
10358 @ref{166,,Machine Code Insertions}
10360 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
10361 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{167}
10362 @section Attribute Asm_Output
10365 @geindex Asm_Output
10367 The @code{Asm_Output} attribute denotes a function that takes two
10368 parameters. The first is a string, the second is the name of a variable
10369 of the type designated by the attribute prefix. The first (string)
10370 argument is required to be a static expression and designates the
10371 constraint for the parameter (e.g., what kind of register is
10372 required). The second argument is the variable to be updated with the
10373 result. The possible values for constraint are the same as those used in
10374 the RTL, and are dependent on the configuration file used to build the
10375 GCC back end. If there are no output operands, then this argument may
10376 either be omitted, or explicitly given as @code{No_Output_Operands}.
10377 @ref{166,,Machine Code Insertions}
10379 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
10380 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{168}
10381 @section Attribute Atomic_Always_Lock_Free
10384 @geindex Atomic_Always_Lock_Free
10386 The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type.
10387 The result is a Boolean value which is True if the type has discriminants,
10388 and False otherwise. The result indicate whether atomic operations are
10389 supported by the target for the given type.
10391 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
10392 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{169}
10393 @section Attribute Bit
10398 @code{obj'Bit}, where @code{obj} is any object, yields the bit
10399 offset within the storage unit (byte) that contains the first bit of
10400 storage allocated for the object. The value of this attribute is of the
10401 type `universal_integer' and is always a nonnegative number smaller
10402 than @code{System.Storage_Unit}.
10404 For an object that is a variable or a constant allocated in a register,
10405 the value is zero. (The use of this attribute does not force the
10406 allocation of a variable to memory).
10408 For an object that is a formal parameter, this attribute applies
10409 to either the matching actual parameter or to a copy of the
10410 matching actual parameter.
10412 For an access object the value is zero. Note that
10413 @code{obj.all'Bit} is subject to an @code{Access_Check} for the
10414 designated object. Similarly for a record component
10415 @code{X.C'Bit} is subject to a discriminant check and
10416 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
10417 are subject to index checks.
10419 This attribute is designed to be compatible with the DEC Ada 83 definition
10420 and implementation of the @code{Bit} attribute.
10422 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
10423 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{16a}
10424 @section Attribute Bit_Position
10427 @geindex Bit_Position
10429 @code{R.C'Bit_Position}, where @code{R} is a record object and @code{C} is one
10430 of the fields of the record type, yields the bit
10431 offset within the record contains the first bit of
10432 storage allocated for the object. The value of this attribute is of the
10433 type `universal_integer'. The value depends only on the field
10434 @code{C} and is independent of the alignment of
10435 the containing record @code{R}.
10437 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
10438 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{16b}
10439 @section Attribute Code_Address
10442 @geindex Code_Address
10444 @geindex Subprogram address
10446 @geindex Address of subprogram code
10448 The @code{'Address}
10449 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
10450 intended effect seems to be to provide
10451 an address value which can be used to call the subprogram by means of
10452 an address clause as in the following example:
10458 for L'Address use K'Address;
10459 pragma Import (Ada, L);
10462 A call to @code{L} is then expected to result in a call to @code{K}.
10463 In Ada 83, where there were no access-to-subprogram values, this was
10464 a common work-around for getting the effect of an indirect call.
10465 GNAT implements the above use of @code{Address} and the technique
10466 illustrated by the example code works correctly.
10468 However, for some purposes, it is useful to have the address of the start
10469 of the generated code for the subprogram. On some architectures, this is
10470 not necessarily the same as the @code{Address} value described above.
10471 For example, the @code{Address} value may reference a subprogram
10472 descriptor rather than the subprogram itself.
10474 The @code{'Code_Address} attribute, which can only be applied to
10475 subprogram entities, always returns the address of the start of the
10476 generated code of the specified subprogram, which may or may not be
10477 the same value as is returned by the corresponding @code{'Address}
10480 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
10481 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{16c}
10482 @section Attribute Compiler_Version
10485 @geindex Compiler_Version
10487 @code{Standard'Compiler_Version} (@code{Standard} is the only allowed
10488 prefix) yields a static string identifying the version of the compiler
10489 being used to compile the unit containing the attribute reference.
10491 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
10492 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{16d}
10493 @section Attribute Constrained
10496 @geindex Constrained
10498 In addition to the usage of this attribute in the Ada RM, GNAT
10499 also permits the use of the @code{'Constrained} attribute
10500 in a generic template
10501 for any type, including types without discriminants. The value of this
10502 attribute in the generic instance when applied to a scalar type or a
10503 record type without discriminants is always @code{True}. This usage is
10504 compatible with older Ada compilers, including notably DEC Ada.
10506 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
10507 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{16e}
10508 @section Attribute Default_Bit_Order
10511 @geindex Big endian
10513 @geindex Little endian
10515 @geindex Default_Bit_Order
10517 @code{Standard'Default_Bit_Order} (@code{Standard} is the only
10518 allowed prefix), provides the value @code{System.Default_Bit_Order}
10519 as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
10520 @code{Low_Order_First}). This is used to construct the definition of
10521 @code{Default_Bit_Order} in package @code{System}.
10523 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
10524 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{16f}
10525 @section Attribute Default_Scalar_Storage_Order
10528 @geindex Big endian
10530 @geindex Little endian
10532 @geindex Default_Scalar_Storage_Order
10534 @code{Standard'Default_Scalar_Storage_Order} (@code{Standard} is the only
10535 allowed prefix), provides the current value of the default scalar storage
10536 order (as specified using pragma @code{Default_Scalar_Storage_Order}, or
10537 equal to @code{Default_Bit_Order} if unspecified) as a
10538 @code{System.Bit_Order} value. This is a static attribute.
10540 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
10541 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{170}
10542 @section Attribute Deref
10547 The attribute @code{typ'Deref(expr)} where @code{expr} is of type @code{System.Address} yields
10548 the variable of type @code{typ} that is located at the given address. It is similar
10549 to @code{(totyp (expr).all)}, where @code{totyp} is an unchecked conversion from address to
10550 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
10551 used on the left side of an assignment.
10553 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
10554 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{171}
10555 @section Attribute Descriptor_Size
10558 @geindex Descriptor
10560 @geindex Dope vector
10562 @geindex Descriptor_Size
10564 Nonstatic attribute @code{Descriptor_Size} returns the size in bits of the
10565 descriptor allocated for a type. The result is non-zero only for unconstrained
10566 array types and the returned value is of type universal integer. In GNAT, an
10567 array descriptor contains bounds information and is located immediately before
10568 the first element of the array.
10571 type Unconstr_Array is array (Short_Short_Integer range <>) of Positive;
10572 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
10575 The attribute takes into account any padding due to the alignment of the
10576 component type. In the example above, the descriptor contains two values
10577 of type @code{Short_Short_Integer} representing the low and high bound. But,
10578 since @code{Positive} has an alignment of 4, the size of the descriptor is
10579 @code{2 * Short_Short_Integer'Size} rounded up to the next multiple of 32,
10580 which yields a size of 32 bits, i.e. including 16 bits of padding.
10582 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
10583 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{172}
10584 @section Attribute Elaborated
10587 @geindex Elaborated
10589 The prefix of the @code{'Elaborated} attribute must be a unit name. The
10590 value is a Boolean which indicates whether or not the given unit has been
10591 elaborated. This attribute is primarily intended for internal use by the
10592 generated code for dynamic elaboration checking, but it can also be used
10593 in user programs. The value will always be True once elaboration of all
10594 units has been completed. An exception is for units which need no
10595 elaboration, the value is always False for such units.
10597 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
10598 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{173}
10599 @section Attribute Elab_Body
10604 This attribute can only be applied to a program unit name. It returns
10605 the entity for the corresponding elaboration procedure for elaborating
10606 the body of the referenced unit. This is used in the main generated
10607 elaboration procedure by the binder and is not normally used in any
10608 other context. However, there may be specialized situations in which it
10609 is useful to be able to call this elaboration procedure from Ada code,
10610 e.g., if it is necessary to do selective re-elaboration to fix some
10613 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
10614 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{174}
10615 @section Attribute Elab_Spec
10620 This attribute can only be applied to a program unit name. It returns
10621 the entity for the corresponding elaboration procedure for elaborating
10622 the spec of the referenced unit. This is used in the main
10623 generated elaboration procedure by the binder and is not normally used
10624 in any other context. However, there may be specialized situations in
10625 which it is useful to be able to call this elaboration procedure from
10626 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
10629 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
10630 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{175}
10631 @section Attribute Elab_Subp_Body
10634 @geindex Elab_Subp_Body
10636 This attribute can only be applied to a library level subprogram
10637 name and is only allowed in CodePeer mode. It returns the entity
10638 for the corresponding elaboration procedure for elaborating the body
10639 of the referenced subprogram unit. This is used in the main generated
10640 elaboration procedure by the binder in CodePeer mode only and is unrecognized
10643 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
10644 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{176}
10645 @section Attribute Emax
10648 @geindex Ada 83 attributes
10652 The @code{Emax} attribute is provided for compatibility with Ada 83. See
10653 the Ada 83 reference manual for an exact description of the semantics of
10656 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
10657 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{177}
10658 @section Attribute Enabled
10663 The @code{Enabled} attribute allows an application program to check at compile
10664 time to see if the designated check is currently enabled. The prefix is a
10665 simple identifier, referencing any predefined check name (other than
10666 @code{All_Checks}) or a check name introduced by pragma Check_Name. If
10667 no argument is given for the attribute, the check is for the general state
10668 of the check, if an argument is given, then it is an entity name, and the
10669 check indicates whether an @code{Suppress} or @code{Unsuppress} has been
10670 given naming the entity (if not, then the argument is ignored).
10672 Note that instantiations inherit the check status at the point of the
10673 instantiation, so a useful idiom is to have a library package that
10674 introduces a check name with @code{pragma Check_Name}, and then contains
10675 generic packages or subprograms which use the @code{Enabled} attribute
10676 to see if the check is enabled. A user of this package can then issue
10677 a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
10678 the package or subprogram, controlling whether the check will be present.
10680 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
10681 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{178}
10682 @section Attribute Enum_Rep
10685 @geindex Representation of enums
10689 Note that this attribute is now standard in Ada 202x and is available
10690 as an implementation defined attribute for earlier Ada versions.
10692 For every enumeration subtype @code{S}, @code{S'Enum_Rep} denotes a
10693 function with the following spec:
10696 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
10699 It is also allowable to apply @code{Enum_Rep} directly to an object of an
10700 enumeration type or to a non-overloaded enumeration
10701 literal. In this case @code{S'Enum_Rep} is equivalent to
10702 @code{typ'Enum_Rep(S)} where @code{typ} is the type of the
10703 enumeration literal or object.
10705 The function returns the representation value for the given enumeration
10706 value. This will be equal to value of the @code{Pos} attribute in the
10707 absence of an enumeration representation clause. This is a static
10708 attribute (i.e., the result is static if the argument is static).
10710 @code{S'Enum_Rep} can also be used with integer types and objects,
10711 in which case it simply returns the integer value. The reason for this
10712 is to allow it to be used for @code{(<>)} discrete formal arguments in
10713 a generic unit that can be instantiated with either enumeration types
10714 or integer types. Note that if @code{Enum_Rep} is used on a modular
10715 type whose upper bound exceeds the upper bound of the largest signed
10716 integer type, and the argument is a variable, so that the universal
10717 integer calculation is done at run time, then the call to @code{Enum_Rep}
10718 may raise @code{Constraint_Error}.
10720 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10721 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{179}
10722 @section Attribute Enum_Val
10725 @geindex Representation of enums
10729 Note that this attribute is now standard in Ada 202x and is available
10730 as an implementation defined attribute for earlier Ada versions.
10732 For every enumeration subtype @code{S}, @code{S'Enum_Val} denotes a
10733 function with the following spec:
10736 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10739 The function returns the enumeration value whose representation matches the
10740 argument, or raises Constraint_Error if no enumeration literal of the type
10741 has the matching value.
10742 This will be equal to value of the @code{Val} attribute in the
10743 absence of an enumeration representation clause. This is a static
10744 attribute (i.e., the result is static if the argument is static).
10746 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10747 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{17a}
10748 @section Attribute Epsilon
10751 @geindex Ada 83 attributes
10755 The @code{Epsilon} attribute is provided for compatibility with Ada 83. See
10756 the Ada 83 reference manual for an exact description of the semantics of
10759 @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
10760 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{17b}
10761 @section Attribute Fast_Math
10766 @code{Standard'Fast_Math} (@code{Standard} is the only allowed
10767 prefix) yields a static Boolean value that is True if pragma
10768 @code{Fast_Math} is active, and False otherwise.
10770 @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
10771 @anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{17c}
10772 @section Attribute Finalization_Size
10775 @geindex Finalization_Size
10777 The prefix of attribute @code{Finalization_Size} must be an object or
10778 a non-class-wide type. This attribute returns the size of any hidden data
10779 reserved by the compiler to handle finalization-related actions. The type of
10780 the attribute is `universal_integer'.
10782 @code{Finalization_Size} yields a value of zero for a type with no controlled
10783 parts, an object whose type has no controlled parts, or an object of a
10784 class-wide type whose tag denotes a type with no controlled parts.
10786 Note that only heap-allocated objects contain finalization data.
10788 @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
10789 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{17d}
10790 @section Attribute Fixed_Value
10793 @geindex Fixed_Value
10795 For every fixed-point type @code{S}, @code{S'Fixed_Value} denotes a
10796 function with the following specification:
10799 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10802 The value returned is the fixed-point value @code{V} such that:
10808 The effect is thus similar to first converting the argument to the
10809 integer type used to represent @code{S}, and then doing an unchecked
10810 conversion to the fixed-point type. The difference is
10811 that there are full range checks, to ensure that the result is in range.
10812 This attribute is primarily intended for use in implementation of the
10813 input-output functions for fixed-point values.
10815 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10816 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{17e}
10817 @section Attribute From_Any
10822 This internal attribute is used for the generation of remote subprogram
10823 stubs in the context of the Distributed Systems Annex.
10825 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10826 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{17f}
10827 @section Attribute Has_Access_Values
10830 @geindex Access values
10831 @geindex testing for
10833 @geindex Has_Access_Values
10835 The prefix of the @code{Has_Access_Values} attribute is a type. The result
10836 is a Boolean value which is True if the is an access type, or is a composite
10837 type with a component (at any nesting depth) that is an access type, and is
10839 The intended use of this attribute is in conjunction with generic
10840 definitions. If the attribute is applied to a generic private type, it
10841 indicates whether or not the corresponding actual type has access values.
10843 @node Attribute Has_Discriminants,Attribute Has_Tagged_Values,Attribute Has_Access_Values,Implementation Defined Attributes
10844 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{180}
10845 @section Attribute Has_Discriminants
10848 @geindex Discriminants
10849 @geindex testing for
10851 @geindex Has_Discriminants
10853 The prefix of the @code{Has_Discriminants} attribute is a type. The result
10854 is a Boolean value which is True if the type has discriminants, and False
10855 otherwise. The intended use of this attribute is in conjunction with generic
10856 definitions. If the attribute is applied to a generic private type, it
10857 indicates whether or not the corresponding actual type has discriminants.
10859 @node Attribute Has_Tagged_Values,Attribute Img,Attribute Has_Discriminants,Implementation Defined Attributes
10860 @anchor{gnat_rm/implementation_defined_attributes attribute-has-tagged-values}@anchor{181}
10861 @section Attribute Has_Tagged_Values
10864 @geindex Tagged values
10865 @geindex testing for
10867 @geindex Has_Tagged_Values
10869 The prefix of the @code{Has_Tagged_Values} attribute is a type. The result is a
10870 Boolean value which is True if the type is a composite type (array or record)
10871 that is either a tagged type or has a subcomponent that is tagged, and is False
10872 otherwise. The intended use of this attribute is in conjunction with generic
10873 definitions. If the attribute is applied to a generic private type, it
10874 indicates whether or not the corresponding actual type has access values.
10876 @node Attribute Img,Attribute Initialized,Attribute Has_Tagged_Values,Implementation Defined Attributes
10877 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{182}
10878 @section Attribute Img
10883 The @code{Img} attribute differs from @code{Image} in that, while both can be
10884 applied directly to an object, @code{Img} cannot be applied to types.
10886 Example usage of the attribute:
10889 Put_Line ("X = " & X'Img);
10892 which has the same meaning as the more verbose:
10895 Put_Line ("X = " & T'Image (X));
10898 where @code{T} is the (sub)type of the object @code{X}.
10900 Note that technically, in analogy to @code{Image},
10901 @code{X'Img} returns a parameterless function
10902 that returns the appropriate string when called. This means that
10903 @code{X'Img} can be renamed as a function-returning-string, or used
10904 in an instantiation as a function parameter.
10906 @node Attribute Initialized,Attribute Integer_Value,Attribute Img,Implementation Defined Attributes
10907 @anchor{gnat_rm/implementation_defined_attributes attribute-initialized}@anchor{183}
10908 @section Attribute Initialized
10911 @geindex Initialized
10913 For the syntax and semantics of this attribute, see the SPARK 2014 Reference
10914 Manual, section 6.10.
10916 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Initialized,Implementation Defined Attributes
10917 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{184}
10918 @section Attribute Integer_Value
10921 @geindex Integer_Value
10923 For every integer type @code{S}, @code{S'Integer_Value} denotes a
10924 function with the following spec:
10927 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10930 The value returned is the integer value @code{V}, such that:
10936 where @code{T} is the type of @code{Arg}.
10937 The effect is thus similar to first doing an unchecked conversion from
10938 the fixed-point type to its corresponding implementation type, and then
10939 converting the result to the target integer type. The difference is
10940 that there are full range checks, to ensure that the result is in range.
10941 This attribute is primarily intended for use in implementation of the
10942 standard input-output functions for fixed-point values.
10944 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
10945 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{185}
10946 @section Attribute Invalid_Value
10949 @geindex Invalid_Value
10951 For every scalar type S, S’Invalid_Value returns an undefined value of the
10952 type. If possible this value is an invalid representation for the type. The
10953 value returned is identical to the value used to initialize an otherwise
10954 uninitialized value of the type if pragma Initialize_Scalars is used,
10955 including the ability to modify the value with the binder -Sxx flag and
10956 relevant environment variables at run time.
10958 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
10959 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{186}
10960 @section Attribute Iterable
10965 Equivalent to Aspect Iterable.
10967 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
10968 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{187}
10969 @section Attribute Large
10972 @geindex Ada 83 attributes
10976 The @code{Large} attribute is provided for compatibility with Ada 83. See
10977 the Ada 83 reference manual for an exact description of the semantics of
10980 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
10981 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{188}
10982 @section Attribute Library_Level
10985 @geindex Library_Level
10987 @code{P'Library_Level}, where P is an entity name,
10988 returns a Boolean value which is True if the entity is declared
10989 at the library level, and False otherwise. Note that within a
10990 generic instantition, the name of the generic unit denotes the
10991 instance, which means that this attribute can be used to test
10992 if a generic is instantiated at the library level, as shown
10999 pragma Compile_Time_Error
11000 (not Gen'Library_Level,
11001 "Gen can only be instantiated at library level");
11006 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
11007 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{189}
11008 @section Attribute Lock_Free
11013 @code{P'Lock_Free}, where P is a protected object, returns True if a
11014 pragma @code{Lock_Free} applies to P.
11016 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
11017 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18a}
11018 @section Attribute Loop_Entry
11021 @geindex Loop_Entry
11026 X'Loop_Entry [(loop_name)]
11029 The @code{Loop_Entry} attribute is used to refer to the value that an
11030 expression had upon entry to a given loop in much the same way that the
11031 @code{Old} attribute in a subprogram postcondition can be used to refer
11032 to the value an expression had upon entry to the subprogram. The
11033 relevant loop is either identified by the given loop name, or it is the
11034 innermost enclosing loop when no loop name is given.
11036 A @code{Loop_Entry} attribute can only occur within an @code{Assert},
11037 @code{Assert_And_Cut}, @code{Assume}, @code{Loop_Variant} or @code{Loop_Invariant} pragma.
11038 In addition, such a pragma must be one of the items in the sequence
11039 of statements of a loop body, or nested inside block statements that
11040 appear in the sequence of statements of a loop body.
11041 A common use of @code{Loop_Entry} is to compare the current value of objects with
11042 their initial value at loop entry, in a @code{Loop_Invariant} pragma.
11044 The effect of using @code{X'Loop_Entry} is the same as declaring
11045 a constant initialized with the initial value of @code{X} at loop
11046 entry. This copy is not performed if the loop is not entered, or if the
11047 corresponding pragmas are ignored or disabled.
11049 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
11050 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18b}
11051 @section Attribute Machine_Size
11054 @geindex Machine_Size
11056 This attribute is identical to the @code{Object_Size} attribute. It is
11057 provided for compatibility with the DEC Ada 83 attribute of this name.
11059 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
11060 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{18c}
11061 @section Attribute Mantissa
11064 @geindex Ada 83 attributes
11068 The @code{Mantissa} attribute is provided for compatibility with Ada 83. See
11069 the Ada 83 reference manual for an exact description of the semantics of
11072 @node Attribute Maximum_Alignment,Attribute Max_Integer_Size,Attribute Mantissa,Implementation Defined Attributes
11073 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{18d}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{18e}
11074 @section Attribute Maximum_Alignment
11080 @geindex Maximum_Alignment
11082 @code{Standard'Maximum_Alignment} (@code{Standard} is the only
11083 allowed prefix) provides the maximum useful alignment value for the
11084 target. This is a static value that can be used to specify the alignment
11085 for an object, guaranteeing that it is properly aligned in all
11088 @node Attribute Max_Integer_Size,Attribute Mechanism_Code,Attribute Maximum_Alignment,Implementation Defined Attributes
11089 @anchor{gnat_rm/implementation_defined_attributes attribute-max-integer-size}@anchor{18f}
11090 @section Attribute Max_Integer_Size
11093 @geindex Max_Integer_Size
11095 @code{Standard'Max_Integer_Size} (@code{Standard} is the only allowed
11096 prefix) provides the size of the largest supported integer type for
11097 the target. The result is a static constant.
11099 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Max_Integer_Size,Implementation Defined Attributes
11100 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{190}
11101 @section Attribute Mechanism_Code
11104 @geindex Return values
11105 @geindex passing mechanism
11107 @geindex Parameters
11108 @geindex passing mechanism
11110 @geindex Mechanism_Code
11112 @code{func'Mechanism_Code} yields an integer code for the
11113 mechanism used for the result of function @code{func}, and
11114 @code{subprog'Mechanism_Code (n)} yields the mechanism
11115 used for formal parameter number `n' (a static integer value, with 1
11116 meaning the first parameter) of subprogram @code{subprog}. The code returned is:
11130 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
11131 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{191}
11132 @section Attribute Null_Parameter
11135 @geindex Zero address
11138 @geindex Null_Parameter
11140 A reference @code{T'Null_Parameter} denotes an imaginary object of
11141 type or subtype @code{T} allocated at machine address zero. The attribute
11142 is allowed only as the default expression of a formal parameter, or as
11143 an actual expression of a subprogram call. In either case, the
11144 subprogram must be imported.
11146 The identity of the object is represented by the address zero in the
11147 argument list, independent of the passing mechanism (explicit or
11150 This capability is needed to specify that a zero address should be
11151 passed for a record or other composite object passed by reference.
11152 There is no way of indicating this without the @code{Null_Parameter}
11155 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
11156 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{141}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{192}
11157 @section Attribute Object_Size
11161 @geindex used for objects
11163 @geindex Object_Size
11165 The size of an object is not necessarily the same as the size of the type
11166 of an object. This is because by default object sizes are increased to be
11167 a multiple of the alignment of the object. For example,
11168 @code{Natural'Size} is
11169 31, but by default objects of type @code{Natural} will have a size of 32 bits.
11170 Similarly, a record containing an integer and a character:
11179 will have a size of 40 (that is @code{Rec'Size} will be 40). The
11180 alignment will be 4, because of the
11181 integer field, and so the default size of record objects for this type
11182 will be 64 (8 bytes).
11184 If the alignment of the above record is specified to be 1, then the
11185 object size will be 40 (5 bytes). This is true by default, and also
11186 an object size of 40 can be explicitly specified in this case.
11188 A consequence of this capability is that different object sizes can be
11189 given to subtypes that would otherwise be considered in Ada to be
11190 statically matching. But it makes no sense to consider such subtypes
11191 as statically matching. Consequently, GNAT adds a rule
11192 to the static matching rules that requires object sizes to match.
11193 Consider this example:
11196 1. procedure BadAVConvert is
11197 2. type R is new Integer;
11198 3. subtype R1 is R range 1 .. 10;
11199 4. subtype R2 is R range 1 .. 10;
11200 5. for R1'Object_Size use 8;
11201 6. for R2'Object_Size use 16;
11202 7. type R1P is access all R1;
11203 8. type R2P is access all R2;
11204 9. R1PV : R1P := new R1'(4);
11207 12. R2PV := R2P (R1PV);
11209 >>> target designated subtype not compatible with
11210 type "R1" defined at line 3
11215 In the absence of lines 5 and 6,
11216 types @code{R1} and @code{R2} statically match and
11217 hence the conversion on line 12 is legal. But since lines 5 and 6
11218 cause the object sizes to differ, GNAT considers that types
11219 @code{R1} and @code{R2} are not statically matching, and line 12
11220 generates the diagnostic shown above.
11222 Similar additional checks are performed in other contexts requiring
11223 statically matching subtypes.
11225 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
11226 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{193}
11227 @section Attribute Old
11232 In addition to the usage of @code{Old} defined in the Ada 2012 RM (usage
11233 within @code{Post} aspect), GNAT also permits the use of this attribute
11234 in implementation defined pragmas @code{Postcondition},
11235 @code{Contract_Cases} and @code{Test_Case}. Also usages of
11236 @code{Old} which would be illegal according to the Ada 2012 RM
11237 definition are allowed under control of
11238 implementation defined pragma @code{Unevaluated_Use_Of_Old}.
11240 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
11241 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{194}
11242 @section Attribute Passed_By_Reference
11245 @geindex Parameters
11246 @geindex when passed by reference
11248 @geindex Passed_By_Reference
11250 @code{typ'Passed_By_Reference} for any subtype @cite{typ} returns
11251 a value of type @code{Boolean} value that is @code{True} if the type is
11252 normally passed by reference and @code{False} if the type is normally
11253 passed by copy in calls. For scalar types, the result is always @code{False}
11254 and is static. For non-scalar types, the result is nonstatic.
11256 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
11257 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{195}
11258 @section Attribute Pool_Address
11261 @geindex Pool_Address
11263 @code{X'Pool_Address} for any object @code{X} returns the address
11264 of X within its storage pool. This is the same as
11265 @code{X'Address}, except that for an unconstrained array whose
11266 bounds are allocated just before the first component,
11267 @code{X'Pool_Address} returns the address of those bounds,
11268 whereas @code{X'Address} returns the address of the first
11271 Here, we are interpreting ‘storage pool’ broadly to mean
11272 @code{wherever the object is allocated}, which could be a
11273 user-defined storage pool,
11274 the global heap, on the stack, or in a static memory area.
11275 For an object created by @code{new}, @code{Ptr.all'Pool_Address} is
11276 what is passed to @code{Allocate} and returned from @code{Deallocate}.
11278 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
11279 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{196}
11280 @section Attribute Range_Length
11283 @geindex Range_Length
11285 @code{typ'Range_Length} for any discrete type @cite{typ} yields
11286 the number of values represented by the subtype (zero for a null
11287 range). The result is static for static subtypes. @code{Range_Length}
11288 applied to the index subtype of a one dimensional array always gives the
11289 same result as @code{Length} applied to the array itself.
11291 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
11292 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{197}
11293 @section Attribute Restriction_Set
11296 @geindex Restriction_Set
11298 @geindex Restrictions
11300 This attribute allows compile time testing of restrictions that
11301 are currently in effect. It is primarily intended for specializing
11302 code in the run-time based on restrictions that are active (e.g.
11303 don’t need to save fpt registers if restriction No_Floating_Point
11304 is known to be in effect), but can be used anywhere.
11306 There are two forms:
11309 System'Restriction_Set (partition_boolean_restriction_NAME)
11310 System'Restriction_Set (No_Dependence => library_unit_NAME);
11313 In the case of the first form, the only restriction names
11314 allowed are parameterless restrictions that are checked
11315 for consistency at bind time. For a complete list see the
11316 subtype @code{System.Rident.Partition_Boolean_Restrictions}.
11318 The result returned is True if the restriction is known to
11319 be in effect, and False if the restriction is known not to
11320 be in effect. An important guarantee is that the value of
11321 a Restriction_Set attribute is known to be consistent throughout
11322 all the code of a partition.
11324 This is trivially achieved if the entire partition is compiled
11325 with a consistent set of restriction pragmas. However, the
11326 compilation model does not require this. It is possible to
11327 compile one set of units with one set of pragmas, and another
11328 set of units with another set of pragmas. It is even possible
11329 to compile a spec with one set of pragmas, and then WITH the
11330 same spec with a different set of pragmas. Inconsistencies
11331 in the actual use of the restriction are checked at bind time.
11333 In order to achieve the guarantee of consistency for the
11334 Restriction_Set pragma, we consider that a use of the pragma
11335 that yields False is equivalent to a violation of the
11338 So for example if you write
11341 if System'Restriction_Set (No_Floating_Point) then
11348 And the result is False, so that the else branch is executed,
11349 you can assume that this restriction is not set for any unit
11350 in the partition. This is checked by considering this use of
11351 the restriction pragma to be a violation of the restriction
11352 No_Floating_Point. This means that no other unit can attempt
11353 to set this restriction (if some unit does attempt to set it,
11354 the binder will refuse to bind the partition).
11356 Technical note: The restriction name and the unit name are
11357 intepreted entirely syntactically, as in the corresponding
11358 Restrictions pragma, they are not analyzed semantically,
11359 so they do not have a type.
11361 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
11362 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{198}
11363 @section Attribute Result
11368 @code{function'Result} can only be used with in a Postcondition pragma
11369 for a function. The prefix must be the name of the corresponding function. This
11370 is used to refer to the result of the function in the postcondition expression.
11371 For a further discussion of the use of this attribute and examples of its use,
11372 see the description of pragma Postcondition.
11374 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
11375 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{199}
11376 @section Attribute Safe_Emax
11379 @geindex Ada 83 attributes
11383 The @code{Safe_Emax} attribute is provided for compatibility with Ada 83. See
11384 the Ada 83 reference manual for an exact description of the semantics of
11387 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
11388 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{19a}
11389 @section Attribute Safe_Large
11392 @geindex Ada 83 attributes
11394 @geindex Safe_Large
11396 The @code{Safe_Large} attribute is provided for compatibility with Ada 83. See
11397 the Ada 83 reference manual for an exact description of the semantics of
11400 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
11401 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{19b}
11402 @section Attribute Safe_Small
11405 @geindex Ada 83 attributes
11407 @geindex Safe_Small
11409 The @code{Safe_Small} attribute is provided for compatibility with Ada 83. See
11410 the Ada 83 reference manual for an exact description of the semantics of
11413 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
11414 @anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{14f}@anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19c}
11415 @section Attribute Scalar_Storage_Order
11418 @geindex Endianness
11420 @geindex Scalar storage order
11422 @geindex Scalar_Storage_Order
11424 For every array or record type @code{S}, the representation attribute
11425 @code{Scalar_Storage_Order} denotes the order in which storage elements
11426 that make up scalar components are ordered within S. The value given must
11427 be a static expression of type System.Bit_Order. The following is an example
11428 of the use of this feature:
11431 -- Component type definitions
11433 subtype Yr_Type is Natural range 0 .. 127;
11434 subtype Mo_Type is Natural range 1 .. 12;
11435 subtype Da_Type is Natural range 1 .. 31;
11437 -- Record declaration
11439 type Date is record
11440 Years_Since_1980 : Yr_Type;
11442 Day_Of_Month : Da_Type;
11445 -- Record representation clause
11447 for Date use record
11448 Years_Since_1980 at 0 range 0 .. 6;
11449 Month at 0 range 7 .. 10;
11450 Day_Of_Month at 0 range 11 .. 15;
11453 -- Attribute definition clauses
11455 for Date'Bit_Order use System.High_Order_First;
11456 for Date'Scalar_Storage_Order use System.High_Order_First;
11457 -- If Scalar_Storage_Order is specified, it must be consistent with
11458 -- Bit_Order, so it's best to always define the latter explicitly if
11459 -- the former is used.
11462 Other properties are as for the standard representation attribute @code{Bit_Order}
11463 defined by Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
11465 For a record type @code{T}, if @code{T'Scalar_Storage_Order} is
11466 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
11467 this means that if a @code{Scalar_Storage_Order} attribute definition
11468 clause is not confirming, then the type’s @code{Bit_Order} shall be
11469 specified explicitly and set to the same value.
11471 Derived types inherit an explicitly set scalar storage order from their parent
11472 types. This may be overridden for the derived type by giving an explicit scalar
11473 storage order for it. However, for a record extension, the derived type must
11474 have the same scalar storage order as the parent type.
11476 A component of a record type that is itself a record or an array and that does
11477 not start and end on a byte boundary must have have the same scalar storage
11478 order as the record type. A component of a bit-packed array type that is itself
11479 a record or an array must have the same scalar storage order as the array type.
11481 No component of a type that has an explicit @code{Scalar_Storage_Order}
11482 attribute definition may be aliased.
11484 A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
11485 with a value equal to @code{System.Default_Bit_Order}) has no effect.
11487 If the opposite storage order is specified, then whenever the value of
11488 a scalar component of an object of type @code{S} is read, the storage
11489 elements of the enclosing machine scalar are first reversed (before
11490 retrieving the component value, possibly applying some shift and mask
11491 operatings on the enclosing machine scalar), and the opposite operation
11492 is done for writes.
11494 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
11495 are relaxed. Instead, the following rules apply:
11501 the underlying storage elements are those at positions
11502 @code{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
11505 the sequence of underlying storage elements shall have
11506 a size no greater than the largest machine scalar
11509 the enclosing machine scalar is defined as the smallest machine
11510 scalar starting at a position no greater than
11511 @code{position + first_bit / storage_element_size} and covering
11512 storage elements at least up to @code{position + (last_bit + storage_element_size - 1) / storage_element_size}
11515 the position of the component is interpreted relative to that machine
11519 If no scalar storage order is specified for a type (either directly, or by
11520 inheritance in the case of a derived type), then the default is normally
11521 the native ordering of the target, but this default can be overridden using
11522 pragma @code{Default_Scalar_Storage_Order}.
11524 If a component of @code{T} is itself of a record or array type, the specfied
11525 @code{Scalar_Storage_Order} does `not' apply to that nested type: an explicit
11526 attribute definition clause must be provided for the component type as well
11529 Representation changes that explicitly or implicitly toggle the scalar storage
11530 order are not supported and may result in erroneous execution of the program,
11531 except when performed by means of an instance of @code{Ada.Unchecked_Conversion}.
11533 In particular, overlays are not supported and a warning is given for them:
11536 type Rec_LE is record
11540 for Rec_LE use record
11541 I at 0 range 0 .. 31;
11544 for Rec_LE'Bit_Order use System.Low_Order_First;
11545 for Rec_LE'Scalar_Storage_Order use System.Low_Order_First;
11547 type Rec_BE is record
11551 for Rec_BE use record
11552 I at 0 range 0 .. 31;
11555 for Rec_BE'Bit_Order use System.High_Order_First;
11556 for Rec_BE'Scalar_Storage_Order use System.High_Order_First;
11561 for R_BE'Address use R_LE'Address;
11564 @code{warning: overlay changes scalar storage order [enabled by default]}
11566 In most cases, such representation changes ought to be replaced by an
11567 instantiation of a function or procedure provided by @code{GNAT.Byte_Swapping}.
11569 Note that the scalar storage order only affects the in-memory data
11570 representation. It has no effect on the representation used by stream
11573 Note that debuggers may be unable to display the correct value of scalar
11574 components of a type for which the opposite storage order is specified.
11576 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
11577 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e4}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{19d}
11578 @section Attribute Simple_Storage_Pool
11581 @geindex Storage pool
11584 @geindex Simple storage pool
11586 @geindex Simple_Storage_Pool
11588 For every nonformal, nonderived access-to-object type @code{Acc}, the
11589 representation attribute @code{Simple_Storage_Pool} may be specified
11590 via an attribute_definition_clause (or by specifying the equivalent aspect):
11593 My_Pool : My_Simple_Storage_Pool_Type;
11595 type Acc is access My_Data_Type;
11597 for Acc'Simple_Storage_Pool use My_Pool;
11600 The name given in an attribute_definition_clause for the
11601 @code{Simple_Storage_Pool} attribute shall denote a variable of
11602 a ‘simple storage pool type’ (see pragma @cite{Simple_Storage_Pool_Type}).
11604 The use of this attribute is only allowed for a prefix denoting a type
11605 for which it has been specified. The type of the attribute is the type
11606 of the variable specified as the simple storage pool of the access type,
11607 and the attribute denotes that variable.
11609 It is illegal to specify both @code{Storage_Pool} and @code{Simple_Storage_Pool}
11610 for the same access type.
11612 If the @code{Simple_Storage_Pool} attribute has been specified for an access
11613 type, then applying the @code{Storage_Pool} attribute to the type is flagged
11614 with a warning and its evaluation raises the exception @code{Program_Error}.
11616 If the Simple_Storage_Pool attribute has been specified for an access
11617 type @code{S}, then the evaluation of the attribute @code{S'Storage_Size}
11618 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
11619 which is intended to indicate the number of storage elements reserved for
11620 the simple storage pool. If the Storage_Size function has not been defined
11621 for the simple storage pool type, then this attribute returns zero.
11623 If an access type @code{S} has a specified simple storage pool of type
11624 @code{SSP}, then the evaluation of an allocator for that access type calls
11625 the primitive @code{Allocate} procedure for type @code{SSP}, passing
11626 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
11627 semantics of such allocators is the same as those defined for allocators
11628 in section 13.11 of the @cite{Ada Reference Manual}, with the term
11629 `simple storage pool' substituted for `storage pool'.
11631 If an access type @code{S} has a specified simple storage pool of type
11632 @code{SSP}, then a call to an instance of the @code{Ada.Unchecked_Deallocation}
11633 for that access type invokes the primitive @code{Deallocate} procedure
11634 for type @code{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
11635 parameter. The detailed semantics of such unchecked deallocations is the same
11636 as defined in section 13.11.2 of the Ada Reference Manual, except that the
11637 term `simple storage pool' is substituted for `storage pool'.
11639 @node Attribute Small,Attribute Small_Denominator,Attribute Simple_Storage_Pool,Implementation Defined Attributes
11640 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{19e}
11641 @section Attribute Small
11644 @geindex Ada 83 attributes
11648 The @code{Small} attribute is defined in Ada 95 (and Ada 2005) only for
11650 GNAT also allows this attribute to be applied to floating-point types
11651 for compatibility with Ada 83. See
11652 the Ada 83 reference manual for an exact description of the semantics of
11653 this attribute when applied to floating-point types.
11655 @node Attribute Small_Denominator,Attribute Small_Numerator,Attribute Small,Implementation Defined Attributes
11656 @anchor{gnat_rm/implementation_defined_attributes attribute-small-denominator}@anchor{19f}
11657 @section Attribute Small_Denominator
11662 @geindex Small_Denominator
11664 @code{typ'Small_Denominator} for any fixed-point subtype @cite{typ} yields the
11665 denominator in the representation of @code{typ'Small} as a rational number
11666 with coprime factors (i.e. as an irreducible fraction).
11668 @node Attribute Small_Numerator,Attribute Storage_Unit,Attribute Small_Denominator,Implementation Defined Attributes
11669 @anchor{gnat_rm/implementation_defined_attributes attribute-small-numerator}@anchor{1a0}
11670 @section Attribute Small_Numerator
11675 @geindex Small_Numerator
11677 @code{typ'Small_Numerator} for any fixed-point subtype @cite{typ} yields the
11678 numerator in the representation of @code{typ'Small} as a rational number
11679 with coprime factors (i.e. as an irreducible fraction).
11681 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small_Numerator,Implementation Defined Attributes
11682 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{1a1}
11683 @section Attribute Storage_Unit
11686 @geindex Storage_Unit
11688 @code{Standard'Storage_Unit} (@code{Standard} is the only allowed
11689 prefix) provides the same value as @code{System.Storage_Unit}.
11691 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
11692 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{1a2}
11693 @section Attribute Stub_Type
11698 The GNAT implementation of remote access-to-classwide types is
11699 organized as described in AARM section E.4 (20.t): a value of an RACW type
11700 (designating a remote object) is represented as a normal access
11701 value, pointing to a “stub” object which in turn contains the
11702 necessary information to contact the designated remote object. A
11703 call on any dispatching operation of such a stub object does the
11704 remote call, if necessary, using the information in the stub object
11705 to locate the target partition, etc.
11707 For a prefix @code{T} that denotes a remote access-to-classwide type,
11708 @code{T'Stub_Type} denotes the type of the corresponding stub objects.
11710 By construction, the layout of @code{T'Stub_Type} is identical to that of
11711 type @code{RACW_Stub_Type} declared in the internal implementation-defined
11712 unit @code{System.Partition_Interface}. Use of this attribute will create
11713 an implicit dependency on this unit.
11715 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
11716 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{1a3}
11717 @section Attribute System_Allocator_Alignment
11723 @geindex System_Allocator_Alignment
11725 @code{Standard'System_Allocator_Alignment} (@code{Standard} is the only
11726 allowed prefix) provides the observable guaranted to be honored by
11727 the system allocator (malloc). This is a static value that can be used
11728 in user storage pools based on malloc either to reject allocation
11729 with alignment too large or to enable a realignment circuitry if the
11730 alignment request is larger than this value.
11732 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
11733 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{1a4}
11734 @section Attribute Target_Name
11737 @geindex Target_Name
11739 @code{Standard'Target_Name} (@code{Standard} is the only allowed
11740 prefix) provides a static string value that identifies the target
11741 for the current compilation. For GCC implementations, this is the
11742 standard gcc target name without the terminating slash (for
11743 example, GNAT 5.0 on windows yields “i586-pc-mingw32msv”).
11745 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
11746 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{1a5}
11747 @section Attribute To_Address
11750 @geindex To_Address
11752 The @code{System'To_Address}
11753 (@code{System} is the only allowed prefix)
11754 denotes a function identical to
11755 @code{System.Storage_Elements.To_Address} except that
11756 it is a static attribute. This means that if its argument is
11757 a static expression, then the result of the attribute is a
11758 static expression. This means that such an expression can be
11759 used in contexts (e.g., preelaborable packages) which require a
11760 static expression and where the function call could not be used
11761 (since the function call is always nonstatic, even if its
11762 argument is static). The argument must be in the range
11763 -(2**(m-1)) .. 2**m-1, where m is the memory size
11764 (typically 32 or 64). Negative values are intepreted in a
11765 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
11766 a 32 bits machine).
11768 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
11769 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{1a6}
11770 @section Attribute To_Any
11775 This internal attribute is used for the generation of remote subprogram
11776 stubs in the context of the Distributed Systems Annex.
11778 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
11779 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1a7}
11780 @section Attribute Type_Class
11783 @geindex Type_Class
11785 @code{typ'Type_Class} for any type or subtype @cite{typ} yields
11786 the value of the type class for the full type of @cite{typ}. If
11787 @cite{typ} is a generic formal type, the value is the value for the
11788 corresponding actual subtype. The value of this attribute is of type
11789 @code{System.Aux_DEC.Type_Class}, which has the following definition:
11793 (Type_Class_Enumeration,
11794 Type_Class_Integer,
11795 Type_Class_Fixed_Point,
11796 Type_Class_Floating_Point,
11801 Type_Class_Address);
11804 Protected types yield the value @code{Type_Class_Task}, which thus
11805 applies to all concurrent types. This attribute is designed to
11806 be compatible with the DEC Ada 83 attribute of the same name.
11808 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
11809 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1a8}
11810 @section Attribute Type_Key
11815 The @code{Type_Key} attribute is applicable to a type or subtype and
11816 yields a value of type Standard.String containing encoded information
11817 about the type or subtype. This provides improved compatibility with
11818 other implementations that support this attribute.
11820 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
11821 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1a9}
11822 @section Attribute TypeCode
11827 This internal attribute is used for the generation of remote subprogram
11828 stubs in the context of the Distributed Systems Annex.
11830 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
11831 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1aa}
11832 @section Attribute Unconstrained_Array
11835 @geindex Unconstrained_Array
11837 The @code{Unconstrained_Array} attribute can be used with a prefix that
11838 denotes any type or subtype. It is a static attribute that yields
11839 @code{True} if the prefix designates an unconstrained array,
11840 and @code{False} otherwise. In a generic instance, the result is
11841 still static, and yields the result of applying this test to the
11844 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
11845 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1ab}
11846 @section Attribute Universal_Literal_String
11849 @geindex Named numbers
11850 @geindex representation of
11852 @geindex Universal_Literal_String
11854 The prefix of @code{Universal_Literal_String} must be a named
11855 number. The static result is the string consisting of the characters of
11856 the number as defined in the original source. This allows the user
11857 program to access the actual text of named numbers without intermediate
11858 conversions and without the need to enclose the strings in quotes (which
11859 would preclude their use as numbers).
11861 For example, the following program prints the first 50 digits of pi:
11864 with Text_IO; use Text_IO;
11868 Put (Ada.Numerics.Pi'Universal_Literal_String);
11872 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11873 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1ac}
11874 @section Attribute Unrestricted_Access
11878 @geindex unrestricted
11880 @geindex Unrestricted_Access
11882 The @code{Unrestricted_Access} attribute is similar to @code{Access}
11883 except that all accessibility and aliased view checks are omitted. This
11884 is a user-beware attribute.
11886 For objects, it is similar to @code{Address}, for which it is a
11887 desirable replacement where the value desired is an access type.
11888 In other words, its effect is similar to first applying the
11889 @code{Address} attribute and then doing an unchecked conversion to a
11890 desired access type.
11892 For subprograms, @code{P'Unrestricted_Access} may be used where
11893 @code{P'Access} would be illegal, to construct a value of a
11894 less-nested named access type that designates a more-nested
11895 subprogram. This value may be used in indirect calls, so long as the
11896 more-nested subprogram still exists; once the subprogram containing it
11897 has returned, such calls are erroneous. For example:
11902 type Less_Nested is not null access procedure;
11903 Global : Less_Nested;
11911 Local_Var : Integer;
11913 procedure More_Nested is
11918 Global := More_Nested'Unrestricted_Access;
11925 When P1 is called from P2, the call via Global is OK, but if P1 were
11926 called after P2 returns, it would be an erroneous use of a dangling
11929 For objects, it is possible to use @code{Unrestricted_Access} for any
11930 type. However, if the result is of an access-to-unconstrained array
11931 subtype, then the resulting pointer has the same scope as the context
11932 of the attribute, and must not be returned to some enclosing scope.
11933 For instance, if a function uses @code{Unrestricted_Access} to create
11934 an access-to-unconstrained-array and returns that value to the caller,
11935 the result will involve dangling pointers. In addition, it is only
11936 valid to create pointers to unconstrained arrays using this attribute
11937 if the pointer has the normal default ‘fat’ representation where a
11938 pointer has two components, one points to the array and one points to
11939 the bounds. If a size clause is used to force ‘thin’ representation
11940 for a pointer to unconstrained where there is only space for a single
11941 pointer, then the resulting pointer is not usable.
11943 In the simple case where a direct use of Unrestricted_Access attempts
11944 to make a thin pointer for a non-aliased object, the compiler will
11945 reject the use as illegal, as shown in the following example:
11948 with System; use System;
11949 procedure SliceUA2 is
11950 type A is access all String;
11951 for A'Size use Standard'Address_Size;
11953 procedure P (Arg : A) is
11958 X : String := "hello world!";
11959 X2 : aliased String := "hello world!";
11961 AV : A := X'Unrestricted_Access; -- ERROR
11963 >>> illegal use of Unrestricted_Access attribute
11964 >>> attempt to generate thin pointer to unaliased object
11967 P (X'Unrestricted_Access); -- ERROR
11969 >>> illegal use of Unrestricted_Access attribute
11970 >>> attempt to generate thin pointer to unaliased object
11972 P (X(7 .. 12)'Unrestricted_Access); -- ERROR
11974 >>> illegal use of Unrestricted_Access attribute
11975 >>> attempt to generate thin pointer to unaliased object
11977 P (X2'Unrestricted_Access); -- OK
11981 but other cases cannot be detected by the compiler, and are
11982 considered to be erroneous. Consider the following example:
11985 with System; use System;
11986 with System; use System;
11987 procedure SliceUA is
11988 type AF is access all String;
11990 type A is access all String;
11991 for A'Size use Standard'Address_Size;
11993 procedure P (Arg : A) is
11995 if Arg'Length /= 6 then
11996 raise Program_Error;
12000 X : String := "hello world!";
12001 Y : AF := X (7 .. 12)'Unrestricted_Access;
12008 A normal unconstrained array value
12009 or a constrained array object marked as aliased has the bounds in memory
12010 just before the array, so a thin pointer can retrieve both the data and
12011 the bounds. But in this case, the non-aliased object @code{X} does not have the
12012 bounds before the string. If the size clause for type @code{A}
12013 were not present, then the pointer
12014 would be a fat pointer, where one component is a pointer to the bounds,
12015 and all would be well. But with the size clause present, the conversion from
12016 fat pointer to thin pointer in the call loses the bounds, and so this
12017 is erroneous, and the program likely raises a @code{Program_Error} exception.
12019 In general, it is advisable to completely
12020 avoid mixing the use of thin pointers and the use of
12021 @code{Unrestricted_Access} where the designated type is an
12022 unconstrained array. The use of thin pointers should be restricted to
12023 cases of porting legacy code that implicitly assumes the size of pointers,
12024 and such code should not in any case be using this attribute.
12026 Another erroneous situation arises if the attribute is
12027 applied to a constant. The resulting pointer can be used to access the
12028 constant, but the effect of trying to modify a constant in this manner
12029 is not well-defined. Consider this example:
12032 P : constant Integer := 4;
12033 type R is access all Integer;
12034 RV : R := P'Unrestricted_Access;
12039 Here we attempt to modify the constant P from 4 to 3, but the compiler may
12040 or may not notice this attempt, and subsequent references to P may yield
12041 either the value 3 or the value 4 or the assignment may blow up if the
12042 compiler decides to put P in read-only memory. One particular case where
12043 @code{Unrestricted_Access} can be used in this way is to modify the
12044 value of an @code{in} parameter:
12047 procedure K (S : in String) is
12048 type R is access all Character;
12049 RV : R := S (3)'Unrestricted_Access;
12055 In general this is a risky approach. It may appear to “work” but such uses of
12056 @code{Unrestricted_Access} are potentially non-portable, even from one version
12057 of GNAT to another, so are best avoided if possible.
12059 @node Attribute Update,Attribute Valid_Image,Attribute Unrestricted_Access,Implementation Defined Attributes
12060 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1ad}
12061 @section Attribute Update
12066 The @code{Update} attribute creates a copy of an array or record value
12067 with one or more modified components. The syntax is:
12070 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
12071 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
12072 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
12073 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
12075 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
12076 INDEX_EXPRESSION_LIST_LIST ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
12077 INDEX_EXPRESSION_LIST ::= ( EXPRESSION @{, EXPRESSION @} )
12080 where @code{PREFIX} is the name of an array or record object, the
12081 association list in parentheses does not contain an @code{others}
12082 choice and the box symbol @code{<>} may not appear in any
12083 expression. The effect is to yield a copy of the array or record value
12084 which is unchanged apart from the components mentioned in the
12085 association list, which are changed to the indicated value. The
12086 original value of the array or record value is not affected. For
12090 type Arr is Array (1 .. 5) of Integer;
12092 Avar1 : Arr := (1,2,3,4,5);
12093 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
12096 yields a value for @code{Avar2} of 1,10,20,20,5 with @code{Avar1}
12097 begin unmodified. Similarly:
12100 type Rec is A, B, C : Integer;
12102 Rvar1 : Rec := (A => 1, B => 2, C => 3);
12103 Rvar2 : Rec := Rvar1'Update (B => 20);
12106 yields a value for @code{Rvar2} of (A => 1, B => 20, C => 3),
12107 with @code{Rvar1} being unmodifed.
12108 Note that the value of the attribute reference is computed
12109 completely before it is used. This means that if you write:
12112 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
12115 then the value of @code{Avar1} is not modified if @code{Function_Call}
12116 raises an exception, unlike the effect of a series of direct assignments
12117 to elements of @code{Avar1}. In general this requires that
12118 two extra complete copies of the object are required, which should be
12119 kept in mind when considering efficiency.
12121 The @code{Update} attribute cannot be applied to prefixes of a limited
12122 type, and cannot reference discriminants in the case of a record type.
12123 The accessibility level of an Update attribute result object is defined
12124 as for an aggregate.
12126 In the record case, no component can be mentioned more than once. In
12127 the array case, two overlapping ranges can appear in the association list,
12128 in which case the modifications are processed left to right.
12130 Multi-dimensional arrays can be modified, as shown by this example:
12133 A : array (1 .. 10, 1 .. 10) of Integer;
12135 A := A'Update ((1, 2) => 20, (3, 4) => 30);
12138 which changes element (1,2) to 20 and (3,4) to 30.
12140 @node Attribute Valid_Image,Attribute Valid_Scalars,Attribute Update,Implementation Defined Attributes
12141 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-image}@anchor{1ae}
12142 @section Attribute Valid_Image
12145 @geindex Valid_Image
12147 The @code{'Valid_Image} attribute is defined for enumeration types other than
12148 those in package Standard. This attribute is a function that takes
12149 a String, and returns Boolean. @code{T'Valid_Image (S)} returns True
12150 if and only if @code{T'Value (S)} would not raise Constraint_Error.
12152 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Valid_Image,Implementation Defined Attributes
12153 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1af}
12154 @section Attribute Valid_Scalars
12157 @geindex Valid_Scalars
12159 The @code{'Valid_Scalars} attribute is intended to make it easier to check the
12160 validity of scalar subcomponents of composite objects. The attribute is defined
12161 for any prefix @code{P} which denotes an object. Prefix @code{P} can be any type
12162 except for tagged private or @code{Unchecked_Union} types. The value of the
12163 attribute is of type @code{Boolean}.
12165 @code{P'Valid_Scalars} yields @code{True} if and only if the evaluation of
12166 @code{C'Valid} yields @code{True} for every scalar subcomponent @code{C} of @code{P}, or if
12167 @code{P} has no scalar subcomponents. Attribute @code{'Valid_Scalars} is equivalent
12168 to attribute @code{'Valid} for scalar types.
12170 It is not specified in what order the subcomponents are checked, nor whether
12171 any more are checked after any one of them is determined to be invalid. If the
12172 prefix @code{P} is of a class-wide type @code{T'Class} (where @code{T} is the associated
12173 specific type), or if the prefix @code{P} is of a specific tagged type @code{T}, then
12174 only the subcomponents of @code{T} are checked; in other words, components of
12175 extensions of @code{T} are not checked even if @code{T'Class (P)'Tag /= T'Tag}.
12177 The compiler will issue a warning if it can be determined at compile time that
12178 the prefix of the attribute has no scalar subcomponents.
12180 Note: @code{Valid_Scalars} can generate a lot of code, especially in the case of
12181 a large variant record. If the attribute is called in many places in the same
12182 program applied to objects of the same type, it can reduce program size to
12183 write a function with a single use of the attribute, and then call that
12184 function from multiple places.
12186 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
12187 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1b0}
12188 @section Attribute VADS_Size
12192 @geindex VADS compatibility
12196 The @code{'VADS_Size} attribute is intended to make it easier to port
12197 legacy code which relies on the semantics of @code{'Size} as implemented
12198 by the VADS Ada 83 compiler. GNAT makes a best effort at duplicating the
12199 same semantic interpretation. In particular, @code{'VADS_Size} applied
12200 to a predefined or other primitive type with no Size clause yields the
12201 Object_Size (for example, @code{Natural'Size} is 32 rather than 31 on
12202 typical machines). In addition @code{'VADS_Size} applied to an object
12203 gives the result that would be obtained by applying the attribute to
12204 the corresponding type.
12206 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
12207 @anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{15d}@anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1b1}
12208 @section Attribute Value_Size
12212 @geindex setting for not-first subtype
12214 @geindex Value_Size
12216 @code{type'Value_Size} is the number of bits required to represent
12217 a value of the given subtype. It is the same as @code{type'Size},
12218 but, unlike @code{Size}, may be set for non-first subtypes.
12220 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
12221 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1b2}
12222 @section Attribute Wchar_T_Size
12225 @geindex Wchar_T_Size
12227 @code{Standard'Wchar_T_Size} (@code{Standard} is the only allowed
12228 prefix) provides the size in bits of the C @code{wchar_t} type
12229 primarily for constructing the definition of this type in
12230 package @code{Interfaces.C}. The result is a static constant.
12232 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
12233 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1b3}
12234 @section Attribute Word_Size
12239 @code{Standard'Word_Size} (@code{Standard} is the only allowed
12240 prefix) provides the value @code{System.Word_Size}. The result is
12243 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
12244 @anchor{gnat_rm/standard_and_implementation_defined_restrictions doc}@anchor{1b4}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1b5}@anchor{gnat_rm/standard_and_implementation_defined_restrictions standard-and-implementation-defined-restrictions}@anchor{9}
12245 @chapter Standard and Implementation Defined Restrictions
12248 All Ada Reference Manual-defined Restriction identifiers are implemented:
12254 language-defined restrictions (see 13.12.1)
12257 tasking restrictions (see D.7)
12260 high integrity restrictions (see H.4)
12263 GNAT implements additional restriction identifiers. All restrictions, whether
12264 language defined or GNAT-specific, are listed in the following.
12267 * Partition-Wide Restrictions::
12268 * Program Unit Level Restrictions::
12272 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
12273 @anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1b6}@anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1b7}
12274 @section Partition-Wide Restrictions
12277 There are two separate lists of restriction identifiers. The first
12278 set requires consistency throughout a partition (in other words, if the
12279 restriction identifier is used for any compilation unit in the partition,
12280 then all compilation units in the partition must obey the restriction).
12283 * Immediate_Reclamation::
12284 * Max_Asynchronous_Select_Nesting::
12285 * Max_Entry_Queue_Length::
12286 * Max_Protected_Entries::
12287 * Max_Select_Alternatives::
12288 * Max_Storage_At_Blocking::
12289 * Max_Task_Entries::
12291 * No_Abort_Statements::
12292 * No_Access_Parameter_Allocators::
12293 * No_Access_Subprograms::
12295 * No_Anonymous_Allocators::
12296 * No_Asynchronous_Control::
12298 * No_Coextensions::
12299 * No_Default_Initialization::
12302 * No_Direct_Boolean_Operators::
12304 * No_Dispatching_Calls::
12305 * No_Dynamic_Attachment::
12306 * No_Dynamic_Priorities::
12307 * No_Entry_Calls_In_Elaboration_Code::
12308 * No_Enumeration_Maps::
12309 * No_Exception_Handlers::
12310 * No_Exception_Propagation::
12311 * No_Exception_Registration::
12313 * No_Finalization::
12315 * No_Floating_Point::
12316 * No_Implicit_Conditionals::
12317 * No_Implicit_Dynamic_Code::
12318 * No_Implicit_Heap_Allocations::
12319 * No_Implicit_Protected_Object_Allocations::
12320 * No_Implicit_Task_Allocations::
12321 * No_Initialize_Scalars::
12323 * No_Local_Allocators::
12324 * No_Local_Protected_Objects::
12325 * No_Local_Tagged_Types::
12326 * No_Local_Timing_Events::
12327 * No_Long_Long_Integers::
12328 * No_Multiple_Elaboration::
12329 * No_Nested_Finalization::
12330 * No_Protected_Type_Allocators::
12331 * No_Protected_Types::
12334 * No_Relative_Delay::
12335 * No_Requeue_Statements::
12336 * No_Secondary_Stack::
12337 * No_Select_Statements::
12338 * No_Specific_Termination_Handlers::
12339 * No_Specification_of_Aspect::
12340 * No_Standard_Allocators_After_Elaboration::
12341 * No_Standard_Storage_Pools::
12342 * No_Stream_Optimizations::
12344 * No_Tagged_Type_Registration::
12345 * No_Task_Allocators::
12346 * No_Task_At_Interrupt_Priority::
12347 * No_Task_Attributes_Package::
12348 * No_Task_Hierarchy::
12349 * No_Task_Termination::
12351 * No_Terminate_Alternatives::
12352 * No_Unchecked_Access::
12353 * No_Unchecked_Conversion::
12354 * No_Unchecked_Deallocation::
12355 * No_Use_Of_Entity::
12357 * Simple_Barriers::
12358 * Static_Priorities::
12359 * Static_Storage_Size::
12363 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
12364 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1b8}
12365 @subsection Immediate_Reclamation
12368 @geindex Immediate_Reclamation
12370 [RM H.4] This restriction ensures that, except for storage occupied by
12371 objects created by allocators and not deallocated via unchecked
12372 deallocation, any storage reserved at run time for an object is
12373 immediately reclaimed when the object no longer exists.
12375 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
12376 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1b9}
12377 @subsection Max_Asynchronous_Select_Nesting
12380 @geindex Max_Asynchronous_Select_Nesting
12382 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
12383 selects. Violations of this restriction with a value of zero are
12384 detected at compile time. Violations of this restriction with values
12385 other than zero cause Storage_Error to be raised.
12387 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
12388 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1ba}
12389 @subsection Max_Entry_Queue_Length
12392 @geindex Max_Entry_Queue_Length
12394 [RM D.7] This restriction is a declaration that any protected entry compiled in
12395 the scope of the restriction has at most the specified number of
12396 tasks waiting on the entry at any one time, and so no queue is required.
12397 Note that this restriction is checked at run time. Violation of this
12398 restriction results in the raising of Program_Error exception at the point of
12401 @geindex Max_Entry_Queue_Depth
12403 The restriction @code{Max_Entry_Queue_Depth} is recognized as a
12404 synonym for @code{Max_Entry_Queue_Length}. This is retained for historical
12405 compatibility purposes (and a warning will be generated for its use if
12406 warnings on obsolescent features are activated).
12408 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
12409 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1bb}
12410 @subsection Max_Protected_Entries
12413 @geindex Max_Protected_Entries
12415 [RM D.7] Specifies the maximum number of entries per protected type. The
12416 bounds of every entry family of a protected unit shall be static, or shall be
12417 defined by a discriminant of a subtype whose corresponding bound is static.
12419 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
12420 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1bc}
12421 @subsection Max_Select_Alternatives
12424 @geindex Max_Select_Alternatives
12426 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
12428 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
12429 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1bd}
12430 @subsection Max_Storage_At_Blocking
12433 @geindex Max_Storage_At_Blocking
12435 [RM D.7] Specifies the maximum portion (in storage elements) of a task’s
12436 Storage_Size that can be retained by a blocked task. A violation of this
12437 restriction causes Storage_Error to be raised.
12439 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
12440 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1be}
12441 @subsection Max_Task_Entries
12444 @geindex Max_Task_Entries
12446 [RM D.7] Specifies the maximum number of entries
12447 per task. The bounds of every entry family
12448 of a task unit shall be static, or shall be
12449 defined by a discriminant of a subtype whose
12450 corresponding bound is static.
12452 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
12453 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1bf}
12454 @subsection Max_Tasks
12459 [RM D.7] Specifies the maximum number of task that may be created, not
12460 counting the creation of the environment task. Violations of this
12461 restriction with a value of zero are detected at compile
12462 time. Violations of this restriction with values other than zero cause
12463 Storage_Error to be raised.
12465 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
12466 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1c0}
12467 @subsection No_Abort_Statements
12470 @geindex No_Abort_Statements
12472 [RM D.7] There are no abort_statements, and there are
12473 no calls to Task_Identification.Abort_Task.
12475 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
12476 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1c1}
12477 @subsection No_Access_Parameter_Allocators
12480 @geindex No_Access_Parameter_Allocators
12482 [RM H.4] This restriction ensures at compile time that there are no
12483 occurrences of an allocator as the actual parameter to an access
12486 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
12487 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1c2}
12488 @subsection No_Access_Subprograms
12491 @geindex No_Access_Subprograms
12493 [RM H.4] This restriction ensures at compile time that there are no
12494 declarations of access-to-subprogram types.
12496 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
12497 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1c3}
12498 @subsection No_Allocators
12501 @geindex No_Allocators
12503 [RM H.4] This restriction ensures at compile time that there are no
12504 occurrences of an allocator.
12506 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
12507 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1c4}
12508 @subsection No_Anonymous_Allocators
12511 @geindex No_Anonymous_Allocators
12513 [RM H.4] This restriction ensures at compile time that there are no
12514 occurrences of an allocator of anonymous access type.
12516 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
12517 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1c5}
12518 @subsection No_Asynchronous_Control
12521 @geindex No_Asynchronous_Control
12523 [RM J.13] This restriction ensures at compile time that there are no semantic
12524 dependences on the predefined package Asynchronous_Task_Control.
12526 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
12527 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1c6}
12528 @subsection No_Calendar
12531 @geindex No_Calendar
12533 [GNAT] This restriction ensures at compile time that there are no semantic
12534 dependences on package Calendar.
12536 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
12537 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1c7}
12538 @subsection No_Coextensions
12541 @geindex No_Coextensions
12543 [RM H.4] This restriction ensures at compile time that there are no
12544 coextensions. See 3.10.2.
12546 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
12547 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1c8}
12548 @subsection No_Default_Initialization
12551 @geindex No_Default_Initialization
12553 [GNAT] This restriction prohibits any instance of default initialization
12554 of variables. The binder implements a consistency rule which prevents
12555 any unit compiled without the restriction from with’ing a unit with the
12556 restriction (this allows the generation of initialization procedures to
12557 be skipped, since you can be sure that no call is ever generated to an
12558 initialization procedure in a unit with the restriction active). If used
12559 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
12560 is to prohibit all cases of variables declared without a specific
12561 initializer (including the case of OUT scalar parameters).
12563 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
12564 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1c9}
12565 @subsection No_Delay
12570 [RM H.4] This restriction ensures at compile time that there are no
12571 delay statements and no semantic dependences on package Calendar.
12573 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
12574 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1ca}
12575 @subsection No_Dependence
12578 @geindex No_Dependence
12580 [RM 13.12.1] This restriction ensures at compile time that there are no
12581 dependences on a library unit. For GNAT, this includes implicit implementation
12582 dependences on units of the runtime library that are created by the compiler
12583 to support specific constructs of the language.
12585 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
12586 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1cb}
12587 @subsection No_Direct_Boolean_Operators
12590 @geindex No_Direct_Boolean_Operators
12592 [GNAT] This restriction ensures that no logical operators (and/or/xor)
12593 are used on operands of type Boolean (or any type derived from Boolean).
12594 This is intended for use in safety critical programs where the certification
12595 protocol requires the use of short-circuit (and then, or else) forms for all
12596 composite boolean operations.
12598 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
12599 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1cc}
12600 @subsection No_Dispatch
12603 @geindex No_Dispatch
12605 [RM H.4] This restriction ensures at compile time that there are no
12606 occurrences of @code{T'Class}, for any (tagged) subtype @code{T}.
12608 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
12609 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1cd}
12610 @subsection No_Dispatching_Calls
12613 @geindex No_Dispatching_Calls
12615 [GNAT] This restriction ensures at compile time that the code generated by the
12616 compiler involves no dispatching calls. The use of this restriction allows the
12617 safe use of record extensions, classwide membership tests and other classwide
12618 features not involving implicit dispatching. This restriction ensures that
12619 the code contains no indirect calls through a dispatching mechanism. Note that
12620 this includes internally-generated calls created by the compiler, for example
12621 in the implementation of class-wide objects assignments. The
12622 membership test is allowed in the presence of this restriction, because its
12623 implementation requires no dispatching.
12624 This restriction is comparable to the official Ada restriction
12625 @code{No_Dispatch} except that it is a bit less restrictive in that it allows
12626 all classwide constructs that do not imply dispatching.
12627 The following example indicates constructs that violate this restriction.
12631 type T is tagged record
12634 procedure P (X : T);
12636 type DT is new T with record
12637 More_Data : Natural;
12639 procedure Q (X : DT);
12643 procedure Example is
12644 procedure Test (O : T'Class) is
12645 N : Natural := O'Size; -- Error: Dispatching call
12646 C : T'Class := O; -- Error: implicit Dispatching Call
12648 if O in DT'Class then -- OK : Membership test
12649 Q (DT (O)); -- OK : Type conversion plus direct call
12651 P (O); -- Error: Dispatching call
12657 P (Obj); -- OK : Direct call
12658 P (T (Obj)); -- OK : Type conversion plus direct call
12659 P (T'Class (Obj)); -- Error: Dispatching call
12661 Test (Obj); -- OK : Type conversion
12663 if Obj in T'Class then -- OK : Membership test
12669 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
12670 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1ce}
12671 @subsection No_Dynamic_Attachment
12674 @geindex No_Dynamic_Attachment
12676 [RM D.7] This restriction ensures that there is no call to any of the
12677 operations defined in package Ada.Interrupts
12678 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
12679 Detach_Handler, and Reference).
12681 @geindex No_Dynamic_Interrupts
12683 The restriction @code{No_Dynamic_Interrupts} is recognized as a
12684 synonym for @code{No_Dynamic_Attachment}. This is retained for historical
12685 compatibility purposes (and a warning will be generated for its use if
12686 warnings on obsolescent features are activated).
12688 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
12689 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1cf}
12690 @subsection No_Dynamic_Priorities
12693 @geindex No_Dynamic_Priorities
12695 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
12697 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
12698 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1d0}
12699 @subsection No_Entry_Calls_In_Elaboration_Code
12702 @geindex No_Entry_Calls_In_Elaboration_Code
12704 [GNAT] This restriction ensures at compile time that no task or protected entry
12705 calls are made during elaboration code. As a result of the use of this
12706 restriction, the compiler can assume that no code past an accept statement
12707 in a task can be executed at elaboration time.
12709 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
12710 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1d1}
12711 @subsection No_Enumeration_Maps
12714 @geindex No_Enumeration_Maps
12716 [GNAT] This restriction ensures at compile time that no operations requiring
12717 enumeration maps are used (that is Image and Value attributes applied
12718 to enumeration types).
12720 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
12721 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1d2}
12722 @subsection No_Exception_Handlers
12725 @geindex No_Exception_Handlers
12727 [GNAT] This restriction ensures at compile time that there are no explicit
12728 exception handlers. It also indicates that no exception propagation will
12729 be provided. In this mode, exceptions may be raised but will result in
12730 an immediate call to the last chance handler, a routine that the user
12731 must define with the following profile:
12734 procedure Last_Chance_Handler
12735 (Source_Location : System.Address; Line : Integer);
12736 pragma Export (C, Last_Chance_Handler,
12737 "__gnat_last_chance_handler");
12740 The parameter is a C null-terminated string representing a message to be
12741 associated with the exception (typically the source location of the raise
12742 statement generated by the compiler). The Line parameter when nonzero
12743 represents the line number in the source program where the raise occurs.
12745 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
12746 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1d3}
12747 @subsection No_Exception_Propagation
12750 @geindex No_Exception_Propagation
12752 [GNAT] This restriction guarantees that exceptions are never propagated
12753 to an outer subprogram scope. The only case in which an exception may
12754 be raised is when the handler is statically in the same subprogram, so
12755 that the effect of a raise is essentially like a goto statement. Any
12756 other raise statement (implicit or explicit) will be considered
12757 unhandled. Exception handlers are allowed, but may not contain an
12758 exception occurrence identifier (exception choice). In addition, use of
12759 the package GNAT.Current_Exception is not permitted, and reraise
12760 statements (raise with no operand) are not permitted.
12762 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
12763 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1d4}
12764 @subsection No_Exception_Registration
12767 @geindex No_Exception_Registration
12769 [GNAT] This restriction ensures at compile time that no stream operations for
12770 types Exception_Id or Exception_Occurrence are used. This also makes it
12771 impossible to pass exceptions to or from a partition with this restriction
12772 in a distributed environment. If this restriction is active, the generated
12773 code is simplified by omitting the otherwise-required global registration
12774 of exceptions when they are declared.
12776 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
12777 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1d5}
12778 @subsection No_Exceptions
12781 @geindex No_Exceptions
12783 [RM H.4] This restriction ensures at compile time that there are no
12784 raise statements and no exception handlers and also suppresses the
12785 generation of language-defined run-time checks.
12787 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
12788 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1d6}
12789 @subsection No_Finalization
12792 @geindex No_Finalization
12794 [GNAT] This restriction disables the language features described in
12795 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
12796 performed by the compiler to support these features. The following types
12797 are no longer considered controlled when this restriction is in effect:
12803 @code{Ada.Finalization.Controlled}
12806 @code{Ada.Finalization.Limited_Controlled}
12809 Derivations from @code{Controlled} or @code{Limited_Controlled}
12821 Array and record types with controlled components
12824 The compiler no longer generates code to initialize, finalize or adjust an
12825 object or a nested component, either declared on the stack or on the heap. The
12826 deallocation of a controlled object no longer finalizes its contents.
12828 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
12829 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1d7}
12830 @subsection No_Fixed_Point
12833 @geindex No_Fixed_Point
12835 [RM H.4] This restriction ensures at compile time that there are no
12836 occurrences of fixed point types and operations.
12838 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
12839 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1d8}
12840 @subsection No_Floating_Point
12843 @geindex No_Floating_Point
12845 [RM H.4] This restriction ensures at compile time that there are no
12846 occurrences of floating point types and operations.
12848 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
12849 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1d9}
12850 @subsection No_Implicit_Conditionals
12853 @geindex No_Implicit_Conditionals
12855 [GNAT] This restriction ensures that the generated code does not contain any
12856 implicit conditionals, either by modifying the generated code where possible,
12857 or by rejecting any construct that would otherwise generate an implicit
12858 conditional. Note that this check does not include run time constraint
12859 checks, which on some targets may generate implicit conditionals as
12860 well. To control the latter, constraint checks can be suppressed in the
12861 normal manner. Constructs generating implicit conditionals include comparisons
12862 of composite objects and the Max/Min attributes.
12864 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12865 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1da}
12866 @subsection No_Implicit_Dynamic_Code
12869 @geindex No_Implicit_Dynamic_Code
12871 @geindex trampoline
12873 [GNAT] This restriction prevents the compiler from building ‘trampolines’.
12874 This is a structure that is built on the stack and contains dynamic
12875 code to be executed at run time. On some targets, a trampoline is
12876 built for the following features: @code{Access},
12877 @code{Unrestricted_Access}, or @code{Address} of a nested subprogram;
12878 nested task bodies; primitive operations of nested tagged types.
12879 Trampolines do not work on machines that prevent execution of stack
12880 data. For example, on windows systems, enabling DEP (data execution
12881 protection) will cause trampolines to raise an exception.
12882 Trampolines are also quite slow at run time.
12884 On many targets, trampolines have been largely eliminated. Look at the
12885 version of system.ads for your target — if it has
12886 Always_Compatible_Rep equal to False, then trampolines are largely
12887 eliminated. In particular, a trampoline is built for the following
12888 features: @code{Address} of a nested subprogram;
12889 @code{Access} or @code{Unrestricted_Access} of a nested subprogram,
12890 but only if pragma Favor_Top_Level applies, or the access type has a
12891 foreign-language convention; primitive operations of nested tagged
12894 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12895 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1db}
12896 @subsection No_Implicit_Heap_Allocations
12899 @geindex No_Implicit_Heap_Allocations
12901 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12903 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12904 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1dc}
12905 @subsection No_Implicit_Protected_Object_Allocations
12908 @geindex No_Implicit_Protected_Object_Allocations
12910 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12913 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12914 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1dd}
12915 @subsection No_Implicit_Task_Allocations
12918 @geindex No_Implicit_Task_Allocations
12920 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12922 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12923 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1de}
12924 @subsection No_Initialize_Scalars
12927 @geindex No_Initialize_Scalars
12929 [GNAT] This restriction ensures that no unit in the partition is compiled with
12930 pragma Initialize_Scalars. This allows the generation of more efficient
12931 code, and in particular eliminates dummy null initialization routines that
12932 are otherwise generated for some record and array types.
12934 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
12935 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1df}
12941 [RM H.4] This restriction ensures at compile time that there are no
12942 dependences on any of the library units Sequential_IO, Direct_IO,
12943 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
12945 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
12946 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1e0}
12947 @subsection No_Local_Allocators
12950 @geindex No_Local_Allocators
12952 [RM H.4] This restriction ensures at compile time that there are no
12953 occurrences of an allocator in subprograms, generic subprograms, tasks,
12956 @node No_Local_Protected_Objects,No_Local_Tagged_Types,No_Local_Allocators,Partition-Wide Restrictions
12957 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1e1}
12958 @subsection No_Local_Protected_Objects
12961 @geindex No_Local_Protected_Objects
12963 [RM D.7] This restriction ensures at compile time that protected objects are
12964 only declared at the library level.
12966 @node No_Local_Tagged_Types,No_Local_Timing_Events,No_Local_Protected_Objects,Partition-Wide Restrictions
12967 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-tagged-types}@anchor{1e2}
12968 @subsection No_Local_Tagged_Types
12971 @geindex No_Local_Tagged_Types
12973 [GNAT] This restriction ensures at compile time that tagged types are only
12974 declared at the library level.
12976 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Tagged_Types,Partition-Wide Restrictions
12977 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1e3}
12978 @subsection No_Local_Timing_Events
12981 @geindex No_Local_Timing_Events
12983 [RM D.7] All objects of type Ada.Real_Time.Timing_Events.Timing_Event are
12984 declared at the library level.
12986 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
12987 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1e4}
12988 @subsection No_Long_Long_Integers
12991 @geindex No_Long_Long_Integers
12993 [GNAT] This partition-wide restriction forbids any explicit reference to
12994 type Standard.Long_Long_Integer, and also forbids declaring range types whose
12995 implicit base type is Long_Long_Integer, and modular types whose size exceeds
12998 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
12999 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1e5}
13000 @subsection No_Multiple_Elaboration
13003 @geindex No_Multiple_Elaboration
13005 [GNAT] When this restriction is active and the static elaboration model is
13006 used, and -fpreserve-control-flow is not used, the compiler is allowed to
13007 suppress the elaboration counter normally associated with the unit, even if
13008 the unit has elaboration code. This counter is typically used to check for
13009 access before elaboration and to control multiple elaboration attempts. If the
13010 restriction is used, then the situations in which multiple elaboration is
13011 possible, including non-Ada main programs and Stand Alone libraries, are not
13012 permitted and will be diagnosed by the binder.
13014 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
13015 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1e6}
13016 @subsection No_Nested_Finalization
13019 @geindex No_Nested_Finalization
13021 [RM D.7] All objects requiring finalization are declared at the library level.
13023 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
13024 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1e7}
13025 @subsection No_Protected_Type_Allocators
13028 @geindex No_Protected_Type_Allocators
13030 [RM D.7] This restriction ensures at compile time that there are no allocator
13031 expressions that attempt to allocate protected objects.
13033 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
13034 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1e8}
13035 @subsection No_Protected_Types
13038 @geindex No_Protected_Types
13040 [RM H.4] This restriction ensures at compile time that there are no
13041 declarations of protected types or protected objects.
13043 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
13044 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1e9}
13045 @subsection No_Recursion
13048 @geindex No_Recursion
13050 [RM H.4] A program execution is erroneous if a subprogram is invoked as
13051 part of its execution.
13053 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
13054 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1ea}
13055 @subsection No_Reentrancy
13058 @geindex No_Reentrancy
13060 [RM H.4] A program execution is erroneous if a subprogram is executed by
13061 two tasks at the same time.
13063 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
13064 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1eb}
13065 @subsection No_Relative_Delay
13068 @geindex No_Relative_Delay
13070 [RM D.7] This restriction ensures at compile time that there are no delay
13071 relative statements and prevents expressions such as @code{delay 1.23;} from
13072 appearing in source code.
13074 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
13075 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1ec}
13076 @subsection No_Requeue_Statements
13079 @geindex No_Requeue_Statements
13081 [RM D.7] This restriction ensures at compile time that no requeue statements
13082 are permitted and prevents keyword @code{requeue} from being used in source
13085 @geindex No_Requeue
13087 The restriction @code{No_Requeue} is recognized as a
13088 synonym for @code{No_Requeue_Statements}. This is retained for historical
13089 compatibility purposes (and a warning will be generated for its use if
13090 warnings on oNobsolescent features are activated).
13092 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
13093 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1ed}
13094 @subsection No_Secondary_Stack
13097 @geindex No_Secondary_Stack
13099 [GNAT] This restriction ensures at compile time that the generated code
13100 does not contain any reference to the secondary stack. The secondary
13101 stack is used to implement functions returning unconstrained objects
13102 (arrays or records) on some targets. Suppresses the allocation of
13103 secondary stacks for tasks (excluding the environment task) at run time.
13105 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
13106 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1ee}
13107 @subsection No_Select_Statements
13110 @geindex No_Select_Statements
13112 [RM D.7] This restriction ensures at compile time no select statements of any
13113 kind are permitted, that is the keyword @code{select} may not appear.
13115 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
13116 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1ef}
13117 @subsection No_Specific_Termination_Handlers
13120 @geindex No_Specific_Termination_Handlers
13122 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
13123 or to Ada.Task_Termination.Specific_Handler.
13125 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
13126 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1f0}
13127 @subsection No_Specification_of_Aspect
13130 @geindex No_Specification_of_Aspect
13132 [RM 13.12.1] This restriction checks at compile time that no aspect
13133 specification, attribute definition clause, or pragma is given for a
13136 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
13137 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1f1}
13138 @subsection No_Standard_Allocators_After_Elaboration
13141 @geindex No_Standard_Allocators_After_Elaboration
13143 [RM D.7] Specifies that an allocator using a standard storage pool
13144 should never be evaluated at run time after the elaboration of the
13145 library items of the partition has completed. Otherwise, Storage_Error
13148 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
13149 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1f2}
13150 @subsection No_Standard_Storage_Pools
13153 @geindex No_Standard_Storage_Pools
13155 [GNAT] This restriction ensures at compile time that no access types
13156 use the standard default storage pool. Any access type declared must
13157 have an explicit Storage_Pool attribute defined specifying a
13158 user-defined storage pool.
13160 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
13161 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1f3}
13162 @subsection No_Stream_Optimizations
13165 @geindex No_Stream_Optimizations
13167 [GNAT] This restriction affects the performance of stream operations on types
13168 @code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
13169 compiler uses block reads and writes when manipulating @code{String} objects
13170 due to their superior performance. When this restriction is in effect, the
13171 compiler performs all IO operations on a per-character basis.
13173 @node No_Streams,No_Tagged_Type_Registration,No_Stream_Optimizations,Partition-Wide Restrictions
13174 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1f4}
13175 @subsection No_Streams
13178 @geindex No_Streams
13180 [GNAT] This restriction ensures at compile/bind time that there are no
13181 stream objects created and no use of stream attributes.
13182 This restriction does not forbid dependences on the package
13183 @code{Ada.Streams}. So it is permissible to with
13184 @code{Ada.Streams} (or another package that does so itself)
13185 as long as no actual stream objects are created and no
13186 stream attributes are used.
13188 Note that the use of restriction allows optimization of tagged types,
13189 since they do not need to worry about dispatching stream operations.
13190 To take maximum advantage of this space-saving optimization, any
13191 unit declaring a tagged type should be compiled with the restriction,
13192 though this is not required.
13194 @node No_Tagged_Type_Registration,No_Task_Allocators,No_Streams,Partition-Wide Restrictions
13195 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tagged-type-registration}@anchor{1f5}
13196 @subsection No_Tagged_Type_Registration
13199 @geindex No_Tagged_Type_Registration
13201 [GNAT] If this restriction is active, then class-wide streaming
13202 attributes are not supported. In addition, the subprograms in
13203 Ada.Tags are not supported.
13204 If this restriction is active, the generated code is simplified by
13205 omitting the otherwise-required global registration of tagged types when they
13206 are declared. This restriction may be necessary in order to also apply
13207 the No_Elaboration_Code restriction.
13209 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Tagged_Type_Registration,Partition-Wide Restrictions
13210 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1f6}
13211 @subsection No_Task_Allocators
13214 @geindex No_Task_Allocators
13216 [RM D.7] There are no allocators for task types
13217 or types containing task subcomponents.
13219 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
13220 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1f7}
13221 @subsection No_Task_At_Interrupt_Priority
13224 @geindex No_Task_At_Interrupt_Priority
13226 [GNAT] This restriction ensures at compile time that there is no
13227 Interrupt_Priority aspect or pragma for a task or a task type. As
13228 a consequence, the tasks are always created with a priority below
13229 that an interrupt priority.
13231 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
13232 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1f8}
13233 @subsection No_Task_Attributes_Package
13236 @geindex No_Task_Attributes_Package
13238 [GNAT] This restriction ensures at compile time that there are no implicit or
13239 explicit dependencies on the package @code{Ada.Task_Attributes}.
13241 @geindex No_Task_Attributes
13243 The restriction @code{No_Task_Attributes} is recognized as a synonym
13244 for @code{No_Task_Attributes_Package}. This is retained for historical
13245 compatibility purposes (and a warning will be generated for its use if
13246 warnings on obsolescent features are activated).
13248 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
13249 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1f9}
13250 @subsection No_Task_Hierarchy
13253 @geindex No_Task_Hierarchy
13255 [RM D.7] All (non-environment) tasks depend
13256 directly on the environment task of the partition.
13258 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
13259 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1fa}
13260 @subsection No_Task_Termination
13263 @geindex No_Task_Termination
13265 [RM D.7] Tasks that terminate are erroneous.
13267 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
13268 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1fb}
13269 @subsection No_Tasking
13272 @geindex No_Tasking
13274 [GNAT] This restriction prevents the declaration of tasks or task types
13275 throughout the partition. It is similar in effect to the use of
13276 @code{Max_Tasks => 0} except that violations are caught at compile time
13277 and cause an error message to be output either by the compiler or
13280 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
13281 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1fc}
13282 @subsection No_Terminate_Alternatives
13285 @geindex No_Terminate_Alternatives
13287 [RM D.7] There are no selective accepts with terminate alternatives.
13289 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
13290 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1fd}
13291 @subsection No_Unchecked_Access
13294 @geindex No_Unchecked_Access
13296 [RM H.4] This restriction ensures at compile time that there are no
13297 occurrences of the Unchecked_Access attribute.
13299 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
13300 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{1fe}
13301 @subsection No_Unchecked_Conversion
13304 @geindex No_Unchecked_Conversion
13306 [RM J.13] This restriction ensures at compile time that there are no semantic
13307 dependences on the predefined generic function Unchecked_Conversion.
13309 @node No_Unchecked_Deallocation,No_Use_Of_Entity,No_Unchecked_Conversion,Partition-Wide Restrictions
13310 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{1ff}
13311 @subsection No_Unchecked_Deallocation
13314 @geindex No_Unchecked_Deallocation
13316 [RM J.13] This restriction ensures at compile time that there are no semantic
13317 dependences on the predefined generic procedure Unchecked_Deallocation.
13319 @node No_Use_Of_Entity,Pure_Barriers,No_Unchecked_Deallocation,Partition-Wide Restrictions
13320 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{200}
13321 @subsection No_Use_Of_Entity
13324 @geindex No_Use_Of_Entity
13326 [GNAT] This restriction ensures at compile time that there are no references
13327 to the entity given in the form
13330 No_Use_Of_Entity => Name
13333 where @code{Name} is the fully qualified entity, for example
13336 No_Use_Of_Entity => Ada.Text_IO.Put_Line
13339 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
13340 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{201}
13341 @subsection Pure_Barriers
13344 @geindex Pure_Barriers
13346 [GNAT] This restriction ensures at compile time that protected entry
13347 barriers are restricted to:
13353 components of the protected object (excluding selection from dereferences),
13356 constant declarations,
13362 enumeration literals,
13371 character literals,
13374 implicitly defined comparison operators,
13377 uses of the Standard.”not” operator,
13380 short-circuit operator,
13383 the Count attribute
13386 This restriction is a relaxation of the Simple_Barriers restriction,
13387 but still ensures absence of side effects, exceptions, and recursion
13388 during the evaluation of the barriers.
13390 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
13391 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{202}
13392 @subsection Simple_Barriers
13395 @geindex Simple_Barriers
13397 [RM D.7] This restriction ensures at compile time that barriers in entry
13398 declarations for protected types are restricted to either static boolean
13399 expressions or references to simple boolean variables defined in the private
13400 part of the protected type. No other form of entry barriers is permitted.
13402 @geindex Boolean_Entry_Barriers
13404 The restriction @code{Boolean_Entry_Barriers} is recognized as a
13405 synonym for @code{Simple_Barriers}. This is retained for historical
13406 compatibility purposes (and a warning will be generated for its use if
13407 warnings on obsolescent features are activated).
13409 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
13410 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{203}
13411 @subsection Static_Priorities
13414 @geindex Static_Priorities
13416 [GNAT] This restriction ensures at compile time that all priority expressions
13417 are static, and that there are no dependences on the package
13418 @code{Ada.Dynamic_Priorities}.
13420 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
13421 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{204}
13422 @subsection Static_Storage_Size
13425 @geindex Static_Storage_Size
13427 [GNAT] This restriction ensures at compile time that any expression appearing
13428 in a Storage_Size pragma or attribute definition clause is static.
13430 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
13431 @anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{205}@anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{206}
13432 @section Program Unit Level Restrictions
13435 The second set of restriction identifiers
13436 does not require partition-wide consistency.
13437 The restriction may be enforced for a single
13438 compilation unit without any effect on any of the
13439 other compilation units in the partition.
13442 * No_Elaboration_Code::
13443 * No_Dynamic_Accessibility_Checks::
13444 * No_Dynamic_Sized_Objects::
13446 * No_Implementation_Aspect_Specifications::
13447 * No_Implementation_Attributes::
13448 * No_Implementation_Identifiers::
13449 * No_Implementation_Pragmas::
13450 * No_Implementation_Restrictions::
13451 * No_Implementation_Units::
13452 * No_Implicit_Aliasing::
13453 * No_Implicit_Loops::
13454 * No_Obsolescent_Features::
13455 * No_Wide_Characters::
13456 * Static_Dispatch_Tables::
13461 @node No_Elaboration_Code,No_Dynamic_Accessibility_Checks,,Program Unit Level Restrictions
13462 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{207}
13463 @subsection No_Elaboration_Code
13466 @geindex No_Elaboration_Code
13468 [GNAT] This restriction ensures at compile time that no elaboration code is
13469 generated. Note that this is not the same condition as is enforced
13470 by pragma @code{Preelaborate}. There are cases in which pragma
13471 @code{Preelaborate} still permits code to be generated (e.g., code
13472 to initialize a large array to all zeroes), and there are cases of units
13473 which do not meet the requirements for pragma @code{Preelaborate},
13474 but for which no elaboration code is generated. Generally, it is
13475 the case that preelaborable units will meet the restrictions, with
13476 the exception of large aggregates initialized with an others_clause,
13477 and exception declarations (which generate calls to a run-time
13478 registry procedure). This restriction is enforced on
13479 a unit by unit basis, it need not be obeyed consistently
13480 throughout a partition.
13482 In the case of aggregates with others, if the aggregate has a dynamic
13483 size, there is no way to eliminate the elaboration code (such dynamic
13484 bounds would be incompatible with @code{Preelaborate} in any case). If
13485 the bounds are static, then use of this restriction actually modifies
13486 the code choice of the compiler to avoid generating a loop, and instead
13487 generate the aggregate statically if possible, no matter how many times
13488 the data for the others clause must be repeatedly generated.
13490 It is not possible to precisely document
13491 the constructs which are compatible with this restriction, since,
13492 unlike most other restrictions, this is not a restriction on the
13493 source code, but a restriction on the generated object code. For
13494 example, if the source contains a declaration:
13497 Val : constant Integer := X;
13500 where X is not a static constant, it may be possible, depending
13501 on complex optimization circuitry, for the compiler to figure
13502 out the value of X at compile time, in which case this initialization
13503 can be done by the loader, and requires no initialization code. It
13504 is not possible to document the precise conditions under which the
13505 optimizer can figure this out.
13507 Note that this the implementation of this restriction requires full
13508 code generation. If it is used in conjunction with “semantics only”
13509 checking, then some cases of violations may be missed.
13511 When this restriction is active, we are not requesting control-flow
13512 preservation with -fpreserve-control-flow, and the static elaboration model is
13513 used, the compiler is allowed to suppress the elaboration counter normally
13514 associated with the unit. This counter is typically used to check for access
13515 before elaboration and to control multiple elaboration attempts.
13517 @node No_Dynamic_Accessibility_Checks,No_Dynamic_Sized_Objects,No_Elaboration_Code,Program Unit Level Restrictions
13518 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-accessibility-checks}@anchor{208}
13519 @subsection No_Dynamic_Accessibility_Checks
13522 @geindex No_Dynamic_Accessibility_Checks
13524 [GNAT] No dynamic accessibility checks are generated when this restriction is
13525 in effect. Instead, dangling references are prevented via more conservative
13526 compile-time checking. More specifically, existing compile-time checks are
13527 enforced but with more conservative assumptions about the accessibility levels
13528 of the relevant entities. These conservative assumptions eliminate the need for
13529 dynamic accessibility checks.
13531 These new rules for computing (at compile-time) the accessibility level of an
13532 anonymous access type T are as follows:
13538 If T is a function result type then, from the caller’s perspective, its level
13539 is that of the innermost master enclosing the function call. From the callee’s
13540 perspective, the level of parameters and local variables of the callee is
13541 statically deeper than the level of T.
13543 For any other accessibility level L such that the level of parameters and local
13544 variables of the callee is statically deeper than L, the level of T (from the
13545 callee’s perspective) is also statically deeper than L.
13548 If T is the type of a formal parameter then, from the caller’s perspective,
13549 its level is at least as deep as that of the type of the corresponding actual
13550 parameter (whatever that actual parameter might be). From the callee’s
13551 perspective, the level of parameters and local variables of the callee is
13552 statically deeper than the level of T.
13555 If T is the type of a discriminant then its level is that of the discriminated
13559 If T is the type of a stand-alone object then its level is the level of the
13563 In all other cases, the level of T is as defined by the existing rules of Ada.
13566 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Dynamic_Accessibility_Checks,Program Unit Level Restrictions
13567 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{209}
13568 @subsection No_Dynamic_Sized_Objects
13571 @geindex No_Dynamic_Sized_Objects
13573 [GNAT] This restriction disallows certain constructs that might lead to the
13574 creation of dynamic-sized composite objects (or array or discriminated type).
13575 An array subtype indication is illegal if the bounds are not static
13576 or references to discriminants of an enclosing type.
13577 A discriminated subtype indication is illegal if the type has
13578 discriminant-dependent array components or a variant part, and the
13579 discriminants are not static. In addition, array and record aggregates are
13580 illegal in corresponding cases. Note that this restriction does not forbid
13581 access discriminants. It is often a good idea to combine this restriction
13582 with No_Secondary_Stack.
13584 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
13585 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{20a}
13586 @subsection No_Entry_Queue
13589 @geindex No_Entry_Queue
13591 [GNAT] This restriction is a declaration that any protected entry compiled in
13592 the scope of the restriction has at most one task waiting on the entry
13593 at any one time, and so no queue is required. This restriction is not
13594 checked at compile time. A program execution is erroneous if an attempt
13595 is made to queue a second task on such an entry.
13597 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
13598 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{20b}
13599 @subsection No_Implementation_Aspect_Specifications
13602 @geindex No_Implementation_Aspect_Specifications
13604 [RM 13.12.1] This restriction checks at compile time that no
13605 GNAT-defined aspects are present. With this restriction, the only
13606 aspects that can be used are those defined in the Ada Reference Manual.
13608 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
13609 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{20c}
13610 @subsection No_Implementation_Attributes
13613 @geindex No_Implementation_Attributes
13615 [RM 13.12.1] This restriction checks at compile time that no
13616 GNAT-defined attributes are present. With this restriction, the only
13617 attributes that can be used are those defined in the Ada Reference
13620 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
13621 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{20d}
13622 @subsection No_Implementation_Identifiers
13625 @geindex No_Implementation_Identifiers
13627 [RM 13.12.1] This restriction checks at compile time that no
13628 implementation-defined identifiers (marked with pragma Implementation_Defined)
13629 occur within language-defined packages.
13631 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
13632 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{20e}
13633 @subsection No_Implementation_Pragmas
13636 @geindex No_Implementation_Pragmas
13638 [RM 13.12.1] This restriction checks at compile time that no
13639 GNAT-defined pragmas are present. With this restriction, the only
13640 pragmas that can be used are those defined in the Ada Reference Manual.
13642 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
13643 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{20f}
13644 @subsection No_Implementation_Restrictions
13647 @geindex No_Implementation_Restrictions
13649 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
13650 identifiers (other than @code{No_Implementation_Restrictions} itself)
13651 are present. With this restriction, the only other restriction identifiers
13652 that can be used are those defined in the Ada Reference Manual.
13654 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
13655 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{210}
13656 @subsection No_Implementation_Units
13659 @geindex No_Implementation_Units
13661 [RM 13.12.1] This restriction checks at compile time that there is no
13662 mention in the context clause of any implementation-defined descendants
13663 of packages Ada, Interfaces, or System.
13665 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
13666 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{211}
13667 @subsection No_Implicit_Aliasing
13670 @geindex No_Implicit_Aliasing
13672 [GNAT] This restriction, which is not required to be partition-wide consistent,
13673 requires an explicit aliased keyword for an object to which ‘Access,
13674 ‘Unchecked_Access, or ‘Address is applied, and forbids entirely the use of
13675 the ‘Unrestricted_Access attribute for objects. Note: the reason that
13676 Unrestricted_Access is forbidden is that it would require the prefix
13677 to be aliased, and in such cases, it can always be replaced by
13678 the standard attribute Unchecked_Access which is preferable.
13680 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
13681 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{212}
13682 @subsection No_Implicit_Loops
13685 @geindex No_Implicit_Loops
13687 [GNAT] This restriction ensures that the generated code of the unit marked
13688 with this restriction does not contain any implicit @code{for} loops, either by
13689 modifying the generated code where possible, or by rejecting any construct
13690 that would otherwise generate an implicit @code{for} loop. If this restriction is
13691 active, it is possible to build large array aggregates with all static
13692 components without generating an intermediate temporary, and without generating
13693 a loop to initialize individual components. Otherwise, a loop is created for
13694 arrays larger than about 5000 scalar components. Note that if this restriction
13695 is set in the spec of a package, it will not apply to its body.
13697 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
13698 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{213}
13699 @subsection No_Obsolescent_Features
13702 @geindex No_Obsolescent_Features
13704 [RM 13.12.1] This restriction checks at compile time that no obsolescent
13705 features are used, as defined in Annex J of the Ada Reference Manual.
13707 @node No_Wide_Characters,Static_Dispatch_Tables,No_Obsolescent_Features,Program Unit Level Restrictions
13708 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{214}
13709 @subsection No_Wide_Characters
13712 @geindex No_Wide_Characters
13714 [GNAT] This restriction ensures at compile time that no uses of the types
13715 @code{Wide_Character} or @code{Wide_String} or corresponding wide
13717 appear, and that no wide or wide wide string or character literals
13718 appear in the program (that is literals representing characters not in
13719 type @code{Character}).
13721 @node Static_Dispatch_Tables,SPARK_05,No_Wide_Characters,Program Unit Level Restrictions
13722 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{215}
13723 @subsection Static_Dispatch_Tables
13726 @geindex Static_Dispatch_Tables
13728 [GNAT] This restriction checks at compile time that all the artifacts
13729 associated with dispatch tables can be placed in read-only memory.
13731 @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions
13732 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{216}
13733 @subsection SPARK_05
13738 [GNAT] This restriction no longer has any effect and is superseded by
13739 SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
13740 a codebase respects SPARK 2014 restrictions, mark the code with pragma or
13741 aspect @code{SPARK_Mode}, and run the tool GNATprove at Stone assurance level, as
13745 gnatprove -P project.gpr --mode=stone
13751 gnatprove -P project.gpr --mode=check_all
13754 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13755 @anchor{gnat_rm/implementation_advice doc}@anchor{217}@anchor{gnat_rm/implementation_advice id1}@anchor{218}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}
13756 @chapter Implementation Advice
13759 The main text of the Ada Reference Manual describes the required
13760 behavior of all Ada compilers, and the GNAT compiler conforms to
13761 these requirements.
13763 In addition, there are sections throughout the Ada Reference Manual headed
13764 by the phrase ‘Implementation advice’. These sections are not normative,
13765 i.e., they do not specify requirements that all compilers must
13766 follow. Rather they provide advice on generally desirable behavior.
13767 They are not requirements, because they describe behavior that cannot
13768 be provided on all systems, or may be undesirable on some systems.
13770 As far as practical, GNAT follows the implementation advice in
13771 the Ada Reference Manual. Each such RM section corresponds to a section
13772 in this chapter whose title specifies the
13773 RM section number and paragraph number and the subject of
13774 the advice. The contents of each section consists of the RM text within
13776 followed by the GNAT interpretation of the advice. Most often, this simply says
13777 ‘followed’, which means that GNAT follows the advice. However, in a
13778 number of cases, GNAT deliberately deviates from this advice, in which
13779 case the text describes what GNAT does and why.
13781 @geindex Error detection
13784 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection.
13785 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units.
13786 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors.
13787 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas.
13788 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas.
13789 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets.
13790 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types.
13791 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types.
13792 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values.
13793 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types.
13794 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays.
13795 * RM 9.6(30-31); Duration’Small: RM 9 6 30-31 Duration’Small.
13796 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation.
13797 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information.
13798 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks.
13799 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses.
13800 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types.
13801 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses.
13802 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses.
13803 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses.
13804 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses.
13805 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses.
13806 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses.
13807 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses.
13808 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes.
13809 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering.
13810 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private.
13811 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations.
13812 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion.
13813 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage.
13814 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation.
13815 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes.
13816 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types.
13817 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling.
13818 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling.
13819 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation.
13820 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate.
13821 * RM A.18; Containers: RM A 18 Containers.
13822 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export.
13823 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces.
13824 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C.
13825 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL.
13826 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran.
13827 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations.
13828 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations.
13829 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support.
13830 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers.
13831 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts.
13832 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements.
13833 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names.
13834 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes.
13835 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies.
13836 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies.
13837 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort.
13838 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions.
13839 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time.
13840 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem.
13841 * RM F(7); COBOL Support: RM F 7 COBOL Support.
13842 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support.
13843 * RM G; Numerics: RM G Numerics.
13844 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types.
13845 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions.
13846 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements.
13847 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy.
13848 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy.
13852 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13853 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{219}
13854 @section RM 1.1.3(20): Error Detection
13859 “If an implementation detects the use of an unsupported Specialized Needs
13860 Annex feature at run time, it should raise @code{Program_Error} if
13864 Not relevant. All specialized needs annex features are either supported,
13865 or diagnosed at compile time.
13867 @geindex Child Units
13869 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13870 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{21a}
13871 @section RM 1.1.3(31): Child Units
13876 “If an implementation wishes to provide implementation-defined
13877 extensions to the functionality of a language-defined library unit, it
13878 should normally do so by adding children to the library unit.”
13883 @geindex Bounded errors
13885 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13886 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{21b}
13887 @section RM 1.1.5(12): Bounded Errors
13892 “If an implementation detects a bounded error or erroneous
13893 execution, it should raise @code{Program_Error}.”
13896 Followed in all cases in which the implementation detects a bounded
13897 error or erroneous execution. Not all such situations are detected at
13902 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
13903 @anchor{gnat_rm/implementation_advice id2}@anchor{21c}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{21d}
13904 @section RM 2.8(16): Pragmas
13909 “Normally, implementation-defined pragmas should have no semantic effect
13910 for error-free programs; that is, if the implementation-defined pragmas
13911 are removed from a working program, the program should still be legal,
13912 and should still have the same semantics.”
13915 The following implementation defined pragmas are exceptions to this
13919 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx}
13986 `Machine_Attribute'
13994 `Unimplemented_Unit'
14011 In each of the above cases, it is essential to the purpose of the pragma
14012 that this advice not be followed. For details see
14013 @ref{7,,Implementation Defined Pragmas}.
14015 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
14016 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{21e}
14017 @section RM 2.8(17-19): Pragmas
14022 “Normally, an implementation should not define pragmas that can
14023 make an illegal program legal, except as follows:
14029 A pragma used to complete a declaration, such as a pragma @code{Import};
14032 A pragma used to configure the environment by adding, removing, or
14033 replacing @code{library_items}.”
14037 See @ref{21d,,RM 2.8(16); Pragmas}.
14039 @geindex Character Sets
14041 @geindex Alternative Character Sets
14043 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
14044 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{21f}
14045 @section RM 3.5.2(5): Alternative Character Sets
14050 “If an implementation supports a mode with alternative interpretations
14051 for @code{Character} and @code{Wide_Character}, the set of graphic
14052 characters of @code{Character} should nevertheless remain a proper
14053 subset of the set of graphic characters of @code{Wide_Character}. Any
14054 character set ‘localizations’ should be reflected in the results of
14055 the subprograms defined in the language-defined package
14056 @code{Characters.Handling} (see A.3) available in such a mode. In a mode with
14057 an alternative interpretation of @code{Character}, the implementation should
14058 also support a corresponding change in what is a legal
14059 @code{identifier_letter}.”
14062 Not all wide character modes follow this advice, in particular the JIS
14063 and IEC modes reflect standard usage in Japan, and in these encoding,
14064 the upper half of the Latin-1 set is not part of the wide-character
14065 subset, since the most significant bit is used for wide character
14066 encoding. However, this only applies to the external forms. Internally
14067 there is no such restriction.
14069 @geindex Integer types
14071 @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
14072 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{220}
14073 @section RM 3.5.4(28): Integer Types
14078 “An implementation should support @code{Long_Integer} in addition to
14079 @code{Integer} if the target machine supports 32-bit (or longer)
14080 arithmetic. No other named integer subtypes are recommended for package
14081 @code{Standard}. Instead, appropriate named integer subtypes should be
14082 provided in the library package @code{Interfaces} (see B.2).”
14085 @code{Long_Integer} is supported. Other standard integer types are supported
14086 so this advice is not fully followed. These types
14087 are supported for convenient interface to C, and so that all hardware
14088 types of the machine are easily available.
14090 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
14091 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{221}
14092 @section RM 3.5.4(29): Integer Types
14097 “An implementation for a two’s complement machine should support
14098 modular types with a binary modulus up to @code{System.Max_Int*2+2}. An
14099 implementation should support a non-binary modules up to @code{Integer'Last}.”
14104 @geindex Enumeration values
14106 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
14107 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{222}
14108 @section RM 3.5.5(8): Enumeration Values
14113 “For the evaluation of a call on @code{S'Pos} for an enumeration
14114 subtype, if the value of the operand does not correspond to the internal
14115 code for any enumeration literal of its type (perhaps due to an
14116 un-initialized variable), then the implementation should raise
14117 @code{Program_Error}. This is particularly important for enumeration
14118 types with noncontiguous internal codes specified by an
14119 enumeration_representation_clause.”
14124 @geindex Float types
14126 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
14127 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{223}
14128 @section RM 3.5.7(17): Float Types
14133 “An implementation should support @code{Long_Float} in addition to
14134 @code{Float} if the target machine supports 11 or more digits of
14135 precision. No other named floating point subtypes are recommended for
14136 package @code{Standard}. Instead, appropriate named floating point subtypes
14137 should be provided in the library package @code{Interfaces} (see B.2).”
14140 @code{Short_Float} and @code{Long_Long_Float} are also provided. The
14141 former provides improved compatibility with other implementations
14142 supporting this type. The latter corresponds to the highest precision
14143 floating-point type supported by the hardware. On most machines, this
14144 will be the same as @code{Long_Float}, but on some machines, it will
14145 correspond to the IEEE extended form. The notable case is all x86
14146 implementations, where @code{Long_Long_Float} corresponds to the 80-bit
14147 extended precision format supported in hardware on this processor.
14148 Note that the 128-bit format on SPARC is not supported, since this
14149 is a software rather than a hardware format.
14151 @geindex Multidimensional arrays
14154 @geindex multidimensional
14156 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration’Small,RM 3 5 7 17 Float Types,Implementation Advice
14157 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{224}
14158 @section RM 3.6.2(11): Multidimensional Arrays
14163 “An implementation should normally represent multidimensional arrays in
14164 row-major order, consistent with the notation used for multidimensional
14165 array aggregates (see 4.3.3). However, if a pragma @code{Convention}
14166 (@code{Fortran}, …) applies to a multidimensional array type, then
14167 column-major order should be used instead (see B.5, `Interfacing with Fortran').”
14172 @geindex Duration'Small
14174 @node RM 9 6 30-31 Duration’Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
14175 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{225}
14176 @section RM 9.6(30-31): Duration’Small
14181 “Whenever possible in an implementation, the value of @code{Duration'Small}
14182 should be no greater than 100 microseconds.”
14185 Followed. (@code{Duration'Small} = 10**(-9)).
14189 “The time base for @code{delay_relative_statements} should be monotonic;
14190 it need not be the same time base as used for @code{Calendar.Clock}.”
14195 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration’Small,Implementation Advice
14196 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{226}
14197 @section RM 10.2.1(12): Consistent Representation
14202 “In an implementation, a type declared in a pre-elaborated package should
14203 have the same representation in every elaboration of a given version of
14204 the package, whether the elaborations occur in distinct executions of
14205 the same program, or in executions of distinct programs or partitions
14206 that include the given version.”
14209 Followed, except in the case of tagged types. Tagged types involve
14210 implicit pointers to a local copy of a dispatch table, and these pointers
14211 have representations which thus depend on a particular elaboration of the
14212 package. It is not easy to see how it would be possible to follow this
14213 advice without severely impacting efficiency of execution.
14215 @geindex Exception information
14217 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
14218 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{227}
14219 @section RM 11.4.1(19): Exception Information
14224 “@code{Exception_Message} by default and @code{Exception_Information}
14225 should produce information useful for
14226 debugging. @code{Exception_Message} should be short, about one
14227 line. @code{Exception_Information} can be long. @code{Exception_Message}
14228 should not include the
14229 @code{Exception_Name}. @code{Exception_Information} should include both
14230 the @code{Exception_Name} and the @code{Exception_Message}.”
14233 Followed. For each exception that doesn’t have a specified
14234 @code{Exception_Message}, the compiler generates one containing the location
14235 of the raise statement. This location has the form ‘file_name:line’, where
14236 file_name is the short file name (without path information) and line is the line
14237 number in the file. Note that in the case of the Zero Cost Exception
14238 mechanism, these messages become redundant with the Exception_Information that
14239 contains a full backtrace of the calling sequence, so they are disabled.
14240 To disable explicitly the generation of the source location message, use the
14241 Pragma @code{Discard_Names}.
14243 @geindex Suppression of checks
14246 @geindex suppression of
14248 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
14249 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{228}
14250 @section RM 11.5(28): Suppression of Checks
14255 “The implementation should minimize the code executed for checks that
14256 have been suppressed.”
14261 @geindex Representation clauses
14263 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
14264 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{229}
14265 @section RM 13.1 (21-24): Representation Clauses
14270 “The recommended level of support for all representation items is
14271 qualified as follows:
14273 An implementation need not support representation items containing
14274 nonstatic expressions, except that an implementation should support a
14275 representation item for a given entity if each nonstatic expression in
14276 the representation item is a name that statically denotes a constant
14277 declared before the entity.”
14280 Followed. In fact, GNAT goes beyond the recommended level of support
14281 by allowing nonstatic expressions in some representation clauses even
14282 without the need to declare constants initialized with the values of
14289 for Y'Address use X'Address;>>
14292 "An implementation need not support a specification for the `@w{`}Size`@w{`}
14293 for a given composite subtype, nor the size or storage place for an
14294 object (including a component) of a given composite subtype, unless the
14295 constraints on the subtype and its composite subcomponents (if any) are
14296 all static constraints."
14299 Followed. Size Clauses are not permitted on nonstatic components, as
14304 “An aliased component, or a component whose type is by-reference, should
14305 always be allocated at an addressable location.”
14310 @geindex Packed types
14312 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
14313 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{22a}
14314 @section RM 13.2(6-8): Packed Types
14319 “If a type is packed, then the implementation should try to minimize
14320 storage allocated to objects of the type, possibly at the expense of
14321 speed of accessing components, subject to reasonable complexity in
14322 addressing calculations.
14324 The recommended level of support pragma @code{Pack} is:
14326 For a packed record type, the components should be packed as tightly as
14327 possible subject to the Sizes of the component subtypes, and subject to
14328 any `record_representation_clause' that applies to the type; the
14329 implementation may, but need not, reorder components or cross aligned
14330 word boundaries to improve the packing. A component whose @code{Size} is
14331 greater than the word size may be allocated an integral number of words.”
14334 Followed. Tight packing of arrays is supported for all component sizes
14335 up to 64-bits. If the array component size is 1 (that is to say, if
14336 the component is a boolean type or an enumeration type with two values)
14337 then values of the type are implicitly initialized to zero. This
14338 happens both for objects of the packed type, and for objects that have a
14339 subcomponent of the packed type.
14341 @geindex Address clauses
14343 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
14344 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{22b}
14345 @section RM 13.3(14-19): Address Clauses
14350 “For an array @code{X}, @code{X'Address} should point at the first
14351 component of the array, and not at the array bounds.”
14358 “The recommended level of support for the @code{Address} attribute is:
14360 @code{X'Address} should produce a useful result if @code{X} is an
14361 object that is aliased or of a by-reference type, or is an entity whose
14362 @code{Address} has been specified.”
14365 Followed. A valid address will be produced even if none of those
14366 conditions have been met. If necessary, the object is forced into
14367 memory to ensure the address is valid.
14371 “An implementation should support @code{Address} clauses for imported
14379 “Objects (including subcomponents) that are aliased or of a by-reference
14380 type should be allocated on storage element boundaries.”
14387 “If the @code{Address} of an object is specified, or it is imported or exported,
14388 then the implementation should not perform optimizations based on
14389 assumptions of no aliases.”
14394 @geindex Alignment clauses
14396 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
14397 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{22c}
14398 @section RM 13.3(29-35): Alignment Clauses
14403 “The recommended level of support for the @code{Alignment} attribute for
14406 An implementation should support specified Alignments that are factors
14407 and multiples of the number of storage elements per word, subject to the
14415 “An implementation need not support specified Alignments for
14416 combinations of Sizes and Alignments that cannot be easily
14417 loaded and stored by available machine instructions.”
14424 “An implementation need not support specified Alignments that are
14425 greater than the maximum @code{Alignment} the implementation ever returns by
14433 “The recommended level of support for the @code{Alignment} attribute for
14436 Same as above, for subtypes, but in addition:”
14443 “For stand-alone library-level objects of statically constrained
14444 subtypes, the implementation should support all alignments
14445 supported by the target linker. For example, page alignment is likely to
14446 be supported for such objects, but not for subtypes.”
14451 @geindex Size clauses
14453 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
14454 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{22d}
14455 @section RM 13.3(42-43): Size Clauses
14460 “The recommended level of support for the @code{Size} attribute of
14463 A @code{Size} clause should be supported for an object if the specified
14464 @code{Size} is at least as large as its subtype’s @code{Size}, and
14465 corresponds to a size in storage elements that is a multiple of the
14466 object’s @code{Alignment} (if the @code{Alignment} is nonzero).”
14471 @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
14472 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{22e}
14473 @section RM 13.3(50-56): Size Clauses
14478 “If the @code{Size} of a subtype is specified, and allows for efficient
14479 independent addressability (see 9.10) on the target architecture, then
14480 the @code{Size} of the following objects of the subtype should equal the
14481 @code{Size} of the subtype:
14483 Aliased objects (including components).”
14490 “@cite{Size} clause on a composite subtype should not affect the
14491 internal layout of components.”
14494 Followed. But note that this can be overridden by use of the implementation
14495 pragma Implicit_Packing in the case of packed arrays.
14499 “The recommended level of support for the @code{Size} attribute of subtypes is:
14501 The @code{Size} (if not specified) of a static discrete or fixed point
14502 subtype should be the number of bits needed to represent each value
14503 belonging to the subtype using an unbiased representation, leaving space
14504 for a sign bit only if the subtype contains negative values. If such a
14505 subtype is a first subtype, then an implementation should support a
14506 specified @code{Size} for it that reflects this representation.”
14513 “For a subtype implemented with levels of indirection, the @code{Size}
14514 should include the size of the pointers, but not the size of what they
14520 @geindex Component_Size clauses
14522 @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
14523 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{22f}
14524 @section RM 13.3(71-73): Component Size Clauses
14529 “The recommended level of support for the @code{Component_Size}
14532 An implementation need not support specified @code{Component_Sizes} that are
14533 less than the @code{Size} of the component subtype.”
14540 “An implementation should support specified Component_Sizes that
14541 are factors and multiples of the word size. For such
14542 Component_Sizes, the array should contain no gaps between
14543 components. For other Component_Sizes (if supported), the array
14544 should contain no gaps between components when packing is also
14545 specified; the implementation should forbid this combination in cases
14546 where it cannot support a no-gaps representation.”
14551 @geindex Enumeration representation clauses
14553 @geindex Representation clauses
14554 @geindex enumeration
14556 @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
14557 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{230}
14558 @section RM 13.4(9-10): Enumeration Representation Clauses
14563 “The recommended level of support for enumeration representation clauses
14566 An implementation need not support enumeration representation clauses
14567 for boolean types, but should at minimum support the internal codes in
14568 the range @code{System.Min_Int .. System.Max_Int}.”
14573 @geindex Record representation clauses
14575 @geindex Representation clauses
14578 @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
14579 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{231}
14580 @section RM 13.5.1(17-22): Record Representation Clauses
14585 “The recommended level of support for
14586 `record_representation_clause's is:
14588 An implementation should support storage places that can be extracted
14589 with a load, mask, shift sequence of machine code, and set with a load,
14590 shift, mask, store sequence, given the available machine instructions
14591 and run-time model.”
14598 “A storage place should be supported if its size is equal to the
14599 @code{Size} of the component subtype, and it starts and ends on a
14600 boundary that obeys the @code{Alignment} of the component subtype.”
14607 “If the default bit ordering applies to the declaration of a given type,
14608 then for a component whose subtype’s @code{Size} is less than the word
14609 size, any storage place that does not cross an aligned word boundary
14610 should be supported.”
14617 “An implementation may reserve a storage place for the tag field of a
14618 tagged type, and disallow other components from overlapping that place.”
14621 Followed. The storage place for the tag field is the beginning of the tagged
14622 record, and its size is Address’Size. GNAT will reject an explicit component
14623 clause for the tag field.
14627 “An implementation need not support a `component_clause' for a
14628 component of an extension part if the storage place is not after the
14629 storage places of all components of the parent type, whether or not
14630 those storage places had been specified.”
14633 Followed. The above advice on record representation clauses is followed,
14634 and all mentioned features are implemented.
14636 @geindex Storage place attributes
14638 @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
14639 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{232}
14640 @section RM 13.5.2(5): Storage Place Attributes
14645 “If a component is represented using some form of pointer (such as an
14646 offset) to the actual data of the component, and this data is contiguous
14647 with the rest of the object, then the storage place attributes should
14648 reflect the place of the actual data, not the pointer. If a component is
14649 allocated discontinuously from the rest of the object, then a warning
14650 should be generated upon reference to one of its storage place
14654 Followed. There are no such components in GNAT.
14656 @geindex Bit ordering
14658 @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
14659 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{233}
14660 @section RM 13.5.3(7-8): Bit Ordering
14665 “The recommended level of support for the non-default bit ordering is:
14667 If @code{Word_Size} = @code{Storage_Unit}, then the implementation
14668 should support the non-default bit ordering in addition to the default
14672 Followed. Word size does not equal storage size in this implementation.
14673 Thus non-default bit ordering is not supported.
14676 @geindex as private type
14678 @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
14679 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{234}
14680 @section RM 13.7(37): Address as Private
14685 “@cite{Address} should be of a private type.”
14690 @geindex Operations
14691 @geindex on `@w{`}Address`@w{`}
14694 @geindex operations of
14696 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14697 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{235}
14698 @section RM 13.7.1(16): Address Operations
14703 “Operations in @code{System} and its children should reflect the target
14704 environment semantics as closely as is reasonable. For example, on most
14705 machines, it makes sense for address arithmetic to ‘wrap around’.
14706 Operations that do not make sense should raise @code{Program_Error}.”
14709 Followed. Address arithmetic is modular arithmetic that wraps around. No
14710 operation raises @code{Program_Error}, since all operations make sense.
14712 @geindex Unchecked conversion
14714 @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
14715 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{236}
14716 @section RM 13.9(14-17): Unchecked Conversion
14721 “The @code{Size} of an array object should not include its bounds; hence,
14722 the bounds should not be part of the converted data.”
14729 “The implementation should not generate unnecessary run-time checks to
14730 ensure that the representation of @code{S} is a representation of the
14731 target type. It should take advantage of the permission to return by
14732 reference when possible. Restrictions on unchecked conversions should be
14733 avoided unless required by the target environment.”
14736 Followed. There are no restrictions on unchecked conversion. A warning is
14737 generated if the source and target types do not have the same size since
14738 the semantics in this case may be target dependent.
14742 “The recommended level of support for unchecked conversions is:
14744 Unchecked conversions should be supported and should be reversible in
14745 the cases where this clause defines the result. To enable meaningful use
14746 of unchecked conversion, a contiguous representation should be used for
14747 elementary subtypes, for statically constrained array subtypes whose
14748 component subtype is one of the subtypes described in this paragraph,
14749 and for record subtypes without discriminants whose component subtypes
14750 are described in this paragraph.”
14755 @geindex Heap usage
14758 @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
14759 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{237}
14760 @section RM 13.11(23-25): Implicit Heap Usage
14765 “An implementation should document any cases in which it dynamically
14766 allocates heap storage for a purpose other than the evaluation of an
14770 Followed, the only other points at which heap storage is dynamically
14771 allocated are as follows:
14777 At initial elaboration time, to allocate dynamically sized global
14781 To allocate space for a task when a task is created.
14784 To extend the secondary stack dynamically when needed. The secondary
14785 stack is used for returning variable length results.
14791 “A default (implementation-provided) storage pool for an
14792 access-to-constant type should not have overhead to support deallocation of
14793 individual objects.”
14800 “A storage pool for an anonymous access type should be created at the
14801 point of an allocator for the type, and be reclaimed when the designated
14802 object becomes inaccessible.”
14807 @geindex Unchecked deallocation
14809 @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
14810 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{238}
14811 @section RM 13.11.2(17): Unchecked Deallocation
14816 “For a standard storage pool, @code{Free} should actually reclaim the
14822 @geindex Stream oriented attributes
14824 @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
14825 @anchor{gnat_rm/implementation_advice rm-13-13-2-1-6-stream-oriented-attributes}@anchor{239}
14826 @section RM 13.13.2(1.6): Stream Oriented Attributes
14831 “If not specified, the value of Stream_Size for an elementary type
14832 should be the number of bits that corresponds to the minimum number of
14833 stream elements required by the first subtype of the type, rounded up
14834 to the nearest factor or multiple of the word size that is also a
14835 multiple of the stream element size.”
14838 Followed, except that the number of stream elements is 1, 2, 3, 4 or 8.
14839 The Stream_Size may be used to override the default choice.
14841 The default implementation is based on direct binary representations and is
14842 therefore target- and endianness-dependent. To address this issue, GNAT also
14843 supplies an alternate implementation of the stream attributes @code{Read} and
14844 @code{Write}, which uses the target-independent XDR standard representation for
14845 scalar types. This XDR alternative can be enabled via the binder switch -xdr.
14847 @geindex XDR representation
14849 @geindex Read attribute
14851 @geindex Write attribute
14853 @geindex Stream oriented attributes
14855 @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
14856 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{23a}
14857 @section RM A.1(52): Names of Predefined Numeric Types
14862 “If an implementation provides additional named predefined integer types,
14863 then the names should end with @code{Integer} as in
14864 @code{Long_Integer}. If an implementation provides additional named
14865 predefined floating point types, then the names should end with
14866 @code{Float} as in @code{Long_Float}.”
14871 @geindex Ada.Characters.Handling
14873 @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
14874 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{23b}
14875 @section RM A.3.2(49): @code{Ada.Characters.Handling}
14880 “If an implementation provides a localized definition of @code{Character}
14881 or @code{Wide_Character}, then the effects of the subprograms in
14882 @code{Characters.Handling} should reflect the localizations.
14886 Followed. GNAT provides no such localized definitions.
14888 @geindex Bounded-length strings
14890 @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
14891 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{23c}
14892 @section RM A.4.4(106): Bounded-Length String Handling
14897 “Bounded string objects should not be implemented by implicit pointers
14898 and dynamic allocation.”
14901 Followed. No implicit pointers or dynamic allocation are used.
14903 @geindex Random number generation
14905 @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
14906 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{23d}
14907 @section RM A.5.2(46-47): Random Number Generation
14912 “Any storage associated with an object of type @code{Generator} should be
14913 reclaimed on exit from the scope of the object.”
14920 “If the generator period is sufficiently long in relation to the number
14921 of distinct initiator values, then each possible value of
14922 @code{Initiator} passed to @code{Reset} should initiate a sequence of
14923 random numbers that does not, in a practical sense, overlap the sequence
14924 initiated by any other value. If this is not possible, then the mapping
14925 between initiator values and generator states should be a rapidly
14926 varying function of the initiator value.”
14929 Followed. The generator period is sufficiently long for the first
14930 condition here to hold true.
14932 @geindex Get_Immediate
14934 @node RM A 10 7 23 Get_Immediate,RM A 18 Containers,RM A 5 2 46-47 Random Number Generation,Implementation Advice
14935 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{23e}
14936 @section RM A.10.7(23): @code{Get_Immediate}
14941 “The @code{Get_Immediate} procedures should be implemented with
14942 unbuffered input. For a device such as a keyboard, input should be
14943 available if a key has already been typed, whereas for a disk
14944 file, input should always be available except at end of file. For a file
14945 associated with a keyboard-like device, any line-editing features of the
14946 underlying operating system should be disabled during the execution of
14947 @code{Get_Immediate}.”
14950 Followed on all targets except VxWorks. For VxWorks, there is no way to
14951 provide this functionality that does not result in the input buffer being
14952 flushed before the @code{Get_Immediate} call. A special unit
14953 @code{Interfaces.Vxworks.IO} is provided that contains routines to enable
14954 this functionality.
14956 @geindex Containers
14958 @node RM A 18 Containers,RM B 1 39-41 Pragma Export,RM A 10 7 23 Get_Immediate,Implementation Advice
14959 @anchor{gnat_rm/implementation_advice rm-a-18-containers}@anchor{23f}
14960 @section RM A.18: @code{Containers}
14963 All implementation advice pertaining to Ada.Containers and its
14964 child units (that is, all implementation advice occurring within
14965 section A.18 and its subsections) is followed except for A.18.24(17):
14969 “Bounded ordered set objects should be implemented without implicit pointers or dynamic allocation. “
14972 The implementations of the two Reference_Preserving_Key functions of
14973 the generic package Ada.Containers.Bounded_Ordered_Sets each currently make
14974 use of dynamic allocation; other operations on bounded ordered set objects
14975 follow the implementation advice.
14979 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 18 Containers,Implementation Advice
14980 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{240}
14981 @section RM B.1(39-41): Pragma @code{Export}
14986 “If an implementation supports pragma @code{Export} to a given language,
14987 then it should also allow the main subprogram to be written in that
14988 language. It should support some mechanism for invoking the elaboration
14989 of the Ada library units included in the system, and for invoking the
14990 finalization of the environment task. On typical systems, the
14991 recommended mechanism is to provide two subprograms whose link names are
14992 @code{adainit} and @code{adafinal}. @code{adainit} should contain the
14993 elaboration code for library units. @code{adafinal} should contain the
14994 finalization code. These subprograms should have no effect the second
14995 and subsequent time they are called.”
15002 “Automatic elaboration of pre-elaborated packages should be
15003 provided when pragma @code{Export} is supported.”
15006 Followed when the main program is in Ada. If the main program is in a
15007 foreign language, then
15008 @code{adainit} must be called to elaborate pre-elaborated
15013 “For each supported convention `L' other than @code{Intrinsic}, an
15014 implementation should support @code{Import} and @code{Export} pragmas
15015 for objects of `L'-compatible types and for subprograms, and pragma
15016 @cite{Convention} for `L'-eligible types and for subprograms,
15017 presuming the other language has corresponding features. Pragma
15018 @code{Convention} need not be supported for scalar types.”
15023 @geindex Package Interfaces
15025 @geindex Interfaces
15027 @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
15028 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{241}
15029 @section RM B.2(12-13): Package @code{Interfaces}
15034 “For each implementation-defined convention identifier, there should be a
15035 child package of package Interfaces with the corresponding name. This
15036 package should contain any declarations that would be useful for
15037 interfacing to the language (implementation) represented by the
15038 convention. Any declarations useful for interfacing to any language on
15039 the given hardware architecture should be provided directly in
15040 @code{Interfaces}.”
15047 “An implementation supporting an interface to C, COBOL, or Fortran should
15048 provide the corresponding package or packages described in the following
15052 Followed. GNAT provides all the packages described in this section.
15055 @geindex interfacing with
15057 @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
15058 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{242}
15059 @section RM B.3(63-71): Interfacing with C
15064 “An implementation should support the following interface correspondences
15065 between Ada and C.”
15072 “An Ada procedure corresponds to a void-returning C function.”
15079 “An Ada function corresponds to a non-void C function.”
15086 “An Ada @code{in} scalar parameter is passed as a scalar argument to a C
15094 “An Ada @code{in} parameter of an access-to-object type with designated
15095 type @code{T} is passed as a @code{t*} argument to a C function,
15096 where @code{t} is the C type corresponding to the Ada type @code{T}.”
15103 “An Ada access @code{T} parameter, or an Ada @code{out} or @code{in out}
15104 parameter of an elementary type @code{T}, is passed as a @code{t*}
15105 argument to a C function, where @code{t} is the C type corresponding to
15106 the Ada type @code{T}. In the case of an elementary @code{out} or
15107 @code{in out} parameter, a pointer to a temporary copy is used to
15108 preserve by-copy semantics.”
15115 “An Ada parameter of a record type @code{T}, of any mode, is passed as a
15116 @code{t*} argument to a C function, where @code{t} is the C
15117 structure corresponding to the Ada type @code{T}.”
15120 Followed. This convention may be overridden by the use of the C_Pass_By_Copy
15121 pragma, or Convention, or by explicitly specifying the mechanism for a given
15122 call using an extended import or export pragma.
15126 “An Ada parameter of an array type with component type @code{T}, of any
15127 mode, is passed as a @code{t*} argument to a C function, where
15128 @code{t} is the C type corresponding to the Ada type @code{T}.”
15135 “An Ada parameter of an access-to-subprogram type is passed as a pointer
15136 to a C function whose prototype corresponds to the designated
15137 subprogram’s specification.”
15143 @geindex interfacing with
15145 @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
15146 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{243}
15147 @section RM B.4(95-98): Interfacing with COBOL
15152 “An Ada implementation should support the following interface
15153 correspondences between Ada and COBOL.”
15160 “An Ada access @code{T} parameter is passed as a @code{BY REFERENCE} data item of
15161 the COBOL type corresponding to @code{T}.”
15168 “An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
15169 the corresponding COBOL type.”
15176 “Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
15177 COBOL type corresponding to the Ada parameter type; for scalars, a local
15178 copy is used if necessary to ensure by-copy semantics.”
15184 @geindex interfacing with
15186 @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
15187 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{244}
15188 @section RM B.5(22-26): Interfacing with Fortran
15193 “An Ada implementation should support the following interface
15194 correspondences between Ada and Fortran:”
15201 “An Ada procedure corresponds to a Fortran subroutine.”
15208 “An Ada function corresponds to a Fortran function.”
15215 “An Ada parameter of an elementary, array, or record type @code{T} is
15216 passed as a @code{T} argument to a Fortran procedure, where @code{T} is
15217 the Fortran type corresponding to the Ada type @code{T}, and where the
15218 INTENT attribute of the corresponding dummy argument matches the Ada
15219 formal parameter mode; the Fortran implementation’s parameter passing
15220 conventions are used. For elementary types, a local copy is used if
15221 necessary to ensure by-copy semantics.”
15228 “An Ada parameter of an access-to-subprogram type is passed as a
15229 reference to a Fortran procedure whose interface corresponds to the
15230 designated subprogram’s specification.”
15235 @geindex Machine operations
15237 @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
15238 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{245}
15239 @section RM C.1(3-5): Access to Machine Operations
15244 “The machine code or intrinsic support should allow access to all
15245 operations normally available to assembly language programmers for the
15246 target environment, including privileged instructions, if any.”
15253 “The interfacing pragmas (see Annex B) should support interface to
15254 assembler; the default assembler should be associated with the
15255 convention identifier @code{Assembler}.”
15262 “If an entity is exported to assembly language, then the implementation
15263 should allocate it at an addressable location, and should ensure that it
15264 is retained by the linking process, even if not otherwise referenced
15265 from the Ada code. The implementation should assume that any call to a
15266 machine code or assembler subprogram is allowed to read or update every
15267 object that is specified as exported.”
15272 @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
15273 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{246}
15274 @section RM C.1(10-16): Access to Machine Operations
15279 “The implementation should ensure that little or no overhead is
15280 associated with calling intrinsic and machine-code subprograms.”
15283 Followed for both intrinsics and machine-code subprograms.
15287 “It is recommended that intrinsic subprograms be provided for convenient
15288 access to any machine operations that provide special capabilities or
15289 efficiency and that are not otherwise available through the language
15293 Followed. A full set of machine operation intrinsic subprograms is provided.
15297 “Atomic read-modify-write operations—e.g., test and set, compare and
15298 swap, decrement and test, enqueue/dequeue.”
15301 Followed on any target supporting such operations.
15305 “Standard numeric functions—e.g.:, sin, log.”
15308 Followed on any target supporting such operations.
15312 “String manipulation operations—e.g.:, translate and test.”
15315 Followed on any target supporting such operations.
15319 “Vector operations—e.g.:, compare vector against thresholds.”
15322 Followed on any target supporting such operations.
15326 “Direct operations on I/O ports.”
15329 Followed on any target supporting such operations.
15331 @geindex Interrupt support
15333 @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
15334 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{247}
15335 @section RM C.3(28): Interrupt Support
15340 “If the @code{Ceiling_Locking} policy is not in effect, the
15341 implementation should provide means for the application to specify which
15342 interrupts are to be blocked during protected actions, if the underlying
15343 system allows for a finer-grain control of interrupt blocking.”
15346 Followed. The underlying system does not allow for finer-grain control
15347 of interrupt blocking.
15349 @geindex Protected procedure handlers
15351 @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
15352 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{248}
15353 @section RM C.3.1(20-21): Protected Procedure Handlers
15358 “Whenever possible, the implementation should allow interrupt handlers to
15359 be called directly by the hardware.”
15362 Followed on any target where the underlying operating system permits
15367 “Whenever practical, violations of any
15368 implementation-defined restrictions should be detected before run time.”
15371 Followed. Compile time warnings are given when possible.
15373 @geindex Package `@w{`}Interrupts`@w{`}
15375 @geindex Interrupts
15377 @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
15378 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{249}
15379 @section RM C.3.2(25): Package @code{Interrupts}
15384 “If implementation-defined forms of interrupt handler procedures are
15385 supported, such as protected procedures with parameters, then for each
15386 such form of a handler, a type analogous to @code{Parameterless_Handler}
15387 should be specified in a child package of @code{Interrupts}, with the
15388 same operations as in the predefined package Interrupts.”
15393 @geindex Pre-elaboration requirements
15395 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
15396 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{24a}
15397 @section RM C.4(14): Pre-elaboration Requirements
15402 “It is recommended that pre-elaborated packages be implemented in such a
15403 way that there should be little or no code executed at run time for the
15404 elaboration of entities not already covered by the Implementation
15408 Followed. Executable code is generated in some cases, e.g., loops
15409 to initialize large arrays.
15411 @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
15412 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{24b}
15413 @section RM C.5(8): Pragma @code{Discard_Names}
15418 “If the pragma applies to an entity, then the implementation should
15419 reduce the amount of storage used for storing names associated with that
15425 @geindex Package Task_Attributes
15427 @geindex Task_Attributes
15429 @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
15430 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{24c}
15431 @section RM C.7.2(30): The Package Task_Attributes
15436 “Some implementations are targeted to domains in which memory use at run
15437 time must be completely deterministic. For such implementations, it is
15438 recommended that the storage for task attributes will be pre-allocated
15439 statically and not from the heap. This can be accomplished by either
15440 placing restrictions on the number and the size of the task’s
15441 attributes, or by using the pre-allocated storage for the first @code{N}
15442 attribute objects, and the heap for the others. In the latter case,
15443 @code{N} should be documented.”
15446 Not followed. This implementation is not targeted to such a domain.
15448 @geindex Locking Policies
15450 @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
15451 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{24d}
15452 @section RM D.3(17): Locking Policies
15457 “The implementation should use names that end with @code{_Locking} for
15458 locking policies defined by the implementation.”
15461 Followed. Two implementation-defined locking policies are defined,
15462 whose names (@code{Inheritance_Locking} and
15463 @code{Concurrent_Readers_Locking}) follow this suggestion.
15465 @geindex Entry queuing policies
15467 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
15468 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{24e}
15469 @section RM D.4(16): Entry Queuing Policies
15474 “Names that end with @code{_Queuing} should be used
15475 for all implementation-defined queuing policies.”
15478 Followed. No such implementation-defined queuing policies exist.
15480 @geindex Preemptive abort
15482 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
15483 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{24f}
15484 @section RM D.6(9-10): Preemptive Abort
15489 “Even though the `abort_statement' is included in the list of
15490 potentially blocking operations (see 9.5.1), it is recommended that this
15491 statement be implemented in a way that never requires the task executing
15492 the `abort_statement' to block.”
15499 “On a multi-processor, the delay associated with aborting a task on
15500 another processor should be bounded; the implementation should use
15501 periodic polling, if necessary, to achieve this.”
15506 @geindex Tasking restrictions
15508 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
15509 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{250}
15510 @section RM D.7(21): Tasking Restrictions
15515 “When feasible, the implementation should take advantage of the specified
15516 restrictions to produce a more efficient implementation.”
15519 GNAT currently takes advantage of these restrictions by providing an optimized
15520 run time when the Ravenscar profile and the GNAT restricted run time set
15521 of restrictions are specified. See pragma @code{Profile (Ravenscar)} and
15522 pragma @code{Profile (Restricted)} for more details.
15527 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
15528 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{251}
15529 @section RM D.8(47-49): Monotonic Time
15534 “When appropriate, implementations should provide configuration
15535 mechanisms to change the value of @code{Tick}.”
15538 Such configuration mechanisms are not appropriate to this implementation
15539 and are thus not supported.
15543 “It is recommended that @code{Calendar.Clock} and @code{Real_Time.Clock}
15544 be implemented as transformations of the same time base.”
15551 “It is recommended that the best time base which exists in
15552 the underlying system be available to the application through
15553 @code{Clock}. @cite{Best} may mean highest accuracy or largest range.”
15558 @geindex Partition communication subsystem
15562 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
15563 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{252}
15564 @section RM E.5(28-29): Partition Communication Subsystem
15569 “Whenever possible, the PCS on the called partition should allow for
15570 multiple tasks to call the RPC-receiver with different messages and
15571 should allow them to block until the corresponding subprogram body
15575 Followed by GLADE, a separately supplied PCS that can be used with
15580 “The @code{Write} operation on a stream of type @code{Params_Stream_Type}
15581 should raise @code{Storage_Error} if it runs out of space trying to
15582 write the @code{Item} into the stream.”
15585 Followed by GLADE, a separately supplied PCS that can be used with
15588 @geindex COBOL support
15590 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
15591 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{253}
15592 @section RM F(7): COBOL Support
15597 “If COBOL (respectively, C) is widely supported in the target
15598 environment, implementations supporting the Information Systems Annex
15599 should provide the child package @code{Interfaces.COBOL} (respectively,
15600 @code{Interfaces.C}) specified in Annex B and should support a
15601 @code{convention_identifier} of COBOL (respectively, C) in the interfacing
15602 pragmas (see Annex B), thus allowing Ada programs to interface with
15603 programs written in that language.”
15608 @geindex Decimal radix support
15610 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15611 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{254}
15612 @section RM F.1(2): Decimal Radix Support
15617 “Packed decimal should be used as the internal representation for objects
15618 of subtype @code{S} when @code{S}’Machine_Radix = 10.”
15621 Not followed. GNAT ignores @code{S}’Machine_Radix and always uses binary
15626 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15627 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{255}
15628 @section RM G: Numerics
15633 “If Fortran (respectively, C) is widely supported in the target
15634 environment, implementations supporting the Numerics Annex
15635 should provide the child package @code{Interfaces.Fortran} (respectively,
15636 @code{Interfaces.C}) specified in Annex B and should support a
15637 @code{convention_identifier} of Fortran (respectively, C) in the interfacing
15638 pragmas (see Annex B), thus allowing Ada programs to interface with
15639 programs written in that language.”
15644 @geindex Complex types
15646 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15647 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{256}
15648 @section RM G.1.1(56-58): Complex Types
15653 “Because the usual mathematical meaning of multiplication of a complex
15654 operand and a real operand is that of the scaling of both components of
15655 the former by the latter, an implementation should not perform this
15656 operation by first promoting the real operand to complex type and then
15657 performing a full complex multiplication. In systems that, in the
15658 future, support an Ada binding to IEC 559:1989, the latter technique
15659 will not generate the required result when one of the components of the
15660 complex operand is infinite. (Explicit multiplication of the infinite
15661 component by the zero component obtained during promotion yields a NaN
15662 that propagates into the final result.) Analogous advice applies in the
15663 case of multiplication of a complex operand and a pure-imaginary
15664 operand, and in the case of division of a complex operand by a real or
15665 pure-imaginary operand.”
15672 “Similarly, because the usual mathematical meaning of addition of a
15673 complex operand and a real operand is that the imaginary operand remains
15674 unchanged, an implementation should not perform this operation by first
15675 promoting the real operand to complex type and then performing a full
15676 complex addition. In implementations in which the @code{Signed_Zeros}
15677 attribute of the component type is @code{True} (and which therefore
15678 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15679 predefined arithmetic operations), the latter technique will not
15680 generate the required result when the imaginary component of the complex
15681 operand is a negatively signed zero. (Explicit addition of the negative
15682 zero to the zero obtained during promotion yields a positive zero.)
15683 Analogous advice applies in the case of addition of a complex operand
15684 and a pure-imaginary operand, and in the case of subtraction of a
15685 complex operand and a real or pure-imaginary operand.”
15692 “Implementations in which @code{Real'Signed_Zeros} is @code{True} should
15693 attempt to provide a rational treatment of the signs of zero results and
15694 result components. As one example, the result of the @code{Argument}
15695 function should have the sign of the imaginary component of the
15696 parameter @code{X} when the point represented by that parameter lies on
15697 the positive real axis; as another, the sign of the imaginary component
15698 of the @code{Compose_From_Polar} function should be the same as
15699 (respectively, the opposite of) that of the @code{Argument} parameter when that
15700 parameter has a value of zero and the @code{Modulus} parameter has a
15701 nonnegative (respectively, negative) value.”
15706 @geindex Complex elementary functions
15708 @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
15709 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{257}
15710 @section RM G.1.2(49): Complex Elementary Functions
15715 “Implementations in which @code{Complex_Types.Real'Signed_Zeros} is
15716 @code{True} should attempt to provide a rational treatment of the signs
15717 of zero results and result components. For example, many of the complex
15718 elementary functions have components that are odd functions of one of
15719 the parameter components; in these cases, the result component should
15720 have the sign of the parameter component at the origin. Other complex
15721 elementary functions have zero components whose sign is opposite that of
15722 a parameter component at the origin, or is always positive or always
15728 @geindex Accuracy requirements
15730 @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
15731 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{258}
15732 @section RM G.2.4(19): Accuracy Requirements
15737 “The versions of the forward trigonometric functions without a
15738 @code{Cycle} parameter should not be implemented by calling the
15739 corresponding version with a @code{Cycle} parameter of
15740 @code{2.0*Numerics.Pi}, since this will not provide the required
15741 accuracy in some portions of the domain. For the same reason, the
15742 version of @code{Log} without a @code{Base} parameter should not be
15743 implemented by calling the corresponding version with a @code{Base}
15744 parameter of @code{Numerics.e}.”
15749 @geindex Complex arithmetic accuracy
15752 @geindex complex arithmetic
15754 @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
15755 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{259}
15756 @section RM G.2.6(15): Complex Arithmetic Accuracy
15761 “The version of the @code{Compose_From_Polar} function without a
15762 @code{Cycle} parameter should not be implemented by calling the
15763 corresponding version with a @code{Cycle} parameter of
15764 @code{2.0*Numerics.Pi}, since this will not provide the required
15765 accuracy in some portions of the domain.”
15770 @geindex Sequential elaboration policy
15772 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15773 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{25a}
15774 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15779 “If the partition elaboration policy is @code{Sequential} and the
15780 Environment task becomes permanently blocked during elaboration then the
15781 partition is deadlocked and it is recommended that the partition be
15782 immediately terminated.”
15787 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15788 @anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{25b}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{25c}@anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}
15789 @chapter Implementation Defined Characteristics
15792 In addition to the implementation dependent pragmas and attributes, and the
15793 implementation advice, there are a number of other Ada features that are
15794 potentially implementation dependent and are designated as
15795 implementation-defined. These are mentioned throughout the Ada Reference
15796 Manual, and are summarized in Annex M.
15798 A requirement for conforming Ada compilers is that they provide
15799 documentation describing how the implementation deals with each of these
15800 issues. In this chapter you will find each point in Annex M listed,
15801 followed by a description of how GNAT handles the implementation dependence.
15803 You can use this chapter as a guide to minimizing implementation
15804 dependent features in your programs if portability to other compilers
15805 and other operating systems is an important consideration. The numbers
15806 in each entry below correspond to the paragraph numbers in the Ada
15813 “Whether or not each recommendation given in Implementation
15814 Advice is followed. See 1.1.2(37).”
15817 See @ref{a,,Implementation Advice}.
15823 “Capacity limitations of the implementation. See 1.1.3(3).”
15826 The complexity of programs that can be processed is limited only by the
15827 total amount of available virtual memory, and disk space for the
15828 generated object files.
15834 “Variations from the standard that are impractical to avoid
15835 given the implementation’s execution environment. See 1.1.3(6).”
15838 There are no variations from the standard.
15844 “Which code_statements cause external
15845 interactions. See 1.1.3(10).”
15848 Any `code_statement' can potentially cause external interactions.
15854 “The coded representation for the text of an Ada
15855 program. See 2.1(4).”
15858 See separate section on source representation.
15864 “The semantics of an Ada program whose text is not in
15865 Normalization Form C. See 2.1(4).”
15868 See separate section on source representation.
15874 “The representation for an end of line. See 2.2(2).”
15877 See separate section on source representation.
15883 “Maximum supported line length and lexical element
15884 length. See 2.2(15).”
15887 The maximum line length is 255 characters and the maximum length of
15888 a lexical element is also 255 characters. This is the default setting
15889 if not overridden by the use of compiler switch `-gnaty' (which
15890 sets the maximum to 79) or `-gnatyMnn' which allows the maximum
15891 line length to be specified to be any value up to 32767. The maximum
15892 length of a lexical element is the same as the maximum line length.
15898 “Implementation defined pragmas. See 2.8(14).”
15901 See @ref{7,,Implementation Defined Pragmas}.
15907 “Effect of pragma @code{Optimize}. See 2.8(27).”
15910 Pragma @code{Optimize}, if given with a @code{Time} or @code{Space}
15911 parameter, checks that the optimization flag is set, and aborts if it is
15918 “The message string associated with the Assertion_Error exception raised
15919 by the failure of a predicate check if there is no applicable
15920 Predicate_Failure aspect. See 3.2.4(31).”
15923 In the case of a Dynamic_Predicate aspect, the string is
15924 “Dynamic_Predicate failed at <source position>”, where
15925 “<source position>” might be something like “foo.adb:123”.
15926 The Static_Predicate case is handled analogously.
15932 “The predefined integer types declared in
15933 @code{Standard}. See 3.5.4(25).”
15937 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
15948 `Short_Short_Integer'
15976 64-bit signed (on most 64-bit targets,
15977 depending on the C definition of long)
15978 32-bit signed (on all other targets)
15982 `Long_Long_Integer'
15990 `Long_Long_Long_Integer'
15994 128-bit signed (on 64-bit targets)
15995 64-bit signed (on 32-bit targets)
16004 “Any nonstandard integer types and the operators defined
16005 for them. See 3.5.4(26).”
16008 There are no nonstandard integer types.
16014 “Any nonstandard real types and the operators defined for
16015 them. See 3.5.6(8).”
16018 There are no nonstandard real types.
16024 “What combinations of requested decimal precision and range
16025 are supported for floating point types. See 3.5.7(7).”
16028 The precision and range are defined by the IEEE Standard for Floating-Point
16029 Arithmetic (IEEE 754-2019).
16035 “The predefined floating point types declared in
16036 @code{Standard}. See 3.5.7(16).”
16040 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16055 IEEE Binary32 (Single)
16063 IEEE Binary32 (Single)
16071 IEEE Binary64 (Double)
16079 IEEE Binary64 (Double) on non-x86 architectures
16080 IEEE 80-bit Extended on x86 architecture
16085 The default rounding mode specified by the IEEE 754 Standard is assumed both
16086 for static and dynamic computations (that is, round to nearest, ties to even).
16087 The input routines yield correctly rounded values for Short_Float, Float, and
16088 Long_Float at least. The output routines can compute up to twice as many exact
16089 digits as the value of @code{T'Digits} for any type, for example 30 digits for
16090 Long_Float; if more digits are requested, zeros are printed.
16096 “The small of an ordinary fixed point type. See 3.5.9(8).”
16099 The small is the largest power of two that does not exceed the delta.
16105 “What combinations of small, range, and digits are
16106 supported for fixed point types. See 3.5.9(10).”
16109 For an ordinary fixed point type, on 32-bit platforms, the small must lie in
16110 2.0**(-80) .. 2.0**80 and the range in -9.0E+36 .. 9.0E+36; any combination
16111 is permitted that does not result in a mantissa larger than 63 bits.
16113 On 64-bit platforms, the small must lie in 2.0**(-127) .. 2.0**127 and the
16114 range in -1.0E+76 .. 1.0E+76; any combination is permitted that does not
16115 result in a mantissa larger than 63 bits, and any combination is permitted
16116 that results in a mantissa between 64 and 127 bits if the small is the
16117 ratio of two integers that lie in 1 .. 2.0**127.
16119 If the small is the ratio of two integers with 64-bit magnitude on 32-bit
16120 platforms and 128-bit magnitude on 64-bit platforms, which is the case if
16121 no @code{small} clause is provided, then the operations of the fixed point
16122 type are entirely implemented by means of integer instructions. In the
16123 other cases, some operations, in particular input and output, may be
16124 implemented by means of floating-point instructions and may be affected
16125 by accuracy issues on architectures other than x86.
16127 For a decimal fixed point type, on 32-bit platforms, the small must lie in
16128 1.0E-18 .. 1.0E+18 and the digits in 1 .. 18. On 64-bit platforms, the
16129 small must lie in 1.0E-38 .. 1.0E+38 and the digits in 1 .. 38.
16135 “The result of @code{Tags.Expanded_Name} for types declared
16136 within an unnamed `block_statement'. See 3.9(10).”
16139 Block numbers of the form @code{B@var{nnn}}, where `nnn' is a
16140 decimal integer are allocated.
16146 “The sequence of characters of the value returned by Tags.Expanded_Name
16147 (respectively, Tags.Wide_Expanded_Name) when some of the graphic
16148 characters of Tags.Wide_Wide_Expanded_Name are not defined in Character
16149 (respectively, Wide_Character). See 3.9(10.1).”
16152 This is handled in the same way as the implementation-defined behavior
16153 referenced in A.4.12(34).
16159 “Implementation-defined attributes. See 4.1.4(12).”
16162 See @ref{8,,Implementation Defined Attributes}.
16168 “The value of the parameter to Empty for some container aggregates.
16172 As per the suggestion given in the Annotated Ada RM, the default value
16173 of the formal parameter is used if one exists and zero is used otherwise.
16179 “The maximum number of chunks for a parallel reduction expression without
16180 a chunk_specification. See 4.5.10(21).”
16183 Feature unimplemented.
16189 “Rounding of real static expressions which are exactly half-way between
16190 two machine numbers. See 4.9(38).”
16193 Round to even is used in all such cases.
16199 “The maximum number of chunks for a parallel generalized iterator without
16200 a chunk_specification. See 5.5.2(10).”
16203 Feature unimplemented.
16209 “The number of chunks for an array component iterator. See 5.5.2(11).”
16212 Feature unimplemented.
16218 “Any extensions of the Global aspect. See 6.1.2(43).”
16221 Feature unimplemented.
16227 “The circumstances the implementation passes in the null value for a view
16228 conversion of an access type used as an out parameter. See 6.4.1(19).”
16231 Difficult to characterize.
16237 “Any extensions of the Default_Initial_Condition aspect. See 7.3.3(11).”
16240 SPARK allows specifying `null' as the Default_Initial_Condition
16241 aspect of a type. See the SPARK reference manual for further details.
16247 “Any implementation-defined time types. See 9.6(6).”
16250 There are no implementation-defined time types.
16256 “The time base associated with relative delays. See 9.6(20).”
16259 See 9.6(20). The time base used is that provided by the C library
16260 function @code{gettimeofday}.
16266 “The time base of the type @code{Calendar.Time}. See 9.6(23).”
16269 The time base used is that provided by the C library function
16270 @code{gettimeofday}.
16276 “The time zone used for package @code{Calendar}
16277 operations. See 9.6(24).”
16280 The time zone used by package @code{Calendar} is the current system time zone
16281 setting for local time, as accessed by the C library function
16288 “Any limit on `delay_until_statements' of
16289 `select_statements'. See 9.6(29).”
16292 There are no such limits.
16298 “The result of Calendar.Formatting.Image if its argument represents more
16299 than 100 hours. See 9.6.1(86).”
16302 Calendar.Time_Error is raised.
16308 “Implementation-defined conflict check policies. See 9.10.1(5).”
16311 There are no implementation-defined conflict check policies.
16317 “The representation for a compilation. See 10.1(2).”
16320 A compilation is represented by a sequence of files presented to the
16321 compiler in a single invocation of the `gcc' command.
16327 “Any restrictions on compilations that contain multiple
16328 compilation_units. See 10.1(4).”
16331 No single file can contain more than one compilation unit, but any
16332 sequence of files can be presented to the compiler as a single
16339 “The mechanisms for creating an environment and for adding
16340 and replacing compilation units. See 10.1.4(3).”
16343 See separate section on compilation model.
16349 “The manner of explicitly assigning library units to a
16350 partition. See 10.2(2).”
16353 If a unit contains an Ada main program, then the Ada units for the partition
16354 are determined by recursive application of the rules in the Ada Reference
16355 Manual section 10.2(2-6). In other words, the Ada units will be those that
16356 are needed by the main program, and then this definition of need is applied
16357 recursively to those units, and the partition contains the transitive
16358 closure determined by this relationship. In short, all the necessary units
16359 are included, with no need to explicitly specify the list. If additional
16360 units are required, e.g., by foreign language units, then all units must be
16361 mentioned in the context clause of one of the needed Ada units.
16363 If the partition contains no main program, or if the main program is in
16364 a language other than Ada, then GNAT
16365 provides the binder options `-z' and `-n' respectively, and in
16366 this case a list of units can be explicitly supplied to the binder for
16367 inclusion in the partition (all units needed by these units will also
16368 be included automatically). For full details on the use of these
16369 options, refer to `GNAT Make Program gnatmake' in the
16370 @cite{GNAT User’s Guide}.
16376 “The implementation-defined means, if any, of specifying which compilation
16377 units are needed by a given compilation unit. See 10.2(2).”
16380 The units needed by a given compilation unit are as defined in
16381 the Ada Reference Manual section 10.2(2-6). There are no
16382 implementation-defined pragmas or other implementation-defined
16383 means for specifying needed units.
16389 “The manner of designating the main subprogram of a
16390 partition. See 10.2(7).”
16393 The main program is designated by providing the name of the
16394 corresponding @code{ALI} file as the input parameter to the binder.
16400 “The order of elaboration of `library_items'. See 10.2(18).”
16403 The first constraint on ordering is that it meets the requirements of
16404 Chapter 10 of the Ada Reference Manual. This still leaves some
16405 implementation-dependent choices, which are resolved by analyzing
16406 the elaboration code of each unit and identifying implicit
16407 elaboration-order dependencies.
16413 “Parameter passing and function return for the main
16414 subprogram. See 10.2(21).”
16417 The main program has no parameters. It may be a procedure, or a function
16418 returning an integer type. In the latter case, the returned integer
16419 value is the return code of the program (overriding any value that
16420 may have been set by a call to @code{Ada.Command_Line.Set_Exit_Status}).
16426 “The mechanisms for building and running partitions. See 10.2(24).”
16429 GNAT itself supports programs with only a single partition. The GNATDIST
16430 tool provided with the GLADE package (which also includes an implementation
16431 of the PCS) provides a completely flexible method for building and running
16432 programs consisting of multiple partitions. See the separate GLADE manual
16439 “The details of program execution, including program
16440 termination. See 10.2(25).”
16443 See separate section on compilation model.
16449 “The semantics of any non-active partitions supported by the
16450 implementation. See 10.2(28).”
16453 Passive partitions are supported on targets where shared memory is
16454 provided by the operating system. See the GLADE reference manual for
16461 “The information returned by @code{Exception_Message}. See 11.4.1(10).”
16464 Exception message returns the null string unless a specific message has
16465 been passed by the program.
16471 “The result of @code{Exceptions.Exception_Name} for types
16472 declared within an unnamed `block_statement'. See 11.4.1(12).”
16475 Blocks have implementation defined names of the form @code{B@var{nnn}}
16476 where `nnn' is an integer.
16482 “The information returned by
16483 @code{Exception_Information}. See 11.4.1(13).”
16486 @code{Exception_Information} returns a string in the following format:
16489 *Exception_Name:* nnnnn
16492 *Load address:* 0xhhhh
16493 *Call stack traceback locations:*
16494 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
16505 @code{nnnn} is the fully qualified name of the exception in all upper
16506 case letters. This line is always present.
16509 @code{mmmm} is the message (this line present only if message is non-null)
16512 @code{ppp} is the Process Id value as a decimal integer (this line is
16513 present only if the Process Id is nonzero). Currently we are
16514 not making use of this field.
16517 The Load address line, the Call stack traceback locations line and the
16518 following values are present only if at least one traceback location was
16519 recorded. The Load address indicates the address at which the main executable
16520 was loaded; this line may not be present if operating system hasn’t relocated
16521 the main executable. The values are given in C style format, with lower case
16522 letters for a-f, and only as many digits present as are necessary.
16523 The line terminator sequence at the end of each line, including
16524 the last line is a single @code{LF} character (@code{16#0A#}).
16532 “The sequence of characters of the value returned by
16533 Exceptions.Exception_Name (respectively, Exceptions.Wide_Exception_Name)
16534 when some of the graphic characters of Exceptions.Wide_Wide_Exception_Name
16535 are not defined in Character (respectively, Wide_Character).
16539 This is handled in the same way as the implementation-defined behavior
16540 referenced in A.4.12(34).
16546 “The information returned by Exception_Information. See 11.4.1(13).”
16549 The exception name and the source location at which the exception was
16550 raised are included.
16556 “Implementation-defined policy_identifiers and assertion_aspect_marks
16557 allowed in a pragma Assertion_Policy. See 11.4.2(9).”
16560 Implementation-defined assertion_aspect_marks include Assert_And_Cut,
16561 Assume, Contract_Cases, Debug, Ghost, Initial_Condition, Loop_Invariant,
16562 Loop_Variant, Postcondition, Precondition, Predicate, Refined_Post,
16563 Statement_Assertions, and Subprogram_Variant. Implementation-defined
16564 policy_identifiers include Ignore and Suppressible.
16570 “The default assertion policy. See 11.4.2(10).”
16573 The default assertion policy is Ignore, although this can be overridden
16574 via compiler switches such as “-gnata”.
16580 “Implementation-defined check names. See 11.5(27).”
16583 The implementation defined check names include Alignment_Check,
16584 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
16585 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
16586 program can add implementation-defined check names by means of the pragma
16587 Check_Name. See the description of pragma @code{Suppress} for full details.
16593 “Existence and meaning of second parameter of pragma Unsuppress.
16597 The legality rules for and semantics of the second parameter of pragma
16598 Unsuppress match those for the second argument of pragma Suppress.
16604 “The cases that cause conflicts between the representation of the
16605 ancestors of a type_declaration. See 13.1(13.1).”
16608 No such cases exist.
16614 “The interpretation of each representation aspect. See 13.1(20).”
16617 See separate section on data representations.
16623 “Any restrictions placed upon the specification of representation aspects.
16627 See separate section on data representations.
16633 “Implementation-defined aspects, including the syntax for specifying
16634 such aspects and the legality rules for such aspects. See 13.1.1(38).”
16637 See @ref{120,,Implementation Defined Aspects}.
16643 “The set of machine scalars. See 13.3(8.1).”
16646 See separate section on data representations.
16652 “The meaning of @code{Size} for indefinite subtypes. See 13.3(48).”
16655 The Size attribute of an indefinite subtype is not less than the Size
16656 attribute of any object of that type.
16662 “The meaning of Object_Size for indefinite subtypes. See 13.3(58).”
16665 The Object_Size attribute of an indefinite subtype is not less than the
16666 Object_Size attribute of any object of that type.
16672 “The default external representation for a type tag. See 13.3(75).”
16675 The default external representation for a type tag is the fully expanded
16676 name of the type in upper case letters.
16682 “What determines whether a compilation unit is the same in
16683 two different partitions. See 13.3(76).”
16686 A compilation unit is the same in two different partitions if and only
16687 if it derives from the same source file.
16693 “Implementation-defined components. See 13.5.1(15).”
16696 The only implementation defined component is the tag for a tagged type,
16697 which contains a pointer to the dispatching table.
16703 “If @code{Word_Size} = @code{Storage_Unit}, the default bit
16704 ordering. See 13.5.3(5).”
16707 @code{Word_Size} (32) is not the same as @code{Storage_Unit} (8) for this
16708 implementation, so no non-default bit ordering is supported. The default
16709 bit ordering corresponds to the natural endianness of the target architecture.
16715 “The contents of the visible part of package @code{System}. See 13.7(2).”
16718 See the definition of package System in @code{system.ads}.
16719 Note that two declarations are added to package System.
16722 Max_Priority : constant Positive := Priority'Last;
16723 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
16730 “The range of Storage_Elements.Storage_Offset, the modulus of
16731 Storage_Elements.Storage_Element, and the declaration of
16732 Storage_Elements.Integer_Address. See 13.7.1(11).”
16735 See the definition of package System.Storage_Elements in @code{s-stoele.ads}.
16741 “The contents of the visible part of package @code{System.Machine_Code},
16742 and the meaning of `code_statements'. See 13.8(7).”
16745 See the definition and documentation in file @code{s-maccod.ads}.
16751 “The result of unchecked conversion for instances with scalar result
16752 types whose result is not defined by the language. See 13.9(11).”
16755 Unchecked conversion between types of the same size
16756 results in an uninterpreted transmission of the bits from one type
16757 to the other. If the types are of unequal sizes, then in the case of
16758 discrete types, a shorter source is first zero or sign extended as
16759 necessary, and a shorter target is simply truncated on the left.
16760 For all non-discrete types, the source is first copied if necessary
16761 to ensure that the alignment requirements of the target are met, then
16762 a pointer is constructed to the source value, and the result is obtained
16763 by dereferencing this pointer after converting it to be a pointer to the
16764 target type. Unchecked conversions where the target subtype is an
16765 unconstrained array are not permitted. If the target alignment is
16766 greater than the source alignment, then a copy of the result is
16767 made with appropriate alignment
16773 “The result of unchecked conversion for instances with nonscalar result
16774 types whose result is not defined by the language. See 13.9(11).”
16777 See preceding definition for the scalar result case.
16783 “Whether or not the implementation provides user-accessible
16784 names for the standard pool type(s). See 13.11(17).”
16787 There are 3 different standard pools used by the compiler when
16788 @code{Storage_Pool} is not specified depending whether the type is local
16789 to a subprogram or defined at the library level and whether
16790 @code{Storage_Size`@w{`}is specified or not. See documentation in the runtime
16791 library units `@w{`}System.Pool_Global}, @code{System.Pool_Size} and
16792 @code{System.Pool_Local} in files @code{s-poosiz.ads},
16793 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
16794 default pools used. All these pools are accessible by means of @cite{with}ing
16801 “The meaning of @code{Storage_Size} when neither the Storage_Size nor the
16802 Storage_Pool is specified for an access type. See 13.11(18).”
16805 @code{Storage_Size} is measured in storage units, and refers to the
16806 total space available for an access type collection, or to the primary
16807 stack space for a task.
16813 “The effect of specifying aspect Default_Storage_Pool on an instance
16814 of a language-defined generic unit. See 13.11.3(5).”
16817 Instances of language-defined generic units are treated the same as other
16818 instances with respect to the Default_Storage_Pool aspect.
16824 “Implementation-defined restrictions allowed in a pragma
16825 @code{Restrictions}. See 13.12(8.7).”
16828 See @ref{9,,Standard and Implementation Defined Restrictions}.
16834 “The consequences of violating limitations on
16835 @code{Restrictions} pragmas. See 13.12(9).”
16838 Restrictions that can be checked at compile time are enforced at
16839 compile time; violations are illegal. For other restrictions, any
16840 violation during program execution results in erroneous execution.
16846 “Implementation-defined usage profiles allowed in a pragma Profile.
16850 See @ref{7,,Implementation Defined Pragmas}.
16856 “The contents of the stream elements read and written by the Read and
16857 Write attributes of elementary types. See 13.13.2(9).”
16860 The representation is the in-memory representation of the base type of
16861 the type, using the number of bits corresponding to the
16862 @code{type'Size} value, and the natural ordering of the machine.
16868 “The names and characteristics of the numeric subtypes
16869 declared in the visible part of package @code{Standard}. See A.1(3).”
16872 See items describing the integer and floating-point types supported.
16878 “The values returned by Strings.Hash. See A.4.9(3).”
16881 This hash function has predictable collisions and is subject to
16882 equivalent substring attacks. It is not suitable for construction of a
16883 hash table keyed on possibly malicious user input.
16889 “The value returned by a call to a Text_Buffer Get procedure if any
16890 character in the returned sequence is not defined in Character.
16894 The contents of a buffer is represented internally as a UTF_8 string.
16895 The value return by Text_Buffer.Get is the result of passing that
16896 UTF_8 string to UTF_Encoding.Strings.Decode.
16902 “The value returned by a call to a Text_Buffer Wide_Get procedure if
16903 any character in the returned sequence is not defined in Wide_Character.
16907 The contents of a buffer is represented internally as a UTF_8 string.
16908 The value return by Text_Buffer.Wide_Get is the result of passing that
16909 UTF_8 string to UTF_Encoding.Wide_Strings.Decode.
16915 “The accuracy actually achieved by the elementary
16916 functions. See A.5.1(1).”
16919 The elementary functions correspond to the functions available in the C
16920 library. Only fast math mode is implemented.
16926 “The sign of a zero result from some of the operators or
16927 functions in @code{Numerics.Generic_Elementary_Functions}, when
16928 @code{Float_Type'Signed_Zeros} is @code{True}. See A.5.1(46).”
16931 The sign of zeroes follows the requirements of the IEEE 754 standard on
16939 @code{Numerics.Float_Random.Max_Image_Width}. See A.5.2(27).”
16942 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16949 @code{Numerics.Discrete_Random.Max_Image_Width}. See A.5.2(27).”
16952 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16958 “The string representation of a random number generator’s
16959 state. See A.5.2(38).”
16962 The value returned by the Image function is the concatenation of
16963 the fixed-width decimal representations of the 624 32-bit integers
16964 of the state vector.
16970 “The values of the @code{Model_Mantissa},
16971 @code{Model_Emin}, @code{Model_Epsilon}, @code{Model},
16972 @code{Safe_First}, and @code{Safe_Last} attributes, if the Numerics
16973 Annex is not supported. See A.5.3(72).”
16976 Running the compiler with `-gnatS' to produce a listing of package
16977 @code{Standard} displays the values of these attributes.
16983 “The value of @code{Buffer_Size} in @code{Storage_IO}. See A.9(10).”
16986 All type representations are contiguous, and the @code{Buffer_Size} is
16987 the value of @code{type'Size} rounded up to the next storage unit
16994 “External files for standard input, standard output, and
16995 standard error See A.10(5).”
16998 These files are mapped onto the files provided by the C streams
16999 libraries. See source file @code{i-cstrea.ads} for further details.
17005 “The accuracy of the value produced by @code{Put}. See A.10.9(36).”
17008 If more digits are requested in the output than are represented by the
17009 precision of the value, zeroes are output in the corresponding least
17010 significant digit positions.
17016 “Current size for a stream file for which positioning is not supported.
17020 Positioning is supported.
17026 “The meaning of @code{Argument_Count}, @code{Argument}, and
17027 @code{Command_Name}. See A.15(1).”
17030 These are mapped onto the @code{argv} and @code{argc} parameters of the
17031 main program in the natural manner.
17037 “The interpretation of file names and directory names. See A.16(46).”
17040 These names are interpreted consistently with the underlying file system.
17046 “The maxium value for a file size in Directories. See A.16(87).”
17049 Directories.File_Size’Last is equal to Long_Long_Integer’Last .
17055 “The result for Directories.Size for a directory or special file.
17059 Name_Error is raised.
17065 “The result for Directories.Modification_Time for a directory or special file.
17069 Name_Error is raised.
17075 “The interpretation of a nonnull search pattern in Directories.
17079 When the @code{Pattern} parameter is not the null string, it is interpreted
17080 according to the syntax of regular expressions as defined in the
17081 @code{GNAT.Regexp} package.
17083 See @ref{25d,,GNAT.Regexp (g-regexp.ads)}.
17089 “The results of a Directories search if the contents of the directory are
17090 altered while a search is in progress. See A.16(110).”
17093 The effect of a call to Get_Next_Entry is determined by the current
17094 state of the directory.
17100 “The definition and meaning of an environment variable. See A.17(1).”
17103 This definition is determined by the underlying operating system.
17109 “The circumstances where an environment variable cannot be defined.
17112 There are no such implementation-defined circumstances.
17115 “Environment names for which Set has the effect of Clear. See A.17(17).”
17118 There are no such names.
17124 “The value of Containers.Hash_Type’Modulus. The value of
17125 Containers.Count_Type’Last. See A.18.1(7).”
17128 Containers.Hash_Type’Modulus is 2**32.
17129 Containers.Count_Type’Last is 2**31 - 1.
17135 “Implementation-defined convention names. See B.1(11).”
17138 The following convention names are supported
17141 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17164 Allowed for any types except by-reference types such as limited
17165 records. Compatible with convention Ada, but causes any parameters
17166 with this convention to be passed by copy.
17170 `Ada_Pass_By_Reference'
17174 Allowed for any types except by-copy types such as scalars.
17175 Compatible with convention Ada, but causes any parameters
17176 with this convention to be passed by reference.
17192 Synonym for Assembler
17200 Synonym for Assembler
17216 Allowed only for record types, like C, but also notes that record
17217 is to be passed by copy rather than reference.
17229 `C_Plus_Plus (or CPP)'
17241 Treated the same as C
17249 Treated the same as C
17265 For support of pragma @code{Import} with convention Intrinsic, see
17266 separate section on Intrinsic Subprograms.
17274 Stdcall (used for Windows implementations only). This convention correspond
17275 to the WINAPI (previously called Pascal convention) C/C++ convention under
17276 Windows. A routine with this convention cleans the stack before
17277 exit. This pragma cannot be applied to a dispatching call.
17285 Synonym for Stdcall
17293 Synonym for Stdcall
17301 Stubbed is a special convention used to indicate that the body of the
17302 subprogram will be entirely ignored. Any call to the subprogram
17303 is converted into a raise of the @code{Program_Error} exception. If a
17304 pragma @code{Import} specifies convention @code{stubbed} then no body need
17305 be present at all. This convention is useful during development for the
17306 inclusion of subprograms whose body has not yet been written.
17307 In addition, all otherwise unrecognized convention names are also
17308 treated as being synonymous with convention C. In all implementations,
17309 use of such other names results in a warning.
17318 “The meaning of link names. See B.1(36).”
17321 Link names are the actual names used by the linker.
17327 “The manner of choosing link names when neither the link name nor the
17328 address of an imported or exported entity is specified. See B.1(36).”
17331 The default linker name is that which would be assigned by the relevant
17332 external language, interpreting the Ada name as being in all lower case
17339 “The effect of pragma @code{Linker_Options}. See B.1(37).”
17342 The string passed to @code{Linker_Options} is presented uninterpreted as
17343 an argument to the link command, unless it contains ASCII.NUL characters.
17344 NUL characters if they appear act as argument separators, so for example
17347 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
17350 causes two separate arguments @code{-labc} and @code{-ldef} to be passed to the
17351 linker. The order of linker options is preserved for a given unit. The final
17352 list of options passed to the linker is in reverse order of the elaboration
17353 order. For example, linker options for a body always appear before the options
17354 from the corresponding package spec.
17360 “The contents of the visible part of package
17361 @code{Interfaces} and its language-defined descendants. See B.2(1).”
17364 See files with prefix @code{i-} in the distributed library.
17370 “Implementation-defined children of package
17371 @code{Interfaces}. The contents of the visible part of package
17372 @code{Interfaces}. See B.2(11).”
17375 See files with prefix @code{i-} in the distributed library.
17381 “The definitions of certain types and constants in Interfaces.C.
17385 See source file @code{i-c.ads}.
17391 “The types @code{Floating}, @code{Long_Floating},
17392 @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and
17393 @code{COBOL_Character}; and the initialization of the variables
17394 @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in
17395 @code{Interfaces.COBOL}. See B.4(50).”
17399 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17422 (Floating) Long_Float
17459 For initialization, see the file @code{i-cobol.ads} in the distributed library.
17465 “The types Fortran_Integer, Real, Double_Precision, and Character_Set
17466 in Interfaces.Fortran. See B.5(17).”
17469 See source file @code{i-fortra.ads}. These types are derived, respectively,
17470 from Integer, Float, Long_Float, and Character.
17476 “Implementation-defined intrinsic subprograms. See C.1(1).”
17479 See separate section on Intrinsic Subprograms.
17485 “Any restrictions on a protected procedure or its containing type when an
17486 aspect Attach_handler or Interrupt_Handler is specified. See C.3.1(17).”
17489 There are no such restrictions.
17495 “Any other forms of interrupt handler supported by the Attach_Handler and
17496 Interrupt_Handler aspects. See C.3.1(19).”
17499 There are no such forms.
17505 “The semantics of some attributes and functions of an entity for which
17506 aspect Discard_Names is True. See C.5(7).”
17509 If Discard_Names is True for an enumeration type, the Image attribute
17510 provides the image of the Pos of the literal, and Value accepts
17513 If both of the aspects`@w{`}Discard_Names`@w{`} and @code{No_Tagged_Streams} are true
17514 for a tagged type, its Expanded_Name and External_Tag values are
17515 empty strings. This is useful to avoid exposing entity names at binary
17522 “The modulus and size of Test_and_Set_Flag. See C.6.3(8).”
17525 The modulus is 2**8. The size is 8.
17531 “The value used to represent the set value for Atomic_Test_and_Set.
17541 “The result of the @code{Task_Identification.Image}
17542 attribute. See C.7.1(7).”
17545 The result of this attribute is a string that identifies
17546 the object or component that denotes a given task. If a variable @code{Var}
17547 has a task type, the image for this task will have the form @code{Var_@var{XXXXXXXX}},
17548 where the suffix `XXXXXXXX'
17549 is the hexadecimal representation of the virtual address of the corresponding
17550 task control block. If the variable is an array of tasks, the image of each
17551 task will have the form of an indexed component indicating the position of a
17552 given task in the array, e.g., @code{Group(5)_@var{XXXXXXX}}. If the task is a
17553 component of a record, the image of the task will have the form of a selected
17554 component. These rules are fully recursive, so that the image of a task that
17555 is a subcomponent of a composite object corresponds to the expression that
17556 designates this task.
17558 If a task is created by an allocator, its image depends on the context. If the
17559 allocator is part of an object declaration, the rules described above are used
17560 to construct its image, and this image is not affected by subsequent
17561 assignments. If the allocator appears within an expression, the image
17562 includes only the name of the task type.
17564 If the configuration pragma Discard_Names is present, or if the restriction
17565 No_Implicit_Heap_Allocation is in effect, the image reduces to
17566 the numeric suffix, that is to say the hexadecimal representation of the
17567 virtual address of the control block of the task.
17573 “The value of @code{Current_Task} when in a protected entry
17574 or interrupt handler. See C.7.1(17).”
17577 Protected entries or interrupt handlers can be executed by any
17578 convenient thread, so the value of @code{Current_Task} is undefined.
17584 “Granularity of locking for Task_Attributes. See C.7.2(16).”
17587 No locking is needed if the formal type Attribute has the size and
17588 alignment of either Integer or System.Address and the bit representation
17589 of Initial_Value is all zeroes. Otherwise, locking is performed.
17595 “The declarations of @code{Any_Priority} and
17596 @code{Priority}. See D.1(11).”
17599 See declarations in file @code{system.ads}.
17605 “Implementation-defined execution resources. See D.1(15).”
17608 There are no implementation-defined execution resources.
17614 “Whether, on a multiprocessor, a task that is waiting for
17615 access to a protected object keeps its processor busy. See D.2.1(3).”
17618 On a multi-processor, a task that is waiting for access to a protected
17619 object does not keep its processor busy.
17625 “The affect of implementation defined execution resources
17626 on task dispatching. See D.2.1(9).”
17629 Tasks map to threads in the threads package used by GNAT. Where possible
17630 and appropriate, these threads correspond to native threads of the
17631 underlying operating system.
17637 “Implementation-defined task dispatching policies. See D.2.2(3).”
17640 There are no implementation-defined task dispatching policies.
17646 “The value of Default_Quantum in Dispatching.Round_Robin. See D.2.5(4).”
17649 The value is 10 milliseconds.
17655 “Implementation-defined `policy_identifiers' allowed
17656 in a pragma @code{Locking_Policy}. See D.3(4).”
17659 The two implementation defined policies permitted in GNAT are
17660 @code{Inheritance_Locking} and @code{Concurrent_Readers_Locking}. On
17661 targets that support the @code{Inheritance_Locking} policy, locking is
17662 implemented by inheritance, i.e., the task owning the lock operates
17663 at a priority equal to the highest priority of any task currently
17664 requesting the lock. On targets that support the
17665 @code{Concurrent_Readers_Locking} policy, locking is implemented with a
17666 read/write lock allowing multiple protected object functions to enter
17673 “Default ceiling priorities. See D.3(10).”
17676 The ceiling priority of protected objects of the type
17677 @code{System.Interrupt_Priority'Last} as described in the Ada
17678 Reference Manual D.3(10),
17684 “The ceiling of any protected object used internally by
17685 the implementation. See D.3(16).”
17688 The ceiling priority of internal protected objects is
17689 @code{System.Priority'Last}.
17695 “Implementation-defined queuing policies. See D.4(1).”
17698 There are no implementation-defined queuing policies.
17704 “Implementation-defined admission policies. See D.4.1(1).”
17707 There are no implementation-defined admission policies.
17713 “Any operations that implicitly require heap storage
17714 allocation. See D.7(8).”
17717 The only operation that implicitly requires heap storage allocation is
17724 “When restriction No_Dynamic_CPU_Assignment applies to a partition, the
17725 processor on which a task with a CPU value of a Not_A_Specific_CPU will
17726 execute. See D.7(10).”
17735 “When restriction No_Task_Termination applies to a partition, what happens
17736 when a task terminates. See D.7(15.1).”
17739 Execution is erroneous in that case.
17745 “The behavior when restriction Max_Storage_At_Blocking is violated.
17749 Execution is erroneous in that case.
17755 “The behavior when restriction Max_Asynchronous_Select_Nesting is violated.
17759 Execution is erroneous in that case.
17765 “The behavior when restriction Max_Tasks is violated. See D.7(19).”
17768 Execution is erroneous in that case.
17774 “Whether the use of pragma Restrictions results in a reduction in program
17775 code or data size or execution time. See D.7(20).”
17777 Yes it can, but the precise circumstances and properties of such reductions
17778 are difficult to characterize.
17781 “The value of Barrier_Limit’Last in Synchronous_Barriers. See D.10.1(4).”
17784 Synchronous_Barriers.Barrier_Limit’Last is Integer’Last .
17790 “When an aborted task that is waiting on a Synchronous_Barrier is aborted.
17794 Difficult to characterize.
17800 “The value of Min_Handler_Ceiling in Execution_Time.Group_Budgets.
17804 See source file @code{a-etgrbu.ads}.
17810 “The value of CPU_Range’Last in System.Multiprocessors. See D.16(4).”
17813 See source file @code{s-multip.ads}.
17819 “The processor on which the environment task executes in the absence
17820 of a value for the aspect CPU. See D.16(13).”
17829 “The means for creating and executing distributed
17830 programs. See E(5).”
17833 The GLADE package provides a utility GNATDIST for creating and executing
17834 distributed programs. See the GLADE reference manual for further details.
17840 “Any events that can result in a partition becoming
17841 inaccessible. See E.1(7).”
17844 See the GLADE reference manual for full details on such events.
17850 “The scheduling policies, treatment of priorities, and management of
17851 shared resources between partitions in certain cases. See E.1(11).”
17854 See the GLADE reference manual for full details on these aspects of
17855 multi-partition execution.
17861 “Whether the execution of the remote subprogram is
17862 immediately aborted as a result of cancellation. See E.4(13).”
17865 See the GLADE reference manual for details on the effect of abort in
17866 a distributed application.
17872 “The range of type System.RPC.Partition_Id. See E.5(14).”
17875 System.RPC.Partion_ID’Last is Integer’Last. See source file @code{s-rpc.ads}.
17881 “Implementation-defined interfaces in the PCS. See E.5(26).”
17884 See the GLADE reference manual for a full description of all
17885 implementation defined interfaces.
17891 “The values of named numbers in the package
17892 @code{Decimal}. See F.2(7).”
17896 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx}
17939 `Max_Decimal_Digits'
17952 “The value of @code{Max_Picture_Length} in the package
17953 @code{Text_IO.Editing}. See F.3.3(16).”
17958 “The value of @code{Max_Picture_Length} in the package
17959 @code{Wide_Text_IO.Editing}. See F.3.4(5).”
17964 “The accuracy actually achieved by the complex elementary
17965 functions and by other complex arithmetic operations. See G.1(1).”
17968 Standard library functions are used for the complex arithmetic
17969 operations. Only fast math mode is currently supported.
17975 “The sign of a zero result (or a component thereof) from
17976 any operator or function in @code{Numerics.Generic_Complex_Types}, when
17977 @code{Real'Signed_Zeros} is True. See G.1.1(53).”
17980 The signs of zero values are as recommended by the relevant
17981 implementation advice.
17987 “The sign of a zero result (or a component thereof) from
17988 any operator or function in
17989 @code{Numerics.Generic_Complex_Elementary_Functions}, when
17990 @code{Real'Signed_Zeros} is @code{True}. See G.1.2(45).”
17993 The signs of zero values are as recommended by the relevant
17994 implementation advice.
18000 “Whether the strict mode or the relaxed mode is the
18001 default. See G.2(2).”
18004 The strict mode is the default. There is no separate relaxed mode. GNAT
18005 provides a highly efficient implementation of strict mode.
18011 “The result interval in certain cases of fixed-to-float
18012 conversion. See G.2.1(10).”
18015 For cases where the result interval is implementation dependent, the
18016 accuracy is that provided by performing all operations in 64-bit IEEE
18017 floating-point format.
18023 “The result of a floating point arithmetic operation in
18024 overflow situations, when the @code{Machine_Overflows} attribute of the
18025 result type is @code{False}. See G.2.1(13).”
18028 Infinite and NaN values are produced as dictated by the IEEE
18029 floating-point standard.
18030 Note that on machines that are not fully compliant with the IEEE
18031 floating-point standard, such as Alpha, the `-mieee' compiler flag
18032 must be used for achieving IEEE conforming behavior (although at the cost
18033 of a significant performance penalty), so infinite and NaN values are
18034 properly generated.
18040 “The result interval for division (or exponentiation by a
18041 negative exponent), when the floating point hardware implements division
18042 as multiplication by a reciprocal. See G.2.1(16).”
18045 Not relevant, division is IEEE exact.
18051 “The definition of close result set, which determines the accuracy of
18052 certain fixed point multiplications and divisions. See G.2.3(5).”
18055 Operations in the close result set are performed using IEEE long format
18056 floating-point arithmetic. The input operands are converted to
18057 floating-point, the operation is done in floating-point, and the result
18058 is converted to the target type.
18064 “Conditions on a `universal_real' operand of a fixed
18065 point multiplication or division for which the result shall be in the
18066 perfect result set. See G.2.3(22).”
18069 The result is only defined to be in the perfect result set if the result
18070 can be computed by a single scaling operation involving a scale factor
18071 representable in 64 bits.
18077 “The result of a fixed point arithmetic operation in
18078 overflow situations, when the @code{Machine_Overflows} attribute of the
18079 result type is @code{False}. See G.2.3(27).”
18082 Not relevant, @code{Machine_Overflows} is @code{True} for fixed-point
18089 “The result of an elementary function reference in
18090 overflow situations, when the @code{Machine_Overflows} attribute of the
18091 result type is @code{False}. See G.2.4(4).”
18094 IEEE infinite and Nan values are produced as appropriate.
18100 “The value of the angle threshold, within which certain
18101 elementary functions, complex arithmetic operations, and complex
18102 elementary functions yield results conforming to a maximum relative
18103 error bound. See G.2.4(10).”
18106 Information on this subject is not yet available.
18112 “The accuracy of certain elementary functions for
18113 parameters beyond the angle threshold. See G.2.4(10).”
18116 Information on this subject is not yet available.
18122 “The result of a complex arithmetic operation or complex
18123 elementary function reference in overflow situations, when the
18124 @code{Machine_Overflows} attribute of the corresponding real type is
18125 @code{False}. See G.2.6(5).”
18128 IEEE infinite and Nan values are produced as appropriate.
18134 “The accuracy of certain complex arithmetic operations and
18135 certain complex elementary functions for parameters (or components
18136 thereof) beyond the angle threshold. See G.2.6(8).”
18139 Information on those subjects is not yet available.
18145 “The accuracy requirements for the subprograms Solve, Inverse,
18146 Determinant, Eigenvalues and Eigensystem for type Real_Matrix.
18150 Information on those subjects is not yet available.
18156 “The accuracy requirements for the subprograms Solve, Inverse,
18157 Determinant, Eigenvalues and Eigensystem for type Complex_Matrix.
18161 Information on those subjects is not yet available.
18167 “The consequences of violating No_Hidden_Indirect_Globals. See H.4(23.9).”
18170 Execution is erroneous in that case.
18172 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
18173 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{25e}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{25f}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}
18174 @chapter Intrinsic Subprograms
18177 @geindex Intrinsic Subprograms
18179 GNAT allows a user application program to write the declaration:
18182 pragma Import (Intrinsic, name);
18185 providing that the name corresponds to one of the implemented intrinsic
18186 subprograms in GNAT, and that the parameter profile of the referenced
18187 subprogram meets the requirements. This chapter describes the set of
18188 implemented intrinsic subprograms, and the requirements on parameter profiles.
18189 Note that no body is supplied; as with other uses of pragma Import, the
18190 body is supplied elsewhere (in this case by the compiler itself). Note
18191 that any use of this feature is potentially non-portable, since the
18192 Ada standard does not require Ada compilers to implement this feature.
18195 * Intrinsic Operators::
18196 * Compilation_ISO_Date::
18197 * Compilation_Date::
18198 * Compilation_Time::
18199 * Enclosing_Entity::
18200 * Exception_Information::
18201 * Exception_Message::
18205 * Shifts and Rotates::
18206 * Source_Location::
18210 @node Intrinsic Operators,Compilation_ISO_Date,,Intrinsic Subprograms
18211 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{260}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{261}
18212 @section Intrinsic Operators
18215 @geindex Intrinsic operator
18217 All the predefined numeric operators in package Standard
18218 in @code{pragma Import (Intrinsic,..)}
18219 declarations. In the binary operator case, the operands must have the same
18220 size. The operand or operands must also be appropriate for
18221 the operator. For example, for addition, the operands must
18222 both be floating-point or both be fixed-point, and the
18223 right operand for @code{"**"} must have a root type of
18224 @code{Standard.Integer'Base}.
18225 You can use an intrinsic operator declaration as in the following example:
18228 type Int1 is new Integer;
18229 type Int2 is new Integer;
18231 function "+" (X1 : Int1; X2 : Int2) return Int1;
18232 function "+" (X1 : Int1; X2 : Int2) return Int2;
18233 pragma Import (Intrinsic, "+");
18236 This declaration would permit ‘mixed mode’ arithmetic on items
18237 of the differing types @code{Int1} and @code{Int2}.
18238 It is also possible to specify such operators for private types, if the
18239 full views are appropriate arithmetic types.
18241 @node Compilation_ISO_Date,Compilation_Date,Intrinsic Operators,Intrinsic Subprograms
18242 @anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{262}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{263}
18243 @section Compilation_ISO_Date
18246 @geindex Compilation_ISO_Date
18248 This intrinsic subprogram is used in the implementation of the
18249 library package @code{GNAT.Source_Info}. The only useful use of the
18250 intrinsic import in this case is the one in this unit, so an
18251 application program should simply call the function
18252 @code{GNAT.Source_Info.Compilation_ISO_Date} to obtain the date of
18253 the current compilation (in local time format YYYY-MM-DD).
18255 @node Compilation_Date,Compilation_Time,Compilation_ISO_Date,Intrinsic Subprograms
18256 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{264}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{265}
18257 @section Compilation_Date
18260 @geindex Compilation_Date
18262 Same as Compilation_ISO_Date, except the string is in the form
18265 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
18266 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{266}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{267}
18267 @section Compilation_Time
18270 @geindex Compilation_Time
18272 This intrinsic subprogram is used in the implementation of the
18273 library package @code{GNAT.Source_Info}. The only useful use of the
18274 intrinsic import in this case is the one in this unit, so an
18275 application program should simply call the function
18276 @code{GNAT.Source_Info.Compilation_Time} to obtain the time of
18277 the current compilation (in local time format HH:MM:SS).
18279 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
18280 @anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{268}@anchor{gnat_rm/intrinsic_subprograms id6}@anchor{269}
18281 @section Enclosing_Entity
18284 @geindex Enclosing_Entity
18286 This intrinsic subprogram is used in the implementation of the
18287 library package @code{GNAT.Source_Info}. The only useful use of the
18288 intrinsic import in this case is the one in this unit, so an
18289 application program should simply call the function
18290 @code{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
18291 the current subprogram, package, task, entry, or protected subprogram.
18293 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
18294 @anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{26a}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{26b}
18295 @section Exception_Information
18298 @geindex Exception_Information'
18300 This intrinsic subprogram is used in the implementation of the
18301 library package @code{GNAT.Current_Exception}. The only useful
18302 use of the intrinsic import in this case is the one in this unit,
18303 so an application program should simply call the function
18304 @code{GNAT.Current_Exception.Exception_Information} to obtain
18305 the exception information associated with the current exception.
18307 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
18308 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{26c}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{26d}
18309 @section Exception_Message
18312 @geindex Exception_Message
18314 This intrinsic subprogram is used in the implementation of the
18315 library package @code{GNAT.Current_Exception}. The only useful
18316 use of the intrinsic import in this case is the one in this unit,
18317 so an application program should simply call the function
18318 @code{GNAT.Current_Exception.Exception_Message} to obtain
18319 the message associated with the current exception.
18321 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
18322 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{26e}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{26f}
18323 @section Exception_Name
18326 @geindex Exception_Name
18328 This intrinsic subprogram is used in the implementation of the
18329 library package @code{GNAT.Current_Exception}. The only useful
18330 use of the intrinsic import in this case is the one in this unit,
18331 so an application program should simply call the function
18332 @code{GNAT.Current_Exception.Exception_Name} to obtain
18333 the name of the current exception.
18335 @node File,Line,Exception_Name,Intrinsic Subprograms
18336 @anchor{gnat_rm/intrinsic_subprograms file}@anchor{270}@anchor{gnat_rm/intrinsic_subprograms id10}@anchor{271}
18342 This intrinsic subprogram is used in the implementation of the
18343 library package @code{GNAT.Source_Info}. The only useful use of the
18344 intrinsic import in this case is the one in this unit, so an
18345 application program should simply call the function
18346 @code{GNAT.Source_Info.File} to obtain the name of the current
18349 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
18350 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{272}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{273}
18356 This intrinsic subprogram is used in the implementation of the
18357 library package @code{GNAT.Source_Info}. The only useful use of the
18358 intrinsic import in this case is the one in this unit, so an
18359 application program should simply call the function
18360 @code{GNAT.Source_Info.Line} to obtain the number of the current
18363 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
18364 @anchor{gnat_rm/intrinsic_subprograms id12}@anchor{274}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{275}
18365 @section Shifts and Rotates
18368 @geindex Shift_Left
18370 @geindex Shift_Right
18372 @geindex Shift_Right_Arithmetic
18374 @geindex Rotate_Left
18376 @geindex Rotate_Right
18378 In standard Ada, the shift and rotate functions are available only
18379 for the predefined modular types in package @code{Interfaces}. However, in
18380 GNAT it is possible to define these functions for any integer
18381 type (signed or modular), as in this example:
18384 function Shift_Left
18386 Amount : Natural) return T
18387 with Import, Convention => Intrinsic;
18390 The function name must be one of
18391 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
18392 Rotate_Right. T must be an integer type. T’Size must be
18393 8, 16, 32 or 64 bits; if T is modular, the modulus
18394 must be 2**8, 2**16, 2**32 or 2**64.
18395 The result type must be the same as the type of @code{Value}.
18396 The shift amount must be Natural.
18397 The formal parameter names can be anything.
18399 A more convenient way of providing these shift operators is to use the
18400 Provide_Shift_Operators pragma, which provides the function declarations and
18401 corresponding pragma Import’s for all five shift functions. For signed types
18402 the semantics of these operators is to interpret the bitwise result of the
18403 corresponding operator for modular type. In particular, shifting a negative
18404 number may change its sign bit to positive.
18406 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
18407 @anchor{gnat_rm/intrinsic_subprograms id13}@anchor{276}@anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{277}
18408 @section Source_Location
18411 @geindex Source_Location
18413 This intrinsic subprogram is used in the implementation of the
18414 library routine @code{GNAT.Source_Info}. The only useful use of the
18415 intrinsic import in this case is the one in this unit, so an
18416 application program should simply call the function
18417 @code{GNAT.Source_Info.Source_Location} to obtain the current
18418 source file location.
18420 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
18421 @anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{278}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{279}@anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}
18422 @chapter Representation Clauses and Pragmas
18425 @geindex Representation Clauses
18427 @geindex Representation Clause
18429 @geindex Representation Pragma
18432 @geindex representation
18434 This section describes the representation clauses accepted by GNAT, and
18435 their effect on the representation of corresponding data objects.
18437 GNAT fully implements Annex C (Systems Programming). This means that all
18438 the implementation advice sections in chapter 13 are fully implemented.
18439 However, these sections only require a minimal level of support for
18440 representation clauses. GNAT provides much more extensive capabilities,
18441 and this section describes the additional capabilities provided.
18444 * Alignment Clauses::
18446 * Storage_Size Clauses::
18447 * Size of Variant Record Objects::
18448 * Biased Representation::
18449 * Value_Size and Object_Size Clauses::
18450 * Component_Size Clauses::
18451 * Bit_Order Clauses::
18452 * Effect of Bit_Order on Byte Ordering::
18453 * Pragma Pack for Arrays::
18454 * Pragma Pack for Records::
18455 * Record Representation Clauses::
18456 * Handling of Records with Holes::
18457 * Enumeration Clauses::
18458 * Address Clauses::
18459 * Use of Address Clauses for Memory-Mapped I/O::
18460 * Effect of Convention on Representation::
18461 * Conventions and Anonymous Access Types::
18462 * Determining the Representations chosen by GNAT::
18466 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
18467 @anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{27a}@anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{27b}
18468 @section Alignment Clauses
18471 @geindex Alignment Clause
18473 GNAT requires that all alignment clauses specify 0 or a power of 2, and
18474 all default alignments are always a power of 2. Specifying 0 is the
18475 same as specifying 1.
18477 The default alignment values are as follows:
18483 `Elementary Types'.
18485 For elementary types, the alignment is the minimum of the actual size of
18486 objects of the type divided by @code{Storage_Unit},
18487 and the maximum alignment supported by the target.
18488 (This maximum alignment is given by the GNAT-specific attribute
18489 @code{Standard'Maximum_Alignment}; see @ref{18d,,Attribute Maximum_Alignment}.)
18491 @geindex Maximum_Alignment attribute
18493 For example, for type @code{Long_Float}, the object size is 8 bytes, and the
18494 default alignment will be 8 on any target that supports alignments
18495 this large, but on some targets, the maximum alignment may be smaller
18496 than 8, in which case objects of type @code{Long_Float} will be maximally
18502 For arrays, the alignment is equal to the alignment of the component type
18503 for the normal case where no packing or component size is given. If the
18504 array is packed, and the packing is effective (see separate section on
18505 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
18506 arrays or arrays whose length is not known at compile time, depending on
18507 whether the component size is divisible by 4, 2, or is odd. For short packed
18508 arrays, which are handled internally as modular types, the alignment
18509 will be as described for elementary types, e.g. a packed array of length
18510 31 bits will have an object size of four bytes, and an alignment of 4.
18515 For the normal unpacked case, the alignment of a record is equal to
18516 the maximum alignment of any of its components. For tagged records, this
18517 includes the implicit access type used for the tag. If a pragma @code{Pack}
18518 is used and all components are packable (see separate section on pragma
18519 @code{Pack}), then the resulting alignment is 1, unless the layout of the
18520 record makes it profitable to increase it.
18522 A special case is when:
18528 the size of the record is given explicitly, or a
18529 full record representation clause is given, and
18532 the size of the record is 2, 4, or 8 bytes.
18535 In this case, an alignment is chosen to match the
18536 size of the record. For example, if we have:
18539 type Small is record
18542 for Small'Size use 16;
18545 then the default alignment of the record type @code{Small} is 2, not 1. This
18546 leads to more efficient code when the record is treated as a unit, and also
18547 allows the type to specified as @code{Atomic} on architectures requiring
18551 An alignment clause may specify a larger alignment than the default value
18552 up to some maximum value dependent on the target (obtainable by using the
18553 attribute reference @code{Standard'Maximum_Alignment}). It may also specify
18554 a smaller alignment than the default value for enumeration, integer and
18555 fixed point types, as well as for record types, for example
18562 for V'alignment use 1;
18568 The default alignment for the type @code{V} is 4, as a result of the
18569 Integer field in the record, but it is permissible, as shown, to
18570 override the default alignment of the record with a smaller value.
18575 Note that according to the Ada standard, an alignment clause applies only
18576 to the first named subtype. If additional subtypes are declared, then the
18577 compiler is allowed to choose any alignment it likes, and there is no way
18578 to control this choice. Consider:
18581 type R is range 1 .. 10_000;
18582 for R'Alignment use 1;
18583 subtype RS is R range 1 .. 1000;
18586 The alignment clause specifies an alignment of 1 for the first named subtype
18587 @code{R} but this does not necessarily apply to @code{RS}. When writing
18588 portable Ada code, you should avoid writing code that explicitly or
18589 implicitly relies on the alignment of such subtypes.
18591 For the GNAT compiler, if an explicit alignment clause is given, this
18592 value is also used for any subsequent subtypes. So for GNAT, in the
18593 above example, you can count on the alignment of @code{RS} being 1. But this
18594 assumption is non-portable, and other compilers may choose different
18595 alignments for the subtype @code{RS}.
18597 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
18598 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{27c}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{27d}
18599 @section Size Clauses
18602 @geindex Size Clause
18604 The default size for a type @code{T} is obtainable through the
18605 language-defined attribute @code{T'Size} and also through the
18606 equivalent GNAT-defined attribute @code{T'Value_Size}.
18607 For objects of type @code{T}, GNAT will generally increase the type size
18608 so that the object size (obtainable through the GNAT-defined attribute
18609 @code{T'Object_Size})
18610 is a multiple of @code{T'Alignment * Storage_Unit}.
18615 type Smallint is range 1 .. 6;
18623 In this example, @code{Smallint'Size} = @code{Smallint'Value_Size} = 3,
18624 as specified by the RM rules,
18625 but objects of this type will have a size of 8
18626 (@code{Smallint'Object_Size} = 8),
18627 since objects by default occupy an integral number
18628 of storage units. On some targets, notably older
18629 versions of the Digital Alpha, the size of stand
18630 alone objects of this type may be 32, reflecting
18631 the inability of the hardware to do byte load/stores.
18633 Similarly, the size of type @code{Rec} is 40 bits
18634 (@code{Rec'Size} = @code{Rec'Value_Size} = 40), but
18635 the alignment is 4, so objects of this type will have
18636 their size increased to 64 bits so that it is a multiple
18637 of the alignment (in bits). This decision is
18638 in accordance with the specific Implementation Advice in RM 13.3(43):
18642 “A @code{Size} clause should be supported for an object if the specified
18643 @code{Size} is at least as large as its subtype’s @code{Size}, and corresponds
18644 to a size in storage elements that is a multiple of the object’s
18645 @code{Alignment} (if the @code{Alignment} is nonzero).”
18648 An explicit size clause may be used to override the default size by
18649 increasing it. For example, if we have:
18652 type My_Boolean is new Boolean;
18653 for My_Boolean'Size use 32;
18656 then values of this type will always be 32-bit long. In the case of discrete
18657 types, the size can be increased up to 64 bits on 32-bit targets and 128 bits
18658 on 64-bit targets, with the effect that the entire specified field is used to
18659 hold the value, sign- or zero-extended as appropriate. If more than 64 bits
18660 or 128 bits resp. is specified, then padding space is allocated after the
18661 value, and a warning is issued that there are unused bits.
18663 Similarly the size of records and arrays may be increased, and the effect
18664 is to add padding bits after the value. This also causes a warning message
18667 The largest Size value permitted in GNAT is 2**31-1. Since this is a
18668 Size in bits, this corresponds to an object of size 256 megabytes (minus
18669 one). This limitation is true on all targets. The reason for this
18670 limitation is that it improves the quality of the code in many cases
18671 if it is known that a Size value can be accommodated in an object of
18674 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
18675 @anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{27e}@anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{27f}
18676 @section Storage_Size Clauses
18679 @geindex Storage_Size Clause
18681 For tasks, the @code{Storage_Size} clause specifies the amount of space
18682 to be allocated for the task stack. This cannot be extended, and if the
18683 stack is exhausted, then @code{Storage_Error} will be raised (if stack
18684 checking is enabled). Use a @code{Storage_Size} attribute definition clause,
18685 or a @code{Storage_Size} pragma in the task definition to set the
18686 appropriate required size. A useful technique is to include in every
18687 task definition a pragma of the form:
18690 pragma Storage_Size (Default_Stack_Size);
18693 Then @code{Default_Stack_Size} can be defined in a global package, and
18694 modified as required. Any tasks requiring stack sizes different from the
18695 default can have an appropriate alternative reference in the pragma.
18697 You can also use the `-d' binder switch to modify the default stack
18700 For access types, the @code{Storage_Size} clause specifies the maximum
18701 space available for allocation of objects of the type. If this space is
18702 exceeded then @code{Storage_Error} will be raised by an allocation attempt.
18703 In the case where the access type is declared local to a subprogram, the
18704 use of a @code{Storage_Size} clause triggers automatic use of a special
18705 predefined storage pool (@code{System.Pool_Size}) that ensures that all
18706 space for the pool is automatically reclaimed on exit from the scope in
18707 which the type is declared.
18709 A special case recognized by the compiler is the specification of a
18710 @code{Storage_Size} of zero for an access type. This means that no
18711 items can be allocated from the pool, and this is recognized at compile
18712 time, and all the overhead normally associated with maintaining a fixed
18713 size storage pool is eliminated. Consider the following example:
18717 type R is array (Natural) of Character;
18718 type P is access all R;
18719 for P'Storage_Size use 0;
18720 -- Above access type intended only for interfacing purposes
18724 procedure g (m : P);
18725 pragma Import (C, g);
18735 As indicated in this example, these dummy storage pools are often useful in
18736 connection with interfacing where no object will ever be allocated. If you
18737 compile the above example, you get the warning:
18740 p.adb:16:09: warning: allocation from empty storage pool
18741 p.adb:16:09: warning: Storage_Error will be raised at run time
18744 Of course in practice, there will not be any explicit allocators in the
18745 case of such an access declaration.
18747 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
18748 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{280}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{281}
18749 @section Size of Variant Record Objects
18753 @geindex variant record objects
18755 @geindex Variant record objects
18758 In the case of variant record objects, there is a question whether Size gives
18759 information about a particular variant, or the maximum size required
18760 for any variant. Consider the following program
18763 with Text_IO; use Text_IO;
18765 type R1 (A : Boolean := False) is record
18767 when True => X : Character;
18768 when False => null;
18776 Put_Line (Integer'Image (V1'Size));
18777 Put_Line (Integer'Image (V2'Size));
18781 Here we are dealing with a variant record, where the True variant
18782 requires 16 bits, and the False variant requires 8 bits.
18783 In the above example, both V1 and V2 contain the False variant,
18784 which is only 8 bits long. However, the result of running the
18792 The reason for the difference here is that the discriminant value of
18793 V1 is fixed, and will always be False. It is not possible to assign
18794 a True variant value to V1, therefore 8 bits is sufficient. On the
18795 other hand, in the case of V2, the initial discriminant value is
18796 False (from the default), but it is possible to assign a True
18797 variant value to V2, therefore 16 bits must be allocated for V2
18798 in the general case, even fewer bits may be needed at any particular
18799 point during the program execution.
18801 As can be seen from the output of this program, the @code{'Size}
18802 attribute applied to such an object in GNAT gives the actual allocated
18803 size of the variable, which is the largest size of any of the variants.
18804 The Ada Reference Manual is not completely clear on what choice should
18805 be made here, but the GNAT behavior seems most consistent with the
18806 language in the RM.
18808 In some cases, it may be desirable to obtain the size of the current
18809 variant, rather than the size of the largest variant. This can be
18810 achieved in GNAT by making use of the fact that in the case of a
18811 subprogram parameter, GNAT does indeed return the size of the current
18812 variant (because a subprogram has no way of knowing how much space
18813 is actually allocated for the actual).
18815 Consider the following modified version of the above program:
18818 with Text_IO; use Text_IO;
18820 type R1 (A : Boolean := False) is record
18822 when True => X : Character;
18823 when False => null;
18829 function Size (V : R1) return Integer is
18835 Put_Line (Integer'Image (V2'Size));
18836 Put_Line (Integer'Image (Size (V2)));
18838 Put_Line (Integer'Image (V2'Size));
18839 Put_Line (Integer'Image (Size (V2)));
18843 The output from this program is
18852 Here we see that while the @code{'Size} attribute always returns
18853 the maximum size, regardless of the current variant value, the
18854 @code{Size} function does indeed return the size of the current
18857 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18858 @anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{282}@anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{283}
18859 @section Biased Representation
18862 @geindex Size for biased representation
18864 @geindex Biased representation
18866 In the case of scalars with a range starting at other than zero, it is
18867 possible in some cases to specify a size smaller than the default minimum
18868 value, and in such cases, GNAT uses an unsigned biased representation,
18869 in which zero is used to represent the lower bound, and successive values
18870 represent successive values of the type.
18872 For example, suppose we have the declaration:
18875 type Small is range -7 .. -4;
18876 for Small'Size use 2;
18879 Although the default size of type @code{Small} is 4, the @code{Size}
18880 clause is accepted by GNAT and results in the following representation
18884 -7 is represented as 2#00#
18885 -6 is represented as 2#01#
18886 -5 is represented as 2#10#
18887 -4 is represented as 2#11#
18890 Biased representation is only used if the specified @code{Size} clause
18891 cannot be accepted in any other manner. These reduced sizes that force
18892 biased representation can be used for all discrete types except for
18893 enumeration types for which a representation clause is given.
18895 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
18896 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{284}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{285}
18897 @section Value_Size and Object_Size Clauses
18900 @geindex Value_Size
18902 @geindex Object_Size
18905 @geindex of objects
18907 In Ada 95 and Ada 2005, @code{T'Size} for a type @code{T} is the minimum
18908 number of bits required to hold values of type @code{T}.
18909 Although this interpretation was allowed in Ada 83, it was not required,
18910 and this requirement in practice can cause some significant difficulties.
18911 For example, in most Ada 83 compilers, @code{Natural'Size} was 32.
18912 However, in Ada 95 and Ada 2005,
18913 @code{Natural'Size} is
18914 typically 31. This means that code may change in behavior when moving
18915 from Ada 83 to Ada 95 or Ada 2005. For example, consider:
18924 A at 0 range 0 .. Natural'Size - 1;
18925 B at 0 range Natural'Size .. 2 * Natural'Size - 1;
18929 In the above code, since the typical size of @code{Natural} objects
18930 is 32 bits and @code{Natural'Size} is 31, the above code can cause
18931 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
18932 there are cases where the fact that the object size can exceed the
18933 size of the type causes surprises.
18935 To help get around this problem GNAT provides two implementation
18936 defined attributes, @code{Value_Size} and @code{Object_Size}. When
18937 applied to a type, these attributes yield the size of the type
18938 (corresponding to the RM defined size attribute), and the size of
18939 objects of the type respectively.
18941 The @code{Object_Size} is used for determining the default size of
18942 objects and components. This size value can be referred to using the
18943 @code{Object_Size} attribute. The phrase ‘is used’ here means that it is
18944 the basis of the determination of the size. The backend is free to
18945 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
18946 character might be stored in 32 bits on a machine with no efficient
18947 byte access instructions such as the Alpha.
18949 The default rules for the value of @code{Object_Size} for
18950 discrete types are as follows:
18956 The @code{Object_Size} for base subtypes reflect the natural hardware
18957 size in bits (run the compiler with `-gnatS' to find those values
18958 for numeric types). Enumeration types and fixed-point base subtypes have
18959 8, 16, 32, or 64 bits for this size, depending on the range of values
18963 The @code{Object_Size} of a subtype is the same as the
18964 @code{Object_Size} of
18965 the type from which it is obtained.
18968 The @code{Object_Size} of a derived base type is copied from the parent
18969 base type, and the @code{Object_Size} of a derived first subtype is copied
18970 from the parent first subtype.
18973 The @code{Value_Size} attribute
18974 is the (minimum) number of bits required to store a value
18976 This value is used to determine how tightly to pack
18977 records or arrays with components of this type, and also affects
18978 the semantics of unchecked conversion (unchecked conversions where
18979 the @code{Value_Size} values differ generate a warning, and are potentially
18982 The default rules for the value of @code{Value_Size} are as follows:
18988 The @code{Value_Size} for a base subtype is the minimum number of bits
18989 required to store all values of the type (including the sign bit
18990 only if negative values are possible).
18993 If a subtype statically matches the first subtype of a given type, then it has
18994 by default the same @code{Value_Size} as the first subtype. (This is a
18995 consequence of RM 13.1(14): “if two subtypes statically match,
18996 then their subtype-specific aspects are the same”.)
18999 All other subtypes have a @code{Value_Size} corresponding to the minimum
19000 number of bits required to store all values of the subtype. For
19001 dynamic bounds, it is assumed that the value can range down or up
19002 to the corresponding bound of the ancestor
19005 The RM defined attribute @code{Size} corresponds to the
19006 @code{Value_Size} attribute.
19008 The @code{Size} attribute may be defined for a first-named subtype. This sets
19009 the @code{Value_Size} of
19010 the first-named subtype to the given value, and the
19011 @code{Object_Size} of this first-named subtype to the given value padded up
19012 to an appropriate boundary. It is a consequence of the default rules
19013 above that this @code{Object_Size} will apply to all further subtypes. On the
19014 other hand, @code{Value_Size} is affected only for the first subtype, any
19015 dynamic subtypes obtained from it directly, and any statically matching
19016 subtypes. The @code{Value_Size} of any other static subtypes is not affected.
19018 @code{Value_Size} and
19019 @code{Object_Size} may be explicitly set for any subtype using
19020 an attribute definition clause. Note that the use of these attributes
19021 can cause the RM 13.1(14) rule to be violated. If two access types
19022 reference aliased objects whose subtypes have differing @code{Object_Size}
19023 values as a result of explicit attribute definition clauses, then it
19024 is illegal to convert from one access subtype to the other. For a more
19025 complete description of this additional legality rule, see the
19026 description of the @code{Object_Size} attribute.
19028 To get a feel for the difference, consider the following examples (note
19029 that in each case the base is @code{Short_Short_Integer} with a size of 8):
19032 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx}
19035 Type or subtype declaration
19047 @code{type x1 is range 0 .. 5;}
19059 @code{type x2 is range 0 .. 5;}
19060 @code{for x2'size use 12;}
19072 @code{subtype x3 is x2 range 0 .. 3;}
19084 @code{subtype x4 is x2'base range 0 .. 10;}
19096 @code{dynamic : x2'Base range -64 .. +63;}
19104 @code{subtype x5 is x2 range 0 .. dynamic;}
19116 @code{subtype x6 is x2'base range 0 .. dynamic;}
19129 Note: the entries marked ‘*’ are not actually specified by the Ada
19130 Reference Manual, which has nothing to say about size in the dynamic
19131 case. What GNAT does is to allocate sufficient bits to accommodate any
19132 possible dynamic values for the bounds at run-time.
19134 So far, so good, but GNAT has to obey the RM rules, so the question is
19135 under what conditions must the RM @code{Size} be used.
19136 The following is a list
19137 of the occasions on which the RM @code{Size} must be used:
19143 Component size for packed arrays or records
19146 Value of the attribute @code{Size} for a type
19149 Warning about sizes not matching for unchecked conversion
19152 For record types, the @code{Object_Size} is always a multiple of the
19153 alignment of the type (this is true for all types). In some cases the
19154 @code{Value_Size} can be smaller. Consider:
19163 On a typical 32-bit architecture, the X component will occupy four bytes
19164 and the Y component will occupy one byte, for a total of 5 bytes. As a
19165 result @code{R'Value_Size} will be 40 (bits) since this is the minimum size
19166 required to store a value of this type. For example, it is permissible
19167 to have a component of type R in an array whose component size is
19168 specified to be 40 bits.
19170 However, @code{R'Object_Size} will be 64 (bits). The difference is due to
19171 the alignment requirement for objects of the record type. The X
19172 component will require four-byte alignment because that is what type
19173 Integer requires, whereas the Y component, a Character, will only
19174 require 1-byte alignment. Since the alignment required for X is the
19175 greatest of all the components’ alignments, that is the alignment
19176 required for the enclosing record type, i.e., 4 bytes or 32 bits. As
19177 indicated above, the actual object size must be rounded up so that it is
19178 a multiple of the alignment value. Therefore, 40 bits rounded up to the
19179 next multiple of 32 yields 64 bits.
19181 For all other types, the @code{Object_Size}
19182 and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}).
19183 Only @code{Size} may be specified for such types.
19185 Note that @code{Value_Size} can be used to force biased representation
19186 for a particular subtype. Consider this example:
19189 type R is (A, B, C, D, E, F);
19190 subtype RAB is R range A .. B;
19191 subtype REF is R range E .. F;
19194 By default, @code{RAB}
19195 has a size of 1 (sufficient to accommodate the representation
19196 of @code{A} and @code{B}, 0 and 1), and @code{REF}
19197 has a size of 3 (sufficient to accommodate the representation
19198 of @code{E} and @code{F}, 4 and 5). But if we add the
19199 following @code{Value_Size} attribute definition clause:
19202 for REF'Value_Size use 1;
19205 then biased representation is forced for @code{REF},
19206 and 0 will represent @code{E} and 1 will represent @code{F}.
19207 A warning is issued when a @code{Value_Size} attribute
19208 definition clause forces biased representation. This
19209 warning can be turned off using @code{-gnatw.B}.
19211 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
19212 @anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{286}@anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{287}
19213 @section Component_Size Clauses
19216 @geindex Component_Size Clause
19218 Normally, the value specified in a component size clause must be consistent
19219 with the subtype of the array component with regard to size and alignment.
19220 In other words, the value specified must be at least equal to the size
19221 of this subtype, and must be a multiple of the alignment value.
19223 In addition, component size clauses are allowed which cause the array
19224 to be packed, by specifying a smaller value. A first case is for
19225 component size values in the range 1 through 63 on 32-bit targets,
19226 and 1 through 127 on 64-bit targets. The value specified may not
19227 be smaller than the Size of the subtype. GNAT will accurately
19228 honor all packing requests in this range. For example, if we have:
19231 type r is array (1 .. 8) of Natural;
19232 for r'Component_Size use 31;
19235 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
19236 Of course access to the components of such an array is considerably
19237 less efficient than if the natural component size of 32 is used.
19238 A second case is when the subtype of the component is a record type
19239 padded because of its default alignment. For example, if we have:
19248 type a is array (1 .. 8) of r;
19249 for a'Component_Size use 72;
19252 then the resulting array has a length of 72 bytes, instead of 96 bytes
19253 if the alignment of the record (4) was obeyed.
19255 Note that there is no point in giving both a component size clause
19256 and a pragma Pack for the same array type. if such duplicate
19257 clauses are given, the pragma Pack will be ignored.
19259 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
19260 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{288}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{289}
19261 @section Bit_Order Clauses
19264 @geindex Bit_Order Clause
19266 @geindex bit ordering
19271 For record subtypes, GNAT permits the specification of the @code{Bit_Order}
19272 attribute. The specification may either correspond to the default bit
19273 order for the target, in which case the specification has no effect and
19274 places no additional restrictions, or it may be for the non-standard
19275 setting (that is the opposite of the default).
19277 In the case where the non-standard value is specified, the effect is
19278 to renumber bits within each byte, but the ordering of bytes is not
19279 affected. There are certain
19280 restrictions placed on component clauses as follows:
19286 Components fitting within a single storage unit.
19288 These are unrestricted, and the effect is merely to renumber bits. For
19289 example if we are on a little-endian machine with @code{Low_Order_First}
19290 being the default, then the following two declarations have exactly
19296 B : Integer range 1 .. 120;
19300 A at 0 range 0 .. 0;
19301 B at 0 range 1 .. 7;
19306 B : Integer range 1 .. 120;
19309 for R2'Bit_Order use High_Order_First;
19312 A at 0 range 7 .. 7;
19313 B at 0 range 0 .. 6;
19317 The useful application here is to write the second declaration with the
19318 @code{Bit_Order} attribute definition clause, and know that it will be treated
19319 the same, regardless of whether the target is little-endian or big-endian.
19322 Components occupying an integral number of bytes.
19324 These are components that exactly fit in two or more bytes. Such component
19325 declarations are allowed, but have no effect, since it is important to realize
19326 that the @code{Bit_Order} specification does not affect the ordering of bytes.
19327 In particular, the following attempt at getting an endian-independent integer
19335 for R2'Bit_Order use High_Order_First;
19338 A at 0 range 0 .. 31;
19342 This declaration will result in a little-endian integer on a
19343 little-endian machine, and a big-endian integer on a big-endian machine.
19344 If byte flipping is required for interoperability between big- and
19345 little-endian machines, this must be explicitly programmed. This capability
19346 is not provided by @code{Bit_Order}.
19349 Components that are positioned across byte boundaries.
19351 but do not occupy an integral number of bytes. Given that bytes are not
19352 reordered, such fields would occupy a non-contiguous sequence of bits
19353 in memory, requiring non-trivial code to reassemble. They are for this
19354 reason not permitted, and any component clause specifying such a layout
19355 will be flagged as illegal by GNAT.
19358 Since the misconception that Bit_Order automatically deals with all
19359 endian-related incompatibilities is a common one, the specification of
19360 a component field that is an integral number of bytes will always
19361 generate a warning. This warning may be suppressed using @code{pragma Warnings (Off)}
19362 if desired. The following section contains additional
19363 details regarding the issue of byte ordering.
19365 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
19366 @anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{28a}@anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{28b}
19367 @section Effect of Bit_Order on Byte Ordering
19370 @geindex byte ordering
19375 In this section we will review the effect of the @code{Bit_Order} attribute
19376 definition clause on byte ordering. Briefly, it has no effect at all, but
19377 a detailed example will be helpful. Before giving this
19378 example, let us review the precise
19379 definition of the effect of defining @code{Bit_Order}. The effect of a
19380 non-standard bit order is described in section 13.5.3 of the Ada
19385 “2 A bit ordering is a method of interpreting the meaning of
19386 the storage place attributes.”
19389 To understand the precise definition of storage place attributes in
19390 this context, we visit section 13.5.1 of the manual:
19394 “13 A record_representation_clause (without the mod_clause)
19395 specifies the layout. The storage place attributes (see 13.5.2)
19396 are taken from the values of the position, first_bit, and last_bit
19397 expressions after normalizing those values so that first_bit is
19398 less than Storage_Unit.”
19401 The critical point here is that storage places are taken from
19402 the values after normalization, not before. So the @code{Bit_Order}
19403 interpretation applies to normalized values. The interpretation
19404 is described in the later part of the 13.5.3 paragraph:
19408 “2 A bit ordering is a method of interpreting the meaning of
19409 the storage place attributes. High_Order_First (known in the
19410 vernacular as ‘big endian’) means that the first bit of a
19411 storage element (bit 0) is the most significant bit (interpreting
19412 the sequence of bits that represent a component as an unsigned
19413 integer value). Low_Order_First (known in the vernacular as
19414 ‘little endian’) means the opposite: the first bit is the
19415 least significant.”
19418 Note that the numbering is with respect to the bits of a storage
19419 unit. In other words, the specification affects only the numbering
19420 of bits within a single storage unit.
19422 We can make the effect clearer by giving an example.
19424 Suppose that we have an external device which presents two bytes, the first
19425 byte presented, which is the first (low addressed byte) of the two byte
19426 record is called Master, and the second byte is called Slave.
19428 The left most (most significant) bit is called Control for each byte, and
19429 the remaining 7 bits are called V1, V2, … V7, where V7 is the rightmost
19430 (least significant) bit.
19432 On a big-endian machine, we can write the following representation clause
19435 type Data is record
19436 Master_Control : Bit;
19444 Slave_Control : Bit;
19454 for Data use record
19455 Master_Control at 0 range 0 .. 0;
19456 Master_V1 at 0 range 1 .. 1;
19457 Master_V2 at 0 range 2 .. 2;
19458 Master_V3 at 0 range 3 .. 3;
19459 Master_V4 at 0 range 4 .. 4;
19460 Master_V5 at 0 range 5 .. 5;
19461 Master_V6 at 0 range 6 .. 6;
19462 Master_V7 at 0 range 7 .. 7;
19463 Slave_Control at 1 range 0 .. 0;
19464 Slave_V1 at 1 range 1 .. 1;
19465 Slave_V2 at 1 range 2 .. 2;
19466 Slave_V3 at 1 range 3 .. 3;
19467 Slave_V4 at 1 range 4 .. 4;
19468 Slave_V5 at 1 range 5 .. 5;
19469 Slave_V6 at 1 range 6 .. 6;
19470 Slave_V7 at 1 range 7 .. 7;
19474 Now if we move this to a little endian machine, then the bit ordering within
19475 the byte is backwards, so we have to rewrite the record rep clause as:
19478 for Data use record
19479 Master_Control at 0 range 7 .. 7;
19480 Master_V1 at 0 range 6 .. 6;
19481 Master_V2 at 0 range 5 .. 5;
19482 Master_V3 at 0 range 4 .. 4;
19483 Master_V4 at 0 range 3 .. 3;
19484 Master_V5 at 0 range 2 .. 2;
19485 Master_V6 at 0 range 1 .. 1;
19486 Master_V7 at 0 range 0 .. 0;
19487 Slave_Control at 1 range 7 .. 7;
19488 Slave_V1 at 1 range 6 .. 6;
19489 Slave_V2 at 1 range 5 .. 5;
19490 Slave_V3 at 1 range 4 .. 4;
19491 Slave_V4 at 1 range 3 .. 3;
19492 Slave_V5 at 1 range 2 .. 2;
19493 Slave_V6 at 1 range 1 .. 1;
19494 Slave_V7 at 1 range 0 .. 0;
19498 It is a nuisance to have to rewrite the clause, especially if
19499 the code has to be maintained on both machines. However,
19500 this is a case that we can handle with the
19501 @code{Bit_Order} attribute if it is implemented.
19502 Note that the implementation is not required on byte addressed
19503 machines, but it is indeed implemented in GNAT.
19504 This means that we can simply use the
19505 first record clause, together with the declaration
19508 for Data'Bit_Order use High_Order_First;
19511 and the effect is what is desired, namely the layout is exactly the same,
19512 independent of whether the code is compiled on a big-endian or little-endian
19515 The important point to understand is that byte ordering is not affected.
19516 A @code{Bit_Order} attribute definition never affects which byte a field
19517 ends up in, only where it ends up in that byte.
19518 To make this clear, let us rewrite the record rep clause of the previous
19522 for Data'Bit_Order use High_Order_First;
19523 for Data use record
19524 Master_Control at 0 range 0 .. 0;
19525 Master_V1 at 0 range 1 .. 1;
19526 Master_V2 at 0 range 2 .. 2;
19527 Master_V3 at 0 range 3 .. 3;
19528 Master_V4 at 0 range 4 .. 4;
19529 Master_V5 at 0 range 5 .. 5;
19530 Master_V6 at 0 range 6 .. 6;
19531 Master_V7 at 0 range 7 .. 7;
19532 Slave_Control at 0 range 8 .. 8;
19533 Slave_V1 at 0 range 9 .. 9;
19534 Slave_V2 at 0 range 10 .. 10;
19535 Slave_V3 at 0 range 11 .. 11;
19536 Slave_V4 at 0 range 12 .. 12;
19537 Slave_V5 at 0 range 13 .. 13;
19538 Slave_V6 at 0 range 14 .. 14;
19539 Slave_V7 at 0 range 15 .. 15;
19543 This is exactly equivalent to saying (a repeat of the first example):
19546 for Data'Bit_Order use High_Order_First;
19547 for Data use record
19548 Master_Control at 0 range 0 .. 0;
19549 Master_V1 at 0 range 1 .. 1;
19550 Master_V2 at 0 range 2 .. 2;
19551 Master_V3 at 0 range 3 .. 3;
19552 Master_V4 at 0 range 4 .. 4;
19553 Master_V5 at 0 range 5 .. 5;
19554 Master_V6 at 0 range 6 .. 6;
19555 Master_V7 at 0 range 7 .. 7;
19556 Slave_Control at 1 range 0 .. 0;
19557 Slave_V1 at 1 range 1 .. 1;
19558 Slave_V2 at 1 range 2 .. 2;
19559 Slave_V3 at 1 range 3 .. 3;
19560 Slave_V4 at 1 range 4 .. 4;
19561 Slave_V5 at 1 range 5 .. 5;
19562 Slave_V6 at 1 range 6 .. 6;
19563 Slave_V7 at 1 range 7 .. 7;
19567 Why are they equivalent? Well take a specific field, the @code{Slave_V2}
19568 field. The storage place attributes are obtained by normalizing the
19569 values given so that the @code{First_Bit} value is less than 8. After
19570 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
19571 we specified in the other case.
19573 Now one might expect that the @code{Bit_Order} attribute might affect
19574 bit numbering within the entire record component (two bytes in this
19575 case, thus affecting which byte fields end up in), but that is not
19576 the way this feature is defined, it only affects numbering of bits,
19577 not which byte they end up in.
19579 Consequently it never makes sense to specify a starting bit number
19580 greater than 7 (for a byte addressable field) if an attribute
19581 definition for @code{Bit_Order} has been given, and indeed it
19582 may be actively confusing to specify such a value, so the compiler
19583 generates a warning for such usage.
19585 If you do need to control byte ordering then appropriate conditional
19586 values must be used. If in our example, the slave byte came first on
19587 some machines we might write:
19590 Master_Byte_First constant Boolean := ...;
19592 Master_Byte : constant Natural :=
19593 1 - Boolean'Pos (Master_Byte_First);
19594 Slave_Byte : constant Natural :=
19595 Boolean'Pos (Master_Byte_First);
19597 for Data'Bit_Order use High_Order_First;
19598 for Data use record
19599 Master_Control at Master_Byte range 0 .. 0;
19600 Master_V1 at Master_Byte range 1 .. 1;
19601 Master_V2 at Master_Byte range 2 .. 2;
19602 Master_V3 at Master_Byte range 3 .. 3;
19603 Master_V4 at Master_Byte range 4 .. 4;
19604 Master_V5 at Master_Byte range 5 .. 5;
19605 Master_V6 at Master_Byte range 6 .. 6;
19606 Master_V7 at Master_Byte range 7 .. 7;
19607 Slave_Control at Slave_Byte range 0 .. 0;
19608 Slave_V1 at Slave_Byte range 1 .. 1;
19609 Slave_V2 at Slave_Byte range 2 .. 2;
19610 Slave_V3 at Slave_Byte range 3 .. 3;
19611 Slave_V4 at Slave_Byte range 4 .. 4;
19612 Slave_V5 at Slave_Byte range 5 .. 5;
19613 Slave_V6 at Slave_Byte range 6 .. 6;
19614 Slave_V7 at Slave_Byte range 7 .. 7;
19618 Now to switch between machines, all that is necessary is
19619 to set the boolean constant @code{Master_Byte_First} in
19620 an appropriate manner.
19622 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
19623 @anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{28c}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{28d}
19624 @section Pragma Pack for Arrays
19627 @geindex Pragma Pack (for arrays)
19629 Pragma @code{Pack} applied to an array has an effect that depends upon whether the
19630 component type is `packable'. For a component type to be `packable', it must
19631 be one of the following cases:
19637 Any elementary type.
19640 Any small packed array type with a static size.
19643 Any small simple record type with a static size.
19646 For all these cases, if the component subtype size is in the range
19647 1 through 63 on 32-bit targets, and 1 through 127 on 64-bit targets,
19648 then the effect of the pragma @code{Pack} is exactly as though a
19649 component size were specified giving the component subtype size.
19651 All other types are non-packable, they occupy an integral number of storage
19652 units and the only effect of pragma Pack is to remove alignment gaps.
19654 For example if we have:
19657 type r is range 0 .. 17;
19659 type ar is array (1 .. 8) of r;
19663 Then the component size of @code{ar} will be set to 5 (i.e., to @code{r'size},
19664 and the size of the array @code{ar} will be exactly 40 bits).
19666 Note that in some cases this rather fierce approach to packing can produce
19667 unexpected effects. For example, in Ada 95 and Ada 2005,
19668 subtype @code{Natural} typically has a size of 31, meaning that if you
19669 pack an array of @code{Natural}, you get 31-bit
19670 close packing, which saves a few bits, but results in far less efficient
19671 access. Since many other Ada compilers will ignore such a packing request,
19672 GNAT will generate a warning on some uses of pragma @code{Pack} that it guesses
19673 might not be what is intended. You can easily remove this warning by
19674 using an explicit @code{Component_Size} setting instead, which never generates
19675 a warning, since the intention of the programmer is clear in this case.
19677 GNAT treats packed arrays in one of two ways. If the size of the array is
19678 known at compile time and is at most 64 bits on 32-bit targets, and at most
19679 128 bits on 64-bit targets, then internally the array is represented as a
19680 single modular type, of exactly the appropriate number of bits. If the
19681 length is greater than 64 bits on 32-bit targets, and greater than 128
19682 bits on 64-bit targets, or is not known at compile time, then the packed
19683 array is represented as an array of bytes, and its length is always a
19684 multiple of 8 bits.
19686 Note that to represent a packed array as a modular type, the alignment must
19687 be suitable for the modular type involved. For example, on typical machines
19688 a 32-bit packed array will be represented by a 32-bit modular integer with
19689 an alignment of four bytes. If you explicitly override the default alignment
19690 with an alignment clause that is too small, the modular representation
19691 cannot be used. For example, consider the following set of declarations:
19694 type R is range 1 .. 3;
19695 type S is array (1 .. 31) of R;
19696 for S'Component_Size use 2;
19698 for S'Alignment use 1;
19701 If the alignment clause were not present, then a 62-bit modular
19702 representation would be chosen (typically with an alignment of 4 or 8
19703 bytes depending on the target). But the default alignment is overridden
19704 with the explicit alignment clause. This means that the modular
19705 representation cannot be used, and instead the array of bytes
19706 representation must be used, meaning that the length must be a multiple
19707 of 8. Thus the above set of declarations will result in a diagnostic
19708 rejecting the size clause and noting that the minimum size allowed is 64.
19710 @geindex Pragma Pack (for type Natural)
19712 @geindex Pragma Pack warning
19714 One special case that is worth noting occurs when the base type of the
19715 component size is 8/16/32 and the subtype is one bit less. Notably this
19716 occurs with subtype @code{Natural}. Consider:
19719 type Arr is array (1 .. 32) of Natural;
19723 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
19724 since typically @code{Natural'Size} is 32 in Ada 83, and in any case most
19725 Ada 83 compilers did not attempt 31 bit packing.
19727 In Ada 95 and Ada 2005, @code{Natural'Size} is required to be 31. Furthermore,
19728 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
19729 substantial unintended performance penalty when porting legacy Ada 83 code.
19730 To help prevent this, GNAT generates a warning in such cases. If you really
19731 want 31 bit packing in a case like this, you can set the component size
19735 type Arr is array (1 .. 32) of Natural;
19736 for Arr'Component_Size use 31;
19739 Here 31-bit packing is achieved as required, and no warning is generated,
19740 since in this case the programmer intention is clear.
19742 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
19743 @anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{28e}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{28f}
19744 @section Pragma Pack for Records
19747 @geindex Pragma Pack (for records)
19749 Pragma @code{Pack} applied to a record will pack the components to reduce
19750 wasted space from alignment gaps and by reducing the amount of space
19751 taken by components. We distinguish between `packable' components and
19752 `non-packable' components.
19753 Components of the following types are considered packable:
19759 Components of an elementary type are packable unless they are aliased,
19760 independent or atomic.
19763 Small packed arrays, where the size is statically known, are represented
19764 internally as modular integers, and so they are also packable.
19767 Small simple records, where the size is statically known, are also packable.
19770 For all these cases, if the @code{'Size} value is in the range 1 through 64 on
19771 32-bit targets, and 1 through 128 on 64-bit targets, the components occupy
19772 the exact number of bits corresponding to this value and are packed with no
19773 padding bits, i.e. they can start on an arbitrary bit boundary.
19775 All other types are non-packable, they occupy an integral number of storage
19776 units and the only effect of pragma @code{Pack} is to remove alignment gaps.
19778 For example, consider the record
19781 type Rb1 is array (1 .. 13) of Boolean;
19784 type Rb2 is array (1 .. 65) of Boolean;
19787 type AF is new Float with Atomic;
19800 The representation for the record @code{X2} is as follows on 32-bit targets:
19803 for X2'Size use 224;
19805 L1 at 0 range 0 .. 0;
19806 L2 at 0 range 1 .. 64;
19807 L3 at 12 range 0 .. 31;
19808 L4 at 16 range 0 .. 0;
19809 L5 at 16 range 1 .. 13;
19810 L6 at 18 range 0 .. 71;
19814 Studying this example, we see that the packable fields @code{L1}
19815 and @code{L2} are of length equal to their sizes, and placed at
19816 specific bit boundaries (and not byte boundaries) to eliminate
19817 padding. But @code{L3} is of a non-packable float type (because
19818 it is aliased), so it is on the next appropriate alignment boundary.
19820 The next two fields are fully packable, so @code{L4} and @code{L5} are
19821 minimally packed with no gaps. However, type @code{Rb2} is a packed
19822 array that is longer than 64 bits, so it is itself non-packable on
19823 32-bit targets. Thus the @code{L6} field is aligned to the next byte
19824 boundary, and takes an integral number of bytes, i.e., 72 bits.
19826 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19827 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{290}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{291}
19828 @section Record Representation Clauses
19831 @geindex Record Representation Clause
19833 Record representation clauses may be given for all record types, including
19834 types obtained by record extension. Component clauses are allowed for any
19835 static component. The restrictions on component clauses depend on the type
19838 @geindex Component Clause
19840 For all components of an elementary type, the only restriction on component
19841 clauses is that the size must be at least the @code{'Size} value of the type
19842 (actually the Value_Size). There are no restrictions due to alignment,
19843 and such components may freely cross storage boundaries.
19845 Packed arrays with a size up to and including 64 bits on 32-bit targets,
19846 and up to and including 128 bits on 64-bit targets, are represented
19847 internally using a modular type with the appropriate number of bits, and
19848 thus the same lack of restriction applies. For example, if you declare:
19851 type R is array (1 .. 49) of Boolean;
19856 then a component clause for a component of type @code{R} may start on any
19857 specified bit boundary, and may specify a value of 49 bits or greater.
19859 For packed bit arrays that are longer than 64 bits on 32-bit targets,
19860 and longer than 128 bits on 64-bit targets, there are two cases. If the
19861 component size is a power of 2 (1,2,4,8,16,32,64 bits), including the
19862 important case of single bits or boolean values, then there are no
19863 limitations on placement of such components, and they may start and
19864 end at arbitrary bit boundaries.
19866 If the component size is not a power of 2 (e.g., 3 or 5), then an array
19867 of this type must always be placed on on a storage unit (byte) boundary
19868 and occupy an integral number of storage units (bytes). Any component
19869 clause that does not meet this requirement will be rejected.
19871 Any aliased component, or component of an aliased type, must have its
19872 normal alignment and size. A component clause that does not meet this
19873 requirement will be rejected.
19875 The tag field of a tagged type always occupies an address sized field at
19876 the start of the record. No component clause may attempt to overlay this
19877 tag. When a tagged type appears as a component, the tag field must have
19880 In the case of a record extension @code{T1}, of a type @code{T}, no component
19881 clause applied to the type @code{T1} can specify a storage location that
19882 would overlap the first @code{T'Object_Size} bits of the record.
19884 For all other component types, including non-bit-packed arrays,
19885 the component can be placed at an arbitrary bit boundary,
19886 so for example, the following is permitted:
19889 type R is array (1 .. 10) of Boolean;
19898 G at 0 range 0 .. 0;
19899 H at 0 range 1 .. 1;
19900 L at 0 range 2 .. 81;
19901 R at 0 range 82 .. 161;
19905 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
19906 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{292}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{293}
19907 @section Handling of Records with Holes
19910 @geindex Handling of Records with Holes
19912 As a result of alignment considerations, records may contain “holes”
19913 or gaps which do not correspond to the data bits of any of the components.
19914 Record representation clauses can also result in holes in records.
19916 GNAT does not attempt to clear these holes, so in record objects,
19917 they should be considered to hold undefined rubbish. The generated
19918 equality routine just tests components so does not access these
19919 undefined bits, and assignment and copy operations may or may not
19920 preserve the contents of these holes (for assignments, the holes
19921 in the target will in practice contain either the bits that are
19922 present in the holes in the source, or the bits that were present
19923 in the target before the assignment).
19925 If it is necessary to ensure that holes in records have all zero
19926 bits, then record objects for which this initialization is desired
19927 should be explicitly set to all zero values using Unchecked_Conversion
19928 or address overlays. For example
19931 type HRec is record
19937 On typical machines, integers need to be aligned on a four-byte
19938 boundary, resulting in three bytes of undefined rubbish following
19939 the 8-bit field for C. To ensure that the hole in a variable of
19940 type HRec is set to all zero bits,
19941 you could for example do:
19944 type Base is record
19945 Dummy1, Dummy2 : Integer := 0;
19950 for RealVar'Address use BaseVar'Address;
19953 Now the 8-bytes of the value of RealVar start out containing all zero
19954 bits. A safer approach is to just define dummy fields, avoiding the
19958 type HRec is record
19960 Dummy1 : Short_Short_Integer := 0;
19961 Dummy2 : Short_Short_Integer := 0;
19962 Dummy3 : Short_Short_Integer := 0;
19967 And to make absolutely sure that the intent of this is followed, you
19968 can use representation clauses:
19971 for Hrec use record
19972 C at 0 range 0 .. 7;
19973 Dummy1 at 1 range 0 .. 7;
19974 Dummy2 at 2 range 0 .. 7;
19975 Dummy3 at 3 range 0 .. 7;
19976 I at 4 range 0 .. 31;
19978 for Hrec'Size use 64;
19981 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
19982 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{294}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{295}
19983 @section Enumeration Clauses
19986 The only restriction on enumeration clauses is that the range of values
19987 must be representable. For the signed case, if one or more of the
19988 representation values are negative, all values must be in the range:
19991 System.Min_Int .. System.Max_Int
19994 For the unsigned case, where all values are nonnegative, the values must
19998 0 .. System.Max_Binary_Modulus;
20001 A `confirming' representation clause is one in which the values range
20002 from 0 in sequence, i.e., a clause that confirms the default representation
20003 for an enumeration type.
20004 Such a confirming representation
20005 is permitted by these rules, and is specially recognized by the compiler so
20006 that no extra overhead results from the use of such a clause.
20008 If an array has an index type which is an enumeration type to which an
20009 enumeration clause has been applied, then the array is stored in a compact
20010 manner. Consider the declarations:
20013 type r is (A, B, C);
20014 for r use (A => 1, B => 5, C => 10);
20015 type t is array (r) of Character;
20018 The array type t corresponds to a vector with exactly three elements and
20019 has a default size equal to @code{3*Character'Size}. This ensures efficient
20020 use of space, but means that accesses to elements of the array will incur
20021 the overhead of converting representation values to the corresponding
20022 positional values, (i.e., the value delivered by the @code{Pos} attribute).
20024 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
20025 @anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{296}@anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{297}
20026 @section Address Clauses
20029 @geindex Address Clause
20031 The reference manual allows a general restriction on representation clauses,
20032 as found in RM 13.1(22):
20036 “An implementation need not support representation
20037 items containing nonstatic expressions, except that
20038 an implementation should support a representation item
20039 for a given entity if each nonstatic expression in the
20040 representation item is a name that statically denotes
20041 a constant declared before the entity.”
20044 In practice this is applicable only to address clauses, since this is the
20045 only case in which a nonstatic expression is permitted by the syntax. As
20046 the AARM notes in sections 13.1 (22.a-22.h):
20050 22.a Reason: This is to avoid the following sort of thing:
20052 22.b X : Integer := F(…);
20053 Y : Address := G(…);
20054 for X’Address use Y;
20056 22.c In the above, we have to evaluate the
20057 initialization expression for X before we
20058 know where to put the result. This seems
20059 like an unreasonable implementation burden.
20061 22.d The above code should instead be written
20064 22.e Y : constant Address := G(…);
20065 X : Integer := F(…);
20066 for X’Address use Y;
20068 22.f This allows the expression ‘Y’ to be safely
20069 evaluated before X is created.
20071 22.g The constant could be a formal parameter of mode in.
20073 22.h An implementation can support other nonstatic
20074 expressions if it wants to. Expressions of type
20075 Address are hardly ever static, but their value
20076 might be known at compile time anyway in many
20080 GNAT does indeed permit many additional cases of nonstatic expressions. In
20081 particular, if the type involved is elementary there are no restrictions
20082 (since in this case, holding a temporary copy of the initialization value,
20083 if one is present, is inexpensive). In addition, if there is no implicit or
20084 explicit initialization, then there are no restrictions. GNAT will reject
20085 only the case where all three of these conditions hold:
20091 The type of the item is non-elementary (e.g., a record or array).
20094 There is explicit or implicit initialization required for the object.
20095 Note that access values are always implicitly initialized.
20098 The address value is nonstatic. Here GNAT is more permissive than the
20099 RM, and allows the address value to be the address of a previously declared
20100 stand-alone variable, as long as it does not itself have an address clause.
20103 Anchor : Some_Initialized_Type;
20104 Overlay : Some_Initialized_Type;
20105 for Overlay'Address use Anchor'Address;
20108 However, the prefix of the address clause cannot be an array component, or
20109 a component of a discriminated record.
20112 As noted above in section 22.h, address values are typically nonstatic. In
20113 particular the To_Address function, even if applied to a literal value, is
20114 a nonstatic function call. To avoid this minor annoyance, GNAT provides
20115 the implementation defined attribute ‘To_Address. The following two
20116 expressions have identical values:
20120 @geindex To_Address
20123 To_Address (16#1234_0000#)
20124 System'To_Address (16#1234_0000#);
20127 except that the second form is considered to be a static expression, and
20128 thus when used as an address clause value is always permitted.
20130 Additionally, GNAT treats as static an address clause that is an
20131 unchecked_conversion of a static integer value. This simplifies the porting
20132 of legacy code, and provides a portable equivalent to the GNAT attribute
20135 Another issue with address clauses is the interaction with alignment
20136 requirements. When an address clause is given for an object, the address
20137 value must be consistent with the alignment of the object (which is usually
20138 the same as the alignment of the type of the object). If an address clause
20139 is given that specifies an inappropriately aligned address value, then the
20140 program execution is erroneous.
20142 Since this source of erroneous behavior can have unfortunate effects on
20143 machines with strict alignment requirements, GNAT
20144 checks (at compile time if possible, generating a warning, or at execution
20145 time with a run-time check) that the alignment is appropriate. If the
20146 run-time check fails, then @code{Program_Error} is raised. This run-time
20147 check is suppressed if range checks are suppressed, or if the special GNAT
20148 check Alignment_Check is suppressed, or if
20149 @code{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
20150 suppressed by default on non-strict alignment machines (such as the x86).
20152 In some cases, GNAT does not support an address specification (using either
20153 form of aspect specification syntax) for the declaration of an object that has
20154 an indefinite nominal subtype. An object declaration has an indefinite
20155 nominal subtype if it takes its bounds (for an array type), discriminant
20156 values (for a discriminated type whose discriminants lack defaults), or tag
20157 (for a class-wide type) from its initial value, as in
20160 X : String := Some_Function_Call;
20161 -- String has no constraint, so bounds for X come from function call
20164 This restriction does not apply if the size of the object’s initial value is
20165 known at compile time and the type of the object is not class-wide.
20169 An address clause cannot be given for an exported object. More
20170 understandably the real restriction is that objects with an address
20171 clause cannot be exported. This is because such variables are not
20172 defined by the Ada program, so there is no external object to export.
20176 It is permissible to give an address clause and a pragma Import for the
20177 same object. In this case, the variable is not really defined by the
20178 Ada program, so there is no external symbol to be linked. The link name
20179 and the external name are ignored in this case. The reason that we allow this
20180 combination is that it provides a useful idiom to avoid unwanted
20181 initializations on objects with address clauses.
20183 When an address clause is given for an object that has implicit or
20184 explicit initialization, then by default initialization takes place. This
20185 means that the effect of the object declaration is to overwrite the
20186 memory at the specified address. This is almost always not what the
20187 programmer wants, so GNAT will output a warning:
20197 for Ext'Address use System'To_Address (16#1234_1234#);
20199 >>> warning: implicit initialization of "Ext" may
20200 modify overlaid storage
20201 >>> warning: use pragma Import for "Ext" to suppress
20202 initialization (RM B(24))
20207 As indicated by the warning message, the solution is to use a (dummy) pragma
20208 Import to suppress this initialization. The pragma tell the compiler that the
20209 object is declared and initialized elsewhere. The following package compiles
20210 without warnings (and the initialization is suppressed):
20220 for Ext'Address use System'To_Address (16#1234_1234#);
20221 pragma Import (Ada, Ext);
20225 A final issue with address clauses involves their use for overlaying
20226 variables, as in the following example:
20228 @geindex Overlaying of objects
20233 for B'Address use A'Address;
20236 or alternatively, using the form recommended by the RM:
20240 Addr : constant Address := A'Address;
20242 for B'Address use Addr;
20245 In both of these cases, @code{A} and @code{B} become aliased to one another
20246 via the address clause. This use of address clauses to overlay
20247 variables, achieving an effect similar to unchecked conversion
20248 was erroneous in Ada 83, but in Ada 95 and Ada 2005
20249 the effect is implementation defined. Furthermore, the
20250 Ada RM specifically recommends that in a situation
20251 like this, @code{B} should be subject to the following
20252 implementation advice (RM 13.3(19)):
20256 “19 If the Address of an object is specified, or it is imported
20257 or exported, then the implementation should not perform
20258 optimizations based on assumptions of no aliases.”
20261 GNAT follows this recommendation, and goes further by also applying
20262 this recommendation to the overlaid variable (@code{A} in the above example)
20263 in this case. This means that the overlay works “as expected”, in that
20264 a modification to one of the variables will affect the value of the other.
20266 More generally, GNAT interprets this recommendation conservatively for
20267 address clauses: in the cases other than overlays, it considers that the
20268 object is effectively subject to pragma @code{Volatile} and implements the
20269 associated semantics.
20271 Note that when address clause overlays are used in this way, there is an
20272 issue of unintentional initialization, as shown by this example:
20275 package Overwrite_Record is
20277 A : Character := 'C';
20278 B : Character := 'A';
20280 X : Short_Integer := 3;
20282 for Y'Address use X'Address;
20284 >>> warning: default initialization of "Y" may
20285 modify "X", use pragma Import for "Y" to
20286 suppress initialization (RM B.1(24))
20288 end Overwrite_Record;
20291 Here the default initialization of @code{Y} will clobber the value
20292 of @code{X}, which justifies the warning. The warning notes that
20293 this effect can be eliminated by adding a @code{pragma Import}
20294 which suppresses the initialization:
20297 package Overwrite_Record is
20299 A : Character := 'C';
20300 B : Character := 'A';
20302 X : Short_Integer := 3;
20304 for Y'Address use X'Address;
20305 pragma Import (Ada, Y);
20306 end Overwrite_Record;
20309 Note that the use of @code{pragma Initialize_Scalars} may cause variables to
20310 be initialized when they would not otherwise have been in the absence
20311 of the use of this pragma. This may cause an overlay to have this
20312 unintended clobbering effect. The compiler avoids this for scalar
20313 types, but not for composite objects (where in general the effect
20314 of @code{Initialize_Scalars} is part of the initialization routine
20315 for the composite object):
20318 pragma Initialize_Scalars;
20319 with Ada.Text_IO; use Ada.Text_IO;
20320 procedure Overwrite_Array is
20321 type Arr is array (1 .. 5) of Integer;
20322 X : Arr := (others => 1);
20324 for A'Address use X'Address;
20326 >>> warning: default initialization of "A" may
20327 modify "X", use pragma Import for "A" to
20328 suppress initialization (RM B.1(24))
20331 if X /= Arr'(others => 1) then
20332 Put_Line ("X was clobbered");
20334 Put_Line ("X was not clobbered");
20336 end Overwrite_Array;
20339 The above program generates the warning as shown, and at execution
20340 time, prints @code{X was clobbered}. If the @code{pragma Import} is
20341 added as suggested:
20344 pragma Initialize_Scalars;
20345 with Ada.Text_IO; use Ada.Text_IO;
20346 procedure Overwrite_Array is
20347 type Arr is array (1 .. 5) of Integer;
20348 X : Arr := (others => 1);
20350 for A'Address use X'Address;
20351 pragma Import (Ada, A);
20353 if X /= Arr'(others => 1) then
20354 Put_Line ("X was clobbered");
20356 Put_Line ("X was not clobbered");
20358 end Overwrite_Array;
20361 then the program compiles without the warning and when run will generate
20362 the output @code{X was not clobbered}.
20364 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
20365 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{298}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{299}
20366 @section Use of Address Clauses for Memory-Mapped I/O
20369 @geindex Memory-mapped I/O
20371 A common pattern is to use an address clause to map an atomic variable to
20372 a location in memory that corresponds to a memory-mapped I/O operation or
20373 operations, for example:
20376 type Mem_Word is record
20379 pragma Atomic (Mem_Word);
20380 for Mem_Word_Size use 32;
20383 for Mem'Address use some-address;
20390 For a full access (reference or modification) of the variable (Mem) in this
20391 case, as in the above examples, GNAT guarantees that the entire atomic word
20392 will be accessed, in accordance with the RM C.6(15) clause.
20394 A problem arises with a component access such as:
20400 Note that the component A is not declared as atomic. This means that it is
20401 not clear what this assignment means. It could correspond to full word read
20402 and write as given in the first example, or on architectures that supported
20403 such an operation it might be a single byte store instruction. The RM does
20404 not have anything to say in this situation, and GNAT does not make any
20405 guarantee. The code generated may vary from target to target. GNAT will issue
20406 a warning in such a case:
20411 >>> warning: access to non-atomic component of atomic array,
20412 may cause unexpected accesses to atomic object
20415 It is best to be explicit in this situation, by either declaring the
20416 components to be atomic if you want the byte store, or explicitly writing
20417 the full word access sequence if that is what the hardware requires.
20418 Alternatively, if the full word access sequence is required, GNAT also
20419 provides the pragma @code{Volatile_Full_Access} which can be used in lieu of
20420 pragma @code{Atomic} and will give the additional guarantee.
20422 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
20423 @anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{29a}@anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{29b}
20424 @section Effect of Convention on Representation
20427 @geindex Convention
20428 @geindex effect on representation
20430 Normally the specification of a foreign language convention for a type or
20431 an object has no effect on the chosen representation. In particular, the
20432 representation chosen for data in GNAT generally meets the standard system
20433 conventions, and for example records are laid out in a manner that is
20434 consistent with C. This means that specifying convention C (for example)
20437 There are four exceptions to this general rule:
20443 `Convention Fortran and array subtypes'.
20445 If pragma Convention Fortran is specified for an array subtype, then in
20446 accordance with the implementation advice in section 3.6.2(11) of the
20447 Ada Reference Manual, the array will be stored in a Fortran-compatible
20448 column-major manner, instead of the normal default row-major order.
20451 `Convention C and enumeration types'
20453 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
20454 to accommodate all values of the type. For example, for the enumeration
20458 type Color is (Red, Green, Blue);
20461 8 bits is sufficient to store all values of the type, so by default, objects
20462 of type @code{Color} will be represented using 8 bits. However, normal C
20463 convention is to use 32 bits for all enum values in C, since enum values
20464 are essentially of type int. If pragma @code{Convention C} is specified for an
20465 Ada enumeration type, then the size is modified as necessary (usually to
20466 32 bits) to be consistent with the C convention for enum values.
20468 Note that this treatment applies only to types. If Convention C is given for
20469 an enumeration object, where the enumeration type is not Convention C, then
20470 Object_Size bits are allocated. For example, for a normal enumeration type,
20471 with less than 256 elements, only 8 bits will be allocated for the object.
20472 Since this may be a surprise in terms of what C expects, GNAT will issue a
20473 warning in this situation. The warning can be suppressed by giving an explicit
20474 size clause specifying the desired size.
20477 `Convention C/Fortran and Boolean types'
20479 In C, the usual convention for boolean values, that is values used for
20480 conditions, is that zero represents false, and nonzero values represent
20481 true. In Ada, the normal convention is that two specific values, typically
20482 0/1, are used to represent false/true respectively.
20484 Fortran has a similar convention for @code{LOGICAL} values (any nonzero
20485 value represents true).
20487 To accommodate the Fortran and C conventions, if a pragma Convention specifies
20488 C or Fortran convention for a derived Boolean, as in the following example:
20491 type C_Switch is new Boolean;
20492 pragma Convention (C, C_Switch);
20495 then the GNAT generated code will treat any nonzero value as true. For truth
20496 values generated by GNAT, the conventional value 1 will be used for True, but
20497 when one of these values is read, any nonzero value is treated as True.
20500 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
20501 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{29c}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{29d}
20502 @section Conventions and Anonymous Access Types
20505 @geindex Anonymous access types
20507 @geindex Convention for anonymous access types
20509 The RM is not entirely clear on convention handling in a number of cases,
20510 and in particular, it is not clear on the convention to be given to
20511 anonymous access types in general, and in particular what is to be
20512 done for the case of anonymous access-to-subprogram.
20514 In GNAT, we decide that if an explicit Convention is applied
20515 to an object or component, and its type is such an anonymous type,
20516 then the convention will apply to this anonymous type as well. This
20517 seems to make sense since it is anomolous in any case to have a
20518 different convention for an object and its type, and there is clearly
20519 no way to explicitly specify a convention for an anonymous type, since
20520 it doesn’t have a name to specify!
20522 Furthermore, we decide that if a convention is applied to a record type,
20523 then this convention is inherited by any of its components that are of an
20524 anonymous access type which do not have an explicitly specified convention.
20526 The following program shows these conventions in action:
20529 package ConvComp is
20530 type Foo is range 1 .. 10;
20532 A : access function (X : Foo) return Integer;
20535 pragma Convention (C, T1);
20538 A : access function (X : Foo) return Integer;
20539 pragma Convention (C, A);
20542 pragma Convention (COBOL, T2);
20545 A : access function (X : Foo) return Integer;
20546 pragma Convention (COBOL, A);
20549 pragma Convention (C, T3);
20552 A : access function (X : Foo) return Integer;
20555 pragma Convention (COBOL, T4);
20557 function F (X : Foo) return Integer;
20558 pragma Convention (C, F);
20560 function F (X : Foo) return Integer is (13);
20562 TV1 : T1 := (F'Access, 12); -- OK
20563 TV2 : T2 := (F'Access, 13); -- OK
20565 TV3 : T3 := (F'Access, 13); -- ERROR
20567 >>> subprogram "F" has wrong convention
20568 >>> does not match access to subprogram declared at line 17
20569 38. TV4 : T4 := (F'Access, 13); -- ERROR
20571 >>> subprogram "F" has wrong convention
20572 >>> does not match access to subprogram declared at line 24
20576 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
20577 @anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{29e}@anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{29f}
20578 @section Determining the Representations chosen by GNAT
20581 @geindex Representation
20582 @geindex determination of
20584 @geindex -gnatR (gcc)
20586 Although the descriptions in this section are intended to be complete, it is
20587 often easier to simply experiment to see what GNAT accepts and what the
20588 effect is on the layout of types and objects.
20590 As required by the Ada RM, if a representation clause is not accepted, then
20591 it must be rejected as illegal by the compiler. However, when a
20592 representation clause or pragma is accepted, there can still be questions
20593 of what the compiler actually does. For example, if a partial record
20594 representation clause specifies the location of some components and not
20595 others, then where are the non-specified components placed? Or if pragma
20596 @code{Pack} is used on a record, then exactly where are the resulting
20597 fields placed? The section on pragma @code{Pack} in this chapter can be
20598 used to answer the second question, but it is often easier to just see
20599 what the compiler does.
20601 For this purpose, GNAT provides the option `-gnatR'. If you compile
20602 with this option, then the compiler will output information on the actual
20603 representations chosen, in a format similar to source representation
20604 clauses. For example, if we compile the package:
20608 type r (x : boolean) is tagged record
20610 when True => S : String (1 .. 100);
20611 when False => null;
20615 type r2 is new r (false) with record
20620 y2 at 16 range 0 .. 31;
20627 type x1 is array (1 .. 10) of x;
20628 for x1'component_size use 11;
20630 type ia is access integer;
20632 type Rb1 is array (1 .. 13) of Boolean;
20635 type Rb2 is array (1 .. 65) of Boolean;
20650 using the switch `-gnatR' we obtain the following output:
20653 Representation information for unit q
20654 -------------------------------------
20657 for r'Alignment use 4;
20659 x at 4 range 0 .. 7;
20660 _tag at 0 range 0 .. 31;
20661 s at 5 range 0 .. 799;
20664 for r2'Size use 160;
20665 for r2'Alignment use 4;
20667 x at 4 range 0 .. 7;
20668 _tag at 0 range 0 .. 31;
20669 _parent at 0 range 0 .. 63;
20670 y2 at 16 range 0 .. 31;
20674 for x'Alignment use 1;
20676 y at 0 range 0 .. 7;
20679 for x1'Size use 112;
20680 for x1'Alignment use 1;
20681 for x1'Component_Size use 11;
20683 for rb1'Size use 13;
20684 for rb1'Alignment use 2;
20685 for rb1'Component_Size use 1;
20687 for rb2'Size use 72;
20688 for rb2'Alignment use 1;
20689 for rb2'Component_Size use 1;
20691 for x2'Size use 224;
20692 for x2'Alignment use 4;
20694 l1 at 0 range 0 .. 0;
20695 l2 at 0 range 1 .. 64;
20696 l3 at 12 range 0 .. 31;
20697 l4 at 16 range 0 .. 0;
20698 l5 at 16 range 1 .. 13;
20699 l6 at 18 range 0 .. 71;
20703 The Size values are actually the Object_Size, i.e., the default size that
20704 will be allocated for objects of the type.
20705 The @code{??} size for type r indicates that we have a variant record, and the
20706 actual size of objects will depend on the discriminant value.
20708 The Alignment values show the actual alignment chosen by the compiler
20709 for each record or array type.
20711 The record representation clause for type r shows where all fields
20712 are placed, including the compiler generated tag field (whose location
20713 cannot be controlled by the programmer).
20715 The record representation clause for the type extension r2 shows all the
20716 fields present, including the parent field, which is a copy of the fields
20717 of the parent type of r2, i.e., r1.
20719 The component size and size clauses for types rb1 and rb2 show
20720 the exact effect of pragma @code{Pack} on these arrays, and the record
20721 representation clause for type x2 shows how pragma @cite{Pack} affects
20724 In some cases, it may be useful to cut and paste the representation clauses
20725 generated by the compiler into the original source to fix and guarantee
20726 the actual representation to be used.
20728 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
20729 @anchor{gnat_rm/standard_library_routines doc}@anchor{2a0}@anchor{gnat_rm/standard_library_routines id1}@anchor{2a1}@anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}
20730 @chapter Standard Library Routines
20733 The Ada Reference Manual contains in Annex A a full description of an
20734 extensive set of standard library routines that can be used in any Ada
20735 program, and which must be provided by all Ada compilers. They are
20736 analogous to the standard C library used by C programs.
20738 GNAT implements all of the facilities described in annex A, and for most
20739 purposes the description in the Ada Reference Manual, or appropriate Ada
20740 text book, will be sufficient for making use of these facilities.
20742 In the case of the input-output facilities,
20743 @ref{f,,The Implementation of Standard I/O},
20744 gives details on exactly how GNAT interfaces to the
20745 file system. For the remaining packages, the Ada Reference Manual
20746 should be sufficient. The following is a list of the packages included,
20747 together with a brief description of the functionality that is provided.
20749 For completeness, references are included to other predefined library
20750 routines defined in other sections of the Ada Reference Manual (these are
20751 cross-indexed from Annex A). For further details see the relevant
20752 package declarations in the run-time library. In particular, a few units
20753 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
20754 and in this case the package declaration contains comments explaining why
20755 the unit is not implemented.
20760 @item @code{Ada} `(A.2)'
20762 This is a parent package for all the standard library packages. It is
20763 usually included implicitly in your program, and itself contains no
20764 useful data or routines.
20766 @item @code{Ada.Assertions} `(11.4.2)'
20768 @code{Assertions} provides the @code{Assert} subprograms, and also
20769 the declaration of the @code{Assertion_Error} exception.
20771 @item @code{Ada.Asynchronous_Task_Control} `(D.11)'
20773 @code{Asynchronous_Task_Control} provides low level facilities for task
20774 synchronization. It is typically not implemented. See package spec for details.
20776 @item @code{Ada.Calendar} `(9.6)'
20778 @code{Calendar} provides time of day access, and routines for
20779 manipulating times and durations.
20781 @item @code{Ada.Calendar.Arithmetic} `(9.6.1)'
20783 This package provides additional arithmetic
20784 operations for @code{Calendar}.
20786 @item @code{Ada.Calendar.Formatting} `(9.6.1)'
20788 This package provides formatting operations for @code{Calendar}.
20790 @item @code{Ada.Calendar.Time_Zones} `(9.6.1)'
20792 This package provides additional @code{Calendar} facilities
20793 for handling time zones.
20795 @item @code{Ada.Characters} `(A.3.1)'
20797 This is a dummy parent package that contains no useful entities
20799 @item @code{Ada.Characters.Conversions} `(A.3.2)'
20801 This package provides character conversion functions.
20803 @item @code{Ada.Characters.Handling} `(A.3.2)'
20805 This package provides some basic character handling capabilities,
20806 including classification functions for classes of characters (e.g., test
20807 for letters, or digits).
20809 @item @code{Ada.Characters.Latin_1} `(A.3.3)'
20811 This package includes a complete set of definitions of the characters
20812 that appear in type CHARACTER. It is useful for writing programs that
20813 will run in international environments. For example, if you want an
20814 upper case E with an acute accent in a string, it is often better to use
20815 the definition of @code{UC_E_Acute} in this package. Then your program
20816 will print in an understandable manner even if your environment does not
20817 support these extended characters.
20819 @item @code{Ada.Command_Line} `(A.15)'
20821 This package provides access to the command line parameters and the name
20822 of the current program (analogous to the use of @code{argc} and @code{argv}
20823 in C), and also allows the exit status for the program to be set in a
20824 system-independent manner.
20826 @item @code{Ada.Complex_Text_IO} `(G.1.3)'
20828 This package provides text input and output of complex numbers.
20830 @item @code{Ada.Containers} `(A.18.1)'
20832 A top level package providing a few basic definitions used by all the
20833 following specific child packages that provide specific kinds of
20837 @code{Ada.Containers.Bounded_Priority_Queues} `(A.18.31)'
20839 @code{Ada.Containers.Bounded_Synchronized_Queues} `(A.18.29)'
20841 @code{Ada.Containers.Doubly_Linked_Lists} `(A.18.3)'
20843 @code{Ada.Containers.Generic_Array_Sort} `(A.18.26)'
20845 @code{Ada.Containers.Generic_Constrained_Array_Sort} `(A.18.26)'
20847 @code{Ada.Containers.Generic_Sort} `(A.18.26)'
20849 @code{Ada.Containers.Hashed_Maps} `(A.18.5)'
20851 @code{Ada.Containers.Hashed_Sets} `(A.18.8)'
20853 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} `(A.18.12)'
20855 @code{Ada.Containers.Indefinite_Hashed_Maps} `(A.18.13)'
20857 @code{Ada.Containers.Indefinite_Hashed_Sets} `(A.18.15)'
20859 @code{Ada.Containers.Indefinite_Holders} `(A.18.18)'
20861 @code{Ada.Containers.Indefinite_Multiway_Trees} `(A.18.17)'
20863 @code{Ada.Containers.Indefinite_Ordered_Maps} `(A.18.14)'
20865 @code{Ada.Containers.Indefinite_Ordered_Sets} `(A.18.16)'
20867 @code{Ada.Containers.Indefinite_Vectors} `(A.18.11)'
20869 @code{Ada.Containers.Multiway_Trees} `(A.18.10)'
20871 @code{Ada.Containers.Ordered_Maps} `(A.18.6)'
20873 @code{Ada.Containers.Ordered_Sets} `(A.18.9)'
20875 @code{Ada.Containers.Synchronized_Queue_Interfaces} `(A.18.27)'
20877 @code{Ada.Containers.Unbounded_Priority_Queues} `(A.18.30)'
20879 @code{Ada.Containers.Unbounded_Synchronized_Queues} `(A.18.28)'
20881 @code{Ada.Containers.Vectors} `(A.18.2)'
20886 @item @code{Ada.Directories} `(A.16)'
20888 This package provides operations on directories.
20890 @item @code{Ada.Directories.Hierarchical_File_Names} `(A.16.1)'
20892 This package provides additional directory operations handling
20893 hiearchical file names.
20895 @item @code{Ada.Directories.Information} `(A.16)'
20897 This is an implementation defined package for additional directory
20898 operations, which is not implemented in GNAT.
20900 @item @code{Ada.Decimal} `(F.2)'
20902 This package provides constants describing the range of decimal numbers
20903 implemented, and also a decimal divide routine (analogous to the COBOL
20904 verb DIVIDE … GIVING … REMAINDER …)
20906 @item @code{Ada.Direct_IO} `(A.8.4)'
20908 This package provides input-output using a model of a set of records of
20909 fixed-length, containing an arbitrary definite Ada type, indexed by an
20910 integer record number.
20912 @item @code{Ada.Dispatching} `(D.2.1)'
20914 A parent package containing definitions for task dispatching operations.
20916 @item @code{Ada.Dispatching.EDF} `(D.2.6)'
20918 Not implemented in GNAT.
20920 @item @code{Ada.Dispatching.Non_Preemptive} `(D.2.4)'
20922 Not implemented in GNAT.
20924 @item @code{Ada.Dispatching.Round_Robin} `(D.2.5)'
20926 Not implemented in GNAT.
20928 @item @code{Ada.Dynamic_Priorities} `(D.5)'
20930 This package allows the priorities of a task to be adjusted dynamically
20931 as the task is running.
20933 @item @code{Ada.Environment_Variables} `(A.17)'
20935 This package provides facilities for accessing environment variables.
20937 @item @code{Ada.Exceptions} `(11.4.1)'
20939 This package provides additional information on exceptions, and also
20940 contains facilities for treating exceptions as data objects, and raising
20941 exceptions with associated messages.
20943 @item @code{Ada.Execution_Time} `(D.14)'
20945 This package provides CPU clock functionalities. It is not implemented on
20946 all targets (see package spec for details).
20948 @item @code{Ada.Execution_Time.Group_Budgets} `(D.14.2)'
20950 Not implemented in GNAT.
20952 @item @code{Ada.Execution_Time.Timers} `(D.14.1)’'
20954 Not implemented in GNAT.
20956 @item @code{Ada.Finalization} `(7.6)'
20958 This package contains the declarations and subprograms to support the
20959 use of controlled types, providing for automatic initialization and
20960 finalization (analogous to the constructors and destructors of C++).
20962 @item @code{Ada.Float_Text_IO} `(A.10.9)'
20964 A library level instantiation of Text_IO.Float_IO for type Float.
20966 @item @code{Ada.Float_Wide_Text_IO} `(A.10.9)'
20968 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
20970 @item @code{Ada.Float_Wide_Wide_Text_IO} `(A.10.9)'
20972 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
20974 @item @code{Ada.Integer_Text_IO} `(A.10.9)'
20976 A library level instantiation of Text_IO.Integer_IO for type Integer.
20978 @item @code{Ada.Integer_Wide_Text_IO} `(A.10.9)'
20980 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
20982 @item @code{Ada.Integer_Wide_Wide_Text_IO} `(A.10.9)'
20984 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
20986 @item @code{Ada.Interrupts} `(C.3.2)'
20988 This package provides facilities for interfacing to interrupts, which
20989 includes the set of signals or conditions that can be raised and
20990 recognized as interrupts.
20992 @item @code{Ada.Interrupts.Names} `(C.3.2)'
20994 This package provides the set of interrupt names (actually signal
20995 or condition names) that can be handled by GNAT.
20997 @item @code{Ada.IO_Exceptions} `(A.13)'
20999 This package defines the set of exceptions that can be raised by use of
21000 the standard IO packages.
21002 @item @code{Ada.Iterator_Interfaces} `(5.5.1)'
21004 This package provides a generic interface to generalized iterators.
21006 @item @code{Ada.Locales} `(A.19)'
21008 This package provides declarations providing information (Language
21009 and Country) about the current locale.
21011 @item @code{Ada.Numerics}
21013 This package contains some standard constants and exceptions used
21014 throughout the numerics packages. Note that the constants pi and e are
21015 defined here, and it is better to use these definitions than rolling
21018 @item @code{Ada.Numerics.Complex_Arrays} `(G.3.2)'
21020 Provides operations on arrays of complex numbers.
21022 @item @code{Ada.Numerics.Complex_Elementary_Functions}
21024 Provides the implementation of standard elementary functions (such as
21025 log and trigonometric functions) operating on complex numbers using the
21026 standard @code{Float} and the @code{Complex} and @code{Imaginary} types
21027 created by the package @code{Numerics.Complex_Types}.
21029 @item @code{Ada.Numerics.Complex_Types}
21031 This is a predefined instantiation of
21032 @code{Numerics.Generic_Complex_Types} using @code{Standard.Float} to
21033 build the type @code{Complex} and @code{Imaginary}.
21035 @item @code{Ada.Numerics.Discrete_Random}
21037 This generic package provides a random number generator suitable for generating
21038 uniformly distributed values of a specified discrete subtype.
21040 @item @code{Ada.Numerics.Float_Random}
21042 This package provides a random number generator suitable for generating
21043 uniformly distributed floating point values in the unit interval.
21045 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
21047 This is a generic version of the package that provides the
21048 implementation of standard elementary functions (such as log and
21049 trigonometric functions) for an arbitrary complex type.
21051 The following predefined instantiations of this package are provided:
21059 @code{Ada.Numerics.Short_Complex_Elementary_Functions}
21064 @code{Ada.Numerics.Complex_Elementary_Functions}
21069 @code{Ada.Numerics.Long_Complex_Elementary_Functions}
21072 @item @code{Ada.Numerics.Generic_Complex_Types}
21074 This is a generic package that allows the creation of complex types,
21075 with associated complex arithmetic operations.
21077 The following predefined instantiations of this package exist
21085 @code{Ada.Numerics.Short_Complex_Complex_Types}
21090 @code{Ada.Numerics.Complex_Complex_Types}
21095 @code{Ada.Numerics.Long_Complex_Complex_Types}
21098 @item @code{Ada.Numerics.Generic_Elementary_Functions}
21100 This is a generic package that provides the implementation of standard
21101 elementary functions (such as log an trigonometric functions) for an
21102 arbitrary float type.
21104 The following predefined instantiations of this package exist
21112 @code{Ada.Numerics.Short_Elementary_Functions}
21117 @code{Ada.Numerics.Elementary_Functions}
21122 @code{Ada.Numerics.Long_Elementary_Functions}
21125 @item @code{Ada.Numerics.Generic_Real_Arrays} `(G.3.1)'
21127 Generic operations on arrays of reals
21129 @item @code{Ada.Numerics.Real_Arrays} `(G.3.1)'
21131 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
21133 @item @code{Ada.Real_Time} `(D.8)'
21135 This package provides facilities similar to those of @code{Calendar}, but
21136 operating with a finer clock suitable for real time control. Note that
21137 annex D requires that there be no backward clock jumps, and GNAT generally
21138 guarantees this behavior, but of course if the external clock on which
21139 the GNAT runtime depends is deliberately reset by some external event,
21140 then such a backward jump may occur.
21142 @item @code{Ada.Real_Time.Timing_Events} `(D.15)'
21144 Not implemented in GNAT.
21146 @item @code{Ada.Sequential_IO} `(A.8.1)'
21148 This package provides input-output facilities for sequential files,
21149 which can contain a sequence of values of a single type, which can be
21150 any Ada type, including indefinite (unconstrained) types.
21152 @item @code{Ada.Storage_IO} `(A.9)'
21154 This package provides a facility for mapping arbitrary Ada types to and
21155 from a storage buffer. It is primarily intended for the creation of new
21158 @item @code{Ada.Streams} `(13.13.1)'
21160 This is a generic package that provides the basic support for the
21161 concept of streams as used by the stream attributes (@code{Input},
21162 @code{Output}, @code{Read} and @code{Write}).
21164 @item @code{Ada.Streams.Stream_IO} `(A.12.1)'
21166 This package is a specialization of the type @code{Streams} defined in
21167 package @code{Streams} together with a set of operations providing
21168 Stream_IO capability. The Stream_IO model permits both random and
21169 sequential access to a file which can contain an arbitrary set of values
21170 of one or more Ada types.
21172 @item @code{Ada.Strings} `(A.4.1)'
21174 This package provides some basic constants used by the string handling
21177 @item @code{Ada.Strings.Bounded} `(A.4.4)'
21179 This package provides facilities for handling variable length
21180 strings. The bounded model requires a maximum length. It is thus
21181 somewhat more limited than the unbounded model, but avoids the use of
21182 dynamic allocation or finalization.
21184 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} `(A.4.10)'
21186 Provides case-insensitive comparisons of bounded strings
21188 @item @code{Ada.Strings.Bounded.Hash} `(A.4.9)'
21190 This package provides a generic hash function for bounded strings
21192 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} `(A.4.9)'
21194 This package provides a generic hash function for bounded strings that
21195 converts the string to be hashed to lower case.
21197 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} `(A.4.10)'
21199 This package provides a comparison function for bounded strings that works
21200 in a case insensitive manner by converting to lower case before the comparison.
21202 @item @code{Ada.Strings.Fixed} `(A.4.3)'
21204 This package provides facilities for handling fixed length strings.
21206 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} `(A.4.10)'
21208 This package provides an equality function for fixed strings that compares
21209 the strings after converting both to lower case.
21211 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} `(A.4.9)'
21213 This package provides a case insensitive hash function for fixed strings that
21214 converts the string to lower case before computing the hash.
21216 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} `(A.4.10)'
21218 This package provides a comparison function for fixed strings that works
21219 in a case insensitive manner by converting to lower case before the comparison.
21221 @item @code{Ada.Strings.Hash} `(A.4.9)'
21223 This package provides a hash function for strings.
21225 @item @code{Ada.Strings.Hash_Case_Insensitive} `(A.4.9)'
21227 This package provides a hash function for strings that is case insensitive.
21228 The string is converted to lower case before computing the hash.
21230 @item @code{Ada.Strings.Less_Case_Insensitive} `(A.4.10)'
21232 This package provides a comparison function for\strings that works
21233 in a case insensitive manner by converting to lower case before the comparison.
21235 @item @code{Ada.Strings.Maps} `(A.4.2)'
21237 This package provides facilities for handling character mappings and
21238 arbitrarily defined subsets of characters. For instance it is useful in
21239 defining specialized translation tables.
21241 @item @code{Ada.Strings.Maps.Constants} `(A.4.6)'
21243 This package provides a standard set of predefined mappings and
21244 predefined character sets. For example, the standard upper to lower case
21245 conversion table is found in this package. Note that upper to lower case
21246 conversion is non-trivial if you want to take the entire set of
21247 characters, including extended characters like E with an acute accent,
21248 into account. You should use the mappings in this package (rather than
21249 adding 32 yourself) to do case mappings.
21251 @item @code{Ada.Strings.Unbounded} `(A.4.5)'
21253 This package provides facilities for handling variable length
21254 strings. The unbounded model allows arbitrary length strings, but
21255 requires the use of dynamic allocation and finalization.
21257 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} `(A.4.10)'
21259 Provides case-insensitive comparisons of unbounded strings
21261 @item @code{Ada.Strings.Unbounded.Hash} `(A.4.9)'
21263 This package provides a generic hash function for unbounded strings
21265 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} `(A.4.9)'
21267 This package provides a generic hash function for unbounded strings that
21268 converts the string to be hashed to lower case.
21270 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} `(A.4.10)'
21272 This package provides a comparison function for unbounded strings that works
21273 in a case insensitive manner by converting to lower case before the comparison.
21275 @item @code{Ada.Strings.UTF_Encoding} `(A.4.11)'
21277 This package provides basic definitions for dealing with UTF-encoded strings.
21279 @item @code{Ada.Strings.UTF_Encoding.Conversions} `(A.4.11)'
21281 This package provides conversion functions for UTF-encoded strings.
21284 @code{Ada.Strings.UTF_Encoding.Strings} `(A.4.11)'
21286 @code{Ada.Strings.UTF_Encoding.Wide_Strings} `(A.4.11)'
21291 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} `(A.4.11)'
21293 These packages provide facilities for handling UTF encodings for
21294 Strings, Wide_Strings and Wide_Wide_Strings.
21297 @code{Ada.Strings.Wide_Bounded} `(A.4.7)'
21299 @code{Ada.Strings.Wide_Fixed} `(A.4.7)'
21301 @code{Ada.Strings.Wide_Maps} `(A.4.7)'
21306 @item @code{Ada.Strings.Wide_Unbounded} `(A.4.7)'
21308 These packages provide analogous capabilities to the corresponding
21309 packages without @code{Wide_} in the name, but operate with the types
21310 @code{Wide_String} and @code{Wide_Character} instead of @code{String}
21311 and @code{Character}. Versions of all the child packages are available.
21314 @code{Ada.Strings.Wide_Wide_Bounded} `(A.4.7)'
21316 @code{Ada.Strings.Wide_Wide_Fixed} `(A.4.7)'
21318 @code{Ada.Strings.Wide_Wide_Maps} `(A.4.7)'
21323 @item @code{Ada.Strings.Wide_Wide_Unbounded} `(A.4.7)'
21325 These packages provide analogous capabilities to the corresponding
21326 packages without @code{Wide_} in the name, but operate with the types
21327 @code{Wide_Wide_String} and @code{Wide_Wide_Character} instead
21328 of @code{String} and @code{Character}.
21330 @item @code{Ada.Synchronous_Barriers} `(D.10.1)'
21332 This package provides facilities for synchronizing tasks at a low level
21335 @item @code{Ada.Synchronous_Task_Control} `(D.10)'
21337 This package provides some standard facilities for controlling task
21338 communication in a synchronous manner.
21340 @item @code{Ada.Synchronous_Task_Control.EDF} `(D.10)'
21342 Not implemented in GNAT.
21344 @item @code{Ada.Tags}
21346 This package contains definitions for manipulation of the tags of tagged
21349 @item @code{Ada.Tags.Generic_Dispatching_Constructor} `(3.9)'
21351 This package provides a way of constructing tagged class-wide values given
21352 only the tag value.
21354 @item @code{Ada.Task_Attributes} `(C.7.2)'
21356 This package provides the capability of associating arbitrary
21357 task-specific data with separate tasks.
21359 @item @code{Ada.Task_Identifification} `(C.7.1)'
21361 This package provides capabilities for task identification.
21363 @item @code{Ada.Task_Termination} `(C.7.3)'
21365 This package provides control over task termination.
21367 @item @code{Ada.Text_IO}
21369 This package provides basic text input-output capabilities for
21370 character, string and numeric data. The subpackages of this
21371 package are listed next. Note that although these are defined
21372 as subpackages in the RM, they are actually transparently
21373 implemented as child packages in GNAT, meaning that they
21374 are only loaded if needed.
21376 @item @code{Ada.Text_IO.Decimal_IO}
21378 Provides input-output facilities for decimal fixed-point types
21380 @item @code{Ada.Text_IO.Enumeration_IO}
21382 Provides input-output facilities for enumeration types.
21384 @item @code{Ada.Text_IO.Fixed_IO}
21386 Provides input-output facilities for ordinary fixed-point types.
21388 @item @code{Ada.Text_IO.Float_IO}
21390 Provides input-output facilities for float types. The following
21391 predefined instantiations of this generic package are available:
21399 @code{Short_Float_Text_IO}
21404 @code{Float_Text_IO}
21409 @code{Long_Float_Text_IO}
21412 @item @code{Ada.Text_IO.Integer_IO}
21414 Provides input-output facilities for integer types. The following
21415 predefined instantiations of this generic package are available:
21421 @code{Short_Short_Integer}
21423 @code{Ada.Short_Short_Integer_Text_IO}
21426 @code{Short_Integer}
21428 @code{Ada.Short_Integer_Text_IO}
21433 @code{Ada.Integer_Text_IO}
21436 @code{Long_Integer}
21438 @code{Ada.Long_Integer_Text_IO}
21441 @code{Long_Long_Integer}
21443 @code{Ada.Long_Long_Integer_Text_IO}
21446 @item @code{Ada.Text_IO.Modular_IO}
21448 Provides input-output facilities for modular (unsigned) types.
21450 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
21452 Provides input-output facilities for bounded strings.
21454 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
21456 This package provides basic text input-output capabilities for complex
21459 @item @code{Ada.Text_IO.Editing (F.3.3)}
21461 This package contains routines for edited output, analogous to the use
21462 of pictures in COBOL. The picture formats used by this package are a
21463 close copy of the facility in COBOL.
21465 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
21467 This package provides a facility that allows Text_IO files to be treated
21468 as streams, so that the stream attributes can be used for writing
21469 arbitrary data, including binary data, to Text_IO files.
21471 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
21473 This package provides input-output facilities for unbounded strings.
21475 @item @code{Ada.Unchecked_Conversion (13.9)}
21477 This generic package allows arbitrary conversion from one type to
21478 another of the same size, providing for breaking the type safety in
21479 special circumstances.
21481 If the types have the same Size (more accurately the same Value_Size),
21482 then the effect is simply to transfer the bits from the source to the
21483 target type without any modification. This usage is well defined, and
21484 for simple types whose representation is typically the same across
21485 all implementations, gives a portable method of performing such
21488 If the types do not have the same size, then the result is implementation
21489 defined, and thus may be non-portable. The following describes how GNAT
21490 handles such unchecked conversion cases.
21492 If the types are of different sizes, and are both discrete types, then
21493 the effect is of a normal type conversion without any constraint checking.
21494 In particular if the result type has a larger size, the result will be
21495 zero or sign extended. If the result type has a smaller size, the result
21496 will be truncated by ignoring high order bits.
21498 If the types are of different sizes, and are not both discrete types,
21499 then the conversion works as though pointers were created to the source
21500 and target, and the pointer value is converted. The effect is that bits
21501 are copied from successive low order storage units and bits of the source
21502 up to the length of the target type.
21504 A warning is issued if the lengths differ, since the effect in this
21505 case is implementation dependent, and the above behavior may not match
21506 that of some other compiler.
21508 A pointer to one type may be converted to a pointer to another type using
21509 unchecked conversion. The only case in which the effect is undefined is
21510 when one or both pointers are pointers to unconstrained array types. In
21511 this case, the bounds information may get incorrectly transferred, and in
21512 particular, GNAT uses double size pointers for such types, and it is
21513 meaningless to convert between such pointer types. GNAT will issue a
21514 warning if the alignment of the target designated type is more strict
21515 than the alignment of the source designated type (since the result may
21516 be unaligned in this case).
21518 A pointer other than a pointer to an unconstrained array type may be
21519 converted to and from System.Address. Such usage is common in Ada 83
21520 programs, but note that Ada.Address_To_Access_Conversions is the
21521 preferred method of performing such conversions in Ada 95 and Ada 2005.
21523 unchecked conversion nor Ada.Address_To_Access_Conversions should be
21524 used in conjunction with pointers to unconstrained objects, since
21525 the bounds information cannot be handled correctly in this case.
21527 @item @code{Ada.Unchecked_Deallocation} `(13.11.2)'
21529 This generic package allows explicit freeing of storage previously
21530 allocated by use of an allocator.
21532 @item @code{Ada.Wide_Text_IO} `(A.11)'
21534 This package is similar to @code{Ada.Text_IO}, except that the external
21535 file supports wide character representations, and the internal types are
21536 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21537 and @code{String}. The corresponding set of nested packages and child
21538 packages are defined.
21540 @item @code{Ada.Wide_Wide_Text_IO} `(A.11)'
21542 This package is similar to @code{Ada.Text_IO}, except that the external
21543 file supports wide character representations, and the internal types are
21544 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21545 and @code{String}. The corresponding set of nested packages and child
21546 packages are defined.
21549 For packages in Interfaces and System, all the RM defined packages are
21550 available in GNAT, see the Ada 2012 RM for full details.
21552 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
21553 @anchor{gnat_rm/the_implementation_of_standard_i_o doc}@anchor{2a2}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{2a3}@anchor{gnat_rm/the_implementation_of_standard_i_o the-implementation-of-standard-i-o}@anchor{f}
21554 @chapter The Implementation of Standard I/O
21557 GNAT implements all the required input-output facilities described in
21558 A.6 through A.14. These sections of the Ada Reference Manual describe the
21559 required behavior of these packages from the Ada point of view, and if
21560 you are writing a portable Ada program that does not need to know the
21561 exact manner in which Ada maps to the outside world when it comes to
21562 reading or writing external files, then you do not need to read this
21563 chapter. As long as your files are all regular files (not pipes or
21564 devices), and as long as you write and read the files only from Ada, the
21565 description in the Ada Reference Manual is sufficient.
21567 However, if you want to do input-output to pipes or other devices, such
21568 as the keyboard or screen, or if the files you are dealing with are
21569 either generated by some other language, or to be read by some other
21570 language, then you need to know more about the details of how the GNAT
21571 implementation of these input-output facilities behaves.
21573 In this chapter we give a detailed description of exactly how GNAT
21574 interfaces to the file system. As always, the sources of the system are
21575 available to you for answering questions at an even more detailed level,
21576 but for most purposes the information in this chapter will suffice.
21578 Another reason that you may need to know more about how input-output is
21579 implemented arises when you have a program written in mixed languages
21580 where, for example, files are shared between the C and Ada sections of
21581 the same program. GNAT provides some additional facilities, in the form
21582 of additional child library packages, that facilitate this sharing, and
21583 these additional facilities are also described in this chapter.
21586 * Standard I/O Packages::
21592 * Wide_Wide_Text_IO::
21594 * Text Translation::
21596 * Filenames encoding::
21597 * File content encoding::
21599 * Operations on C Streams::
21600 * Interfacing to C Streams::
21604 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
21605 @anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{2a4}@anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{2a5}
21606 @section Standard I/O Packages
21609 The Standard I/O packages described in Annex A for
21618 Ada.Text_IO.Complex_IO
21621 Ada.Text_IO.Text_Streams
21627 Ada.Wide_Text_IO.Complex_IO
21630 Ada.Wide_Text_IO.Text_Streams
21633 Ada.Wide_Wide_Text_IO
21636 Ada.Wide_Wide_Text_IO.Complex_IO
21639 Ada.Wide_Wide_Text_IO.Text_Streams
21651 are implemented using the C
21652 library streams facility; where
21658 All files are opened using @code{fopen}.
21661 All input/output operations use @code{fread}/@cite{fwrite}.
21664 There is no internal buffering of any kind at the Ada library level. The only
21665 buffering is that provided at the system level in the implementation of the
21666 library routines that support streams. This facilitates shared use of these
21667 streams by mixed language programs. Note though that system level buffering is
21668 explicitly enabled at elaboration of the standard I/O packages and that can
21669 have an impact on mixed language programs, in particular those using I/O before
21670 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
21671 the Ada elaboration routine before performing any I/O or when impractical,
21672 flush the common I/O streams and in particular Standard_Output before
21673 elaborating the Ada code.
21675 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
21676 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{2a6}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{2a7}
21677 @section FORM Strings
21680 The format of a FORM string in GNAT is:
21683 "keyword=value,keyword=value,...,keyword=value"
21686 where letters may be in upper or lower case, and there are no spaces
21687 between values. The order of the entries is not important. Currently
21688 the following keywords defined.
21691 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
21693 WCEM=[n|h|u|s|e|8|b]
21694 ENCODING=[UTF8|8BITS]
21697 The use of these parameters is described later in this section. If an
21698 unrecognized keyword appears in a form string, it is silently ignored
21699 and not considered invalid.
21701 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
21702 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{2a8}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{2a9}
21706 Direct_IO can only be instantiated for definite types. This is a
21707 restriction of the Ada language, which means that the records are fixed
21708 length (the length being determined by @code{type'Size}, rounded
21709 up to the next storage unit boundary if necessary).
21711 The records of a Direct_IO file are simply written to the file in index
21712 sequence, with the first record starting at offset zero, and subsequent
21713 records following. There is no control information of any kind. For
21714 example, if 32-bit integers are being written, each record takes
21715 4-bytes, so the record at index @code{K} starts at offset
21718 There is no limit on the size of Direct_IO files, they are expanded as
21719 necessary to accommodate whatever records are written to the file.
21721 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
21722 @anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{2aa}@anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{2ab}
21723 @section Sequential_IO
21726 Sequential_IO may be instantiated with either a definite (constrained)
21727 or indefinite (unconstrained) type.
21729 For the definite type case, the elements written to the file are simply
21730 the memory images of the data values with no control information of any
21731 kind. The resulting file should be read using the same type, no validity
21732 checking is performed on input.
21734 For the indefinite type case, the elements written consist of two
21735 parts. First is the size of the data item, written as the memory image
21736 of a @code{Interfaces.C.size_t} value, followed by the memory image of
21737 the data value. The resulting file can only be read using the same
21738 (unconstrained) type. Normal assignment checks are performed on these
21739 read operations, and if these checks fail, @code{Data_Error} is
21740 raised. In particular, in the array case, the lengths must match, and in
21741 the variant record case, if the variable for a particular read operation
21742 is constrained, the discriminants must match.
21744 Note that it is not possible to use Sequential_IO to write variable
21745 length array items, and then read the data back into different length
21746 arrays. For example, the following will raise @code{Data_Error}:
21749 package IO is new Sequential_IO (String);
21754 IO.Write (F, "hello!")
21755 IO.Reset (F, Mode=>In_File);
21760 On some Ada implementations, this will print @code{hell}, but the program is
21761 clearly incorrect, since there is only one element in the file, and that
21762 element is the string @code{hello!}.
21764 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
21765 using Stream_IO, and this is the preferred mechanism. In particular, the
21766 above program fragment rewritten to use Stream_IO will work correctly.
21768 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
21769 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{2ac}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{2ad}
21773 Text_IO files consist of a stream of characters containing the following
21774 special control characters:
21777 LF (line feed, 16#0A#) Line Mark
21778 FF (form feed, 16#0C#) Page Mark
21781 A canonical Text_IO file is defined as one in which the following
21782 conditions are met:
21788 The character @code{LF} is used only as a line mark, i.e., to mark the end
21792 The character @code{FF} is used only as a page mark, i.e., to mark the
21793 end of a page and consequently can appear only immediately following a
21794 @code{LF} (line mark) character.
21797 The file ends with either @code{LF} (line mark) or @code{LF}-@cite{FF}
21798 (line mark, page mark). In the former case, the page mark is implicitly
21799 assumed to be present.
21802 A file written using Text_IO will be in canonical form provided that no
21803 explicit @code{LF} or @code{FF} characters are written using @code{Put}
21804 or @code{Put_Line}. There will be no @code{FF} character at the end of
21805 the file unless an explicit @code{New_Page} operation was performed
21806 before closing the file.
21808 A canonical Text_IO file that is a regular file (i.e., not a device or a
21809 pipe) can be read using any of the routines in Text_IO. The
21810 semantics in this case will be exactly as defined in the Ada Reference
21811 Manual, and all the routines in Text_IO are fully implemented.
21813 A text file that does not meet the requirements for a canonical Text_IO
21814 file has one of the following:
21820 The file contains @code{FF} characters not immediately following a
21821 @code{LF} character.
21824 The file contains @code{LF} or @code{FF} characters written by
21825 @code{Put} or @code{Put_Line}, which are not logically considered to be
21826 line marks or page marks.
21829 The file ends in a character other than @code{LF} or @code{FF},
21830 i.e., there is no explicit line mark or page mark at the end of the file.
21833 Text_IO can be used to read such non-standard text files but subprograms
21834 to do with line or page numbers do not have defined meanings. In
21835 particular, a @code{FF} character that does not follow a @code{LF}
21836 character may or may not be treated as a page mark from the point of
21837 view of page and line numbering. Every @code{LF} character is considered
21838 to end a line, and there is an implied @code{LF} character at the end of
21842 * Stream Pointer Positioning::
21843 * Reading and Writing Non-Regular Files::
21845 * Treating Text_IO Files as Streams::
21846 * Text_IO Extensions::
21847 * Text_IO Facilities for Unbounded Strings::
21851 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21852 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{2ae}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{2af}
21853 @subsection Stream Pointer Positioning
21856 @code{Ada.Text_IO} has a definition of current position for a file that
21857 is being read. No internal buffering occurs in Text_IO, and usually the
21858 physical position in the stream used to implement the file corresponds
21859 to this logical position defined by Text_IO. There are two exceptions:
21865 After a call to @code{End_Of_Page} that returns @code{True}, the stream
21866 is positioned past the @code{LF} (line mark) that precedes the page
21867 mark. Text_IO maintains an internal flag so that subsequent read
21868 operations properly handle the logical position which is unchanged by
21869 the @code{End_Of_Page} call.
21872 After a call to @code{End_Of_File} that returns @code{True}, if the
21873 Text_IO file was positioned before the line mark at the end of file
21874 before the call, then the logical position is unchanged, but the stream
21875 is physically positioned right at the end of file (past the line mark,
21876 and past a possible page mark following the line mark. Again Text_IO
21877 maintains internal flags so that subsequent read operations properly
21878 handle the logical position.
21881 These discrepancies have no effect on the observable behavior of
21882 Text_IO, but if a single Ada stream is shared between a C program and
21883 Ada program, or shared (using @code{shared=yes} in the form string)
21884 between two Ada files, then the difference may be observable in some
21887 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21888 @anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{2b0}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{2b1}
21889 @subsection Reading and Writing Non-Regular Files
21892 A non-regular file is a device (such as a keyboard), or a pipe. Text_IO
21893 can be used for reading and writing. Writing is not affected and the
21894 sequence of characters output is identical to the normal file case, but
21895 for reading, the behavior of Text_IO is modified to avoid undesirable
21896 look-ahead as follows:
21898 An input file that is not a regular file is considered to have no page
21899 marks. Any @code{Ascii.FF} characters (the character normally used for a
21900 page mark) appearing in the file are considered to be data
21901 characters. In particular:
21907 @code{Get_Line} and @code{Skip_Line} do not test for a page mark
21908 following a line mark. If a page mark appears, it will be treated as a
21912 This avoids the need to wait for an extra character to be typed or
21913 entered from the pipe to complete one of these operations.
21916 @code{End_Of_Page} always returns @code{False}
21919 @code{End_Of_File} will return @code{False} if there is a page mark at
21920 the end of the file.
21923 Output to non-regular files is the same as for regular files. Page marks
21924 may be written to non-regular files using @code{New_Page}, but as noted
21925 above they will not be treated as page marks on input if the output is
21926 piped to another Ada program.
21928 Another important discrepancy when reading non-regular files is that the end
21929 of file indication is not ‘sticky’. If an end of file is entered, e.g., by
21930 pressing the @code{EOT} key,
21932 is signaled once (i.e., the test @code{End_Of_File}
21933 will yield @code{True}, or a read will
21934 raise @code{End_Error}), but then reading can resume
21935 to read data past that end of
21936 file indication, until another end of file indication is entered.
21938 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
21939 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{2b2}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2b3}
21940 @subsection Get_Immediate
21943 @geindex Get_Immediate
21945 Get_Immediate returns the next character (including control characters)
21946 from the input file. In particular, Get_Immediate will return LF or FF
21947 characters used as line marks or page marks. Such operations leave the
21948 file positioned past the control character, and it is thus not treated
21949 as having its normal function. This means that page, line and column
21950 counts after this kind of Get_Immediate call are set as though the mark
21951 did not occur. In the case where a Get_Immediate leaves the file
21952 positioned between the line mark and page mark (which is not normally
21953 possible), it is undefined whether the FF character will be treated as a
21956 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
21957 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2b4}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2b5}
21958 @subsection Treating Text_IO Files as Streams
21961 @geindex Stream files
21963 The package @code{Text_IO.Streams} allows a @code{Text_IO} file to be treated
21964 as a stream. Data written to a @code{Text_IO} file in this stream mode is
21965 binary data. If this binary data contains bytes 16#0A# (@code{LF}) or
21966 16#0C# (@code{FF}), the resulting file may have non-standard
21967 format. Similarly if read operations are used to read from a Text_IO
21968 file treated as a stream, then @code{LF} and @code{FF} characters may be
21969 skipped and the effect is similar to that described above for
21970 @code{Get_Immediate}.
21972 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
21973 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2b6}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2b7}
21974 @subsection Text_IO Extensions
21977 @geindex Text_IO extensions
21979 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
21980 to the standard @code{Text_IO} package:
21986 function File_Exists (Name : String) return Boolean;
21987 Determines if a file of the given name exists.
21990 function Get_Line return String;
21991 Reads a string from the standard input file. The value returned is exactly
21992 the length of the line that was read.
21995 function Get_Line (File : Ada.Text_IO.File_Type) return String;
21996 Similar, except that the parameter File specifies the file from which
21997 the string is to be read.
22000 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
22001 @anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2b8}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2b9}
22002 @subsection Text_IO Facilities for Unbounded Strings
22005 @geindex Text_IO for unbounded strings
22007 @geindex Unbounded_String
22008 @geindex Text_IO operations
22010 The package @code{Ada.Strings.Unbounded.Text_IO}
22011 in library files @code{a-suteio.ads/adb} contains some GNAT-specific
22012 subprograms useful for Text_IO operations on unbounded strings:
22018 function Get_Line (File : File_Type) return Unbounded_String;
22019 Reads a line from the specified file
22020 and returns the result as an unbounded string.
22023 procedure Put (File : File_Type; U : Unbounded_String);
22024 Writes the value of the given unbounded string to the specified file
22025 Similar to the effect of
22026 @code{Put (To_String (U))} except that an extra copy is avoided.
22029 procedure Put_Line (File : File_Type; U : Unbounded_String);
22030 Writes the value of the given unbounded string to the specified file,
22031 followed by a @code{New_Line}.
22032 Similar to the effect of @code{Put_Line (To_String (U))} except
22033 that an extra copy is avoided.
22036 In the above procedures, @code{File} is of type @code{Ada.Text_IO.File_Type}
22037 and is optional. If the parameter is omitted, then the standard input or
22038 output file is referenced as appropriate.
22040 The package @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
22041 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
22042 @code{Wide_Text_IO} functionality for unbounded wide strings.
22044 The package @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
22045 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
22046 @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
22048 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
22049 @anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2ba}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2bb}
22050 @section Wide_Text_IO
22053 @code{Wide_Text_IO} is similar in most respects to Text_IO, except that
22054 both input and output files may contain special sequences that represent
22055 wide character values. The encoding scheme for a given file may be
22056 specified using a FORM parameter:
22062 as part of the FORM string (WCEM = wide character encoding method),
22063 where @code{x} is one of the following characters
22066 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx}
22089 Upper half encoding
22126 The encoding methods match those that
22127 can be used in a source
22128 program, but there is no requirement that the encoding method used for
22129 the source program be the same as the encoding method used for files,
22130 and different files may use different encoding methods.
22132 The default encoding method for the standard files, and for opened files
22133 for which no WCEM parameter is given in the FORM string matches the
22134 wide character encoding specified for the main program (the default
22135 being brackets encoding if no coding method was specified with -gnatW).
22142 In this encoding, a wide character is represented by a five character
22153 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22154 characters (using upper case letters) of the wide character code. For
22155 example, ESC A345 is used to represent the wide character with code
22156 16#A345#. This scheme is compatible with use of the full
22157 @code{Wide_Character} set.
22163 @item `Upper Half Coding'
22165 The wide character with encoding 16#abcd#, where the upper bit is on
22166 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
22167 16#cd#. The second byte may never be a format control character, but is
22168 not required to be in the upper half. This method can be also used for
22169 shift-JIS or EUC where the internal coding matches the external coding.
22171 @item `Shift JIS Coding'
22173 A wide character is represented by a two character sequence 16#ab# and
22174 16#cd#, with the restrictions described for upper half encoding as
22175 described above. The internal character code is the corresponding JIS
22176 character according to the standard algorithm for Shift-JIS
22177 conversion. Only characters defined in the JIS code set table can be
22178 used with this encoding method.
22182 A wide character is represented by a two character sequence 16#ab# and
22183 16#cd#, with both characters being in the upper half. The internal
22184 character code is the corresponding JIS character according to the EUC
22185 encoding algorithm. Only characters defined in the JIS code set table
22186 can be used with this encoding method.
22188 @item `UTF-8 Coding'
22190 A wide character is represented using
22191 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22192 10646-1/Am.2. Depending on the character value, the representation
22193 is a one, two, or three byte sequence:
22197 16#0000#-16#007f#: 2#0xxxxxxx#
22198 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
22199 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22205 where the @code{xxx} bits correspond to the left-padded bits of the
22206 16-bit character value. Note that all lower half ASCII characters
22207 are represented as ASCII bytes and all upper half characters and
22208 other wide characters are represented as sequences of upper-half
22209 (The full UTF-8 scheme allows for encoding 31-bit characters as
22210 6-byte sequences, but in this implementation, all UTF-8 sequences
22211 of four or more bytes length will raise a Constraint_Error, as
22212 will all invalid UTF-8 sequences.)
22218 @item `Brackets Coding'
22220 In this encoding, a wide character is represented by the following eight
22221 character sequence:
22231 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22232 characters (using uppercase letters) of the wide character code. For
22233 example, @code{["A345"]} is used to represent the wide character with code
22235 This scheme is compatible with use of the full Wide_Character set.
22236 On input, brackets coding can also be used for upper half characters,
22237 e.g., @code{["C1"]} for lower case a. However, on output, brackets notation
22238 is only used for wide characters with a code greater than @code{16#FF#}.
22240 Note that brackets coding is not normally used in the context of
22241 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
22242 a portable way of encoding source files. In the context of Wide_Text_IO
22243 or Wide_Wide_Text_IO, it can only be used if the file does not contain
22244 any instance of the left bracket character other than to encode wide
22245 character values using the brackets encoding method. In practice it is
22246 expected that some standard wide character encoding method such
22247 as UTF-8 will be used for text input output.
22249 If brackets notation is used, then any occurrence of a left bracket
22250 in the input file which is not the start of a valid wide character
22251 sequence will cause Constraint_Error to be raised. It is possible to
22252 encode a left bracket as [“5B”] and Wide_Text_IO and Wide_Wide_Text_IO
22253 input will interpret this as a left bracket.
22255 However, when a left bracket is output, it will be output as a left bracket
22256 and not as [“5B”]. We make this decision because for normal use of
22257 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
22258 brackets. For example, if we write:
22261 Put_Line ("Start of output [first run]");
22264 we really do not want to have the left bracket in this message clobbered so
22265 that the output reads:
22269 Start of output ["5B"]first run]
22275 In practice brackets encoding is reasonably useful for normal Put_Line use
22276 since we won’t get confused between left brackets and wide character
22277 sequences in the output. But for input, or when files are written out
22278 and read back in, it really makes better sense to use one of the standard
22279 encoding methods such as UTF-8.
22282 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
22283 not all wide character
22284 values can be represented. An attempt to output a character that cannot
22285 be represented using the encoding scheme for the file causes
22286 Constraint_Error to be raised. An invalid wide character sequence on
22287 input also causes Constraint_Error to be raised.
22290 * Stream Pointer Positioning: Stream Pointer Positioning<2>.
22291 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>.
22295 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
22296 @anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2bc}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2bd}
22297 @subsection Stream Pointer Positioning
22300 @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22301 of stream pointer positioning (@ref{2ad,,Text_IO}). There is one additional
22304 If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
22305 normal lower ASCII set, i.e. a character in the range:
22308 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
22311 then although the logical position of the file pointer is unchanged by
22312 the @code{Look_Ahead} call, the stream is physically positioned past the
22313 wide character sequence. Again this is to avoid the need for buffering
22314 or backup, and all @code{Wide_Text_IO} routines check the internal
22315 indication that this situation has occurred so that this is not visible
22316 to a normal program using @code{Wide_Text_IO}. However, this discrepancy
22317 can be observed if the wide text file shares a stream with another file.
22319 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
22320 @anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2be}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2bf}
22321 @subsection Reading and Writing Non-Regular Files
22324 As in the case of Text_IO, when a non-regular file is read, it is
22325 assumed that the file contains no page marks (any form characters are
22326 treated as data characters), and @code{End_Of_Page} always returns
22327 @code{False}. Similarly, the end of file indication is not sticky, so
22328 it is possible to read beyond an end of file.
22330 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
22331 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2c0}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2c1}
22332 @section Wide_Wide_Text_IO
22335 @code{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
22336 both input and output files may contain special sequences that represent
22337 wide wide character values. The encoding scheme for a given file may be
22338 specified using a FORM parameter:
22344 as part of the FORM string (WCEM = wide character encoding method),
22345 where @code{x} is one of the following characters
22348 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx}
22371 Upper half encoding
22408 The encoding methods match those that
22409 can be used in a source
22410 program, but there is no requirement that the encoding method used for
22411 the source program be the same as the encoding method used for files,
22412 and different files may use different encoding methods.
22414 The default encoding method for the standard files, and for opened files
22415 for which no WCEM parameter is given in the FORM string matches the
22416 wide character encoding specified for the main program (the default
22417 being brackets encoding if no coding method was specified with -gnatW).
22422 @item `UTF-8 Coding'
22424 A wide character is represented using
22425 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22426 10646-1/Am.2. Depending on the character value, the representation
22427 is a one, two, three, or four byte sequence:
22431 16#000000#-16#00007f#: 2#0xxxxxxx#
22432 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
22433 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22434 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
22440 where the @code{xxx} bits correspond to the left-padded bits of the
22441 21-bit character value. Note that all lower half ASCII characters
22442 are represented as ASCII bytes and all upper half characters and
22443 other wide characters are represented as sequences of upper-half
22450 @item `Brackets Coding'
22452 In this encoding, a wide wide character is represented by the following eight
22453 character sequence if is in wide character range
22463 and by the following ten character sequence if not
22467 [ " a b c d e f " ]
22473 where @code{a}, @code{b}, @code{c}, @code{d}, @code{e}, and @code{f}
22474 are the four or six hexadecimal
22475 characters (using uppercase letters) of the wide wide character code. For
22476 example, @code{["01A345"]} is used to represent the wide wide character
22477 with code @code{16#01A345#}.
22479 This scheme is compatible with use of the full Wide_Wide_Character set.
22480 On input, brackets coding can also be used for upper half characters,
22481 e.g., @code{["C1"]} for lower case a. However, on output, brackets notation
22482 is only used for wide characters with a code greater than @code{16#FF#}.
22485 If is also possible to use the other Wide_Character encoding methods,
22486 such as Shift-JIS, but the other schemes cannot support the full range
22487 of wide wide characters.
22488 An attempt to output a character that cannot
22489 be represented using the encoding scheme for the file causes
22490 Constraint_Error to be raised. An invalid wide character sequence on
22491 input also causes Constraint_Error to be raised.
22494 * Stream Pointer Positioning: Stream Pointer Positioning<3>.
22495 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>.
22499 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
22500 @anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2c2}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2c3}
22501 @subsection Stream Pointer Positioning
22504 @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22505 of stream pointer positioning (@ref{2ad,,Text_IO}). There is one additional
22508 If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
22509 normal lower ASCII set, i.e. a character in the range:
22512 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
22515 then although the logical position of the file pointer is unchanged by
22516 the @code{Look_Ahead} call, the stream is physically positioned past the
22517 wide character sequence. Again this is to avoid the need for buffering
22518 or backup, and all @code{Wide_Wide_Text_IO} routines check the internal
22519 indication that this situation has occurred so that this is not visible
22520 to a normal program using @code{Wide_Wide_Text_IO}. However, this discrepancy
22521 can be observed if the wide text file shares a stream with another file.
22523 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
22524 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2c4}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2c5}
22525 @subsection Reading and Writing Non-Regular Files
22528 As in the case of Text_IO, when a non-regular file is read, it is
22529 assumed that the file contains no page marks (any form characters are
22530 treated as data characters), and @code{End_Of_Page} always returns
22531 @code{False}. Similarly, the end of file indication is not sticky, so
22532 it is possible to read beyond an end of file.
22534 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
22535 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2c6}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2c7}
22539 A stream file is a sequence of bytes, where individual elements are
22540 written to the file as described in the Ada Reference Manual. The type
22541 @code{Stream_Element} is simply a byte. There are two ways to read or
22542 write a stream file.
22548 The operations @code{Read} and @code{Write} directly read or write a
22549 sequence of stream elements with no control information.
22552 The stream attributes applied to a stream file transfer data in the
22553 manner described for stream attributes.
22556 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
22557 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2c8}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2c9}
22558 @section Text Translation
22561 @code{Text_Translation=xxx} may be used as the Form parameter
22562 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
22563 has no effect on Unix systems. Possible values are:
22569 @code{Yes} or @code{Text} is the default, which means to
22570 translate LF to/from CR/LF on Windows systems.
22572 @code{No} disables this translation; i.e. it
22573 uses binary mode. For output files, @code{Text_Translation=No}
22574 may be used to create Unix-style files on
22578 @code{wtext} translation enabled in Unicode mode.
22579 (corresponds to _O_WTEXT).
22582 @code{u8text} translation enabled in Unicode UTF-8 mode.
22583 (corresponds to O_U8TEXT).
22586 @code{u16text} translation enabled in Unicode UTF-16
22587 mode. (corresponds to_O_U16TEXT).
22590 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
22591 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2ca}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2cb}
22592 @section Shared Files
22595 Section A.14 of the Ada Reference Manual allows implementations to
22596 provide a wide variety of behavior if an attempt is made to access the
22597 same external file with two or more internal files.
22599 To provide a full range of functionality, while at the same time
22600 minimizing the problems of portability caused by this implementation
22601 dependence, GNAT handles file sharing as follows:
22607 In the absence of a @code{shared=xxx} form parameter, an attempt
22608 to open two or more files with the same full name is considered an error
22609 and is not supported. The exception @code{Use_Error} will be
22610 raised. Note that a file that is not explicitly closed by the program
22611 remains open until the program terminates.
22614 If the form parameter @code{shared=no} appears in the form string, the
22615 file can be opened or created with its own separate stream identifier,
22616 regardless of whether other files sharing the same external file are
22617 opened. The exact effect depends on how the C stream routines handle
22618 multiple accesses to the same external files using separate streams.
22621 If the form parameter @code{shared=yes} appears in the form string for
22622 each of two or more files opened using the same full name, the same
22623 stream is shared between these files, and the semantics are as described
22624 in Ada Reference Manual, Section A.14.
22627 When a program that opens multiple files with the same name is ported
22628 from another Ada compiler to GNAT, the effect will be that
22629 @code{Use_Error} is raised.
22631 The documentation of the original compiler and the documentation of the
22632 program should then be examined to determine if file sharing was
22633 expected, and @code{shared=xxx} parameters added to @code{Open}
22634 and @code{Create} calls as required.
22636 When a program is ported from GNAT to some other Ada compiler, no
22637 special attention is required unless the @code{shared=xxx} form
22638 parameter is used in the program. In this case, you must examine the
22639 documentation of the new compiler to see if it supports the required
22640 file sharing semantics, and form strings modified appropriately. Of
22641 course it may be the case that the program cannot be ported if the
22642 target compiler does not support the required functionality. The best
22643 approach in writing portable code is to avoid file sharing (and hence
22644 the use of the @code{shared=xxx} parameter in the form string)
22647 One common use of file sharing in Ada 83 is the use of instantiations of
22648 Sequential_IO on the same file with different types, to achieve
22649 heterogeneous input-output. Although this approach will work in GNAT if
22650 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
22651 for this purpose (using the stream attributes)
22653 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
22654 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2cc}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2cd}
22655 @section Filenames encoding
22658 An encoding form parameter can be used to specify the filename
22659 encoding @code{encoding=xxx}.
22665 If the form parameter @code{encoding=utf8} appears in the form string, the
22666 filename must be encoded in UTF-8.
22669 If the form parameter @code{encoding=8bits} appears in the form
22670 string, the filename must be a standard 8bits string.
22673 In the absence of a @code{encoding=xxx} form parameter, the
22674 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
22675 variable. And if not set @code{utf8} is assumed.
22682 The current system Windows ANSI code page.
22689 This encoding form parameter is only supported on the Windows
22690 platform. On the other Operating Systems the run-time is supporting
22693 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
22694 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2ce}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2cf}
22695 @section File content encoding
22698 For text files it is possible to specify the encoding to use. This is
22699 controlled by the by the @code{GNAT_CCS_ENCODING} environment
22700 variable. And if not set @code{TEXT} is assumed.
22702 The possible values are those supported on Windows:
22709 Translated text mode
22713 Translated unicode encoding
22717 Unicode 16-bit encoding
22721 Unicode 8-bit encoding
22724 This encoding is only supported on the Windows platform.
22726 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
22727 @anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2d0}@anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2d1}
22728 @section Open Modes
22731 @code{Open} and @code{Create} calls result in a call to @code{fopen}
22732 using the mode shown in the following table:
22735 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx}
22738 @code{Open} and @code{Create} Call Modes
22780 Out_File (Direct_IO)
22792 Out_File (all other cases)
22817 If text file translation is required, then either @code{b} or @code{t}
22818 is added to the mode, depending on the setting of Text. Text file
22819 translation refers to the mapping of CR/LF sequences in an external file
22820 to LF characters internally. This mapping only occurs in DOS and
22821 DOS-like systems, and is not relevant to other systems.
22823 A special case occurs with Stream_IO. As shown in the above table, the
22824 file is initially opened in @code{r} or @code{w} mode for the
22825 @code{In_File} and @code{Out_File} cases. If a @code{Set_Mode} operation
22826 subsequently requires switching from reading to writing or vice-versa,
22827 then the file is reopened in @code{r+} mode to permit the required operation.
22829 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22830 @anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2d2}@anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2d3}
22831 @section Operations on C Streams
22834 The package @code{Interfaces.C_Streams} provides an Ada program with direct
22835 access to the C library functions for operations on C streams:
22838 package Interfaces.C_Streams is
22839 -- Note: the reason we do not use the types that are in
22840 -- Interfaces.C is that we want to avoid dragging in the
22841 -- code in this unit if possible.
22842 subtype chars is System.Address;
22843 -- Pointer to null-terminated array of characters
22844 subtype FILEs is System.Address;
22845 -- Corresponds to the C type FILE*
22846 subtype voids is System.Address;
22847 -- Corresponds to the C type void*
22848 subtype int is Integer;
22849 subtype long is Long_Integer;
22850 -- Note: the above types are subtypes deliberately, and it
22851 -- is part of this spec that the above correspondences are
22852 -- guaranteed. This means that it is legitimate to, for
22853 -- example, use Integer instead of int. We provide these
22854 -- synonyms for clarity, but in some cases it may be
22855 -- convenient to use the underlying types (for example to
22856 -- avoid an unnecessary dependency of a spec on the spec
22858 type size_t is mod 2 ** Standard'Address_Size;
22859 NULL_Stream : constant FILEs;
22860 -- Value returned (NULL in C) to indicate an
22861 -- fdopen/fopen/tmpfile error
22862 ----------------------------------
22863 -- Constants Defined in stdio.h --
22864 ----------------------------------
22865 EOF : constant int;
22866 -- Used by a number of routines to indicate error or
22868 IOFBF : constant int;
22869 IOLBF : constant int;
22870 IONBF : constant int;
22871 -- Used to indicate buffering mode for setvbuf call
22872 SEEK_CUR : constant int;
22873 SEEK_END : constant int;
22874 SEEK_SET : constant int;
22875 -- Used to indicate origin for fseek call
22876 function stdin return FILEs;
22877 function stdout return FILEs;
22878 function stderr return FILEs;
22879 -- Streams associated with standard files
22880 --------------------------
22881 -- Standard C functions --
22882 --------------------------
22883 -- The functions selected below are ones that are
22884 -- available in UNIX (but not necessarily in ANSI C).
22885 -- These are very thin interfaces
22886 -- which copy exactly the C headers. For more
22887 -- documentation on these functions, see the Microsoft C
22888 -- "Run-Time Library Reference" (Microsoft Press, 1990,
22889 -- ISBN 1-55615-225-6), which includes useful information
22890 -- on system compatibility.
22891 procedure clearerr (stream : FILEs);
22892 function fclose (stream : FILEs) return int;
22893 function fdopen (handle : int; mode : chars) return FILEs;
22894 function feof (stream : FILEs) return int;
22895 function ferror (stream : FILEs) return int;
22896 function fflush (stream : FILEs) return int;
22897 function fgetc (stream : FILEs) return int;
22898 function fgets (strng : chars; n : int; stream : FILEs)
22900 function fileno (stream : FILEs) return int;
22901 function fopen (filename : chars; Mode : chars)
22903 -- Note: to maintain target independence, use
22904 -- text_translation_required, a boolean variable defined in
22905 -- a-sysdep.c to deal with the target dependent text
22906 -- translation requirement. If this variable is set,
22907 -- then b/t should be appended to the standard mode
22908 -- argument to set the text translation mode off or on
22910 function fputc (C : int; stream : FILEs) return int;
22911 function fputs (Strng : chars; Stream : FILEs) return int;
22928 function ftell (stream : FILEs) return long;
22935 function isatty (handle : int) return int;
22936 procedure mktemp (template : chars);
22937 -- The return value (which is just a pointer to template)
22939 procedure rewind (stream : FILEs);
22940 function rmtmp return int;
22948 function tmpfile return FILEs;
22949 function ungetc (c : int; stream : FILEs) return int;
22950 function unlink (filename : chars) return int;
22951 ---------------------
22952 -- Extra functions --
22953 ---------------------
22954 -- These functions supply slightly thicker bindings than
22955 -- those above. They are derived from functions in the
22956 -- C Run-Time Library, but may do a bit more work than
22957 -- just directly calling one of the Library functions.
22958 function is_regular_file (handle : int) return int;
22959 -- Tests if given handle is for a regular file (result 1)
22960 -- or for a non-regular file (pipe or device, result 0).
22961 ---------------------------------
22962 -- Control of Text/Binary Mode --
22963 ---------------------------------
22964 -- If text_translation_required is true, then the following
22965 -- functions may be used to dynamically switch a file from
22966 -- binary to text mode or vice versa. These functions have
22967 -- no effect if text_translation_required is false (i.e., in
22968 -- normal UNIX mode). Use fileno to get a stream handle.
22969 procedure set_binary_mode (handle : int);
22970 procedure set_text_mode (handle : int);
22971 ----------------------------
22972 -- Full Path Name support --
22973 ----------------------------
22974 procedure full_name (nam : chars; buffer : chars);
22975 -- Given a NUL terminated string representing a file
22976 -- name, returns in buffer a NUL terminated string
22977 -- representing the full path name for the file name.
22978 -- On systems where it is relevant the drive is also
22979 -- part of the full path name. It is the responsibility
22980 -- of the caller to pass an actual parameter for buffer
22981 -- that is big enough for any full path name. Use
22982 -- max_path_len given below as the size of buffer.
22983 max_path_len : integer;
22984 -- Maximum length of an allowable full path name on the
22985 -- system, including a terminating NUL character.
22986 end Interfaces.C_Streams;
22989 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
22990 @anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2d4}@anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2d5}
22991 @section Interfacing to C Streams
22994 The packages in this section permit interfacing Ada files to C Stream
22998 with Interfaces.C_Streams;
22999 package Ada.Sequential_IO.C_Streams is
23000 function C_Stream (F : File_Type)
23001 return Interfaces.C_Streams.FILEs;
23003 (File : in out File_Type;
23004 Mode : in File_Mode;
23005 C_Stream : in Interfaces.C_Streams.FILEs;
23006 Form : in String := "");
23007 end Ada.Sequential_IO.C_Streams;
23009 with Interfaces.C_Streams;
23010 package Ada.Direct_IO.C_Streams is
23011 function C_Stream (F : File_Type)
23012 return Interfaces.C_Streams.FILEs;
23014 (File : in out File_Type;
23015 Mode : in File_Mode;
23016 C_Stream : in Interfaces.C_Streams.FILEs;
23017 Form : in String := "");
23018 end Ada.Direct_IO.C_Streams;
23020 with Interfaces.C_Streams;
23021 package Ada.Text_IO.C_Streams is
23022 function C_Stream (F : File_Type)
23023 return Interfaces.C_Streams.FILEs;
23025 (File : in out File_Type;
23026 Mode : in File_Mode;
23027 C_Stream : in Interfaces.C_Streams.FILEs;
23028 Form : in String := "");
23029 end Ada.Text_IO.C_Streams;
23031 with Interfaces.C_Streams;
23032 package Ada.Wide_Text_IO.C_Streams is
23033 function C_Stream (F : File_Type)
23034 return Interfaces.C_Streams.FILEs;
23036 (File : in out File_Type;
23037 Mode : in File_Mode;
23038 C_Stream : in Interfaces.C_Streams.FILEs;
23039 Form : in String := "");
23040 end Ada.Wide_Text_IO.C_Streams;
23042 with Interfaces.C_Streams;
23043 package Ada.Wide_Wide_Text_IO.C_Streams is
23044 function C_Stream (F : File_Type)
23045 return Interfaces.C_Streams.FILEs;
23047 (File : in out File_Type;
23048 Mode : in File_Mode;
23049 C_Stream : in Interfaces.C_Streams.FILEs;
23050 Form : in String := "");
23051 end Ada.Wide_Wide_Text_IO.C_Streams;
23053 with Interfaces.C_Streams;
23054 package Ada.Stream_IO.C_Streams is
23055 function C_Stream (F : File_Type)
23056 return Interfaces.C_Streams.FILEs;
23058 (File : in out File_Type;
23059 Mode : in File_Mode;
23060 C_Stream : in Interfaces.C_Streams.FILEs;
23061 Form : in String := "");
23062 end Ada.Stream_IO.C_Streams;
23065 In each of these six packages, the @code{C_Stream} function obtains the
23066 @code{FILE} pointer from a currently opened Ada file. It is then
23067 possible to use the @code{Interfaces.C_Streams} package to operate on
23068 this stream, or the stream can be passed to a C program which can
23069 operate on it directly. Of course the program is responsible for
23070 ensuring that only appropriate sequences of operations are executed.
23072 One particular use of relevance to an Ada program is that the
23073 @code{setvbuf} function can be used to control the buffering of the
23074 stream used by an Ada file. In the absence of such a call the standard
23075 default buffering is used.
23077 The @code{Open} procedures in these packages open a file giving an
23078 existing C Stream instead of a file name. Typically this stream is
23079 imported from a C program, allowing an Ada file to operate on an
23082 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
23083 @anchor{gnat_rm/the_gnat_library doc}@anchor{2d6}@anchor{gnat_rm/the_gnat_library id1}@anchor{2d7}@anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}
23084 @chapter The GNAT Library
23087 The GNAT library contains a number of general and special purpose packages.
23088 It represents functionality that the GNAT developers have found useful, and
23089 which is made available to GNAT users. The packages described here are fully
23090 supported, and upwards compatibility will be maintained in future releases,
23091 so you can use these facilities with the confidence that the same functionality
23092 will be available in future releases.
23094 The chapter here simply gives a brief summary of the facilities available.
23095 The full documentation is found in the spec file for the package. The full
23096 sources of these library packages, including both spec and body, are provided
23097 with all GNAT releases. For example, to find out the full specifications of
23098 the SPITBOL pattern matching capability, including a full tutorial and
23099 extensive examples, look in the @code{g-spipat.ads} file in the library.
23101 For each entry here, the package name (as it would appear in a @code{with}
23102 clause) is given, followed by the name of the corresponding spec file in
23103 parentheses. The packages are children in four hierarchies, @code{Ada},
23104 @code{Interfaces}, @code{System}, and @code{GNAT}, the latter being a
23105 GNAT-specific hierarchy.
23107 Note that an application program should only use packages in one of these
23108 four hierarchies if the package is defined in the Ada Reference Manual,
23109 or is listed in this section of the GNAT Programmers Reference Manual.
23110 All other units should be considered internal implementation units and
23111 should not be directly @code{with}ed by application code. The use of
23112 a @code{with} clause that references one of these internal implementation
23113 units makes an application potentially dependent on changes in versions
23114 of GNAT, and will generate a warning message.
23117 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads.
23118 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads.
23119 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads.
23120 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads.
23121 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads.
23122 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads.
23123 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads.
23124 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads.
23125 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads.
23126 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads.
23127 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads.
23128 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads.
23129 * Ada.Containers.Functional_Infinite_Sequences (a-cfinse.ads): Ada Containers Functional_Infinite_Sequences a-cfinse ads.
23130 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads.
23131 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads.
23132 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads.
23133 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads.
23134 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads.
23135 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads.
23136 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads.
23137 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads.
23138 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads.
23139 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads.
23140 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads.
23141 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads.
23142 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads.
23143 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
23144 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
23145 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
23146 * Ada.Task_Initialization (a-tasini.ads): Ada Task_Initialization a-tasini ads.
23147 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
23148 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
23149 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
23150 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads.
23151 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads.
23152 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads.
23153 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads.
23154 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads.
23155 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads.
23156 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads.
23157 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads.
23158 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads.
23159 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads.
23160 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads.
23161 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads.
23162 * GNAT.Binary_Search (g-binsea.ads): GNAT Binary_Search g-binsea ads.
23163 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads.
23164 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads.
23165 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads.
23166 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads.
23167 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads.
23168 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads.
23169 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads.
23170 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads.
23171 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads.
23172 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads.
23173 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads.
23174 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads.
23175 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads.
23176 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads.
23177 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads.
23178 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads.
23179 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads.
23180 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads.
23181 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads.
23182 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads.
23183 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads.
23184 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads.
23185 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads.
23186 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads.
23187 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads.
23188 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads.
23189 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads.
23190 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads.
23191 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads.
23192 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads.
23193 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads.
23194 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads.
23195 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads.
23196 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads.
23197 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads.
23198 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads.
23199 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads.
23200 * GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads): GNAT Generic_Fast_Math_Functions g-gfmafu ads.
23201 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads.
23202 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads.
23203 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads.
23204 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads.
23205 * GNAT.IO (g-io.ads): GNAT IO g-io ads.
23206 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads.
23207 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads.
23208 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads.
23209 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads.
23210 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads.
23211 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads.
23212 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads.
23213 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads.
23214 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads.
23215 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads.
23216 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads.
23217 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads.
23218 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads.
23219 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads.
23220 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads.
23221 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads.
23222 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads.
23223 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads.
23224 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads.
23225 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads.
23226 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads.
23227 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads.
23228 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads.
23229 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads.
23230 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads.
23231 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads.
23232 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads.
23233 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads.
23234 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads.
23235 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads.
23236 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads.
23237 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads.
23238 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads.
23239 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads.
23240 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads.
23241 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads.
23242 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads.
23243 * GNAT.Table (g-table.ads): GNAT Table g-table ads.
23244 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads.
23245 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads.
23246 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads.
23247 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads.
23248 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads.
23249 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads.
23250 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads.
23251 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads.
23252 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads.
23253 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads.
23254 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads.
23255 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads.
23256 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads.
23257 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads.
23258 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads.
23259 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads.
23260 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads.
23261 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads.
23262 * System.Assertions (s-assert.ads): System Assertions s-assert ads.
23263 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads.
23264 * System.Memory (s-memory.ads): System Memory s-memory ads.
23265 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads.
23266 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads.
23267 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads.
23268 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads.
23269 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads.
23270 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads.
23271 * System.Rident (s-rident.ads): System Rident s-rident ads.
23272 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads.
23273 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads.
23274 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads.
23275 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads.
23279 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
23280 @anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2d8}@anchor{gnat_rm/the_gnat_library id2}@anchor{2d9}
23281 @section @code{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
23284 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
23286 @geindex Latin_9 constants for Character
23288 This child of @code{Ada.Characters}
23289 provides a set of definitions corresponding to those in the
23290 RM-defined package @code{Ada.Characters.Latin_1} but with the
23291 few modifications required for @code{Latin-9}
23292 The provision of such a package
23293 is specifically authorized by the Ada Reference Manual
23296 @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
23297 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2da}@anchor{gnat_rm/the_gnat_library id3}@anchor{2db}
23298 @section @code{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
23301 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
23303 @geindex Latin_1 constants for Wide_Character
23305 This child of @code{Ada.Characters}
23306 provides a set of definitions corresponding to those in the
23307 RM-defined package @code{Ada.Characters.Latin_1} but with the
23308 types of the constants being @code{Wide_Character}
23309 instead of @code{Character}. The provision of such a package
23310 is specifically authorized by the Ada Reference Manual
23313 @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
23314 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila1-ads}@anchor{2dc}@anchor{gnat_rm/the_gnat_library id4}@anchor{2dd}
23315 @section @code{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
23318 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
23320 @geindex Latin_9 constants for Wide_Character
23322 This child of @code{Ada.Characters}
23323 provides a set of definitions corresponding to those in the
23324 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23325 types of the constants being @code{Wide_Character}
23326 instead of @code{Character}. The provision of such a package
23327 is specifically authorized by the Ada Reference Manual
23330 @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
23331 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2de}@anchor{gnat_rm/the_gnat_library id5}@anchor{2df}
23332 @section @code{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
23335 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
23337 @geindex Latin_1 constants for Wide_Wide_Character
23339 This child of @code{Ada.Characters}
23340 provides a set of definitions corresponding to those in the
23341 RM-defined package @code{Ada.Characters.Latin_1} but with the
23342 types of the constants being @code{Wide_Wide_Character}
23343 instead of @code{Character}. The provision of such a package
23344 is specifically authorized by the Ada Reference Manual
23347 @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
23348 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2e0}@anchor{gnat_rm/the_gnat_library id6}@anchor{2e1}
23349 @section @code{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
23352 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
23354 @geindex Latin_9 constants for Wide_Wide_Character
23356 This child of @code{Ada.Characters}
23357 provides a set of definitions corresponding to those in the
23358 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23359 types of the constants being @code{Wide_Wide_Character}
23360 instead of @code{Character}. The provision of such a package
23361 is specifically authorized by the Ada Reference Manual
23364 @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
23365 @anchor{gnat_rm/the_gnat_library ada-containers-formal-doubly-linked-lists-a-cfdlli-ads}@anchor{2e2}@anchor{gnat_rm/the_gnat_library id7}@anchor{2e3}
23366 @section @code{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
23369 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
23371 @geindex Formal container for doubly linked lists
23373 This child of @code{Ada.Containers} defines a modified version of the
23374 Ada 2005 container for doubly linked lists, meant to facilitate formal
23375 verification of code using such containers. The specification of this
23376 unit is compatible with SPARK 2014.
23378 Note that although this container was designed with formal verification
23379 in mind, it may well be generally useful in that it is a simplified more
23380 efficient version than the one defined in the standard. In particular it
23381 does not have the complex overhead required to detect cursor tampering.
23383 @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
23384 @anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-maps-a-cfhama-ads}@anchor{2e4}@anchor{gnat_rm/the_gnat_library id8}@anchor{2e5}
23385 @section @code{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
23388 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
23390 @geindex Formal container for hashed maps
23392 This child of @code{Ada.Containers} defines a modified version of the
23393 Ada 2005 container for hashed maps, meant to facilitate formal
23394 verification of code using such containers. The specification of this
23395 unit is compatible with SPARK 2014.
23397 Note that although this container was designed with formal verification
23398 in mind, it may well be generally useful in that it is a simplified more
23399 efficient version than the one defined in the standard. In particular it
23400 does not have the complex overhead required to detect cursor tampering.
23402 @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
23403 @anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-sets-a-cfhase-ads}@anchor{2e6}@anchor{gnat_rm/the_gnat_library id9}@anchor{2e7}
23404 @section @code{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
23407 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
23409 @geindex Formal container for hashed sets
23411 This child of @code{Ada.Containers} defines a modified version of the
23412 Ada 2005 container for hashed sets, meant to facilitate formal
23413 verification of code using such containers. The specification of this
23414 unit is compatible with SPARK 2014.
23416 Note that although this container was designed with formal verification
23417 in mind, it may well be generally useful in that it is a simplified more
23418 efficient version than the one defined in the standard. In particular it
23419 does not have the complex overhead required to detect cursor tampering.
23421 @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
23422 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-maps-a-cforma-ads}@anchor{2e8}@anchor{gnat_rm/the_gnat_library id10}@anchor{2e9}
23423 @section @code{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
23426 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
23428 @geindex Formal container for ordered maps
23430 This child of @code{Ada.Containers} defines a modified version of the
23431 Ada 2005 container for ordered maps, meant to facilitate formal
23432 verification of code using such containers. The specification of this
23433 unit is compatible with SPARK 2014.
23435 Note that although this container was designed with formal verification
23436 in mind, it may well be generally useful in that it is a simplified more
23437 efficient version than the one defined in the standard. In particular it
23438 does not have the complex overhead required to detect cursor tampering.
23440 @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
23441 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-sets-a-cforse-ads}@anchor{2ea}@anchor{gnat_rm/the_gnat_library id11}@anchor{2eb}
23442 @section @code{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
23445 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
23447 @geindex Formal container for ordered sets
23449 This child of @code{Ada.Containers} defines a modified version of the
23450 Ada 2005 container for ordered sets, meant to facilitate formal
23451 verification of code using such containers. The specification of this
23452 unit is compatible with SPARK 2014.
23454 Note that although this container was designed with formal verification
23455 in mind, it may well be generally useful in that it is a simplified more
23456 efficient version than the one defined in the standard. In particular it
23457 does not have the complex overhead required to detect cursor tampering.
23459 @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
23460 @anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{2ec}@anchor{gnat_rm/the_gnat_library id12}@anchor{2ed}
23461 @section @code{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
23464 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
23466 @geindex Formal container for vectors
23468 This child of @code{Ada.Containers} defines a modified version of the
23469 Ada 2005 container for vectors, meant to facilitate formal
23470 verification of code using such containers. The specification of this
23471 unit is compatible with SPARK 2014.
23473 Note that although this container was designed with formal verification
23474 in mind, it may well be generally useful in that it is a simplified more
23475 efficient version than the one defined in the standard. In particular it
23476 does not have the complex overhead required to detect cursor tampering.
23478 @node Ada Containers Formal_Indefinite_Vectors a-cfinve ads,Ada Containers Functional_Infinite_Sequences a-cfinse ads,Ada Containers Formal_Vectors a-cofove ads,The GNAT Library
23479 @anchor{gnat_rm/the_gnat_library ada-containers-formal-indefinite-vectors-a-cfinve-ads}@anchor{2ee}@anchor{gnat_rm/the_gnat_library id13}@anchor{2ef}
23480 @section @code{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
23483 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
23485 @geindex Formal container for vectors
23487 This child of @code{Ada.Containers} defines a modified version of the
23488 Ada 2005 container for vectors of indefinite elements, meant to
23489 facilitate formal verification of code using such containers. The
23490 specification of this unit is compatible with SPARK 2014.
23492 Note that although this container was designed with formal verification
23493 in mind, it may well be generally useful in that it is a simplified more
23494 efficient version than the one defined in the standard. In particular it
23495 does not have the complex overhead required to detect cursor tampering.
23497 @node Ada Containers Functional_Infinite_Sequences a-cfinse ads,Ada Containers Functional_Vectors a-cofuve ads,Ada Containers Formal_Indefinite_Vectors a-cfinve ads,The GNAT Library
23498 @anchor{gnat_rm/the_gnat_library ada-containers-functional-infinite-sequences-a-cfinse-ads}@anchor{2f0}@anchor{gnat_rm/the_gnat_library id14}@anchor{2f1}
23499 @section @code{Ada.Containers.Functional_Infinite_Sequences} (@code{a-cfinse.ads})
23502 @geindex Ada.Containers.Functional_Infinite_Sequences (a-cfinse.ads)
23504 @geindex Functional Infinite Sequences
23506 This child of @code{Ada.Containers} defines immutable sequences indexed by
23507 @code{Big_Integer}. These containers are unbounded and may contain indefinite
23508 elements. Their API features functions creating new containers from existing
23509 ones. To remain reasonably efficient, their implementation involves sharing
23510 between data-structures. As they are functional, that is, no primitives are
23511 provided which would allow modifying an existing container, these containers
23512 can still be used safely.
23514 These containers are controlled so that the allocated memory can be reclaimed
23515 when the container is no longer referenced. Thus, they cannot directly be used
23516 in contexts where controlled types are not supported.
23517 The specification of this unit is compatible with SPARK 2014.
23519 @node Ada Containers Functional_Vectors a-cofuve ads,Ada Containers Functional_Sets a-cofuse ads,Ada Containers Functional_Infinite_Sequences a-cfinse ads,The GNAT Library
23520 @anchor{gnat_rm/the_gnat_library ada-containers-functional-vectors-a-cofuve-ads}@anchor{2f2}@anchor{gnat_rm/the_gnat_library id15}@anchor{2f3}
23521 @section @code{Ada.Containers.Functional_Vectors} (@code{a-cofuve.ads})
23524 @geindex Ada.Containers.Functional_Vectors (a-cofuve.ads)
23526 @geindex Functional vectors
23528 This child of @code{Ada.Containers} defines immutable vectors. These
23529 containers are unbounded and may contain indefinite elements. Furthermore, to
23530 be usable in every context, they are neither controlled nor limited. As they
23531 are functional, that is, no primitives are provided which would allow modifying
23532 an existing container, these containers can still be used safely.
23534 Their API features functions creating new containers from existing ones.
23535 As a consequence, these containers are highly inefficient. They are also
23536 memory consuming, as the allocated memory is not reclaimed when the container
23537 is no longer referenced. Thus, they should in general be used in ghost code
23538 and annotations, so that they can be removed from the final executable. The
23539 specification of this unit is compatible with SPARK 2014.
23541 @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
23542 @anchor{gnat_rm/the_gnat_library ada-containers-functional-sets-a-cofuse-ads}@anchor{2f4}@anchor{gnat_rm/the_gnat_library id16}@anchor{2f5}
23543 @section @code{Ada.Containers.Functional_Sets} (@code{a-cofuse.ads})
23546 @geindex Ada.Containers.Functional_Sets (a-cofuse.ads)
23548 @geindex Functional sets
23550 This child of @code{Ada.Containers} defines immutable sets. These containers are
23551 unbounded and may contain indefinite elements. Their API features functions
23552 creating new containers from existing ones. To remain reasonably efficient,
23553 their implementation involves sharing between data-structures. As they are
23554 functional, that is, no primitives are provided which would allow modifying an
23555 existing container, these containers can still be used safely.
23557 These containers are controlled so that the allocated memory can be reclaimed
23558 when the container is no longer referenced. Thus, they cannot directly be used
23559 in contexts where controlled types are not supported.
23560 The specification of this unit is compatible with SPARK 2014.
23562 @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
23563 @anchor{gnat_rm/the_gnat_library ada-containers-functional-maps-a-cofuma-ads}@anchor{2f6}@anchor{gnat_rm/the_gnat_library id17}@anchor{2f7}
23564 @section @code{Ada.Containers.Functional_Maps} (@code{a-cofuma.ads})
23567 @geindex Ada.Containers.Functional_Maps (a-cofuma.ads)
23569 @geindex Functional maps
23571 This child of @code{Ada.Containers} defines immutable maps. These containers are
23572 unbounded and may contain indefinite elements. Their API features functions
23573 creating new containers from existing ones. To remain reasonably efficient,
23574 their implementation involves sharing between data-structures. As they are
23575 functional, that is, no primitives are provided which would allow modifying an
23576 existing container, these containers can still be used safely.
23578 These containers are controlled so that the allocated memory can be reclaimed
23579 when the container is no longer referenced. Thus, they cannot directly be used
23580 in contexts where controlled types are not supported.
23581 The specification of this unit is compatible with SPARK 2014.
23583 @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
23584 @anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2f8}@anchor{gnat_rm/the_gnat_library id18}@anchor{2f9}
23585 @section @code{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
23588 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
23590 @geindex Formal container for vectors
23592 This child of @code{Ada.Containers} defines a modified version of
23593 Indefinite_Holders that avoids heap allocation.
23595 @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
23596 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2fa}@anchor{gnat_rm/the_gnat_library id19}@anchor{2fb}
23597 @section @code{Ada.Command_Line.Environment} (@code{a-colien.ads})
23600 @geindex Ada.Command_Line.Environment (a-colien.ads)
23602 @geindex Environment entries
23604 This child of @code{Ada.Command_Line}
23605 provides a mechanism for obtaining environment values on systems
23606 where this concept makes sense.
23608 @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
23609 @anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2fc}@anchor{gnat_rm/the_gnat_library id20}@anchor{2fd}
23610 @section @code{Ada.Command_Line.Remove} (@code{a-colire.ads})
23613 @geindex Ada.Command_Line.Remove (a-colire.ads)
23615 @geindex Removing command line arguments
23617 @geindex Command line
23618 @geindex argument removal
23620 This child of @code{Ada.Command_Line}
23621 provides a mechanism for logically removing
23622 arguments from the argument list. Once removed, an argument is not visible
23623 to further calls on the subprograms in @code{Ada.Command_Line} will not
23624 see the removed argument.
23626 @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
23627 @anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2fe}@anchor{gnat_rm/the_gnat_library id21}@anchor{2ff}
23628 @section @code{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
23631 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
23633 @geindex Response file for command line
23635 @geindex Command line
23636 @geindex response file
23638 @geindex Command line
23639 @geindex handling long command lines
23641 This child of @code{Ada.Command_Line} provides a mechanism facilities for
23642 getting command line arguments from a text file, called a “response file”.
23643 Using a response file allow passing a set of arguments to an executable longer
23644 than the maximum allowed by the system on the command line.
23646 @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
23647 @anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{300}@anchor{gnat_rm/the_gnat_library id22}@anchor{301}
23648 @section @code{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
23651 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
23654 @geindex Interfacing with Direct_IO
23656 This package provides subprograms that allow interfacing between
23657 C streams and @code{Direct_IO}. The stream identifier can be
23658 extracted from a file opened on the Ada side, and an Ada file
23659 can be constructed from a stream opened on the C side.
23661 @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
23662 @anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{302}@anchor{gnat_rm/the_gnat_library id23}@anchor{303}
23663 @section @code{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
23666 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
23668 @geindex Null_Occurrence
23669 @geindex testing for
23671 This child subprogram provides a way of testing for the null
23672 exception occurrence (@code{Null_Occurrence}) without raising
23675 @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
23676 @anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{304}@anchor{gnat_rm/the_gnat_library id24}@anchor{305}
23677 @section @code{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
23680 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
23682 @geindex Null_Occurrence
23683 @geindex testing for
23685 This child subprogram is used for handling otherwise unhandled
23686 exceptions (hence the name last chance), and perform clean ups before
23687 terminating the program. Note that this subprogram never returns.
23689 @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
23690 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{306}@anchor{gnat_rm/the_gnat_library id25}@anchor{307}
23691 @section @code{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
23694 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
23696 @geindex Traceback for Exception Occurrence
23698 This child package provides the subprogram (@code{Tracebacks}) to
23699 give a traceback array of addresses based on an exception
23702 @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
23703 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{308}@anchor{gnat_rm/the_gnat_library id26}@anchor{309}
23704 @section @code{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
23707 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
23710 @geindex Interfacing with Sequential_IO
23712 This package provides subprograms that allow interfacing between
23713 C streams and @code{Sequential_IO}. The stream identifier can be
23714 extracted from a file opened on the Ada side, and an Ada file
23715 can be constructed from a stream opened on the C side.
23717 @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
23718 @anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{30a}@anchor{gnat_rm/the_gnat_library id27}@anchor{30b}
23719 @section @code{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
23722 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
23725 @geindex Interfacing with Stream_IO
23727 This package provides subprograms that allow interfacing between
23728 C streams and @code{Stream_IO}. The stream identifier can be
23729 extracted from a file opened on the Ada side, and an Ada file
23730 can be constructed from a stream opened on the C side.
23732 @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
23733 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{30c}@anchor{gnat_rm/the_gnat_library id28}@anchor{30d}
23734 @section @code{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
23737 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
23739 @geindex Unbounded_String
23740 @geindex IO support
23743 @geindex extensions for unbounded strings
23745 This package provides subprograms for Text_IO for unbounded
23746 strings, avoiding the necessity for an intermediate operation
23747 with ordinary strings.
23749 @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
23750 @anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{30e}@anchor{gnat_rm/the_gnat_library id29}@anchor{30f}
23751 @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
23754 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
23756 @geindex Unbounded_Wide_String
23757 @geindex IO support
23760 @geindex extensions for unbounded wide strings
23762 This package provides subprograms for Text_IO for unbounded
23763 wide strings, avoiding the necessity for an intermediate operation
23764 with ordinary wide strings.
23766 @node Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,Ada Task_Initialization a-tasini ads,Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,The GNAT Library
23767 @anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{310}@anchor{gnat_rm/the_gnat_library id30}@anchor{311}
23768 @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
23771 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
23773 @geindex Unbounded_Wide_Wide_String
23774 @geindex IO support
23777 @geindex extensions for unbounded wide wide strings
23779 This package provides subprograms for Text_IO for unbounded
23780 wide wide strings, avoiding the necessity for an intermediate operation
23781 with ordinary wide wide strings.
23783 @node Ada Task_Initialization a-tasini ads,Ada Text_IO C_Streams a-tiocst ads,Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,The GNAT Library
23784 @anchor{gnat_rm/the_gnat_library ada-task-initialization-a-tasini-ads}@anchor{312}@anchor{gnat_rm/the_gnat_library id31}@anchor{313}
23785 @section @code{Ada.Task_Initialization} (@code{a-tasini.ads})
23788 @geindex Ada.Task_Initialization (a-tasini.ads)
23790 This package provides a way to set a global initialization handler that
23791 is automatically invoked whenever a task is activated. Handlers are
23792 parameterless procedures. Note that such a handler is only invoked for
23793 those tasks activated after the handler is set.
23795 @node Ada Text_IO C_Streams a-tiocst ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Task_Initialization a-tasini ads,The GNAT Library
23796 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{314}@anchor{gnat_rm/the_gnat_library id32}@anchor{315}
23797 @section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
23800 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
23803 @geindex Interfacing with `@w{`}Text_IO`@w{`}
23805 This package provides subprograms that allow interfacing between
23806 C streams and @code{Text_IO}. The stream identifier can be
23807 extracted from a file opened on the Ada side, and an Ada file
23808 can be constructed from a stream opened on the C side.
23810 @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
23811 @anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{316}@anchor{gnat_rm/the_gnat_library id33}@anchor{317}
23812 @section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
23815 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
23817 @geindex Text_IO resetting standard files
23819 This procedure is used to reset the status of the standard files used
23820 by Ada.Text_IO. This is useful in a situation (such as a restart in an
23821 embedded application) where the status of the files may change during
23822 execution (for example a standard input file may be redefined to be
23825 @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
23826 @anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{318}@anchor{gnat_rm/the_gnat_library id34}@anchor{319}
23827 @section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
23830 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
23832 @geindex Unicode categorization
23833 @geindex Wide_Character
23835 This package provides subprograms that allow categorization of
23836 Wide_Character values according to Unicode categories.
23838 @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
23839 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{31a}@anchor{gnat_rm/the_gnat_library id35}@anchor{31b}
23840 @section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
23843 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
23846 @geindex Interfacing with `@w{`}Wide_Text_IO`@w{`}
23848 This package provides subprograms that allow interfacing between
23849 C streams and @code{Wide_Text_IO}. The stream identifier can be
23850 extracted from a file opened on the Ada side, and an Ada file
23851 can be constructed from a stream opened on the C side.
23853 @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
23854 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{31c}@anchor{gnat_rm/the_gnat_library id36}@anchor{31d}
23855 @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
23858 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
23860 @geindex Wide_Text_IO resetting standard files
23862 This procedure is used to reset the status of the standard files used
23863 by Ada.Wide_Text_IO. This is useful in a situation (such as a restart in an
23864 embedded application) where the status of the files may change during
23865 execution (for example a standard input file may be redefined to be
23868 @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
23869 @anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{31e}@anchor{gnat_rm/the_gnat_library id37}@anchor{31f}
23870 @section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
23873 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
23875 @geindex Unicode categorization
23876 @geindex Wide_Wide_Character
23878 This package provides subprograms that allow categorization of
23879 Wide_Wide_Character values according to Unicode categories.
23881 @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
23882 @anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{320}@anchor{gnat_rm/the_gnat_library id38}@anchor{321}
23883 @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
23886 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
23889 @geindex Interfacing with `@w{`}Wide_Wide_Text_IO`@w{`}
23891 This package provides subprograms that allow interfacing between
23892 C streams and @code{Wide_Wide_Text_IO}. The stream identifier can be
23893 extracted from a file opened on the Ada side, and an Ada file
23894 can be constructed from a stream opened on the C side.
23896 @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
23897 @anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{322}@anchor{gnat_rm/the_gnat_library id39}@anchor{323}
23898 @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23901 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23903 @geindex Wide_Wide_Text_IO resetting standard files
23905 This procedure is used to reset the status of the standard files used
23906 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23907 restart in an embedded application) where the status of the files may
23908 change during execution (for example a standard input file may be
23909 redefined to be interactive).
23911 @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
23912 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{324}@anchor{gnat_rm/the_gnat_library id40}@anchor{325}
23913 @section @code{GNAT.Altivec} (@code{g-altive.ads})
23916 @geindex GNAT.Altivec (g-altive.ads)
23920 This is the root package of the GNAT AltiVec binding. It provides
23921 definitions of constants and types common to all the versions of the
23924 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23925 @anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{326}@anchor{gnat_rm/the_gnat_library id41}@anchor{327}
23926 @section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23929 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23933 This package provides the Vector/View conversion routines.
23935 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23936 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{328}@anchor{gnat_rm/the_gnat_library id42}@anchor{329}
23937 @section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23940 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23944 This package exposes the Ada interface to the AltiVec operations on
23945 vector objects. A soft emulation is included by default in the GNAT
23946 library. The hard binding is provided as a separate package. This unit
23947 is common to both bindings.
23949 @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
23950 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{32a}@anchor{gnat_rm/the_gnat_library id43}@anchor{32b}
23951 @section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23954 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23958 This package exposes the various vector types part of the Ada binding
23959 to AltiVec facilities.
23961 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23962 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{32c}@anchor{gnat_rm/the_gnat_library id44}@anchor{32d}
23963 @section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23966 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23970 This package provides public ‘View’ data types from/to which private
23971 vector representations can be converted via
23972 GNAT.Altivec.Conversions. This allows convenient access to individual
23973 vector elements and provides a simple way to initialize vector
23976 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23977 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{32e}@anchor{gnat_rm/the_gnat_library id45}@anchor{32f}
23978 @section @code{GNAT.Array_Split} (@code{g-arrspl.ads})
23981 @geindex GNAT.Array_Split (g-arrspl.ads)
23983 @geindex Array splitter
23985 Useful array-manipulation routines: given a set of separators, split
23986 an array wherever the separators appear, and provide direct access
23987 to the resulting slices.
23989 @node GNAT AWK g-awk ads,GNAT Binary_Search g-binsea ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23990 @anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{330}@anchor{gnat_rm/the_gnat_library id46}@anchor{331}
23991 @section @code{GNAT.AWK} (@code{g-awk.ads})
23994 @geindex GNAT.AWK (g-awk.ads)
24000 Provides AWK-like parsing functions, with an easy interface for parsing one
24001 or more files containing formatted data. The file is viewed as a database
24002 where each record is a line and a field is a data element in this line.
24004 @node GNAT Binary_Search g-binsea ads,GNAT Bind_Environment g-binenv ads,GNAT AWK g-awk ads,The GNAT Library
24005 @anchor{gnat_rm/the_gnat_library gnat-binary-search-g-binsea-ads}@anchor{332}@anchor{gnat_rm/the_gnat_library id47}@anchor{333}
24006 @section @code{GNAT.Binary_Search} (@code{g-binsea.ads})
24009 @geindex GNAT.Binary_Search (g-binsea.ads)
24011 @geindex Binary search
24013 Allow binary search of a sorted array (or of an array-like container;
24014 the generic does not reference the array directly).
24016 @node GNAT Bind_Environment g-binenv ads,GNAT Branch_Prediction g-brapre ads,GNAT Binary_Search g-binsea ads,The GNAT Library
24017 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{334}@anchor{gnat_rm/the_gnat_library id48}@anchor{335}
24018 @section @code{GNAT.Bind_Environment} (@code{g-binenv.ads})
24021 @geindex GNAT.Bind_Environment (g-binenv.ads)
24023 @geindex Bind environment
24025 Provides access to key=value associations captured at bind time.
24026 These associations can be specified using the @code{-V} binder command
24029 @node GNAT Branch_Prediction g-brapre ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
24030 @anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{336}@anchor{gnat_rm/the_gnat_library id49}@anchor{337}
24031 @section @code{GNAT.Branch_Prediction} (@code{g-brapre.ads})
24034 @geindex GNAT.Branch_Prediction (g-brapre.ads)
24036 @geindex Branch Prediction
24038 Provides routines giving hints to the branch predictor of the code generator.
24040 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Branch_Prediction g-brapre ads,The GNAT Library
24041 @anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{338}@anchor{gnat_rm/the_gnat_library id50}@anchor{339}
24042 @section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
24045 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
24049 @geindex Bounded Buffers
24051 Provides a concurrent generic bounded buffer abstraction. Instances are
24052 useful directly or as parts of the implementations of other abstractions,
24055 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
24056 @anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{33a}@anchor{gnat_rm/the_gnat_library id51}@anchor{33b}
24057 @section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
24060 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
24066 Provides a thread-safe asynchronous intertask mailbox communication facility.
24068 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
24069 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{33c}@anchor{gnat_rm/the_gnat_library id52}@anchor{33d}
24070 @section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
24073 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
24077 @geindex Bubble sort
24079 Provides a general implementation of bubble sort usable for sorting arbitrary
24080 data items. Exchange and comparison procedures are provided by passing
24081 access-to-procedure values.
24083 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
24084 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{33e}@anchor{gnat_rm/the_gnat_library id53}@anchor{33f}
24085 @section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
24088 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
24092 @geindex Bubble sort
24094 Provides a general implementation of bubble sort usable for sorting arbitrary
24095 data items. Move and comparison procedures are provided by passing
24096 access-to-procedure values. This is an older version, retained for
24097 compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
24099 @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
24100 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{340}@anchor{gnat_rm/the_gnat_library id54}@anchor{341}
24101 @section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
24104 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
24108 @geindex Bubble sort
24110 Similar to @code{Bubble_Sort_A} except that the move and sorting procedures
24111 are provided as generic parameters, this improves efficiency, especially
24112 if the procedures can be inlined, at the expense of duplicating code for
24113 multiple instantiations.
24115 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
24116 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{342}@anchor{gnat_rm/the_gnat_library id55}@anchor{343}
24117 @section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
24120 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
24122 @geindex UTF-8 representation
24124 @geindex Wide characte representations
24126 Provides a routine which given a string, reads the start of the string to
24127 see whether it is one of the standard byte order marks (BOM’s) which signal
24128 the encoding of the string. The routine includes detection of special XML
24129 sequences for various UCS input formats.
24131 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
24132 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{344}@anchor{gnat_rm/the_gnat_library id56}@anchor{345}
24133 @section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
24136 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
24138 @geindex Byte swapping
24140 @geindex Endianness
24142 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
24143 Machine-specific implementations are available in some cases.
24145 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
24146 @anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{346}@anchor{gnat_rm/the_gnat_library id57}@anchor{347}
24147 @section @code{GNAT.Calendar} (@code{g-calend.ads})
24150 @geindex GNAT.Calendar (g-calend.ads)
24154 Extends the facilities provided by @code{Ada.Calendar} to include handling
24155 of days of the week, an extended @code{Split} and @code{Time_Of} capability.
24156 Also provides conversion of @code{Ada.Calendar.Time} values to and from the
24157 C @code{timeval} format.
24159 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
24160 @anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{348}@anchor{gnat_rm/the_gnat_library id58}@anchor{349}
24161 @section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
24168 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
24170 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
24171 @anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{34a}@anchor{gnat_rm/the_gnat_library id59}@anchor{34b}
24172 @section @code{GNAT.CRC32} (@code{g-crc32.ads})
24175 @geindex GNAT.CRC32 (g-crc32.ads)
24179 @geindex Cyclic Redundancy Check
24181 This package implements the CRC-32 algorithm. For a full description
24182 of this algorithm see
24183 `Computation of Cyclic Redundancy Checks via Table Look-Up',
24184 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
24185 Aug. 1988. Sarwate, D.V.
24187 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
24188 @anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{34c}@anchor{gnat_rm/the_gnat_library id60}@anchor{34d}
24189 @section @code{GNAT.Case_Util} (@code{g-casuti.ads})
24192 @geindex GNAT.Case_Util (g-casuti.ads)
24194 @geindex Casing utilities
24196 @geindex Character handling (`@w{`}GNAT.Case_Util`@w{`})
24198 A set of simple routines for handling upper and lower casing of strings
24199 without the overhead of the full casing tables
24200 in @code{Ada.Characters.Handling}.
24202 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
24203 @anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{34e}@anchor{gnat_rm/the_gnat_library id61}@anchor{34f}
24204 @section @code{GNAT.CGI} (@code{g-cgi.ads})
24207 @geindex GNAT.CGI (g-cgi.ads)
24209 @geindex CGI (Common Gateway Interface)
24211 This is a package for interfacing a GNAT program with a Web server via the
24212 Common Gateway Interface (CGI). Basically this package parses the CGI
24213 parameters, which are a set of key/value pairs sent by the Web server. It
24214 builds a table whose index is the key and provides some services to deal
24217 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
24218 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{350}@anchor{gnat_rm/the_gnat_library id62}@anchor{351}
24219 @section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
24222 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
24224 @geindex CGI (Common Gateway Interface) cookie support
24226 @geindex Cookie support in CGI
24228 This is a package to interface a GNAT program with a Web server via the
24229 Common Gateway Interface (CGI). It exports services to deal with Web
24230 cookies (piece of information kept in the Web client software).
24232 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
24233 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{352}@anchor{gnat_rm/the_gnat_library id63}@anchor{353}
24234 @section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads})
24237 @geindex GNAT.CGI.Debug (g-cgideb.ads)
24239 @geindex CGI (Common Gateway Interface) debugging
24241 This is a package to help debugging CGI (Common Gateway Interface)
24242 programs written in Ada.
24244 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
24245 @anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{354}@anchor{gnat_rm/the_gnat_library id64}@anchor{355}
24246 @section @code{GNAT.Command_Line} (@code{g-comlin.ads})
24249 @geindex GNAT.Command_Line (g-comlin.ads)
24251 @geindex Command line
24253 Provides a high level interface to @code{Ada.Command_Line} facilities,
24254 including the ability to scan for named switches with optional parameters
24255 and expand file names using wildcard notations.
24257 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
24258 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{356}@anchor{gnat_rm/the_gnat_library id65}@anchor{357}
24259 @section @code{GNAT.Compiler_Version} (@code{g-comver.ads})
24262 @geindex GNAT.Compiler_Version (g-comver.ads)
24264 @geindex Compiler Version
24267 @geindex of compiler
24269 Provides a routine for obtaining the version of the compiler used to
24270 compile the program. More accurately this is the version of the binder
24271 used to bind the program (this will normally be the same as the version
24272 of the compiler if a consistent tool set is used to compile all units
24275 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
24276 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{358}@anchor{gnat_rm/the_gnat_library id66}@anchor{359}
24277 @section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
24280 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
24284 Provides a simple interface to handle Ctrl-C keyboard events.
24286 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
24287 @anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{35a}@anchor{gnat_rm/the_gnat_library id67}@anchor{35b}
24288 @section @code{GNAT.Current_Exception} (@code{g-curexc.ads})
24291 @geindex GNAT.Current_Exception (g-curexc.ads)
24293 @geindex Current exception
24295 @geindex Exception retrieval
24297 Provides access to information on the current exception that has been raised
24298 without the need for using the Ada 95 / Ada 2005 exception choice parameter
24299 specification syntax.
24300 This is particularly useful in simulating typical facilities for
24301 obtaining information about exceptions provided by Ada 83 compilers.
24303 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
24304 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{35c}@anchor{gnat_rm/the_gnat_library id68}@anchor{35d}
24305 @section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads})
24308 @geindex GNAT.Debug_Pools (g-debpoo.ads)
24312 @geindex Debug pools
24314 @geindex Memory corruption debugging
24316 Provide a debugging storage pools that helps tracking memory corruption
24318 See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User’s Guide}.
24320 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
24321 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{35e}@anchor{gnat_rm/the_gnat_library id69}@anchor{35f}
24322 @section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads})
24325 @geindex GNAT.Debug_Utilities (g-debuti.ads)
24329 Provides a few useful utilities for debugging purposes, including conversion
24330 to and from string images of address values. Supports both C and Ada formats
24331 for hexadecimal literals.
24333 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
24334 @anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{360}@anchor{gnat_rm/the_gnat_library id70}@anchor{361}
24335 @section @code{GNAT.Decode_String} (@code{g-decstr.ads})
24338 @geindex GNAT.Decode_String (g-decstr.ads)
24340 @geindex Decoding strings
24342 @geindex String decoding
24344 @geindex Wide character encoding
24350 A generic package providing routines for decoding wide character and wide wide
24351 character strings encoded as sequences of 8-bit characters using a specified
24352 encoding method. Includes validation routines, and also routines for stepping
24353 to next or previous encoded character in an encoded string.
24354 Useful in conjunction with Unicode character coding. Note there is a
24355 preinstantiation for UTF-8. See next entry.
24357 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
24358 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{362}@anchor{gnat_rm/the_gnat_library id71}@anchor{363}
24359 @section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
24362 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
24364 @geindex Decoding strings
24366 @geindex Decoding UTF-8 strings
24368 @geindex UTF-8 string decoding
24370 @geindex Wide character decoding
24376 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
24378 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
24379 @anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{364}@anchor{gnat_rm/the_gnat_library id72}@anchor{365}
24380 @section @code{GNAT.Directory_Operations} (@code{g-dirope.ads})
24383 @geindex GNAT.Directory_Operations (g-dirope.ads)
24385 @geindex Directory operations
24387 Provides a set of routines for manipulating directories, including changing
24388 the current directory, making new directories, and scanning the files in a
24391 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
24392 @anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{366}@anchor{gnat_rm/the_gnat_library id73}@anchor{367}
24393 @section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
24396 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
24398 @geindex Directory operations iteration
24400 A child unit of GNAT.Directory_Operations providing additional operations
24401 for iterating through directories.
24403 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
24404 @anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{368}@anchor{gnat_rm/the_gnat_library id74}@anchor{369}
24405 @section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
24408 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
24410 @geindex Hash tables
24412 A generic implementation of hash tables that can be used to hash arbitrary
24413 data. Provided in two forms, a simple form with built in hash functions,
24414 and a more complex form in which the hash function is supplied.
24416 This package provides a facility similar to that of @code{GNAT.HTable},
24417 except that this package declares a type that can be used to define
24418 dynamic instances of the hash table, while an instantiation of
24419 @code{GNAT.HTable} creates a single instance of the hash table.
24421 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
24422 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{36a}@anchor{gnat_rm/the_gnat_library id75}@anchor{36b}
24423 @section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
24426 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
24428 @geindex Table implementation
24431 @geindex extendable
24433 A generic package providing a single dimension array abstraction where the
24434 length of the array can be dynamically modified.
24436 This package provides a facility similar to that of @code{GNAT.Table},
24437 except that this package declares a type that can be used to define
24438 dynamic instances of the table, while an instantiation of
24439 @code{GNAT.Table} creates a single instance of the table type.
24441 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
24442 @anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{36c}@anchor{gnat_rm/the_gnat_library id76}@anchor{36d}
24443 @section @code{GNAT.Encode_String} (@code{g-encstr.ads})
24446 @geindex GNAT.Encode_String (g-encstr.ads)
24448 @geindex Encoding strings
24450 @geindex String encoding
24452 @geindex Wide character encoding
24458 A generic package providing routines for encoding wide character and wide
24459 wide character strings as sequences of 8-bit characters using a specified
24460 encoding method. Useful in conjunction with Unicode character coding.
24461 Note there is a preinstantiation for UTF-8. See next entry.
24463 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
24464 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{36e}@anchor{gnat_rm/the_gnat_library id77}@anchor{36f}
24465 @section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
24468 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
24470 @geindex Encoding strings
24472 @geindex Encoding UTF-8 strings
24474 @geindex UTF-8 string encoding
24476 @geindex Wide character encoding
24482 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
24484 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
24485 @anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{370}@anchor{gnat_rm/the_gnat_library id78}@anchor{371}
24486 @section @code{GNAT.Exception_Actions} (@code{g-excact.ads})
24489 @geindex GNAT.Exception_Actions (g-excact.ads)
24491 @geindex Exception actions
24493 Provides callbacks when an exception is raised. Callbacks can be registered
24494 for specific exceptions, or when any exception is raised. This
24495 can be used for instance to force a core dump to ease debugging.
24497 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library
24498 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{372}@anchor{gnat_rm/the_gnat_library id79}@anchor{373}
24499 @section @code{GNAT.Exception_Traces} (@code{g-exctra.ads})
24502 @geindex GNAT.Exception_Traces (g-exctra.ads)
24504 @geindex Exception traces
24508 Provides an interface allowing to control automatic output upon exception
24511 @node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
24512 @anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{374}@anchor{gnat_rm/the_gnat_library id80}@anchor{375}
24513 @section @code{GNAT.Exceptions} (@code{g-except.ads})
24516 @geindex GNAT.Exceptions (g-except.ads)
24518 @geindex Exceptions
24521 @geindex Pure packages
24522 @geindex exceptions
24524 Normally it is not possible to raise an exception with
24525 a message from a subprogram in a pure package, since the
24526 necessary types and subprograms are in @code{Ada.Exceptions}
24527 which is not a pure unit. @code{GNAT.Exceptions} provides a
24528 facility for getting around this limitation for a few
24529 predefined exceptions, and for example allow raising
24530 @code{Constraint_Error} with a message from a pure subprogram.
24532 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library
24533 @anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{376}@anchor{gnat_rm/the_gnat_library id81}@anchor{377}
24534 @section @code{GNAT.Expect} (@code{g-expect.ads})
24537 @geindex GNAT.Expect (g-expect.ads)
24539 Provides a set of subprograms similar to what is available
24540 with the standard Tcl Expect tool.
24541 It allows you to easily spawn and communicate with an external process.
24542 You can send commands or inputs to the process, and compare the output
24543 with some expected regular expression. Currently @code{GNAT.Expect}
24544 is implemented on all native GNAT ports.
24545 It is not implemented for cross ports, and in particular is not
24546 implemented for VxWorks or LynxOS.
24548 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
24549 @anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{378}@anchor{gnat_rm/the_gnat_library id82}@anchor{379}
24550 @section @code{GNAT.Expect.TTY} (@code{g-exptty.ads})
24553 @geindex GNAT.Expect.TTY (g-exptty.ads)
24555 As GNAT.Expect but using pseudo-terminal.
24556 Currently @code{GNAT.Expect.TTY} is implemented on all native GNAT
24557 ports. It is not implemented for cross ports, and
24558 in particular is not implemented for VxWorks or LynxOS.
24560 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
24561 @anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{37a}@anchor{gnat_rm/the_gnat_library id83}@anchor{37b}
24562 @section @code{GNAT.Float_Control} (@code{g-flocon.ads})
24565 @geindex GNAT.Float_Control (g-flocon.ads)
24567 @geindex Floating-Point Processor
24569 Provides an interface for resetting the floating-point processor into the
24570 mode required for correct semantic operation in Ada. Some third party
24571 library calls may cause this mode to be modified, and the Reset procedure
24572 in this package can be used to reestablish the required mode.
24574 @node GNAT Formatted_String g-forstr ads,GNAT Generic_Fast_Math_Functions g-gfmafu ads,GNAT Float_Control g-flocon ads,The GNAT Library
24575 @anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{37c}@anchor{gnat_rm/the_gnat_library id84}@anchor{37d}
24576 @section @code{GNAT.Formatted_String} (@code{g-forstr.ads})
24579 @geindex GNAT.Formatted_String (g-forstr.ads)
24581 @geindex Formatted String
24583 Provides support for C/C++ printf() formatted strings. The format is
24584 copied from the printf() routine and should therefore gives identical
24585 output. Some generic routines are provided to be able to use types
24586 derived from Integer, Float or enumerations as values for the
24589 @node GNAT Generic_Fast_Math_Functions g-gfmafu ads,GNAT Heap_Sort g-heasor ads,GNAT Formatted_String g-forstr ads,The GNAT Library
24590 @anchor{gnat_rm/the_gnat_library gnat-generic-fast-math-functions-g-gfmafu-ads}@anchor{37e}@anchor{gnat_rm/the_gnat_library id85}@anchor{37f}
24591 @section @code{GNAT.Generic_Fast_Math_Functions} (@code{g-gfmafu.ads})
24594 @geindex GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads)
24596 @geindex Mathematical functions
24598 Provides direct access to the underlying implementation of the common
24599 mathematical functions, generally from the system mathematical library.
24600 This differs from @code{Ada.Numerics.Generic_Elementary_Functions} in that
24601 the implementation may deviate from the semantics specified for these
24602 functions in the Reference Manual, for example @code{Numerics.Argument_Error}
24603 is not raised. On selected platforms, some of these functions may also
24604 have a vector implementation that can be automatically used by the
24605 compiler when auto-vectorization is enabled.
24607 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Generic_Fast_Math_Functions g-gfmafu ads,The GNAT Library
24608 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{380}@anchor{gnat_rm/the_gnat_library id86}@anchor{381}
24609 @section @code{GNAT.Heap_Sort} (@code{g-heasor.ads})
24612 @geindex GNAT.Heap_Sort (g-heasor.ads)
24616 Provides a general implementation of heap sort usable for sorting arbitrary
24617 data items. Exchange and comparison procedures are provided by passing
24618 access-to-procedure values. The algorithm used is a modified heap sort
24619 that performs approximately N*log(N) comparisons in the worst case.
24621 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
24622 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{382}@anchor{gnat_rm/the_gnat_library id87}@anchor{383}
24623 @section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
24626 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
24630 Provides a general implementation of heap sort usable for sorting arbitrary
24631 data items. Move and comparison procedures are provided by passing
24632 access-to-procedure values. The algorithm used is a modified heap sort
24633 that performs approximately N*log(N) comparisons in the worst case.
24634 This differs from @code{GNAT.Heap_Sort} in having a less convenient
24635 interface, but may be slightly more efficient.
24637 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
24638 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{384}@anchor{gnat_rm/the_gnat_library id88}@anchor{385}
24639 @section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
24642 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
24646 Similar to @code{Heap_Sort_A} except that the move and sorting procedures
24647 are provided as generic parameters, this improves efficiency, especially
24648 if the procedures can be inlined, at the expense of duplicating code for
24649 multiple instantiations.
24651 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
24652 @anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{386}@anchor{gnat_rm/the_gnat_library id89}@anchor{387}
24653 @section @code{GNAT.HTable} (@code{g-htable.ads})
24656 @geindex GNAT.HTable (g-htable.ads)
24658 @geindex Hash tables
24660 A generic implementation of hash tables that can be used to hash arbitrary
24661 data. Provides two approaches, one a simple static approach, and the other
24662 allowing arbitrary dynamic hash tables.
24664 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
24665 @anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{388}@anchor{gnat_rm/the_gnat_library id90}@anchor{389}
24666 @section @code{GNAT.IO} (@code{g-io.ads})
24669 @geindex GNAT.IO (g-io.ads)
24671 @geindex Simple I/O
24673 @geindex Input/Output facilities
24675 A simple preelaborable input-output package that provides a subset of
24676 simple Text_IO functions for reading characters and strings from
24677 Standard_Input, and writing characters, strings and integers to either
24678 Standard_Output or Standard_Error.
24680 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
24681 @anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{38a}@anchor{gnat_rm/the_gnat_library id91}@anchor{38b}
24682 @section @code{GNAT.IO_Aux} (@code{g-io_aux.ads})
24685 @geindex GNAT.IO_Aux (g-io_aux.ads)
24689 @geindex Input/Output facilities
24691 Provides some auxiliary functions for use with Text_IO, including a test
24692 for whether a file exists, and functions for reading a line of text.
24694 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
24695 @anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{38c}@anchor{gnat_rm/the_gnat_library id92}@anchor{38d}
24696 @section @code{GNAT.Lock_Files} (@code{g-locfil.ads})
24699 @geindex GNAT.Lock_Files (g-locfil.ads)
24701 @geindex File locking
24703 @geindex Locking using files
24705 Provides a general interface for using files as locks. Can be used for
24706 providing program level synchronization.
24708 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
24709 @anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{38e}@anchor{gnat_rm/the_gnat_library id93}@anchor{38f}
24710 @section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
24713 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
24715 @geindex Random number generation
24717 The original implementation of @code{Ada.Numerics.Discrete_Random}. Uses
24718 a modified version of the Blum-Blum-Shub generator.
24720 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
24721 @anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{390}@anchor{gnat_rm/the_gnat_library id94}@anchor{391}
24722 @section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
24725 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
24727 @geindex Random number generation
24729 The original implementation of @code{Ada.Numerics.Float_Random}. Uses
24730 a modified version of the Blum-Blum-Shub generator.
24732 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
24733 @anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{392}@anchor{gnat_rm/the_gnat_library id95}@anchor{393}
24734 @section @code{GNAT.MD5} (@code{g-md5.ads})
24737 @geindex GNAT.MD5 (g-md5.ads)
24739 @geindex Message Digest MD5
24741 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
24742 the HMAC-MD5 message authentication function as described in RFC 2104 and
24745 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
24746 @anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{394}@anchor{gnat_rm/the_gnat_library id96}@anchor{395}
24747 @section @code{GNAT.Memory_Dump} (@code{g-memdum.ads})
24750 @geindex GNAT.Memory_Dump (g-memdum.ads)
24752 @geindex Dump Memory
24754 Provides a convenient routine for dumping raw memory to either the
24755 standard output or standard error files. Uses GNAT.IO for actual
24758 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
24759 @anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{396}@anchor{gnat_rm/the_gnat_library id97}@anchor{397}
24760 @section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
24763 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
24766 @geindex obtaining most recent
24768 Provides access to the most recently raised exception. Can be used for
24769 various logging purposes, including duplicating functionality of some
24770 Ada 83 implementation dependent extensions.
24772 @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
24773 @anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{398}@anchor{gnat_rm/the_gnat_library id98}@anchor{399}
24774 @section @code{GNAT.OS_Lib} (@code{g-os_lib.ads})
24777 @geindex GNAT.OS_Lib (g-os_lib.ads)
24779 @geindex Operating System interface
24781 @geindex Spawn capability
24783 Provides a range of target independent operating system interface functions,
24784 including time/date management, file operations, subprocess management,
24785 including a portable spawn procedure, and access to environment variables
24786 and error return codes.
24788 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
24789 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{39a}@anchor{gnat_rm/the_gnat_library id99}@anchor{39b}
24790 @section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
24793 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
24795 @geindex Hash functions
24797 Provides a generator of static minimal perfect hash functions. No
24798 collisions occur and each item can be retrieved from the table in one
24799 probe (perfect property). The hash table size corresponds to the exact
24800 size of the key set and no larger (minimal property). The key set has to
24801 be know in advance (static property). The hash functions are also order
24802 preserving. If w2 is inserted after w1 in the generator, their
24803 hashcode are in the same order. These hashing functions are very
24804 convenient for use with realtime applications.
24806 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
24807 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{39c}@anchor{gnat_rm/the_gnat_library id100}@anchor{39d}
24808 @section @code{GNAT.Random_Numbers} (@code{g-rannum.ads})
24811 @geindex GNAT.Random_Numbers (g-rannum.ads)
24813 @geindex Random number generation
24815 Provides random number capabilities which extend those available in the
24816 standard Ada library and are more convenient to use.
24818 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
24819 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{25d}@anchor{gnat_rm/the_gnat_library id101}@anchor{39e}
24820 @section @code{GNAT.Regexp} (@code{g-regexp.ads})
24823 @geindex GNAT.Regexp (g-regexp.ads)
24825 @geindex Regular expressions
24827 @geindex Pattern matching
24829 A simple implementation of regular expressions, using a subset of regular
24830 expression syntax copied from familiar Unix style utilities. This is the
24831 simplest of the three pattern matching packages provided, and is particularly
24832 suitable for ‘file globbing’ applications.
24834 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
24835 @anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{39f}@anchor{gnat_rm/the_gnat_library id102}@anchor{3a0}
24836 @section @code{GNAT.Registry} (@code{g-regist.ads})
24839 @geindex GNAT.Registry (g-regist.ads)
24841 @geindex Windows Registry
24843 This is a high level binding to the Windows registry. It is possible to
24844 do simple things like reading a key value, creating a new key. For full
24845 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
24846 package provided with the Win32Ada binding
24848 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
24849 @anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{3a1}@anchor{gnat_rm/the_gnat_library id103}@anchor{3a2}
24850 @section @code{GNAT.Regpat} (@code{g-regpat.ads})
24853 @geindex GNAT.Regpat (g-regpat.ads)
24855 @geindex Regular expressions
24857 @geindex Pattern matching
24859 A complete implementation of Unix-style regular expression matching, copied
24860 from the original V7 style regular expression library written in C by
24861 Henry Spencer (and binary compatible with this C library).
24863 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
24864 @anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{3a3}@anchor{gnat_rm/the_gnat_library id104}@anchor{3a4}
24865 @section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
24868 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
24870 @geindex Rewrite data
24872 A unit to rewrite on-the-fly string occurrences in a stream of
24873 data. The implementation has a very minimal memory footprint as the
24874 full content to be processed is not loaded into memory all at once. This makes
24875 this interface usable for large files or socket streams.
24877 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
24878 @anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{3a5}@anchor{gnat_rm/the_gnat_library id105}@anchor{3a6}
24879 @section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
24882 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
24884 @geindex Secondary Stack Info
24886 Provide the capability to query the high water mark of the current task’s
24889 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
24890 @anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{3a7}@anchor{gnat_rm/the_gnat_library id106}@anchor{3a8}
24891 @section @code{GNAT.Semaphores} (@code{g-semaph.ads})
24894 @geindex GNAT.Semaphores (g-semaph.ads)
24896 @geindex Semaphores
24898 Provides classic counting and binary semaphores using protected types.
24900 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
24901 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{3a9}@anchor{gnat_rm/the_gnat_library id107}@anchor{3aa}
24902 @section @code{GNAT.Serial_Communications} (@code{g-sercom.ads})
24905 @geindex GNAT.Serial_Communications (g-sercom.ads)
24907 @geindex Serial_Communications
24909 Provides a simple interface to send and receive data over a serial
24910 port. This is only supported on GNU/Linux and Windows.
24912 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
24913 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{3ab}@anchor{gnat_rm/the_gnat_library id108}@anchor{3ac}
24914 @section @code{GNAT.SHA1} (@code{g-sha1.ads})
24917 @geindex GNAT.SHA1 (g-sha1.ads)
24919 @geindex Secure Hash Algorithm SHA-1
24921 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
24922 and RFC 3174, and the HMAC-SHA1 message authentication function as described
24923 in RFC 2104 and FIPS PUB 198.
24925 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
24926 @anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{3ad}@anchor{gnat_rm/the_gnat_library id109}@anchor{3ae}
24927 @section @code{GNAT.SHA224} (@code{g-sha224.ads})
24930 @geindex GNAT.SHA224 (g-sha224.ads)
24932 @geindex Secure Hash Algorithm SHA-224
24934 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24935 and the HMAC-SHA224 message authentication function as described
24936 in RFC 2104 and FIPS PUB 198.
24938 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24939 @anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{3af}@anchor{gnat_rm/the_gnat_library id110}@anchor{3b0}
24940 @section @code{GNAT.SHA256} (@code{g-sha256.ads})
24943 @geindex GNAT.SHA256 (g-sha256.ads)
24945 @geindex Secure Hash Algorithm SHA-256
24947 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24948 and the HMAC-SHA256 message authentication function as described
24949 in RFC 2104 and FIPS PUB 198.
24951 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24952 @anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{3b1}@anchor{gnat_rm/the_gnat_library id111}@anchor{3b2}
24953 @section @code{GNAT.SHA384} (@code{g-sha384.ads})
24956 @geindex GNAT.SHA384 (g-sha384.ads)
24958 @geindex Secure Hash Algorithm SHA-384
24960 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24961 and the HMAC-SHA384 message authentication function as described
24962 in RFC 2104 and FIPS PUB 198.
24964 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24965 @anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3b3}@anchor{gnat_rm/the_gnat_library id112}@anchor{3b4}
24966 @section @code{GNAT.SHA512} (@code{g-sha512.ads})
24969 @geindex GNAT.SHA512 (g-sha512.ads)
24971 @geindex Secure Hash Algorithm SHA-512
24973 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24974 and the HMAC-SHA512 message authentication function as described
24975 in RFC 2104 and FIPS PUB 198.
24977 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24978 @anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3b5}@anchor{gnat_rm/the_gnat_library id113}@anchor{3b6}
24979 @section @code{GNAT.Signals} (@code{g-signal.ads})
24982 @geindex GNAT.Signals (g-signal.ads)
24986 Provides the ability to manipulate the blocked status of signals on supported
24989 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24990 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3b7}@anchor{gnat_rm/the_gnat_library id114}@anchor{3b8}
24991 @section @code{GNAT.Sockets} (@code{g-socket.ads})
24994 @geindex GNAT.Sockets (g-socket.ads)
24998 A high level and portable interface to develop sockets based applications.
24999 This package is based on the sockets thin binding found in
25000 @code{GNAT.Sockets.Thin}. Currently @code{GNAT.Sockets} is implemented
25001 on all native GNAT ports and on VxWorks cross prots. It is not implemented for
25002 the LynxOS cross port.
25004 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
25005 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3b9}@anchor{gnat_rm/the_gnat_library id115}@anchor{3ba}
25006 @section @code{GNAT.Source_Info} (@code{g-souinf.ads})
25009 @geindex GNAT.Source_Info (g-souinf.ads)
25011 @geindex Source Information
25013 Provides subprograms that give access to source code information known at
25014 compile time, such as the current file name and line number. Also provides
25015 subprograms yielding the date and time of the current compilation (like the
25016 C macros @code{__DATE__} and @code{__TIME__})
25018 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
25019 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3bb}@anchor{gnat_rm/the_gnat_library id116}@anchor{3bc}
25020 @section @code{GNAT.Spelling_Checker} (@code{g-speche.ads})
25023 @geindex GNAT.Spelling_Checker (g-speche.ads)
25025 @geindex Spell checking
25027 Provides a function for determining whether one string is a plausible
25028 near misspelling of another string.
25030 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
25031 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3bd}@anchor{gnat_rm/the_gnat_library id117}@anchor{3be}
25032 @section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
25035 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
25037 @geindex Spell checking
25039 Provides a generic function that can be instantiated with a string type for
25040 determining whether one string is a plausible near misspelling of another
25043 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
25044 @anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3bf}@anchor{gnat_rm/the_gnat_library id118}@anchor{3c0}
25045 @section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
25048 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
25050 @geindex SPITBOL pattern matching
25052 @geindex Pattern matching
25054 A complete implementation of SNOBOL4 style pattern matching. This is the
25055 most elaborate of the pattern matching packages provided. It fully duplicates
25056 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
25057 efficient algorithm developed by Robert Dewar for the SPITBOL system.
25059 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
25060 @anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3c1}@anchor{gnat_rm/the_gnat_library id119}@anchor{3c2}
25061 @section @code{GNAT.Spitbol} (@code{g-spitbo.ads})
25064 @geindex GNAT.Spitbol (g-spitbo.ads)
25066 @geindex SPITBOL interface
25068 The top level package of the collection of SPITBOL-style functionality, this
25069 package provides basic SNOBOL4 string manipulation functions, such as
25070 Pad, Reverse, Trim, Substr capability, as well as a generic table function
25071 useful for constructing arbitrary mappings from strings in the style of
25072 the SNOBOL4 TABLE function.
25074 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
25075 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3c3}@anchor{gnat_rm/the_gnat_library id120}@anchor{3c4}
25076 @section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
25079 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
25081 @geindex Sets of strings
25083 @geindex SPITBOL Tables
25085 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
25086 for type @code{Standard.Boolean}, giving an implementation of sets of
25089 @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
25090 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3c5}@anchor{gnat_rm/the_gnat_library id121}@anchor{3c6}
25091 @section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
25094 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
25096 @geindex Integer maps
25100 @geindex SPITBOL Tables
25102 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
25103 for type @code{Standard.Integer}, giving an implementation of maps
25104 from string to integer values.
25106 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
25107 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3c7}@anchor{gnat_rm/the_gnat_library id122}@anchor{3c8}
25108 @section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
25111 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
25113 @geindex String maps
25117 @geindex SPITBOL Tables
25119 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table} for
25120 a variable length string type, giving an implementation of general
25121 maps from strings to strings.
25123 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
25124 @anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3c9}@anchor{gnat_rm/the_gnat_library id123}@anchor{3ca}
25125 @section @code{GNAT.SSE} (@code{g-sse.ads})
25128 @geindex GNAT.SSE (g-sse.ads)
25130 Root of a set of units aimed at offering Ada bindings to a subset of
25131 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
25132 targets. It exposes vector component types together with a general
25133 introduction to the binding contents and use.
25135 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
25136 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3cb}@anchor{gnat_rm/the_gnat_library id124}@anchor{3cc}
25137 @section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
25140 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
25142 SSE vector types for use with SSE related intrinsics.
25144 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
25145 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3cd}@anchor{gnat_rm/the_gnat_library id125}@anchor{3ce}
25146 @section @code{GNAT.String_Hash} (@code{g-strhas.ads})
25149 @geindex GNAT.String_Hash (g-strhas.ads)
25151 @geindex Hash functions
25153 Provides a generic hash function working on arrays of scalars. Both the scalar
25154 type and the hash result type are parameters.
25156 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
25157 @anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3cf}@anchor{gnat_rm/the_gnat_library id126}@anchor{3d0}
25158 @section @code{GNAT.Strings} (@code{g-string.ads})
25161 @geindex GNAT.Strings (g-string.ads)
25163 Common String access types and related subprograms. Basically it
25164 defines a string access and an array of string access types.
25166 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
25167 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3d1}@anchor{gnat_rm/the_gnat_library id127}@anchor{3d2}
25168 @section @code{GNAT.String_Split} (@code{g-strspl.ads})
25171 @geindex GNAT.String_Split (g-strspl.ads)
25173 @geindex String splitter
25175 Useful string manipulation routines: given a set of separators, split
25176 a string wherever the separators appear, and provide direct access
25177 to the resulting slices. This package is instantiated from
25178 @code{GNAT.Array_Split}.
25180 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
25181 @anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3d3}@anchor{gnat_rm/the_gnat_library id128}@anchor{3d4}
25182 @section @code{GNAT.Table} (@code{g-table.ads})
25185 @geindex GNAT.Table (g-table.ads)
25187 @geindex Table implementation
25190 @geindex extendable
25192 A generic package providing a single dimension array abstraction where the
25193 length of the array can be dynamically modified.
25195 This package provides a facility similar to that of @code{GNAT.Dynamic_Tables},
25196 except that this package declares a single instance of the table type,
25197 while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
25198 used to define dynamic instances of the table.
25200 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
25201 @anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3d5}@anchor{gnat_rm/the_gnat_library id129}@anchor{3d6}
25202 @section @code{GNAT.Task_Lock} (@code{g-tasloc.ads})
25205 @geindex GNAT.Task_Lock (g-tasloc.ads)
25207 @geindex Task synchronization
25209 @geindex Task locking
25213 A very simple facility for locking and unlocking sections of code using a
25214 single global task lock. Appropriate for use in situations where contention
25215 between tasks is very rarely expected.
25217 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
25218 @anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3d7}@anchor{gnat_rm/the_gnat_library id130}@anchor{3d8}
25219 @section @code{GNAT.Time_Stamp} (@code{g-timsta.ads})
25222 @geindex GNAT.Time_Stamp (g-timsta.ads)
25224 @geindex Time stamp
25226 @geindex Current time
25228 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
25229 represents the current date and time in ISO 8601 format. This is a very simple
25230 routine with minimal code and there are no dependencies on any other unit.
25232 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
25233 @anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3d9}@anchor{gnat_rm/the_gnat_library id131}@anchor{3da}
25234 @section @code{GNAT.Threads} (@code{g-thread.ads})
25237 @geindex GNAT.Threads (g-thread.ads)
25239 @geindex Foreign threads
25244 Provides facilities for dealing with foreign threads which need to be known
25245 by the GNAT run-time system. Consult the documentation of this package for
25246 further details if your program has threads that are created by a non-Ada
25247 environment which then accesses Ada code.
25249 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
25250 @anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3db}@anchor{gnat_rm/the_gnat_library id132}@anchor{3dc}
25251 @section @code{GNAT.Traceback} (@code{g-traceb.ads})
25254 @geindex GNAT.Traceback (g-traceb.ads)
25256 @geindex Trace back facilities
25258 Provides a facility for obtaining non-symbolic traceback information, useful
25259 in various debugging situations.
25261 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
25262 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3dd}@anchor{gnat_rm/the_gnat_library id133}@anchor{3de}
25263 @section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
25266 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
25268 @geindex Trace back facilities
25270 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
25271 @anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3df}@anchor{gnat_rm/the_gnat_library id134}@anchor{3e0}
25272 @section @code{GNAT.UTF_32} (@code{g-table.ads})
25275 @geindex GNAT.UTF_32 (g-table.ads)
25277 @geindex Wide character codes
25279 This is a package intended to be used in conjunction with the
25280 @code{Wide_Character} type in Ada 95 and the
25281 @code{Wide_Wide_Character} type in Ada 2005 (available
25282 in @code{GNAT} in Ada 2005 mode). This package contains
25283 Unicode categorization routines, as well as lexical
25284 categorization routines corresponding to the Ada 2005
25285 lexical rules for identifiers and strings, and also a
25286 lower case to upper case fold routine corresponding to
25287 the Ada 2005 rules for identifier equivalence.
25289 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
25290 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3e1}@anchor{gnat_rm/the_gnat_library id135}@anchor{3e2}
25291 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
25294 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
25296 @geindex Spell checking
25298 Provides a function for determining whether one wide wide string is a plausible
25299 near misspelling of another wide wide string, where the strings are represented
25300 using the UTF_32_String type defined in System.Wch_Cnv.
25302 @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
25303 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3e3}@anchor{gnat_rm/the_gnat_library id136}@anchor{3e4}
25304 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
25307 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
25309 @geindex Spell checking
25311 Provides a function for determining whether one wide string is a plausible
25312 near misspelling of another wide string.
25314 @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
25315 @anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3e5}@anchor{gnat_rm/the_gnat_library id137}@anchor{3e6}
25316 @section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
25319 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
25321 @geindex Wide_String splitter
25323 Useful wide string manipulation routines: given a set of separators, split
25324 a wide string wherever the separators appear, and provide direct access
25325 to the resulting slices. This package is instantiated from
25326 @code{GNAT.Array_Split}.
25328 @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
25329 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3e7}@anchor{gnat_rm/the_gnat_library id138}@anchor{3e8}
25330 @section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
25333 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
25335 @geindex Spell checking
25337 Provides a function for determining whether one wide wide string is a plausible
25338 near misspelling of another wide wide string.
25340 @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
25341 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3e9}@anchor{gnat_rm/the_gnat_library id139}@anchor{3ea}
25342 @section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
25345 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
25347 @geindex Wide_Wide_String splitter
25349 Useful wide wide string manipulation routines: given a set of separators, split
25350 a wide wide string wherever the separators appear, and provide direct access
25351 to the resulting slices. This package is instantiated from
25352 @code{GNAT.Array_Split}.
25354 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
25355 @anchor{gnat_rm/the_gnat_library id140}@anchor{3eb}@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3ec}
25356 @section @code{Interfaces.C.Extensions} (@code{i-cexten.ads})
25359 @geindex Interfaces.C.Extensions (i-cexten.ads)
25361 This package contains additional C-related definitions, intended
25362 for use with either manually or automatically generated bindings
25365 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
25366 @anchor{gnat_rm/the_gnat_library id141}@anchor{3ed}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3ee}
25367 @section @code{Interfaces.C.Streams} (@code{i-cstrea.ads})
25370 @geindex Interfaces.C.Streams (i-cstrea.ads)
25373 @geindex interfacing
25375 This package is a binding for the most commonly used operations
25378 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
25379 @anchor{gnat_rm/the_gnat_library id142}@anchor{3ef}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3f0}
25380 @section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
25383 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
25385 @geindex IBM Packed Format
25387 @geindex Packed Decimal
25389 This package provides a set of routines for conversions to and
25390 from a packed decimal format compatible with that used on IBM
25393 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
25394 @anchor{gnat_rm/the_gnat_library id143}@anchor{3f1}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3f2}
25395 @section @code{Interfaces.VxWorks} (@code{i-vxwork.ads})
25398 @geindex Interfaces.VxWorks (i-vxwork.ads)
25400 @geindex Interfacing to VxWorks
25403 @geindex interfacing
25405 This package provides a limited binding to the VxWorks API.
25406 In particular, it interfaces with the
25407 VxWorks hardware interrupt facilities.
25409 @node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
25410 @anchor{gnat_rm/the_gnat_library id144}@anchor{3f3}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3f4}
25411 @section @code{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads})
25414 @geindex Interfaces.VxWorks.Int_Connection (i-vxinco.ads)
25416 @geindex Interfacing to VxWorks
25419 @geindex interfacing
25421 This package provides a way for users to replace the use of
25422 intConnect() with a custom routine for installing interrupt
25425 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library
25426 @anchor{gnat_rm/the_gnat_library id145}@anchor{3f5}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3f6}
25427 @section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
25430 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
25432 @geindex Interfacing to VxWorks' I/O
25435 @geindex I/O interfacing
25438 @geindex Get_Immediate
25440 @geindex Get_Immediate
25443 This package provides a binding to the ioctl (IO/Control)
25444 function of VxWorks, defining a set of option values and
25445 function codes. A particular use of this package is
25446 to enable the use of Get_Immediate under VxWorks.
25448 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
25449 @anchor{gnat_rm/the_gnat_library id146}@anchor{3f7}@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3f8}
25450 @section @code{System.Address_Image} (@code{s-addima.ads})
25453 @geindex System.Address_Image (s-addima.ads)
25455 @geindex Address image
25458 @geindex of an address
25460 This function provides a useful debugging
25461 function that gives an (implementation dependent)
25462 string which identifies an address.
25464 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
25465 @anchor{gnat_rm/the_gnat_library id147}@anchor{3f9}@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3fa}
25466 @section @code{System.Assertions} (@code{s-assert.ads})
25469 @geindex System.Assertions (s-assert.ads)
25471 @geindex Assertions
25473 @geindex Assert_Failure
25476 This package provides the declaration of the exception raised
25477 by an run-time assertion failure, as well as the routine that
25478 is used internally to raise this assertion.
25480 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
25481 @anchor{gnat_rm/the_gnat_library id148}@anchor{3fb}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3fc}
25482 @section @code{System.Atomic_Counters} (@code{s-atocou.ads})
25485 @geindex System.Atomic_Counters (s-atocou.ads)
25487 This package provides the declaration of an atomic counter type,
25488 together with efficient routines (using hardware
25489 synchronization primitives) for incrementing, decrementing,
25490 and testing of these counters. This package is implemented
25491 on most targets, including all Alpha, AARCH64, ARM, ia64, PowerPC, SPARC V9,
25492 x86, and x86_64 platforms.
25494 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
25495 @anchor{gnat_rm/the_gnat_library id149}@anchor{3fd}@anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3fe}
25496 @section @code{System.Memory} (@code{s-memory.ads})
25499 @geindex System.Memory (s-memory.ads)
25501 @geindex Memory allocation
25503 This package provides the interface to the low level routines used
25504 by the generated code for allocation and freeing storage for the
25505 default storage pool (analogous to the C routines malloc and free).
25506 It also provides a reallocation interface analogous to the C routine
25507 realloc. The body of this unit may be modified to provide alternative
25508 allocation mechanisms for the default pool, and in addition, direct
25509 calls to this unit may be made for low level allocation uses (for
25510 example see the body of @code{GNAT.Tables}).
25512 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
25513 @anchor{gnat_rm/the_gnat_library id150}@anchor{3ff}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{400}
25514 @section @code{System.Multiprocessors} (@code{s-multip.ads})
25517 @geindex System.Multiprocessors (s-multip.ads)
25519 @geindex Multiprocessor interface
25521 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25522 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25523 technically an implementation-defined addition).
25525 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
25526 @anchor{gnat_rm/the_gnat_library id151}@anchor{401}@anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{402}
25527 @section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
25530 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
25532 @geindex Multiprocessor interface
25534 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25535 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25536 technically an implementation-defined addition).
25538 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
25539 @anchor{gnat_rm/the_gnat_library id152}@anchor{403}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{404}
25540 @section @code{System.Partition_Interface} (@code{s-parint.ads})
25543 @geindex System.Partition_Interface (s-parint.ads)
25545 @geindex Partition interfacing functions
25547 This package provides facilities for partition interfacing. It
25548 is used primarily in a distribution context when using Annex E
25551 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
25552 @anchor{gnat_rm/the_gnat_library id153}@anchor{405}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{406}
25553 @section @code{System.Pool_Global} (@code{s-pooglo.ads})
25556 @geindex System.Pool_Global (s-pooglo.ads)
25558 @geindex Storage pool
25561 @geindex Global storage pool
25563 This package provides a storage pool that is equivalent to the default
25564 storage pool used for access types for which no pool is specifically
25565 declared. It uses malloc/free to allocate/free and does not attempt to
25566 do any automatic reclamation.
25568 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
25569 @anchor{gnat_rm/the_gnat_library id154}@anchor{407}@anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{408}
25570 @section @code{System.Pool_Local} (@code{s-pooloc.ads})
25573 @geindex System.Pool_Local (s-pooloc.ads)
25575 @geindex Storage pool
25578 @geindex Local storage pool
25580 This package provides a storage pool that is intended for use with locally
25581 defined access types. It uses malloc/free for allocate/free, and maintains
25582 a list of allocated blocks, so that all storage allocated for the pool can
25583 be freed automatically when the pool is finalized.
25585 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
25586 @anchor{gnat_rm/the_gnat_library id155}@anchor{409}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{40a}
25587 @section @code{System.Restrictions} (@code{s-restri.ads})
25590 @geindex System.Restrictions (s-restri.ads)
25592 @geindex Run-time restrictions access
25594 This package provides facilities for accessing at run time
25595 the status of restrictions specified at compile time for
25596 the partition. Information is available both with regard
25597 to actual restrictions specified, and with regard to
25598 compiler determined information on which restrictions
25599 are violated by one or more packages in the partition.
25601 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
25602 @anchor{gnat_rm/the_gnat_library id156}@anchor{40b}@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{40c}
25603 @section @code{System.Rident} (@code{s-rident.ads})
25606 @geindex System.Rident (s-rident.ads)
25608 @geindex Restrictions definitions
25610 This package provides definitions of the restrictions
25611 identifiers supported by GNAT, and also the format of
25612 the restrictions provided in package System.Restrictions.
25613 It is not normally necessary to @code{with} this generic package
25614 since the necessary instantiation is included in
25615 package System.Restrictions.
25617 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
25618 @anchor{gnat_rm/the_gnat_library id157}@anchor{40d}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{40e}
25619 @section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads})
25622 @geindex System.Strings.Stream_Ops (s-ststop.ads)
25624 @geindex Stream operations
25626 @geindex String stream operations
25628 This package provides a set of stream subprograms for standard string types.
25629 It is intended primarily to support implicit use of such subprograms when
25630 stream attributes are applied to string types, but the subprograms in this
25631 package can be used directly by application programs.
25633 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
25634 @anchor{gnat_rm/the_gnat_library id158}@anchor{40f}@anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{410}
25635 @section @code{System.Unsigned_Types} (@code{s-unstyp.ads})
25638 @geindex System.Unsigned_Types (s-unstyp.ads)
25640 This package contains definitions of standard unsigned types that
25641 correspond in size to the standard signed types declared in Standard,
25642 and (unlike the types in Interfaces) have corresponding names. It
25643 also contains some related definitions for other specialized types
25644 used by the compiler in connection with packed array types.
25646 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
25647 @anchor{gnat_rm/the_gnat_library id159}@anchor{411}@anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{412}
25648 @section @code{System.Wch_Cnv} (@code{s-wchcnv.ads})
25651 @geindex System.Wch_Cnv (s-wchcnv.ads)
25653 @geindex Wide Character
25654 @geindex Representation
25656 @geindex Wide String
25657 @geindex Conversion
25659 @geindex Representation of wide characters
25661 This package provides routines for converting between
25662 wide and wide wide characters and a representation as a value of type
25663 @code{Standard.String}, using a specified wide character
25664 encoding method. It uses definitions in
25665 package @code{System.Wch_Con}.
25667 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
25668 @anchor{gnat_rm/the_gnat_library id160}@anchor{413}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{414}
25669 @section @code{System.Wch_Con} (@code{s-wchcon.ads})
25672 @geindex System.Wch_Con (s-wchcon.ads)
25674 This package provides definitions and descriptions of
25675 the various methods used for encoding wide characters
25676 in ordinary strings. These definitions are used by
25677 the package @code{System.Wch_Cnv}.
25679 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
25680 @anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{415}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{416}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}
25681 @chapter Interfacing to Other Languages
25684 The facilities in Annex B of the Ada Reference Manual are fully
25685 implemented in GNAT, and in addition, a full interface to C++ is
25689 * Interfacing to C::
25690 * Interfacing to C++::
25691 * Interfacing to COBOL::
25692 * Interfacing to Fortran::
25693 * Interfacing to non-GNAT Ada code::
25697 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
25698 @anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{417}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{418}
25699 @section Interfacing to C
25702 Interfacing to C with GNAT can use one of two approaches:
25708 The types in the package @code{Interfaces.C} may be used.
25711 Standard Ada types may be used directly. This may be less portable to
25712 other compilers, but will work on all GNAT compilers, which guarantee
25713 correspondence between the C and Ada types.
25716 Pragma @code{Convention C} may be applied to Ada types, but mostly has no
25717 effect, since this is the default. The following table shows the
25718 correspondence between Ada scalar types and the corresponding C types.
25721 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
25740 @code{Short_Integer}
25748 @code{Short_Short_Integer}
25756 @code{Long_Integer}
25764 @code{Long_Long_Integer}
25796 @code{Long_Long_Float}
25800 This is the longest floating-point type supported by the hardware.
25805 Additionally, there are the following general correspondences between Ada
25812 Ada enumeration types map to C enumeration types directly if pragma
25813 @code{Convention C} is specified, which causes them to have a length of
25814 32 bits, except for boolean types which map to C99 @code{bool} and for
25815 which the length is 8 bits.
25816 Without pragma @code{Convention C}, Ada enumeration types map to
25817 8, 16, or 32 bits (i.e., C types @code{signed char}, @code{short},
25818 @code{int}, respectively) depending on the number of values passed.
25819 This is the only case in which pragma @code{Convention C} affects the
25820 representation of an Ada type.
25823 Ada access types map to C pointers, except for the case of pointers to
25824 unconstrained types in Ada, which have no direct C equivalent.
25827 Ada arrays map directly to C arrays.
25830 Ada records map directly to C structures.
25833 Packed Ada records map to C structures where all members are bit fields
25834 of the length corresponding to the @code{type'Size} value in Ada.
25837 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
25838 @anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{47}@anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{419}
25839 @section Interfacing to C++
25842 The interface to C++ makes use of the following pragmas, which are
25843 primarily intended to be constructed automatically using a binding generator
25844 tool, although it is possible to construct them by hand.
25846 Using these pragmas it is possible to achieve complete
25847 inter-operability between Ada tagged types and C++ class definitions.
25848 See @ref{7,,Implementation Defined Pragmas}, for more details.
25853 @item @code{pragma CPP_Class ([Entity =>] @var{LOCAL_NAME})}
25855 The argument denotes an entity in the current declarative region that is
25856 declared as a tagged or untagged record type. It indicates that the type
25857 corresponds to an externally declared C++ class type, and is to be laid
25858 out the same way that C++ would lay out the type.
25860 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
25861 for backward compatibility but its functionality is available
25862 using pragma @code{Import} with @code{Convention} = @code{CPP}.
25864 @item @code{pragma CPP_Constructor ([Entity =>] @var{LOCAL_NAME})}
25866 This pragma identifies an imported function (imported in the usual way
25867 with pragma @code{Import}) as corresponding to a C++ constructor.
25870 A few restrictions are placed on the use of the @code{Access} attribute
25871 in conjunction with subprograms subject to convention @code{CPP}: the
25872 attribute may be used neither on primitive operations of a tagged
25873 record type with convention @code{CPP}, imported or not, nor on
25874 subprograms imported with pragma @code{CPP_Constructor}.
25876 In addition, C++ exceptions are propagated and can be handled in an
25877 @code{others} choice of an exception handler. The corresponding Ada
25878 occurrence has no message, and the simple name of the exception identity
25879 contains @code{Foreign_Exception}. Finalization and awaiting dependent
25880 tasks works properly when such foreign exceptions are propagated.
25882 It is also possible to import a C++ exception using the following syntax:
25885 LOCAL_NAME : exception;
25886 pragma Import (Cpp,
25887 [Entity =>] LOCAL_NAME,
25888 [External_Name =>] static_string_EXPRESSION);
25891 The @code{External_Name} is the name of the C++ RTTI symbol. You can then
25892 cover a specific C++ exception in an exception handler.
25894 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
25895 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{41a}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{41b}
25896 @section Interfacing to COBOL
25899 Interfacing to COBOL is achieved as described in section B.4 of
25900 the Ada Reference Manual.
25902 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
25903 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{41c}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{41d}
25904 @section Interfacing to Fortran
25907 Interfacing to Fortran is achieved as described in section B.5 of the
25908 Ada Reference Manual. The pragma @code{Convention Fortran}, applied to a
25909 multi-dimensional array causes the array to be stored in column-major
25910 order as required for convenient interface to Fortran.
25912 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
25913 @anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{41e}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{41f}
25914 @section Interfacing to non-GNAT Ada code
25917 It is possible to specify the convention @code{Ada} in a pragma
25918 @code{Import} or pragma @code{Export}. However this refers to
25919 the calling conventions used by GNAT, which may or may not be
25920 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
25921 compiler to allow interoperation.
25923 If arguments types are kept simple, and if the foreign compiler generally
25924 follows system calling conventions, then it may be possible to integrate
25925 files compiled by other Ada compilers, provided that the elaboration
25926 issues are adequately addressed (for example by eliminating the
25927 need for any load time elaboration).
25929 In particular, GNAT running on VMS is designed to
25930 be highly compatible with the DEC Ada 83 compiler, so this is one
25931 case in which it is possible to import foreign units of this type,
25932 provided that the data items passed are restricted to simple scalar
25933 values or simple record types without variants, or simple array
25934 types with fixed bounds.
25936 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
25937 @anchor{gnat_rm/specialized_needs_annexes doc}@anchor{420}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{421}@anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}
25938 @chapter Specialized Needs Annexes
25941 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
25942 required in all implementations. However, as described in this chapter,
25943 GNAT implements all of these annexes:
25948 @item `Systems Programming (Annex C)'
25950 The Systems Programming Annex is fully implemented.
25952 @item `Real-Time Systems (Annex D)'
25954 The Real-Time Systems Annex is fully implemented.
25956 @item `Distributed Systems (Annex E)'
25958 Stub generation is fully implemented in the GNAT compiler. In addition,
25959 a complete compatible PCS is available as part of the GLADE system,
25960 a separate product. When the two
25961 products are used in conjunction, this annex is fully implemented.
25963 @item `Information Systems (Annex F)'
25965 The Information Systems annex is fully implemented.
25967 @item `Numerics (Annex G)'
25969 The Numerics Annex is fully implemented.
25971 @item `Safety and Security / High-Integrity Systems (Annex H)'
25973 The Safety and Security Annex (termed the High-Integrity Systems Annex
25974 in Ada 2005) is fully implemented.
25977 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25978 @anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{422}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{423}@anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13}
25979 @chapter Implementation of Specific Ada Features
25982 This chapter describes the GNAT implementation of several Ada language
25986 * Machine Code Insertions::
25987 * GNAT Implementation of Tasking::
25988 * GNAT Implementation of Shared Passive Packages::
25989 * Code Generation for Array Aggregates::
25990 * The Size of Discriminated Records with Default Discriminants::
25991 * Image Values For Nonscalar Types::
25992 * Strict Conformance to the Ada Reference Manual::
25996 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25997 @anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{424}@anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{166}
25998 @section Machine Code Insertions
26001 @geindex Machine Code insertions
26003 Package @code{Machine_Code} provides machine code support as described
26004 in the Ada Reference Manual in two separate forms:
26010 Machine code statements, consisting of qualified expressions that
26011 fit the requirements of RM section 13.8.
26014 An intrinsic callable procedure, providing an alternative mechanism of
26015 including machine instructions in a subprogram.
26018 The two features are similar, and both are closely related to the mechanism
26019 provided by the asm instruction in the GNU C compiler. Full understanding
26020 and use of the facilities in this package requires understanding the asm
26021 instruction, see the section on Extended Asm in
26022 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
26024 Calls to the function @code{Asm} and the procedure @code{Asm} have identical
26025 semantic restrictions and effects as described below. Both are provided so
26026 that the procedure call can be used as a statement, and the function call
26027 can be used to form a code_statement.
26029 Consider this C @code{asm} instruction:
26032 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
26035 The equivalent can be written for GNAT as:
26038 Asm ("fsinx %1 %0",
26039 My_Float'Asm_Output ("=f", result),
26040 My_Float'Asm_Input ("f", angle));
26043 The first argument to @code{Asm} is the assembler template, and is
26044 identical to what is used in GNU C. This string must be a static
26045 expression. The second argument is the output operand list. It is
26046 either a single @code{Asm_Output} attribute reference, or a list of such
26047 references enclosed in parentheses (technically an array aggregate of
26050 The @code{Asm_Output} attribute denotes a function that takes two
26051 parameters. The first is a string, the second is the name of a variable
26052 of the type designated by the attribute prefix. The first (string)
26053 argument is required to be a static expression and designates the
26054 constraint (see the section on Constraints in
26055 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
26056 for the parameter; e.g., what kind of register is required. The second
26057 argument is the variable to be written or updated with the
26058 result. The possible values for constraint are the same as those used in
26059 the RTL, and are dependent on the configuration file used to build the
26060 GCC back end. If there are no output operands, then this argument may
26061 either be omitted, or explicitly given as @code{No_Output_Operands}.
26062 No support is provided for GNU C’s symbolic names for output parameters.
26064 The second argument of @code{my_float'Asm_Output} functions as
26065 though it were an @code{out} parameter, which is a little curious, but
26066 all names have the form of expressions, so there is no syntactic
26067 irregularity, even though normally functions would not be permitted
26068 @code{out} parameters. The third argument is the list of input
26069 operands. It is either a single @code{Asm_Input} attribute reference, or
26070 a list of such references enclosed in parentheses (technically an array
26071 aggregate of such references).
26073 The @code{Asm_Input} attribute denotes a function that takes two
26074 parameters. The first is a string, the second is an expression of the
26075 type designated by the prefix. The first (string) argument is required
26076 to be a static expression, and is the constraint for the parameter,
26077 (e.g., what kind of register is required). The second argument is the
26078 value to be used as the input argument. The possible values for the
26079 constraint are the same as those used in the RTL, and are dependent on
26080 the configuration file used to built the GCC back end.
26081 No support is provided for GNU C’s symbolic names for input parameters.
26083 If there are no input operands, this argument may either be omitted, or
26084 explicitly given as @code{No_Input_Operands}. The fourth argument, not
26085 present in the above example, is a list of register names, called the
26086 `clobber' argument. This argument, if given, must be a static string
26087 expression, and is a space or comma separated list of names of registers
26088 that must be considered destroyed as a result of the @code{Asm} call. If
26089 this argument is the null string (the default value), then the code
26090 generator assumes that no additional registers are destroyed.
26091 In addition to registers, the special clobbers @code{memory} and
26092 @code{cc} as described in the GNU C docs are both supported.
26094 The fifth argument, not present in the above example, called the
26095 `volatile' argument, is by default @code{False}. It can be set to
26096 the literal value @code{True} to indicate to the code generator that all
26097 optimizations with respect to the instruction specified should be
26098 suppressed, and in particular an instruction that has outputs
26099 will still be generated, even if none of the outputs are
26100 used. See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
26101 for the full description.
26102 Generally it is strongly advisable to use Volatile for any ASM statement
26103 that is missing either input or output operands or to avoid unwanted
26104 optimizations. A warning is generated if this advice is not followed.
26106 No support is provided for GNU C’s @code{asm goto} feature.
26108 The @code{Asm} subprograms may be used in two ways. First the procedure
26109 forms can be used anywhere a procedure call would be valid, and
26110 correspond to what the RM calls ‘intrinsic’ routines. Such calls can
26111 be used to intersperse machine instructions with other Ada statements.
26112 Second, the function forms, which return a dummy value of the limited
26113 private type @code{Asm_Insn}, can be used in code statements, and indeed
26114 this is the only context where such calls are allowed. Code statements
26115 appear as aggregates of the form:
26118 Asm_Insn'(Asm (...));
26119 Asm_Insn'(Asm_Volatile (...));
26122 In accordance with RM rules, such code statements are allowed only
26123 within subprograms whose entire body consists of such statements. It is
26124 not permissible to intermix such statements with other Ada statements.
26126 Typically the form using intrinsic procedure calls is more convenient
26127 and more flexible. The code statement form is provided to meet the RM
26128 suggestion that such a facility should be made available. The following
26129 is the exact syntax of the call to @code{Asm}. As usual, if named notation
26130 is used, the arguments may be given in arbitrary order, following the
26131 normal rules for use of positional and named arguments:
26135 [Template =>] static_string_EXPRESSION
26136 [,[Outputs =>] OUTPUT_OPERAND_LIST ]
26137 [,[Inputs =>] INPUT_OPERAND_LIST ]
26138 [,[Clobber =>] static_string_EXPRESSION ]
26139 [,[Volatile =>] static_boolean_EXPRESSION] )
26141 OUTPUT_OPERAND_LIST ::=
26142 [PREFIX.]No_Output_Operands
26143 | OUTPUT_OPERAND_ATTRIBUTE
26144 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
26146 OUTPUT_OPERAND_ATTRIBUTE ::=
26147 SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
26149 INPUT_OPERAND_LIST ::=
26150 [PREFIX.]No_Input_Operands
26151 | INPUT_OPERAND_ATTRIBUTE
26152 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
26154 INPUT_OPERAND_ATTRIBUTE ::=
26155 SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
26158 The identifiers @code{No_Input_Operands} and @code{No_Output_Operands}
26159 are declared in the package @code{Machine_Code} and must be referenced
26160 according to normal visibility rules. In particular if there is no
26161 @code{use} clause for this package, then appropriate package name
26162 qualification is required.
26164 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
26165 @anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{425}@anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{426}
26166 @section GNAT Implementation of Tasking
26169 This chapter outlines the basic GNAT approach to tasking (in particular,
26170 a multi-layered library for portability) and discusses issues related
26171 to compliance with the Real-Time Systems Annex.
26174 * Mapping Ada Tasks onto the Underlying Kernel Threads::
26175 * Ensuring Compliance with the Real-Time Annex::
26176 * Support for Locking Policies::
26180 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
26181 @anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{427}@anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{428}
26182 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
26185 GNAT’s run-time support comprises two layers:
26191 GNARL (GNAT Run-time Layer)
26194 GNULL (GNAT Low-level Library)
26197 In GNAT, Ada’s tasking services rely on a platform and OS independent
26198 layer known as GNARL. This code is responsible for implementing the
26199 correct semantics of Ada’s task creation, rendezvous, protected
26202 GNARL decomposes Ada’s tasking semantics into simpler lower level
26203 operations such as create a thread, set the priority of a thread,
26204 yield, create a lock, lock/unlock, etc. The spec for these low-level
26205 operations constitutes GNULLI, the GNULL Interface. This interface is
26206 directly inspired from the POSIX real-time API.
26208 If the underlying executive or OS implements the POSIX standard
26209 faithfully, the GNULL Interface maps as is to the services offered by
26210 the underlying kernel. Otherwise, some target dependent glue code maps
26211 the services offered by the underlying kernel to the semantics expected
26214 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
26215 key point is that each Ada task is mapped on a thread in the underlying
26216 kernel. For example, in the case of VxWorks, one Ada task = one VxWorks task.
26218 In addition Ada task priorities map onto the underlying thread priorities.
26219 Mapping Ada tasks onto the underlying kernel threads has several advantages:
26225 The underlying scheduler is used to schedule the Ada tasks. This
26226 makes Ada tasks as efficient as kernel threads from a scheduling
26230 Interaction with code written in C containing threads is eased
26231 since at the lowest level Ada tasks and C threads map onto the same
26232 underlying kernel concept.
26235 When an Ada task is blocked during I/O the remaining Ada tasks are
26239 On multiprocessor systems Ada tasks can execute in parallel.
26242 Some threads libraries offer a mechanism to fork a new process, with the
26243 child process duplicating the threads from the parent.
26245 support this functionality when the parent contains more than one task.
26247 @geindex Forking a new process
26249 @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
26250 @anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{429}@anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{42a}
26251 @subsection Ensuring Compliance with the Real-Time Annex
26254 @geindex Real-Time Systems Annex compliance
26256 Although mapping Ada tasks onto
26257 the underlying threads has significant advantages, it does create some
26258 complications when it comes to respecting the scheduling semantics
26259 specified in the real-time annex (Annex D).
26261 For instance the Annex D requirement for the @code{FIFO_Within_Priorities}
26262 scheduling policy states:
26266 `When the active priority of a ready task that is not running
26267 changes, or the setting of its base priority takes effect, the
26268 task is removed from the ready queue for its old active priority
26269 and is added at the tail of the ready queue for its new active
26270 priority, except in the case where the active priority is lowered
26271 due to the loss of inherited priority, in which case the task is
26272 added at the head of the ready queue for its new active priority.'
26275 While most kernels do put tasks at the end of the priority queue when
26276 a task changes its priority, (which respects the main
26277 FIFO_Within_Priorities requirement), almost none keep a thread at the
26278 beginning of its priority queue when its priority drops from the loss
26279 of inherited priority.
26281 As a result most vendors have provided incomplete Annex D implementations.
26283 The GNAT run-time, has a nice cooperative solution to this problem
26284 which ensures that accurate FIFO_Within_Priorities semantics are
26287 The principle is as follows. When an Ada task T is about to start
26288 running, it checks whether some other Ada task R with the same
26289 priority as T has been suspended due to the loss of priority
26290 inheritance. If this is the case, T yields and is placed at the end of
26291 its priority queue. When R arrives at the front of the queue it
26294 Note that this simple scheme preserves the relative order of the tasks
26295 that were ready to execute in the priority queue where R has been
26298 @c Support_for_Locking_Policies
26300 @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
26301 @anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{42b}
26302 @subsection Support for Locking Policies
26305 This section specifies which policies specified by pragma Locking_Policy
26306 are supported on which platforms.
26308 GNAT supports the standard @code{Ceiling_Locking} policy, and the
26309 implementation defined @code{Inheritance_Locking} and
26310 @code{Concurrent_Readers_Locking} policies.
26312 @code{Ceiling_Locking} is supported on all platforms if the operating system
26313 supports it. In particular, @code{Ceiling_Locking} is not supported on
26315 @code{Inheritance_Locking} is supported on
26320 @code{Concurrent_Readers_Locking} is supported on Linux.
26322 Notes about @code{Ceiling_Locking} on Linux:
26323 If the process is running as ‘root’, ceiling locking is used.
26324 If the capabilities facility is installed
26325 (“sudo apt-get –assume-yes install libcap-dev” on Ubuntu,
26327 and the program is linked against that library
26329 and the executable file has the cap_sys_nice capability
26330 (“sudo /sbin/setcap cap_sys_nice=ep executable_file_name”),
26331 then ceiling locking is used.
26332 Otherwise, the @code{Ceiling_Locking} policy is ignored.
26334 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
26335 @anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{42c}@anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{42d}
26336 @section GNAT Implementation of Shared Passive Packages
26339 @geindex Shared passive packages
26341 GNAT fully implements the
26342 @geindex pragma Shared_Passive
26344 @code{Shared_Passive} for
26345 the purpose of designating shared passive packages.
26346 This allows the use of passive partitions in the
26347 context described in the Ada Reference Manual; i.e., for communication
26348 between separate partitions of a distributed application using the
26349 features in Annex E.
26353 @geindex Distribution Systems Annex
26355 However, the implementation approach used by GNAT provides for more
26356 extensive usage as follows:
26361 @item `Communication between separate programs'
26363 This allows separate programs to access the data in passive
26364 partitions, using protected objects for synchronization where
26365 needed. The only requirement is that the two programs have a
26366 common shared file system. It is even possible for programs
26367 running on different machines with different architectures
26368 (e.g., different endianness) to communicate via the data in
26369 a passive partition.
26371 @item `Persistence between program runs'
26373 The data in a passive package can persist from one run of a
26374 program to another, so that a later program sees the final
26375 values stored by a previous run of the same program.
26378 The implementation approach used is to store the data in files. A
26379 separate stream file is created for each object in the package, and
26380 an access to an object causes the corresponding file to be read or
26383 @geindex SHARED_MEMORY_DIRECTORY environment variable
26385 The environment variable @code{SHARED_MEMORY_DIRECTORY} should be
26386 set to the directory to be used for these files.
26387 The files in this directory
26388 have names that correspond to their fully qualified names. For
26389 example, if we have the package
26393 pragma Shared_Passive (X);
26399 and the environment variable is set to @code{/stemp/}, then the files created
26400 will have the names:
26407 These files are created when a value is initially written to the object, and
26408 the files are retained until manually deleted. This provides the persistence
26409 semantics. If no file exists, it means that no partition has assigned a value
26410 to the variable; in this case the initial value declared in the package
26411 will be used. This model ensures that there are no issues in synchronizing
26412 the elaboration process, since elaboration of passive packages elaborates the
26413 initial values, but does not create the files.
26415 The files are written using normal @code{Stream_IO} access.
26416 If you want to be able
26417 to communicate between programs or partitions running on different
26418 architectures, then you should use the XDR versions of the stream attribute
26419 routines, since these are architecture independent.
26421 If active synchronization is required for access to the variables in the
26422 shared passive package, then as described in the Ada Reference Manual, the
26423 package may contain protected objects used for this purpose. In this case
26424 a lock file (whose name is @code{___lock}, with three underscores)
26425 is created in the shared memory directory.
26427 @geindex ___lock file (for shared passive packages)
26429 This is used to provide the required locking
26430 semantics for proper protected object synchronization.
26432 @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
26433 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{42e}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{42f}
26434 @section Code Generation for Array Aggregates
26437 Aggregates have a rich syntax and allow the user to specify the values of
26438 complex data structures by means of a single construct. As a result, the
26439 code generated for aggregates can be quite complex and involve loops, case
26440 statements and multiple assignments. In the simplest cases, however, the
26441 compiler will recognize aggregates whose components and constraints are
26442 fully static, and in those cases the compiler will generate little or no
26443 executable code. The following is an outline of the code that GNAT generates
26444 for various aggregate constructs. For further details, you will find it
26445 useful to examine the output produced by the -gnatG flag to see the expanded
26446 source that is input to the code generator. You may also want to examine
26447 the assembly code generated at various levels of optimization.
26449 The code generated for aggregates depends on the context, the component values,
26450 and the type. In the context of an object declaration the code generated is
26451 generally simpler than in the case of an assignment. As a general rule, static
26452 component values and static subtypes also lead to simpler code.
26455 * Static constant aggregates with static bounds::
26456 * Constant aggregates with unconstrained nominal types::
26457 * Aggregates with static bounds::
26458 * Aggregates with nonstatic bounds::
26459 * Aggregates in assignment statements::
26463 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
26464 @anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{430}@anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{431}
26465 @subsection Static constant aggregates with static bounds
26468 For the declarations:
26471 type One_Dim is array (1..10) of integer;
26472 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
26475 GNAT generates no executable code: the constant ar0 is placed in static memory.
26476 The same is true for constant aggregates with named associations:
26479 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
26480 Cr3 : constant One_Dim := (others => 7777);
26483 The same is true for multidimensional constant arrays such as:
26486 type two_dim is array (1..3, 1..3) of integer;
26487 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
26490 The same is true for arrays of one-dimensional arrays: the following are
26494 type ar1b is array (1..3) of boolean;
26495 type ar_ar is array (1..3) of ar1b;
26496 None : constant ar1b := (others => false); -- fully static
26497 None2 : constant ar_ar := (1..3 => None); -- fully static
26500 However, for multidimensional aggregates with named associations, GNAT will
26501 generate assignments and loops, even if all associations are static. The
26502 following two declarations generate a loop for the first dimension, and
26503 individual component assignments for the second dimension:
26506 Zero1: constant two_dim := (1..3 => (1..3 => 0));
26507 Zero2: constant two_dim := (others => (others => 0));
26510 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
26511 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{432}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{433}
26512 @subsection Constant aggregates with unconstrained nominal types
26515 In such cases the aggregate itself establishes the subtype, so that
26516 associations with @code{others} cannot be used. GNAT determines the
26517 bounds for the actual subtype of the aggregate, and allocates the
26518 aggregate statically as well. No code is generated for the following:
26521 type One_Unc is array (natural range <>) of integer;
26522 Cr_Unc : constant One_Unc := (12,24,36);
26525 @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
26526 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{434}@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{435}
26527 @subsection Aggregates with static bounds
26530 In all previous examples the aggregate was the initial (and immutable) value
26531 of a constant. If the aggregate initializes a variable, then code is generated
26532 for it as a combination of individual assignments and loops over the target
26533 object. The declarations
26536 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
26537 Cr_Var2 : One_Dim := (others > -1);
26540 generate the equivalent of
26548 for I in Cr_Var2'range loop
26553 @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
26554 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{436}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{437}
26555 @subsection Aggregates with nonstatic bounds
26558 If the bounds of the aggregate are not statically compatible with the bounds
26559 of the nominal subtype of the target, then constraint checks have to be
26560 generated on the bounds. For a multidimensional array, constraint checks may
26561 have to be applied to sub-arrays individually, if they do not have statically
26562 compatible subtypes.
26564 @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
26565 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{438}@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{439}
26566 @subsection Aggregates in assignment statements
26569 In general, aggregate assignment requires the construction of a temporary,
26570 and a copy from the temporary to the target of the assignment. This is because
26571 it is not always possible to convert the assignment into a series of individual
26572 component assignments. For example, consider the simple case:
26578 This cannot be converted into:
26585 So the aggregate has to be built first in a separate location, and then
26586 copied into the target. GNAT recognizes simple cases where this intermediate
26587 step is not required, and the assignments can be performed in place, directly
26588 into the target. The following sufficient criteria are applied:
26594 The bounds of the aggregate are static, and the associations are static.
26597 The components of the aggregate are static constants, names of
26598 simple variables that are not renamings, or expressions not involving
26599 indexed components whose operands obey these rules.
26602 If any of these conditions are violated, the aggregate will be built in
26603 a temporary (created either by the front-end or the code generator) and then
26604 that temporary will be copied onto the target.
26606 @node The Size of Discriminated Records with Default Discriminants,Image Values For Nonscalar Types,Code Generation for Array Aggregates,Implementation of Specific Ada Features
26607 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{43a}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{43b}
26608 @section The Size of Discriminated Records with Default Discriminants
26611 If a discriminated type @code{T} has discriminants with default values, it is
26612 possible to declare an object of this type without providing an explicit
26616 type Size is range 1..100;
26618 type Rec (D : Size := 15) is record
26619 Name : String (1..D);
26625 Such an object is said to be `unconstrained'.
26626 The discriminant of the object
26627 can be modified by a full assignment to the object, as long as it preserves the
26628 relation between the value of the discriminant, and the value of the components
26632 Word := (3, "yes");
26634 Word := (5, "maybe");
26636 Word := (5, "no"); -- raises Constraint_Error
26639 In order to support this behavior efficiently, an unconstrained object is
26640 given the maximum size that any value of the type requires. In the case
26641 above, @code{Word} has storage for the discriminant and for
26642 a @code{String} of length 100.
26643 It is important to note that unconstrained objects do not require dynamic
26644 allocation. It would be an improper implementation to place on the heap those
26645 components whose size depends on discriminants. (This improper implementation
26646 was used by some Ada83 compilers, where the @code{Name} component above
26648 been stored as a pointer to a dynamic string). Following the principle that
26649 dynamic storage management should never be introduced implicitly,
26650 an Ada compiler should reserve the full size for an unconstrained declared
26651 object, and place it on the stack.
26653 This maximum size approach
26654 has been a source of surprise to some users, who expect the default
26655 values of the discriminants to determine the size reserved for an
26656 unconstrained object: “If the default is 15, why should the object occupy
26658 The answer, of course, is that the discriminant may be later modified,
26659 and its full range of values must be taken into account. This is why the
26663 type Rec (D : Positive := 15) is record
26664 Name : String (1..D);
26670 is flagged by the compiler with a warning:
26671 an attempt to create @code{Too_Large} will raise @code{Storage_Error},
26672 because the required size includes @code{Positive'Last}
26673 bytes. As the first example indicates, the proper approach is to declare an
26674 index type of ‘reasonable’ range so that unconstrained objects are not too
26677 One final wrinkle: if the object is declared to be @code{aliased}, or if it is
26678 created in the heap by means of an allocator, then it is `not'
26680 it is constrained by the default values of the discriminants, and those values
26681 cannot be modified by full assignment. This is because in the presence of
26682 aliasing all views of the object (which may be manipulated by different tasks,
26683 say) must be consistent, so it is imperative that the object, once created,
26686 @node Image Values For Nonscalar Types,Strict Conformance to the Ada Reference Manual,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
26687 @anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{43c}@anchor{gnat_rm/implementation_of_specific_ada_features image-values-for-nonscalar-types}@anchor{43d}
26688 @section Image Values For Nonscalar Types
26691 Ada 2022 defines the Image, Wide_Image, and Wide_Wide image attributes
26692 for nonscalar types; earlier Ada versions defined these attributes only
26693 for scalar types. Ada RM 4.10 provides some general guidance regarding
26694 the default implementation of these attributes and the GNAT compiler
26695 follows that guidance. However, beyond that the precise details of the
26696 image text generated in these cases are deliberately not documented and are
26697 subject to change. In particular, users should not rely on formatting details
26698 (such as spaces or line breaking), record field order, image values for access
26699 types, image values for types that have ancestor or subcomponent types
26700 declared in non-Ada2022 code, image values for predefined types, or the
26701 compiler’s choices regarding the implementation permissions described in
26702 Ada RM 4.10. This list is not intended to be exhaustive. If more precise
26703 control of image text is required for some type T, then T’Put_Image should be
26704 explicitly specified.
26706 @node Strict Conformance to the Ada Reference Manual,,Image Values For Nonscalar Types,Implementation of Specific Ada Features
26707 @anchor{gnat_rm/implementation_of_specific_ada_features id15}@anchor{43e}@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{43f}
26708 @section Strict Conformance to the Ada Reference Manual
26711 The dynamic semantics defined by the Ada Reference Manual impose a set of
26712 run-time checks to be generated. By default, the GNAT compiler will insert many
26713 run-time checks into the compiled code, including most of those required by the
26714 Ada Reference Manual. However, there are two checks that are not enabled in
26715 the default mode for efficiency reasons: checks for access before elaboration
26716 on subprogram calls, and stack overflow checking (most operating systems do not
26717 perform this check by default).
26719 Strict conformance to the Ada Reference Manual can be achieved by adding two
26720 compiler options for dynamic checks for access-before-elaboration on subprogram
26721 calls and generic instantiations (`-gnatE'), and stack overflow checking
26724 Note that the result of a floating point arithmetic operation in overflow and
26725 invalid situations, when the @code{Machine_Overflows} attribute of the result
26726 type is @code{False}, is to generate IEEE NaN and infinite values. This is the
26727 case for machines compliant with the IEEE floating-point standard, but on
26728 machines that are not fully compliant with this standard, such as Alpha, the
26729 `-mieee' compiler flag must be used for achieving IEEE confirming
26730 behavior (although at the cost of a significant performance penalty), so
26731 infinite and NaN values are properly generated.
26733 @node Implementation of Ada 2012 Features,Security Hardening Features,Implementation of Specific Ada Features,Top
26734 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{440}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{441}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14}
26735 @chapter Implementation of Ada 2012 Features
26738 @geindex Ada 2012 implementation status
26740 @geindex -gnat12 option (gcc)
26742 @geindex pragma Ada_2012
26744 @geindex configuration pragma Ada_2012
26746 @geindex Ada_2012 configuration pragma
26748 This chapter contains a complete list of Ada 2012 features that have been
26750 Generally, these features are only
26751 available if the `-gnat12' (Ada 2012 features enabled) option is set,
26752 which is the default behavior,
26753 or if the configuration pragma @code{Ada_2012} is used.
26755 However, new pragmas, attributes, and restrictions are
26756 unconditionally available, since the Ada 95 standard allows the addition of
26757 new pragmas, attributes, and restrictions (there are exceptions, which are
26758 documented in the individual descriptions), and also certain packages
26759 were made available in earlier versions of Ada.
26761 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
26762 This date shows the implementation date of the feature. Any wavefront
26763 subsequent to this date will contain the indicated feature, as will any
26764 subsequent releases. A date of 0000-00-00 means that GNAT has always
26765 implemented the feature, or implemented it as soon as it appeared as a
26766 binding interpretation.
26768 Each feature corresponds to an Ada Issue (‘AI’) approved by the Ada
26769 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
26770 The features are ordered based on the relevant sections of the Ada
26771 Reference Manual (“RM”). When a given AI relates to multiple points
26772 in the RM, the earliest is used.
26774 A complete description of the AIs may be found in
26775 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
26777 @geindex AI-0176 (Ada 2012 feature)
26783 `AI-0176 Quantified expressions (2010-09-29)'
26785 Both universally and existentially quantified expressions are implemented.
26786 They use the new syntax for iterators proposed in AI05-139-2, as well as
26787 the standard Ada loop syntax.
26789 RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0)
26792 @geindex AI-0079 (Ada 2012 feature)
26798 `AI-0079 Allow other_format characters in source (2010-07-10)'
26800 Wide characters in the unicode category `other_format' are now allowed in
26801 source programs between tokens, but not within a token such as an identifier.
26803 RM References: 2.01 (4/2) 2.02 (7)
26806 @geindex AI-0091 (Ada 2012 feature)
26812 `AI-0091 Do not allow other_format in identifiers (0000-00-00)'
26814 Wide characters in the unicode category `other_format' are not permitted
26815 within an identifier, since this can be a security problem. The error
26816 message for this case has been improved to be more specific, but GNAT has
26817 never allowed such characters to appear in identifiers.
26819 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)
26822 @geindex AI-0100 (Ada 2012 feature)
26828 `AI-0100 Placement of pragmas (2010-07-01)'
26830 This AI is an earlier version of AI-163. It simplifies the rules
26831 for legal placement of pragmas. In the case of lists that allow pragmas, if
26832 the list may have no elements, then the list may consist solely of pragmas.
26834 RM References: 2.08 (7)
26837 @geindex AI-0163 (Ada 2012 feature)
26843 `AI-0163 Pragmas in place of null (2010-07-01)'
26845 A statement sequence may be composed entirely of pragmas. It is no longer
26846 necessary to add a dummy @code{null} statement to make the sequence legal.
26848 RM References: 2.08 (7) 2.08 (16)
26851 @geindex AI-0080 (Ada 2012 feature)
26857 `AI-0080 ‘View of’ not needed if clear from context (0000-00-00)'
26859 This is an editorial change only, described as non-testable in the AI.
26861 RM References: 3.01 (7)
26864 @geindex AI-0183 (Ada 2012 feature)
26870 `AI-0183 Aspect specifications (2010-08-16)'
26872 Aspect specifications have been fully implemented except for pre and post-
26873 conditions, and type invariants, which have their own separate AI’s. All
26874 forms of declarations listed in the AI are supported. The following is a
26875 list of the aspects supported (with GNAT implementation aspects marked)
26879 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx}
26924 @code{Atomic_Components}
26936 @code{Component_Size}
26942 @code{Contract_Cases}
26950 @code{Discard_Names}
26956 @code{External_Tag}
26962 @code{Favor_Top_Level}
26976 @code{Inline_Always}
26992 @code{Machine_Radix}
27018 @code{Persistent_BSS}
27044 @code{Preelaborable_Initialization}
27050 @code{Pure_Function}
27058 @code{Remote_Access_Type}
27080 @code{Storage_Pool}
27086 @code{Storage_Size}
27104 @code{Suppress_Debug_Info}
27120 @code{Thread_Local_Storage}
27128 @code{Type_Invariant}
27134 @code{Unchecked_Union}
27140 @code{Universal_Aliasing}
27156 @code{Unreferenced}
27164 @code{Unreferenced_Objects}
27192 @code{Volatile_Components}
27209 Note that for aspects with an expression, e.g. @code{Size}, the expression is
27210 treated like a default expression (visibility is analyzed at the point of
27211 occurrence of the aspect, but evaluation of the expression occurs at the
27212 freeze point of the entity involved).
27214 RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6)
27215 3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03
27216 (2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2)
27217 9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2)
27218 12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1)
27222 @geindex AI-0128 (Ada 2012 feature)
27228 `AI-0128 Inequality is a primitive operation (0000-00-00)'
27230 If an equality operator (“=”) is declared for a type, then the implicitly
27231 declared inequality operator (“/=”) is a primitive operation of the type.
27232 This is the only reasonable interpretation, and is the one always implemented
27233 by GNAT, but the RM was not entirely clear in making this point.
27235 RM References: 3.02.03 (6) 6.06 (6)
27238 @geindex AI-0003 (Ada 2012 feature)
27244 `AI-0003 Qualified expressions as names (2010-07-11)'
27246 In Ada 2012, a qualified expression is considered to be syntactically a name,
27247 meaning that constructs such as @code{A'(F(X)).B} are now legal. This is
27248 useful in disambiguating some cases of overloading.
27250 RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3)
27254 @geindex AI-0120 (Ada 2012 feature)
27260 `AI-0120 Constant instance of protected object (0000-00-00)'
27262 This is an RM editorial change only. The section that lists objects that are
27263 constant failed to include the current instance of a protected object
27264 within a protected function. This has always been treated as a constant
27267 RM References: 3.03 (21)
27270 @geindex AI-0008 (Ada 2012 feature)
27276 `AI-0008 General access to constrained objects (0000-00-00)'
27278 The wording in the RM implied that if you have a general access to a
27279 constrained object, it could be used to modify the discriminants. This was
27280 obviously not intended. @code{Constraint_Error} should be raised, and GNAT
27281 has always done so in this situation.
27283 RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2)
27286 @geindex AI-0093 (Ada 2012 feature)
27292 `AI-0093 Additional rules use immutably limited (0000-00-00)'
27294 This is an editorial change only, to make more widespread use of the Ada 2012
27295 ‘immutably limited’.
27297 RM References: 3.03 (23.4/3)
27300 @geindex AI-0096 (Ada 2012 feature)
27306 `AI-0096 Deriving from formal private types (2010-07-20)'
27308 In general it is illegal for a type derived from a formal limited type to be
27309 nonlimited. This AI makes an exception to this rule: derivation is legal
27310 if it appears in the private part of the generic, and the formal type is not
27311 tagged. If the type is tagged, the legality check must be applied to the
27312 private part of the package.
27314 RM References: 3.04 (5.1/2) 6.02 (7)
27317 @geindex AI-0181 (Ada 2012 feature)
27323 `AI-0181 Soft hyphen is a non-graphic character (2010-07-23)'
27325 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
27326 means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the
27327 @code{Image} and @code{Value} attributes for the character types. Strictly
27328 speaking this is an inconsistency with Ada 95, but in practice the use of
27329 these attributes is so obscure that it will not cause problems.
27331 RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21)
27334 @geindex AI-0182 (Ada 2012 feature)
27340 `AI-0182 Additional forms for' @code{Character'Value} `(0000-00-00)'
27342 This AI allows @code{Character'Value} to accept the string @code{'?'} where
27343 @code{?} is any character including non-graphic control characters. GNAT has
27344 always accepted such strings. It also allows strings such as
27345 @code{HEX_00000041} to be accepted, but GNAT does not take advantage of this
27346 permission and raises @code{Constraint_Error}, as is certainly still
27349 RM References: 3.05 (56/2)
27352 @geindex AI-0214 (Ada 2012 feature)
27358 `AI-0214 Defaulted discriminants for limited tagged (2010-10-01)'
27360 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
27361 to have default expressions by allowing them when the type is limited. It
27362 is often useful to define a default value for a discriminant even though
27363 it can’t be changed by assignment.
27365 RM References: 3.07 (9.1/2) 3.07.02 (3)
27368 @geindex AI-0102 (Ada 2012 feature)
27374 `AI-0102 Some implicit conversions are illegal (0000-00-00)'
27376 It is illegal to assign an anonymous access constant to an anonymous access
27377 variable. The RM did not have a clear rule to prevent this, but GNAT has
27378 always generated an error for this usage.
27380 RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2)
27383 @geindex AI-0158 (Ada 2012 feature)
27389 `AI-0158 Generalizing membership tests (2010-09-16)'
27391 This AI extends the syntax of membership tests to simplify complex conditions
27392 that can be expressed as membership in a subset of values of any type. It
27393 introduces syntax for a list of expressions that may be used in loop contexts
27396 RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27)
27399 @geindex AI-0173 (Ada 2012 feature)
27405 `AI-0173 Testing if tags represent abstract types (2010-07-03)'
27407 The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked
27408 with the tag of an abstract type, and @code{False} otherwise.
27410 RM References: 3.09 (7.4/2) 3.09 (12.4/2)
27413 @geindex AI-0076 (Ada 2012 feature)
27419 `AI-0076 function with controlling result (0000-00-00)'
27421 This is an editorial change only. The RM defines calls with controlling
27422 results, but uses the term ‘function with controlling result’ without an
27423 explicit definition.
27425 RM References: 3.09.02 (2/2)
27428 @geindex AI-0126 (Ada 2012 feature)
27434 `AI-0126 Dispatching with no declared operation (0000-00-00)'
27436 This AI clarifies dispatching rules, and simply confirms that dispatching
27437 executes the operation of the parent type when there is no explicitly or
27438 implicitly declared operation for the descendant type. This has always been
27439 the case in all versions of GNAT.
27441 RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2)
27444 @geindex AI-0097 (Ada 2012 feature)
27450 `AI-0097 Treatment of abstract null extension (2010-07-19)'
27452 The RM as written implied that in some cases it was possible to create an
27453 object of an abstract type, by having an abstract extension inherit a non-
27454 abstract constructor from its parent type. This mistake has been corrected
27455 in GNAT and in the RM, and this construct is now illegal.
27457 RM References: 3.09.03 (4/2)
27460 @geindex AI-0203 (Ada 2012 feature)
27466 `AI-0203 Extended return cannot be abstract (0000-00-00)'
27468 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
27469 permitted such usage.
27471 RM References: 3.09.03 (8/3)
27474 @geindex AI-0198 (Ada 2012 feature)
27480 `AI-0198 Inheriting abstract operators (0000-00-00)'
27482 This AI resolves a conflict between two rules involving inherited abstract
27483 operations and predefined operators. If a derived numeric type inherits
27484 an abstract operator, it overrides the predefined one. This interpretation
27485 was always the one implemented in GNAT.
27487 RM References: 3.09.03 (4/3)
27490 @geindex AI-0073 (Ada 2012 feature)
27496 `AI-0073 Functions returning abstract types (2010-07-10)'
27498 This AI covers a number of issues regarding returning abstract types. In
27499 particular generic functions cannot have abstract result types or access
27500 result types designated an abstract type. There are some other cases which
27501 are detailed in the AI. Note that this binding interpretation has not been
27502 retrofitted to operate before Ada 2012 mode, since it caused a significant
27503 number of regressions.
27505 RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2)
27508 @geindex AI-0070 (Ada 2012 feature)
27514 `AI-0070 Elaboration of interface types (0000-00-00)'
27516 This is an editorial change only, there are no testable consequences short of
27517 checking for the absence of generated code for an interface declaration.
27519 RM References: 3.09.04 (18/2)
27522 @geindex AI-0208 (Ada 2012 feature)
27528 `AI-0208 Characteristics of incomplete views (0000-00-00)'
27530 The wording in the Ada 2005 RM concerning characteristics of incomplete views
27531 was incorrect and implied that some programs intended to be legal were now
27532 illegal. GNAT had never considered such programs illegal, so it has always
27533 implemented the intent of this AI.
27535 RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2)
27538 @geindex AI-0162 (Ada 2012 feature)
27544 `AI-0162 Incomplete type completed by partial view (2010-09-15)'
27546 Incomplete types are made more useful by allowing them to be completed by
27547 private types and private extensions.
27549 RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2)
27552 @geindex AI-0098 (Ada 2012 feature)
27558 `AI-0098 Anonymous subprogram access restrictions (0000-00-00)'
27560 An unintentional omission in the RM implied some inconsistent restrictions on
27561 the use of anonymous access to subprogram values. These restrictions were not
27562 intentional, and have never been enforced by GNAT.
27564 RM References: 3.10.01 (6) 3.10.01 (9.2/2)
27567 @geindex AI-0199 (Ada 2012 feature)
27573 `AI-0199 Aggregate with anonymous access components (2010-07-14)'
27575 A choice list in a record aggregate can include several components of
27576 (distinct) anonymous access types as long as they have matching designated
27579 RM References: 4.03.01 (16)
27582 @geindex AI-0220 (Ada 2012 feature)
27588 `AI-0220 Needed components for aggregates (0000-00-00)'
27590 This AI addresses a wording problem in the RM that appears to permit some
27591 complex cases of aggregates with nonstatic discriminants. GNAT has always
27592 implemented the intended semantics.
27594 RM References: 4.03.01 (17)
27597 @geindex AI-0147 (Ada 2012 feature)
27603 `AI-0147 Conditional expressions (2009-03-29)'
27605 Conditional expressions are permitted. The form of such an expression is:
27608 (if expr then expr @{elsif expr then expr@} [else expr])
27611 The parentheses can be omitted in contexts where parentheses are present
27612 anyway, such as subprogram arguments and pragma arguments. If the `else'
27613 clause is omitted, `else' `True' is assumed;
27614 thus @code{(if A then B)} is a way to conveniently represent
27615 `(A implies B)' in standard logic.
27617 RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2)
27618 4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2)
27621 @geindex AI-0037 (Ada 2012 feature)
27627 `AI-0037 Out-of-range box associations in aggregate (0000-00-00)'
27629 This AI confirms that an association of the form @code{Indx => <>} in an
27630 array aggregate must raise @code{Constraint_Error} if @code{Indx}
27631 is out of range. The RM specified a range check on other associations, but
27632 not when the value of the association was defaulted. GNAT has always inserted
27633 a constraint check on the index value.
27635 RM References: 4.03.03 (29)
27638 @geindex AI-0123 (Ada 2012 feature)
27644 `AI-0123 Composability of equality (2010-04-13)'
27646 Equality of untagged record composes, so that the predefined equality for a
27647 composite type that includes a component of some untagged record type
27648 @code{R} uses the equality operation of @code{R} (which may be user-defined
27649 or predefined). This makes the behavior of untagged records identical to that
27650 of tagged types in this respect.
27652 This change is an incompatibility with previous versions of Ada, but it
27653 corrects a non-uniformity that was often a source of confusion. Analysis of
27654 a large number of industrial programs indicates that in those rare cases
27655 where a composite type had an untagged record component with a user-defined
27656 equality, either there was no use of the composite equality, or else the code
27657 expected the same composability as for tagged types, and thus had a bug that
27658 would be fixed by this change.
27660 RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24)
27664 @geindex AI-0088 (Ada 2012 feature)
27670 `AI-0088 The value of exponentiation (0000-00-00)'
27672 This AI clarifies the equivalence rule given for the dynamic semantics of
27673 exponentiation: the value of the operation can be obtained by repeated
27674 multiplication, but the operation can be implemented otherwise (for example
27675 using the familiar divide-by-two-and-square algorithm, even if this is less
27676 accurate), and does not imply repeated reads of a volatile base.
27678 RM References: 4.05.06 (11)
27681 @geindex AI-0188 (Ada 2012 feature)
27687 `AI-0188 Case expressions (2010-01-09)'
27689 Case expressions are permitted. This allows use of constructs such as:
27692 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
27695 RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33)
27698 @geindex AI-0104 (Ada 2012 feature)
27704 `AI-0104 Null exclusion and uninitialized allocator (2010-07-15)'
27706 The assignment @code{Ptr := new not null Some_Ptr;} will raise
27707 @code{Constraint_Error} because the default value of the allocated object is
27708 `null'. This useless construct is illegal in Ada 2012.
27710 RM References: 4.08 (2)
27713 @geindex AI-0157 (Ada 2012 feature)
27719 `AI-0157 Allocation/Deallocation from empty pool (2010-07-11)'
27721 Allocation and Deallocation from an empty storage pool (i.e. allocation or
27722 deallocation of a pointer for which a static storage size clause of zero
27723 has been given) is now illegal and is detected as such. GNAT
27724 previously gave a warning but not an error.
27726 RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17)
27729 @geindex AI-0179 (Ada 2012 feature)
27735 `AI-0179 Statement not required after label (2010-04-10)'
27737 It is not necessary to have a statement following a label, so a label
27738 can appear at the end of a statement sequence without the need for putting a
27739 null statement afterwards, but it is not allowable to have only labels and
27740 no real statements in a statement sequence.
27742 RM References: 5.01 (2)
27745 @geindex AI-0139-2 (Ada 2012 feature)
27751 `AI-0139-2 Syntactic sugar for iterators (2010-09-29)'
27753 The new syntax for iterating over arrays and containers is now implemented.
27754 Iteration over containers is for now limited to read-only iterators. Only
27755 default iterators are supported, with the syntax: @code{for Elem of C}.
27757 RM References: 5.05
27760 @geindex AI-0134 (Ada 2012 feature)
27766 `AI-0134 Profiles must match for full conformance (0000-00-00)'
27768 For full conformance, the profiles of anonymous-access-to-subprogram
27769 parameters must match. GNAT has always enforced this rule.
27771 RM References: 6.03.01 (18)
27774 @geindex AI-0207 (Ada 2012 feature)
27780 `AI-0207 Mode conformance and access constant (0000-00-00)'
27782 This AI confirms that access_to_constant indication must match for mode
27783 conformance. This was implemented in GNAT when the qualifier was originally
27784 introduced in Ada 2005.
27786 RM References: 6.03.01 (16/2)
27789 @geindex AI-0046 (Ada 2012 feature)
27795 `AI-0046 Null exclusion match for full conformance (2010-07-17)'
27797 For full conformance, in the case of access parameters, the null exclusion
27798 must match (either both or neither must have @code{not null}).
27800 RM References: 6.03.02 (18)
27803 @geindex AI-0118 (Ada 2012 feature)
27809 `AI-0118 The association of parameter associations (0000-00-00)'
27811 This AI clarifies the rules for named associations in subprogram calls and
27812 generic instantiations. The rules have been in place since Ada 83.
27814 RM References: 6.04.01 (2) 12.03 (9)
27817 @geindex AI-0196 (Ada 2012 feature)
27823 `AI-0196 Null exclusion tests for out parameters (0000-00-00)'
27825 Null exclusion checks are not made for @code{out} parameters when
27826 evaluating the actual parameters. GNAT has never generated these checks.
27828 RM References: 6.04.01 (13)
27831 @geindex AI-0015 (Ada 2012 feature)
27837 `AI-0015 Constant return objects (0000-00-00)'
27839 The return object declared in an `extended_return_statement' may be
27840 declared constant. This was always intended, and GNAT has always allowed it.
27842 RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2)
27846 @geindex AI-0032 (Ada 2012 feature)
27852 `AI-0032 Extended return for class-wide functions (0000-00-00)'
27854 If a function returns a class-wide type, the object of an extended return
27855 statement can be declared with a specific type that is covered by the class-
27856 wide type. This has been implemented in GNAT since the introduction of
27857 extended returns. Note AI-0103 complements this AI by imposing matching
27858 rules for constrained return types.
27860 RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2)
27864 @geindex AI-0103 (Ada 2012 feature)
27870 `AI-0103 Static matching for extended return (2010-07-23)'
27872 If the return subtype of a function is an elementary type or a constrained
27873 type, the subtype indication in an extended return statement must match
27874 statically this return subtype.
27876 RM References: 6.05 (5.2/2)
27879 @geindex AI-0058 (Ada 2012 feature)
27885 `AI-0058 Abnormal completion of an extended return (0000-00-00)'
27887 The RM had some incorrect wording implying wrong treatment of abnormal
27888 completion in an extended return. GNAT has always implemented the intended
27889 correct semantics as described by this AI.
27891 RM References: 6.05 (22/2)
27894 @geindex AI-0050 (Ada 2012 feature)
27900 `AI-0050 Raising Constraint_Error early for function call (0000-00-00)'
27902 The implementation permissions for raising @code{Constraint_Error} early on a function call
27903 when it was clear an exception would be raised were over-permissive and allowed
27904 mishandling of discriminants in some cases. GNAT did
27905 not take advantage of these incorrect permissions in any case.
27907 RM References: 6.05 (24/2)
27910 @geindex AI-0125 (Ada 2012 feature)
27916 `AI-0125 Nonoverridable operations of an ancestor (2010-09-28)'
27918 In Ada 2012, the declaration of a primitive operation of a type extension
27919 or private extension can also override an inherited primitive that is not
27920 visible at the point of this declaration.
27922 RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2)
27925 @geindex AI-0062 (Ada 2012 feature)
27931 `AI-0062 Null exclusions and deferred constants (0000-00-00)'
27933 A full constant may have a null exclusion even if its associated deferred
27934 constant does not. GNAT has always allowed this.
27936 RM References: 7.04 (6/2) 7.04 (7.1/2)
27939 @geindex AI-0178 (Ada 2012 feature)
27945 `AI-0178 Incomplete views are limited (0000-00-00)'
27947 This AI clarifies the role of incomplete views and plugs an omission in the
27948 RM. GNAT always correctly restricted the use of incomplete views and types.
27950 RM References: 7.05 (3/2) 7.05 (6/2)
27953 @geindex AI-0087 (Ada 2012 feature)
27959 `AI-0087 Actual for formal nonlimited derived type (2010-07-15)'
27961 The actual for a formal nonlimited derived type cannot be limited. In
27962 particular, a formal derived type that extends a limited interface but which
27963 is not explicitly limited cannot be instantiated with a limited type.
27965 RM References: 7.05 (5/2) 12.05.01 (5.1/2)
27968 @geindex AI-0099 (Ada 2012 feature)
27974 `AI-0099 Tag determines whether finalization needed (0000-00-00)'
27976 This AI clarifies that ‘needs finalization’ is part of dynamic semantics,
27977 and therefore depends on the run-time characteristics of an object (i.e. its
27978 tag) and not on its nominal type. As the AI indicates: “we do not expect
27979 this to affect any implementation’’.
27981 RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2)
27984 @geindex AI-0064 (Ada 2012 feature)
27990 `AI-0064 Redundant finalization rule (0000-00-00)'
27992 This is an editorial change only. The intended behavior is already checked
27993 by an existing ACATS test, which GNAT has always executed correctly.
27995 RM References: 7.06.01 (17.1/1)
27998 @geindex AI-0026 (Ada 2012 feature)
28004 `AI-0026 Missing rules for Unchecked_Union (2010-07-07)'
28006 Record representation clauses concerning Unchecked_Union types cannot mention
28007 the discriminant of the type. The type of a component declared in the variant
28008 part of an Unchecked_Union cannot be controlled, have controlled components,
28009 nor have protected or task parts. If an Unchecked_Union type is declared
28010 within the body of a generic unit or its descendants, then the type of a
28011 component declared in the variant part cannot be a formal private type or a
28012 formal private extension declared within the same generic unit.
28014 RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2)
28017 @geindex AI-0205 (Ada 2012 feature)
28023 `AI-0205 Extended return declares visible name (0000-00-00)'
28025 This AI corrects a simple omission in the RM. Return objects have always
28026 been visible within an extended return statement.
28028 RM References: 8.03 (17)
28031 @geindex AI-0042 (Ada 2012 feature)
28037 `AI-0042 Overriding versus implemented-by (0000-00-00)'
28039 This AI fixes a wording gap in the RM. An operation of a synchronized
28040 interface can be implemented by a protected or task entry, but the abstract
28041 operation is not being overridden in the usual sense, and it must be stated
28042 separately that this implementation is legal. This has always been the case
28045 RM References: 9.01 (9.2/2) 9.04 (11.1/2)
28048 @geindex AI-0030 (Ada 2012 feature)
28054 `AI-0030 Requeue on synchronized interfaces (2010-07-19)'
28056 Requeue is permitted to a protected, synchronized or task interface primitive
28057 providing it is known that the overriding operation is an entry. Otherwise
28058 the requeue statement has the same effect as a procedure call. Use of pragma
28059 @code{Implemented} provides a way to impose a static requirement on the
28060 overriding operation by adhering to one of the implementation kinds: entry,
28061 protected procedure or any of the above.
28063 RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5)
28064 9.05.04 (6) 9.05.04 (7) 9.05.04 (12)
28067 @geindex AI-0201 (Ada 2012 feature)
28073 `AI-0201 Independence of atomic object components (2010-07-22)'
28075 If an Atomic object has a pragma @code{Pack} or a @code{Component_Size}
28076 attribute, then individual components may not be addressable by independent
28077 tasks. However, if the representation clause has no effect (is confirming),
28078 then independence is not compromised. Furthermore, in GNAT, specification of
28079 other appropriately addressable component sizes (e.g. 16 for 8-bit
28080 characters) also preserves independence. GNAT now gives very clear warnings
28081 both for the declaration of such a type, and for any assignment to its components.
28083 RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2)
28086 @geindex AI-0009 (Ada 2012 feature)
28092 `AI-0009 Pragma Independent[_Components] (2010-07-23)'
28094 This AI introduces the new pragmas @code{Independent} and
28095 @code{Independent_Components},
28096 which control guaranteeing independence of access to objects and components.
28097 The AI also requires independence not unaffected by confirming rep clauses.
28099 RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2)
28100 C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14)
28103 @geindex AI-0072 (Ada 2012 feature)
28109 `AI-0072 Task signalling using ‘Terminated (0000-00-00)'
28111 This AI clarifies that task signalling for reading @code{'Terminated} only
28112 occurs if the result is True. GNAT semantics has always been consistent with
28113 this notion of task signalling.
28115 RM References: 9.10 (6.1/1)
28118 @geindex AI-0108 (Ada 2012 feature)
28124 `AI-0108 Limited incomplete view and discriminants (0000-00-00)'
28126 This AI confirms that an incomplete type from a limited view does not have
28127 discriminants. This has always been the case in GNAT.
28129 RM References: 10.01.01 (12.3/2)
28132 @geindex AI-0129 (Ada 2012 feature)
28138 `AI-0129 Limited views and incomplete types (0000-00-00)'
28140 This AI clarifies the description of limited views: a limited view of a
28141 package includes only one view of a type that has an incomplete declaration
28142 and a full declaration (there is no possible ambiguity in a client package).
28143 This AI also fixes an omission: a nested package in the private part has no
28144 limited view. GNAT always implemented this correctly.
28146 RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2)
28149 @geindex AI-0077 (Ada 2012 feature)
28155 `AI-0077 Limited withs and scope of declarations (0000-00-00)'
28157 This AI clarifies that a declaration does not include a context clause,
28158 and confirms that it is illegal to have a context in which both a limited
28159 and a nonlimited view of a package are accessible. Such double visibility
28160 was always rejected by GNAT.
28162 RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2)
28165 @geindex AI-0122 (Ada 2012 feature)
28171 `AI-0122 Private with and children of generics (0000-00-00)'
28173 This AI clarifies the visibility of private children of generic units within
28174 instantiations of a parent. GNAT has always handled this correctly.
28176 RM References: 10.01.02 (12/2)
28179 @geindex AI-0040 (Ada 2012 feature)
28185 `AI-0040 Limited with clauses on descendant (0000-00-00)'
28187 This AI confirms that a limited with clause in a child unit cannot name
28188 an ancestor of the unit. This has always been checked in GNAT.
28190 RM References: 10.01.02 (20/2)
28193 @geindex AI-0132 (Ada 2012 feature)
28199 `AI-0132 Placement of library unit pragmas (0000-00-00)'
28201 This AI fills a gap in the description of library unit pragmas. The pragma
28202 clearly must apply to a library unit, even if it does not carry the name
28203 of the enclosing unit. GNAT has always enforced the required check.
28205 RM References: 10.01.05 (7)
28208 @geindex AI-0034 (Ada 2012 feature)
28214 `AI-0034 Categorization of limited views (0000-00-00)'
28216 The RM makes certain limited with clauses illegal because of categorization
28217 considerations, when the corresponding normal with would be legal. This is
28218 not intended, and GNAT has always implemented the recommended behavior.
28220 RM References: 10.02.01 (11/1) 10.02.01 (17/2)
28223 @geindex AI-0035 (Ada 2012 feature)
28229 `AI-0035 Inconsistencies with Pure units (0000-00-00)'
28231 This AI remedies some inconsistencies in the legality rules for Pure units.
28232 Derived access types are legal in a pure unit (on the assumption that the
28233 rule for a zero storage pool size has been enforced on the ancestor type).
28234 The rules are enforced in generic instances and in subunits. GNAT has always
28235 implemented the recommended behavior.
28237 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)
28240 @geindex AI-0219 (Ada 2012 feature)
28246 `AI-0219 Pure permissions and limited parameters (2010-05-25)'
28248 This AI refines the rules for the cases with limited parameters which do not
28249 allow the implementations to omit ‘redundant’. GNAT now properly conforms
28250 to the requirements of this binding interpretation.
28252 RM References: 10.02.01 (18/2)
28255 @geindex AI-0043 (Ada 2012 feature)
28261 `AI-0043 Rules about raising exceptions (0000-00-00)'
28263 This AI covers various omissions in the RM regarding the raising of
28264 exceptions. GNAT has always implemented the intended semantics.
28266 RM References: 11.04.01 (10.1/2) 11 (2)
28269 @geindex AI-0200 (Ada 2012 feature)
28275 `AI-0200 Mismatches in formal package declarations (0000-00-00)'
28277 This AI plugs a gap in the RM which appeared to allow some obviously intended
28278 illegal instantiations. GNAT has never allowed these instantiations.
28280 RM References: 12.07 (16)
28283 @geindex AI-0112 (Ada 2012 feature)
28289 `AI-0112 Detection of duplicate pragmas (2010-07-24)'
28291 This AI concerns giving names to various representation aspects, but the
28292 practical effect is simply to make the use of duplicate
28293 @code{Atomic[_Components]},
28294 @code{Volatile[_Components]}, and
28295 @code{Independent[_Components]} pragmas illegal, and GNAT
28296 now performs this required check.
28298 RM References: 13.01 (8)
28301 @geindex AI-0106 (Ada 2012 feature)
28307 `AI-0106 No representation pragmas on generic formals (0000-00-00)'
28309 The RM appeared to allow representation pragmas on generic formal parameters,
28310 but this was not intended, and GNAT has never permitted this usage.
28312 RM References: 13.01 (9.1/1)
28315 @geindex AI-0012 (Ada 2012 feature)
28321 `AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)'
28323 It is now illegal to give an inappropriate component size or a pragma
28324 @code{Pack} that attempts to change the component size in the case of atomic
28325 or aliased components. Previously GNAT ignored such an attempt with a
28328 RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21)
28331 @geindex AI-0039 (Ada 2012 feature)
28337 `AI-0039 Stream attributes cannot be dynamic (0000-00-00)'
28339 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
28340 for stream attributes, but these were never useful and are now illegal. GNAT
28341 has always regarded such expressions as illegal.
28343 RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2)
28346 @geindex AI-0095 (Ada 2012 feature)
28352 `AI-0095 Address of intrinsic subprograms (0000-00-00)'
28354 The prefix of @code{'Address} cannot statically denote a subprogram with
28355 convention @code{Intrinsic}. The use of the @code{Address} attribute raises
28356 @code{Program_Error} if the prefix denotes a subprogram with convention
28359 RM References: 13.03 (11/1)
28362 @geindex AI-0116 (Ada 2012 feature)
28368 `AI-0116 Alignment of class-wide objects (0000-00-00)'
28370 This AI requires that the alignment of a class-wide object be no greater
28371 than the alignment of any type in the class. GNAT has always followed this
28374 RM References: 13.03 (29) 13.11 (16)
28377 @geindex AI-0146 (Ada 2012 feature)
28383 `AI-0146 Type invariants (2009-09-21)'
28385 Type invariants may be specified for private types using the aspect notation.
28386 Aspect @code{Type_Invariant} may be specified for any private type,
28387 @code{Type_Invariant'Class} can
28388 only be specified for tagged types, and is inherited by any descendent of the
28389 tagged types. The invariant is a boolean expression that is tested for being
28390 true in the following situations: conversions to the private type, object
28391 declarations for the private type that are default initialized, and
28393 parameters and returned result on return from any primitive operation for
28394 the type that is visible to a client.
28395 GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and
28396 @code{Invariant'Class} for @code{Type_Invariant'Class}.
28398 RM References: 13.03.03 (00)
28401 @geindex AI-0078 (Ada 2012 feature)
28407 `AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)'
28409 In Ada 2012, compilers are required to support unchecked conversion where the
28410 target alignment is a multiple of the source alignment. GNAT always supported
28411 this case (and indeed all cases of differing alignments, doing copies where
28412 required if the alignment was reduced).
28414 RM References: 13.09 (7)
28417 @geindex AI-0195 (Ada 2012 feature)
28423 `AI-0195 Invalid value handling is implementation defined (2010-07-03)'
28425 The handling of invalid values is now designated to be implementation
28426 defined. This is a documentation change only, requiring Annex M in the GNAT
28427 Reference Manual to document this handling.
28428 In GNAT, checks for invalid values are made
28429 only when necessary to avoid erroneous behavior. Operations like assignments
28430 which cannot cause erroneous behavior ignore the possibility of invalid
28431 values and do not do a check. The date given above applies only to the
28432 documentation change, this behavior has always been implemented by GNAT.
28434 RM References: 13.09.01 (10)
28437 @geindex AI-0193 (Ada 2012 feature)
28443 `AI-0193 Alignment of allocators (2010-09-16)'
28445 This AI introduces a new attribute @code{Max_Alignment_For_Allocation},
28446 analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead
28449 RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1)
28450 13.11.01 (2) 13.11.01 (3)
28453 @geindex AI-0177 (Ada 2012 feature)
28459 `AI-0177 Parameterized expressions (2010-07-10)'
28461 The new Ada 2012 notion of parameterized expressions is implemented. The form
28465 function-specification is (expression)
28468 This is exactly equivalent to the
28469 corresponding function body that returns the expression, but it can appear
28470 in a package spec. Note that the expression must be parenthesized.
28472 RM References: 13.11.01 (3/2)
28475 @geindex AI-0033 (Ada 2012 feature)
28481 `AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)'
28483 Neither of these two pragmas may appear within a generic template, because
28484 the generic might be instantiated at other than the library level.
28486 RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2)
28489 @geindex AI-0161 (Ada 2012 feature)
28495 `AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)'
28497 A new restriction @code{No_Default_Stream_Attributes} prevents the use of any
28498 of the default stream attributes for elementary types. If this restriction is
28499 in force, then it is necessary to provide explicit subprograms for any
28500 stream attributes used.
28502 RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2)
28505 @geindex AI-0194 (Ada 2012 feature)
28511 `AI-0194 Value of Stream_Size attribute (0000-00-00)'
28513 The @code{Stream_Size} attribute returns the default number of bits in the
28514 stream representation of the given type.
28515 This value is not affected by the presence
28516 of stream subprogram attributes for the type. GNAT has always implemented
28517 this interpretation.
28519 RM References: 13.13.02 (1.2/2)
28522 @geindex AI-0109 (Ada 2012 feature)
28528 `AI-0109 Redundant check in S’Class’Input (0000-00-00)'
28530 This AI is an editorial change only. It removes the need for a tag check
28531 that can never fail.
28533 RM References: 13.13.02 (34/2)
28536 @geindex AI-0007 (Ada 2012 feature)
28542 `AI-0007 Stream read and private scalar types (0000-00-00)'
28544 The RM as written appeared to limit the possibilities of declaring read
28545 attribute procedures for private scalar types. This limitation was not
28546 intended, and has never been enforced by GNAT.
28548 RM References: 13.13.02 (50/2) 13.13.02 (51/2)
28551 @geindex AI-0065 (Ada 2012 feature)
28557 `AI-0065 Remote access types and external streaming (0000-00-00)'
28559 This AI clarifies the fact that all remote access types support external
28560 streaming. This fixes an obvious oversight in the definition of the
28561 language, and GNAT always implemented the intended correct rules.
28563 RM References: 13.13.02 (52/2)
28566 @geindex AI-0019 (Ada 2012 feature)
28572 `AI-0019 Freezing of primitives for tagged types (0000-00-00)'
28574 The RM suggests that primitive subprograms of a specific tagged type are
28575 frozen when the tagged type is frozen. This would be an incompatible change
28576 and is not intended. GNAT has never attempted this kind of freezing and its
28577 behavior is consistent with the recommendation of this AI.
28579 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)
28582 @geindex AI-0017 (Ada 2012 feature)
28588 `AI-0017 Freezing and incomplete types (0000-00-00)'
28590 So-called ‘Taft-amendment types’ (i.e., types that are completed in package
28591 bodies) are not frozen by the occurrence of bodies in the
28592 enclosing declarative part. GNAT always implemented this properly.
28594 RM References: 13.14 (3/1)
28597 @geindex AI-0060 (Ada 2012 feature)
28603 `AI-0060 Extended definition of remote access types (0000-00-00)'
28605 This AI extends the definition of remote access types to include access
28606 to limited, synchronized, protected or task class-wide interface types.
28607 GNAT already implemented this extension.
28609 RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18)
28612 @geindex AI-0114 (Ada 2012 feature)
28618 `AI-0114 Classification of letters (0000-00-00)'
28620 The code points 170 (@code{FEMININE ORDINAL INDICATOR}),
28621 181 (@code{MICRO SIGN}), and
28622 186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered
28623 lower case letters by Unicode.
28624 However, they are not allowed in identifiers, and they
28625 return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}.
28626 This behavior is consistent with that defined in Ada 95.
28628 RM References: A.03.02 (59) A.04.06 (7)
28631 @geindex AI-0185 (Ada 2012 feature)
28637 `AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)'
28639 Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide
28640 classification functions for @code{Wide_Character} and
28641 @code{Wide_Wide_Character}, as well as providing
28642 case folding routines for @code{Wide_[Wide_]Character} and
28643 @code{Wide_[Wide_]String}.
28645 RM References: A.03.05 (0) A.03.06 (0)
28648 @geindex AI-0031 (Ada 2012 feature)
28654 `AI-0031 Add From parameter to Find_Token (2010-07-25)'
28656 A new version of @code{Find_Token} is added to all relevant string packages,
28657 with an extra parameter @code{From}. Instead of starting at the first
28658 character of the string, the search for a matching Token starts at the
28659 character indexed by the value of @code{From}.
28660 These procedures are available in all versions of Ada
28661 but if used in versions earlier than Ada 2012 they will generate a warning
28662 that an Ada 2012 subprogram is being used.
28664 RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51)
28668 @geindex AI-0056 (Ada 2012 feature)
28674 `AI-0056 Index on null string returns zero (0000-00-00)'
28676 The wording in the Ada 2005 RM implied an incompatible handling of the
28677 @code{Index} functions, resulting in raising an exception instead of
28678 returning zero in some situations.
28679 This was not intended and has been corrected.
28680 GNAT always returned zero, and is thus consistent with this AI.
28682 RM References: A.04.03 (56.2/2) A.04.03 (58.5/2)
28685 @geindex AI-0137 (Ada 2012 feature)
28691 `AI-0137 String encoding package (2010-03-25)'
28693 The packages @code{Ada.Strings.UTF_Encoding}, together with its child
28694 packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings},
28695 and @code{Wide_Wide_Strings} have been
28696 implemented. These packages (whose documentation can be found in the spec
28697 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
28698 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
28699 @code{String}, @code{Wide_String}, and @code{Wide_Wide_String}
28700 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
28701 UTF-16), as well as conversions between the different UTF encodings. With
28702 the exception of @code{Wide_Wide_Strings}, these packages are available in
28703 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
28704 The @code{Wide_Wide_Strings} package
28705 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
28706 mode since it uses @code{Wide_Wide_Character}).
28708 RM References: A.04.11
28711 @geindex AI-0038 (Ada 2012 feature)
28717 `AI-0038 Minor errors in Text_IO (0000-00-00)'
28719 These are minor errors in the description on three points. The intent on
28720 all these points has always been clear, and GNAT has always implemented the
28721 correct intended semantics.
28723 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)
28726 @geindex AI-0044 (Ada 2012 feature)
28732 `AI-0044 Restrictions on container instantiations (0000-00-00)'
28734 This AI places restrictions on allowed instantiations of generic containers.
28735 These restrictions are not checked by the compiler, so there is nothing to
28736 change in the implementation. This affects only the RM documentation.
28738 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)
28741 @geindex AI-0127 (Ada 2012 feature)
28747 `AI-0127 Adding Locale Capabilities (2010-09-29)'
28749 This package provides an interface for identifying the current locale.
28751 RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06
28752 A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13
28755 @geindex AI-0002 (Ada 2012 feature)
28761 `AI-0002 Export C with unconstrained arrays (0000-00-00)'
28763 The compiler is not required to support exporting an Ada subprogram with
28764 convention C if there are parameters or a return type of an unconstrained
28765 array type (such as @code{String}). GNAT allows such declarations but
28766 generates warnings. It is possible, but complicated, to write the
28767 corresponding C code and certainly such code would be specific to GNAT and
28770 RM References: B.01 (17) B.03 (62) B.03 (71.1/2)
28773 @geindex AI05-0216 (Ada 2012 feature)
28779 `AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)'
28781 It is clearly the intention that @code{No_Task_Hierarchy} is intended to
28782 forbid tasks declared locally within subprograms, or functions returning task
28783 objects, and that is the implementation that GNAT has always provided.
28784 However the language in the RM was not sufficiently clear on this point.
28785 Thus this is a documentation change in the RM only.
28787 RM References: D.07 (3/3)
28790 @geindex AI-0211 (Ada 2012 feature)
28796 `AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)'
28798 The restriction @code{No_Relative_Delays} forbids any calls to the subprogram
28799 @code{Ada.Real_Time.Timing_Events.Set_Handler}.
28801 RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2)
28804 @geindex AI-0190 (Ada 2012 feature)
28810 `AI-0190 pragma Default_Storage_Pool (2010-09-15)'
28812 This AI introduces a new pragma @code{Default_Storage_Pool}, which can be
28813 used to control storage pools globally.
28814 In particular, you can force every access
28815 type that is used for allocation (`new') to have an explicit storage pool,
28816 or you can declare a pool globally to be used for all access types that lack
28819 RM References: D.07 (8)
28822 @geindex AI-0189 (Ada 2012 feature)
28828 `AI-0189 No_Allocators_After_Elaboration (2010-01-23)'
28830 This AI introduces a new restriction @code{No_Allocators_After_Elaboration},
28831 which says that no dynamic allocation will occur once elaboration is
28833 In general this requires a run-time check, which is not required, and which
28834 GNAT does not attempt. But the static cases of allocators in a task body or
28835 in the body of the main program are detected and flagged at compile or bind
28838 RM References: D.07 (19.1/2) H.04 (23.3/2)
28841 @geindex AI-0171 (Ada 2012 feature)
28847 `AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)'
28849 A new package @code{System.Multiprocessors} is added, together with the
28850 definition of pragma @code{CPU} for controlling task affinity. A new no
28851 dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains},
28852 is added to the Ravenscar profile.
28854 RM References: D.13.01 (4/2) D.16
28857 @geindex AI-0210 (Ada 2012 feature)
28863 `AI-0210 Correct Timing_Events metric (0000-00-00)'
28865 This is a documentation only issue regarding wording of metric requirements,
28866 that does not affect the implementation of the compiler.
28868 RM References: D.15 (24/2)
28871 @geindex AI-0206 (Ada 2012 feature)
28877 `AI-0206 Remote types packages and preelaborate (2010-07-24)'
28879 Remote types packages are now allowed to depend on preelaborated packages.
28880 This was formerly considered illegal.
28882 RM References: E.02.02 (6)
28885 @geindex AI-0152 (Ada 2012 feature)
28891 `AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)'
28893 Restriction @code{No_Anonymous_Allocators} prevents the use of allocators
28894 where the type of the returned value is an anonymous access type.
28896 RM References: H.04 (8/1)
28899 @node Security Hardening Features,Obsolescent Features,Implementation of Ada 2012 Features,Top
28900 @anchor{gnat_rm/security_hardening_features doc}@anchor{442}@anchor{gnat_rm/security_hardening_features id1}@anchor{443}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15}
28901 @chapter Security Hardening Features
28904 This chapter describes Ada extensions aimed at security hardening that
28905 are provided by GNAT.
28907 The features in this chapter are currently experimental and subject to
28910 @c Register Scrubbing:
28913 * Register Scrubbing::
28914 * Stack Scrubbing::
28915 * Hardened Conditionals::
28916 * Hardened Booleans::
28917 * Control Flow Redundancy::
28921 @node Register Scrubbing,Stack Scrubbing,,Security Hardening Features
28922 @anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{444}
28923 @section Register Scrubbing
28926 GNAT can generate code to zero-out hardware registers before returning
28929 It can be enabled with the @code{-fzero-call-used-regs=`choice'}
28930 command-line option, to affect all subprograms in a compilation, and
28931 with a @code{Machine_Attribute} pragma, to affect only specific
28936 pragma Machine_Attribute (Foo, "zero_call_used_regs", "used");
28937 -- Before returning, Foo scrubs only call-clobbered registers
28938 -- that it uses itself.
28940 function Bar return Integer;
28941 pragma Machine_Attribute (Bar, "zero_call_used_regs", "all");
28942 -- Before returning, Bar scrubs all call-clobbered registers.
28945 For usage and more details on the command-line option, on the
28946 @code{zero_call_used_regs} attribute, and on their use with other
28947 programming languages, see @cite{Using the GNU Compiler Collection (GCC)}.
28949 @c Stack Scrubbing:
28951 @node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features
28952 @anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{445}
28953 @section Stack Scrubbing
28956 GNAT can generate code to zero-out stack frames used by subprograms.
28958 It can be activated with the @code{Machine_Attribute} pragma, on
28959 specific subprograms and variables, or their types. (This attribute
28960 always applies to a type, even when it is associated with a subprogram
28964 function Foo returns Integer;
28965 pragma Machine_Attribute (Foo, "strub");
28966 -- Foo and its callers are modified so as to scrub the stack
28967 -- space used by Foo after it returns. Shorthand for:
28968 -- pragma Machine_Attribute (Foo, "strub", "at-calls");
28971 pragma Machine_Attribute (Bar, "strub", "internal");
28972 -- Bar is turned into a wrapper for its original body,
28973 -- and they scrub the stack used by the original body.
28976 pragma Machine_Attribute (Var, "strub");
28977 -- Reading from Var in a subprogram enables stack scrubbing
28978 -- of the stack space used by the subprogram. Furthermore, if
28979 -- Var is declared within a subprogram, this also enables
28980 -- scrubbing of the stack space used by that subprogram.
28983 There are also @code{-fstrub=`choice'} command-line options to
28984 control default settings. For usage and more details on the
28985 command-line options, on the @code{strub} attribute, and their use with
28986 other programming languages, see @cite{Using the GNU Compiler Collection (GCC)}.
28988 Note that Ada secondary stacks are not scrubbed. The restriction
28989 @code{No_Secondary_Stack} avoids their use, and thus their accidental
28990 preservation of data that should be scrubbed.
28992 Attributes @code{Access} and @code{Unconstrained_Access} of variables and
28993 constants with @code{strub} enabled require types with @code{strub} enabled;
28994 there is no way to express an access-to-strub type otherwise.
28995 @code{Unchecked_Access} bypasses this constraint, but the resulting
28996 access type designates a non-strub type.
28999 VI : aliased Integer;
29000 pragma Machine_Attribute (VI, "strub");
29001 XsVI : access Integer := VI'Access; -- Error.
29002 UXsVI : access Integer := VI'Unchecked_Access; -- OK,
29003 -- UXsVI does *not* enable strub in subprograms that
29004 -- dereference it to obtain the UXsVI.all value.
29006 type Strub_Int is new Integer;
29007 pragma Machine_Attribute (Strub_Int, "strub");
29008 VSI : aliased Strub_Int;
29009 XsVSI : access Strub_Int := VSI'Access; -- OK,
29010 -- VSI and XsVSI.all both enable strub in subprograms that
29011 -- read their values.
29014 Every access-to-subprogram type, renaming, and overriding and
29015 overridden dispatching operations that may refer to a subprogram with
29016 an attribute-modified interface must be annotated with the same
29017 interface-modifying attribute. Access-to-subprogram types can be
29018 explicitly converted to different strub modes, as long as they are
29019 interface-compatible (i.e., adding or removing @code{at-calls} is not
29020 allowed). For example, a @code{strub}-@code{disabled} subprogram can be
29021 turned @code{callable} through such an explicit conversion:
29024 type TBar is access procedure;
29026 type TBar_Callable is access procedure;
29027 pragma Machine_Attribute (TBar_Callable, "strub", "callable");
29028 -- The attribute modifies the procedure type, rather than the
29029 -- access type, because of the extra argument after "strub",
29030 -- only applicable to subprogram types.
29032 Bar_Callable_Ptr : constant TBar_Callable
29033 := TBar_Callable (TBar'(Bar'Access));
29035 procedure Bar_Callable renames Bar_Callable_Ptr.all;
29036 pragma Machine_Attribute (Bar_Callable, "strub", "callable");
29039 Note that the renaming declaration is expanded to a full subprogram
29040 body, it won’t be just an alias. Only if it is inlined will it be as
29041 efficient as a call by dereferencing the access-to-subprogram constant
29044 @c Hardened Conditionals:
29046 @node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features
29047 @anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{446}
29048 @section Hardened Conditionals
29051 GNAT can harden conditionals to protect against control-flow attacks.
29053 This is accomplished by two complementary transformations, each
29054 activated by a separate command-line option.
29056 The option @code{-fharden-compares} enables hardening of compares
29057 that compute results stored in variables, adding verification that the
29058 reversed compare yields the opposite result.
29060 The option @code{-fharden-conditional-branches} enables hardening
29061 of compares that guard conditional branches, adding verification of
29062 the reversed compare to both execution paths.
29064 These transformations are introduced late in the compilation pipeline,
29065 long after boolean expressions are decomposed into separate compares,
29066 each one turned into either a conditional branch or a compare whose
29067 result is stored in a boolean variable or temporary. Compiler
29068 optimizations, if enabled, may also turn conditional branches into
29069 stored compares, and vice-versa, or into operations with implied
29070 conditionals (e.g. MIN and MAX). Conditionals may also be optimized
29071 out entirely, if their value can be determined at compile time, and
29072 occasionally multiple compares can be combined into one.
29074 It is thus difficult to predict which of these two options will affect
29075 a specific compare operation expressed in source code. Using both
29076 options ensures that every compare that is neither optimized out nor
29077 optimized into implied conditionals will be hardened.
29079 The addition of reversed compares can be observed by enabling the dump
29080 files of the corresponding passes, through command-line options
29081 @code{-fdump-tree-hardcmp} and @code{-fdump-tree-hardcbr},
29084 They are separate options, however, because of the significantly
29085 different performance impact of the hardening transformations.
29087 For usage and more details on the command-line options, see
29088 @cite{Using the GNU Compiler Collection (GCC)}. These options can
29089 be used with other programming languages supported by GCC.
29091 @c Hardened Booleans:
29093 @node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features
29094 @anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{447}
29095 @section Hardened Booleans
29098 Ada has built-in support for introducing boolean types with
29099 alternative representations, using representation clauses:
29102 type HBool is new Boolean;
29103 for HBool use (16#5a#, 16#a5#);
29104 for HBool'Size use 8;
29107 When validity checking is enabled, the compiler will check that
29108 variables of such types hold values corresponding to the selected
29111 There are multiple strategies for where to introduce validity checking
29112 (see @code{-gnatV} options). Their goal is to guard against
29113 various kinds of programming errors, and GNAT strives to omit checks
29114 when program logic rules out an invalid value, and optimizers may
29115 further remove checks found to be redundant.
29117 For additional hardening, the @code{hardbool} @code{Machine_Attribute}
29118 pragma can be used to annotate boolean types with representation
29119 clauses, so that expressions of such types used as conditions are
29120 checked even when compiling with @code{-gnatVT}.
29123 pragma Machine_Attribute (HBool, "hardbool");
29126 Note that @code{-gnatVn} will disable even @code{hardbool} testing.
29128 Analogous behavior is available as a GCC extension to the C and
29129 Objective C programming languages, through the @code{hardbool} attribute.
29130 For usage and more details on that attribute, see @cite{Using the GNU Compiler Collection (GCC)}.
29132 @c Control Flow Redundancy:
29134 @node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features
29135 @anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{448}
29136 @section Control Flow Redundancy
29139 GNAT can guard against unexpected execution flows, such as branching
29140 into the middle of subprograms, as in Return Oriented Programming
29143 In units compiled with @code{-fharden-control-flow-redundancy},
29144 subprograms are instrumented so that, every time they are called,
29145 basic blocks take note as control flows through them, and, before
29146 returning, subprograms verify that the taken notes are consistent with
29147 the control-flow graph.
29149 Functions with too many basic blocks, or with multiple return points,
29150 call a run-time function to perform the verification. Other functions
29151 perform the verification inline before returning.
29153 Optimizing the inlined verification can be quite time consuming, so
29154 the default upper limit for the inline mode is set at 16 blocks.
29155 Command-line option @code{--param hardcfr-max-inline-blocks=} can
29158 Even though typically sparse control-flow graphs exhibit run-time
29159 verification time nearly proportional to the block count of a
29160 subprogram, it may become very significant for generated subprograms
29161 with thousands of blocks. Command-line option
29162 @code{--param hardcfr-max-blocks=} can set an upper limit for
29165 For each block that is marked as visited, the mechanism checks that at
29166 least one of its predecessors, and at least one of its successors, are
29167 also marked as visited.
29169 Verification is performed just before returning. Subprogram
29170 executions that complete by raising or propagating an exception bypass
29171 verification-and-return points. A subprogram that can only complete
29172 by raising or propagating an exception may have instrumentation
29173 disabled altogether.
29175 The instrumentation for hardening with control flow redundancy can be
29176 observed in dump files generated by the command-line option
29177 @code{-fdump-tree-hardcfr}.
29179 For more details on the control flow redundancy command-line options,
29180 see @cite{Using the GNU Compiler Collection (GCC)}. These options
29181 can be used with other programming languages supported by GCC.
29183 @node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top
29184 @anchor{gnat_rm/obsolescent_features doc}@anchor{449}@anchor{gnat_rm/obsolescent_features id1}@anchor{44a}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16}
29185 @chapter Obsolescent Features
29188 This chapter describes features that are provided by GNAT, but are
29189 considered obsolescent since there are preferred ways of achieving
29190 the same effect. These features are provided solely for historical
29191 compatibility purposes.
29194 * pragma No_Run_Time::
29195 * pragma Ravenscar::
29196 * pragma Restricted_Run_Time::
29197 * pragma Task_Info::
29198 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads.
29202 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
29203 @anchor{gnat_rm/obsolescent_features id2}@anchor{44b}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{44c}
29204 @section pragma No_Run_Time
29207 The pragma @code{No_Run_Time} is used to achieve an affect similar
29208 to the use of the “Zero Foot Print” configurable run time, but without
29209 requiring a specially configured run time. The result of using this
29210 pragma, which must be used for all units in a partition, is to restrict
29211 the use of any language features requiring run-time support code. The
29212 preferred usage is to use an appropriately configured run-time that
29213 includes just those features that are to be made accessible.
29215 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
29216 @anchor{gnat_rm/obsolescent_features id3}@anchor{44d}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{44e}
29217 @section pragma Ravenscar
29220 The pragma @code{Ravenscar} has exactly the same effect as pragma
29221 @code{Profile (Ravenscar)}. The latter usage is preferred since it
29222 is part of the new Ada 2005 standard.
29224 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
29225 @anchor{gnat_rm/obsolescent_features id4}@anchor{44f}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{450}
29226 @section pragma Restricted_Run_Time
29229 The pragma @code{Restricted_Run_Time} has exactly the same effect as
29230 pragma @code{Profile (Restricted)}. The latter usage is
29231 preferred since the Ada 2005 pragma @code{Profile} is intended for
29232 this kind of implementation dependent addition.
29234 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
29235 @anchor{gnat_rm/obsolescent_features id5}@anchor{451}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{452}
29236 @section pragma Task_Info
29239 The functionality provided by pragma @code{Task_Info} is now part of the
29240 Ada language. The @code{CPU} aspect and the package
29241 @code{System.Multiprocessors} offer a less system-dependent way to specify
29242 task affinity or to query the number of processors.
29247 pragma Task_Info (EXPRESSION);
29250 This pragma appears within a task definition (like pragma
29251 @code{Priority}) and applies to the task in which it appears. The
29252 argument must be of type @code{System.Task_Info.Task_Info_Type}.
29253 The @code{Task_Info} pragma provides system dependent control over
29254 aspects of tasking implementation, for example, the ability to map
29255 tasks to specific processors. For details on the facilities available
29256 for the version of GNAT that you are using, see the documentation
29257 in the spec of package System.Task_Info in the runtime
29260 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
29261 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{453}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{454}
29262 @section package System.Task_Info (@code{s-tasinf.ads})
29265 This package provides target dependent functionality that is used
29266 to support the @code{Task_Info} pragma. The predefined Ada package
29267 @code{System.Multiprocessors} and the @code{CPU} aspect now provide a
29268 standard replacement for GNAT’s @code{Task_Info} functionality.
29270 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
29271 @anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{455}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{456}
29272 @chapter Compatibility and Porting Guide
29275 This chapter presents some guidelines for developing portable Ada code,
29276 describes the compatibility issues that may arise between
29277 GNAT and other Ada compilation systems (including those for Ada 83),
29278 and shows how GNAT can expedite porting
29279 applications developed in other Ada environments.
29282 * Writing Portable Fixed-Point Declarations::
29283 * Compatibility with Ada 83::
29284 * Compatibility between Ada 95 and Ada 2005::
29285 * Implementation-dependent characteristics::
29286 * Compatibility with Other Ada Systems::
29287 * Representation Clauses::
29288 * Compatibility with HP Ada 83::
29292 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
29293 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{457}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{458}
29294 @section Writing Portable Fixed-Point Declarations
29297 The Ada Reference Manual gives an implementation freedom to choose bounds
29298 that are narrower by @code{Small} from the given bounds.
29299 For example, if we write
29302 type F1 is delta 1.0 range -128.0 .. +128.0;
29305 then the implementation is allowed to choose -128.0 .. +127.0 if it
29306 likes, but is not required to do so.
29308 This leads to possible portability problems, so let’s have a closer
29309 look at this, and figure out how to avoid these problems.
29311 First, why does this freedom exist, and why would an implementation
29312 take advantage of it? To answer this, take a closer look at the type
29313 declaration for @code{F1} above. If the compiler uses the given bounds,
29314 it would need 9 bits to hold the largest positive value (and typically
29315 that means 16 bits on all machines). But if the implementation chooses
29316 the +127.0 bound then it can fit values of the type in 8 bits.
29318 Why not make the user write +127.0 if that’s what is wanted?
29319 The rationale is that if you are thinking of fixed point
29320 as a kind of ‘poor man’s floating-point’, then you don’t want
29321 to be thinking about the scaled integers that are used in its
29322 representation. Let’s take another example:
29325 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
29328 Looking at this declaration, it seems casually as though
29329 it should fit in 16 bits, but again that extra positive value
29330 +1.0 has the scaled integer equivalent of 2**15 which is one too
29331 big for signed 16 bits. The implementation can treat this as:
29334 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
29337 and the Ada language design team felt that this was too annoying
29338 to require. We don’t need to debate this decision at this point,
29339 since it is well established (the rule about narrowing the ranges
29342 But the important point is that an implementation is not required
29343 to do this narrowing, so we have a potential portability problem.
29344 We could imagine three types of implementation:
29350 those that narrow the range automatically if they can figure
29351 out that the narrower range will allow storage in a smaller machine unit,
29354 those that will narrow only if forced to by a @code{'Size} clause, and
29357 those that will never narrow.
29360 Now if we are language theoreticians, we can imagine a fourth
29361 approach: to narrow all the time, e.g. to treat
29364 type F3 is delta 1.0 range -10.0 .. +23.0;
29367 as though it had been written:
29370 type F3 is delta 1.0 range -9.0 .. +22.0;
29373 But although technically allowed, such a behavior would be hostile and silly,
29374 and no real compiler would do this. All real compilers will fall into one of
29375 the categories (a), (b) or (c) above.
29377 So, how do you get the compiler to do what you want? The answer is give the
29378 actual bounds you want, and then use a @code{'Small} clause and a
29379 @code{'Size} clause to absolutely pin down what the compiler does.
29380 E.g., for @code{F2} above, we will write:
29383 My_Small : constant := 2.0**(-15);
29384 My_First : constant := -1.0;
29385 My_Last : constant := +1.0 - My_Small;
29387 type F2 is delta My_Small range My_First .. My_Last;
29393 for F2'Small use my_Small;
29394 for F2'Size use 16;
29397 In practice all compilers will do the same thing here and will give you
29398 what you want, so the above declarations are fully portable. If you really
29399 want to play language lawyer and guard against ludicrous behavior by the
29400 compiler you could add
29403 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
29404 Test2 : constant := 1 / Boolean'Pos (F2'Last = My_Last);
29407 One or other or both are allowed to be illegal if the compiler is
29408 behaving in a silly manner, but at least the silly compiler will not
29409 get away with silently messing with your (very clear) intentions.
29411 If you follow this scheme you will be guaranteed that your fixed-point
29412 types will be portable.
29414 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
29415 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{459}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{45a}
29416 @section Compatibility with Ada 83
29419 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
29421 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
29422 are highly upwards compatible with Ada 83. In
29423 particular, the design intention was that the difficulties associated
29424 with moving from Ada 83 to later versions of the standard should be no greater
29425 than those that occur when moving from one Ada 83 system to another.
29427 However, there are a number of points at which there are minor
29428 incompatibilities. The @cite{Ada 95 Annotated Reference Manual} contains
29429 full details of these issues as they relate to Ada 95,
29430 and should be consulted for a complete treatment.
29432 following subsections treat the most likely issues to be encountered.
29435 * Legal Ada 83 programs that are illegal in Ada 95::
29436 * More deterministic semantics::
29437 * Changed semantics::
29438 * Other language compatibility issues::
29442 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
29443 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{45b}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{45c}
29444 @subsection Legal Ada 83 programs that are illegal in Ada 95
29447 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
29448 Ada 95 and later versions of the standard:
29454 `Character literals'
29456 Some uses of character literals are ambiguous. Since Ada 95 has introduced
29457 @code{Wide_Character} as a new predefined character type, some uses of
29458 character literals that were legal in Ada 83 are illegal in Ada 95.
29462 for Char in 'A' .. 'Z' loop ... end loop;
29465 The problem is that ‘A’ and ‘Z’ could be from either
29466 @code{Character} or @code{Wide_Character}. The simplest correction
29467 is to make the type explicit; e.g.:
29470 for Char in Character range 'A' .. 'Z' loop ... end loop;
29474 `New reserved words'
29476 The identifiers @code{abstract}, @code{aliased}, @code{protected},
29477 @code{requeue}, @code{tagged}, and @code{until} are reserved in Ada 95.
29478 Existing Ada 83 code using any of these identifiers must be edited to
29479 use some alternative name.
29484 The rules in Ada 95 are slightly different with regard to the point at
29485 which entities are frozen, and representation pragmas and clauses are
29486 not permitted past the freeze point. This shows up most typically in
29487 the form of an error message complaining that a representation item
29488 appears too late, and the appropriate corrective action is to move
29489 the item nearer to the declaration of the entity to which it refers.
29491 A particular case is that representation pragmas
29492 cannot be applied to a subprogram body. If necessary, a separate subprogram
29493 declaration must be introduced to which the pragma can be applied.
29496 `Optional bodies for library packages'
29498 In Ada 83, a package that did not require a package body was nevertheless
29499 allowed to have one. This lead to certain surprises in compiling large
29500 systems (situations in which the body could be unexpectedly ignored by the
29501 binder). In Ada 95, if a package does not require a body then it is not
29502 permitted to have a body. To fix this problem, simply remove a redundant
29503 body if it is empty, or, if it is non-empty, introduce a dummy declaration
29504 into the spec that makes the body required. One approach is to add a private
29505 part to the package declaration (if necessary), and define a parameterless
29506 procedure called @code{Requires_Body}, which must then be given a dummy
29507 procedure body in the package body, which then becomes required.
29508 Another approach (assuming that this does not introduce elaboration
29509 circularities) is to add an @code{Elaborate_Body} pragma to the package spec,
29510 since one effect of this pragma is to require the presence of a package body.
29513 `Numeric_Error is the same exception as Constraint_Error'
29515 In Ada 95, the exception @code{Numeric_Error} is a renaming of @code{Constraint_Error}.
29516 This means that it is illegal to have separate exception handlers for
29517 the two exceptions. The fix is simply to remove the handler for the
29518 @code{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
29519 @code{Constraint_Error} in place of @code{Numeric_Error} in all cases).
29522 `Indefinite subtypes in generics'
29524 In Ada 83, it was permissible to pass an indefinite type (e.g, @code{String})
29525 as the actual for a generic formal private type, but then the instantiation
29526 would be illegal if there were any instances of declarations of variables
29527 of this type in the generic body. In Ada 95, to avoid this clear violation
29528 of the methodological principle known as the ‘contract model’,
29529 the generic declaration explicitly indicates whether
29530 or not such instantiations are permitted. If a generic formal parameter
29531 has explicit unknown discriminants, indicated by using @code{(<>)} after the
29532 subtype name, then it can be instantiated with indefinite types, but no
29533 stand-alone variables can be declared of this type. Any attempt to declare
29534 such a variable will result in an illegality at the time the generic is
29535 declared. If the @code{(<>)} notation is not used, then it is illegal
29536 to instantiate the generic with an indefinite type.
29537 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
29538 It will show up as a compile time error, and
29539 the fix is usually simply to add the @code{(<>)} to the generic declaration.
29542 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
29543 @anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{45d}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{45e}
29544 @subsection More deterministic semantics
29553 Conversions from real types to integer types round away from 0. In Ada 83
29554 the conversion Integer(2.5) could deliver either 2 or 3 as its value. This
29555 implementation freedom was intended to support unbiased rounding in
29556 statistical applications, but in practice it interfered with portability.
29557 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
29558 is required. Numeric code may be affected by this change in semantics.
29559 Note, though, that this issue is no worse than already existed in Ada 83
29560 when porting code from one vendor to another.
29565 The Real-Time Annex introduces a set of policies that define the behavior of
29566 features that were implementation dependent in Ada 83, such as the order in
29567 which open select branches are executed.
29570 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
29571 @anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{45f}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{460}
29572 @subsection Changed semantics
29575 The worst kind of incompatibility is one where a program that is legal in
29576 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
29577 possible in Ada 83. Fortunately this is extremely rare, but the one
29578 situation that you should be alert to is the change in the predefined type
29579 @code{Character} from 7-bit ASCII to 8-bit Latin-1.
29590 `Range of type `@w{`}Character`@w{`}'
29592 The range of @code{Standard.Character} is now the full 256 characters
29593 of Latin-1, whereas in most Ada 83 implementations it was restricted
29594 to 128 characters. Although some of the effects of
29595 this change will be manifest in compile-time rejection of legal
29596 Ada 83 programs it is possible for a working Ada 83 program to have
29597 a different effect in Ada 95, one that was not permitted in Ada 83.
29598 As an example, the expression
29599 @code{Character'Pos(Character'Last)} returned @code{127} in Ada 83 and now
29600 delivers @code{255} as its value.
29601 In general, you should look at the logic of any
29602 character-processing Ada 83 program and see whether it needs to be adapted
29603 to work correctly with Latin-1. Note that the predefined Ada 95 API has a
29604 character handling package that may be relevant if code needs to be adapted
29605 to account for the additional Latin-1 elements.
29606 The desirable fix is to
29607 modify the program to accommodate the full character set, but in some cases
29608 it may be convenient to define a subtype or derived type of Character that
29609 covers only the restricted range.
29612 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
29613 @anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{461}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{462}
29614 @subsection Other language compatibility issues
29623 All implementations of GNAT provide a switch that causes GNAT to operate
29624 in Ada 83 mode. In this mode, some but not all compatibility problems
29625 of the type described above are handled automatically. For example, the
29626 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
29627 as identifiers as in Ada 83. However,
29628 in practice, it is usually advisable to make the necessary modifications
29629 to the program to remove the need for using this switch.
29630 See the @code{Compiling Different Versions of Ada} section in
29631 the @cite{GNAT User’s Guide}.
29634 Support for removed Ada 83 pragmas and attributes
29636 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
29637 generally because they were replaced by other mechanisms. Ada 95 and Ada 2005
29638 compilers are allowed, but not required, to implement these missing
29639 elements. In contrast with some other compilers, GNAT implements all
29640 such pragmas and attributes, eliminating this compatibility concern. These
29641 include @code{pragma Interface} and the floating point type attributes
29642 (@code{Emax}, @code{Mantissa}, etc.), among other items.
29645 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
29646 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{463}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{464}
29647 @section Compatibility between Ada 95 and Ada 2005
29650 @geindex Compatibility between Ada 95 and Ada 2005
29652 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
29653 a number of incompatibilities. Several are enumerated below;
29654 for a complete description please see the
29655 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
29656 @cite{Rationale for Ada 2005}.
29662 `New reserved words.'
29664 The words @code{interface}, @code{overriding} and @code{synchronized} are
29665 reserved in Ada 2005.
29666 A pre-Ada 2005 program that uses any of these as an identifier will be
29670 `New declarations in predefined packages.'
29672 A number of packages in the predefined environment contain new declarations:
29673 @code{Ada.Exceptions}, @code{Ada.Real_Time}, @code{Ada.Strings},
29674 @code{Ada.Strings.Fixed}, @code{Ada.Strings.Bounded},
29675 @code{Ada.Strings.Unbounded}, @code{Ada.Strings.Wide_Fixed},
29676 @code{Ada.Strings.Wide_Bounded}, @code{Ada.Strings.Wide_Unbounded},
29677 @code{Ada.Tags}, @code{Ada.Text_IO}, and @code{Interfaces.C}.
29678 If an Ada 95 program does a @code{with} and @code{use} of any of these
29679 packages, the new declarations may cause name clashes.
29682 `Access parameters.'
29684 A nondispatching subprogram with an access parameter cannot be renamed
29685 as a dispatching operation. This was permitted in Ada 95.
29688 `Access types, discriminants, and constraints.'
29690 Rule changes in this area have led to some incompatibilities; for example,
29691 constrained subtypes of some access types are not permitted in Ada 2005.
29694 `Aggregates for limited types.'
29696 The allowance of aggregates for limited types in Ada 2005 raises the
29697 possibility of ambiguities in legal Ada 95 programs, since additional types
29698 now need to be considered in expression resolution.
29701 `Fixed-point multiplication and division.'
29703 Certain expressions involving ‘*’ or ‘/’ for a fixed-point type, which
29704 were legal in Ada 95 and invoked the predefined versions of these operations,
29706 The ambiguity may be resolved either by applying a type conversion to the
29707 expression, or by explicitly invoking the operation from package
29711 `Return-by-reference types.'
29713 The Ada 95 return-by-reference mechanism has been removed. Instead, the user
29714 can declare a function returning a value from an anonymous access type.
29717 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
29718 @anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{465}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{466}
29719 @section Implementation-dependent characteristics
29722 Although the Ada language defines the semantics of each construct as
29723 precisely as practical, in some situations (for example for reasons of
29724 efficiency, or where the effect is heavily dependent on the host or target
29725 platform) the implementation is allowed some freedom. In porting Ada 83
29726 code to GNAT, you need to be aware of whether / how the existing code
29727 exercised such implementation dependencies. Such characteristics fall into
29728 several categories, and GNAT offers specific support in assisting the
29729 transition from certain Ada 83 compilers.
29732 * Implementation-defined pragmas::
29733 * Implementation-defined attributes::
29735 * Elaboration order::
29736 * Target-specific aspects::
29740 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
29741 @anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{467}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{468}
29742 @subsection Implementation-defined pragmas
29745 Ada compilers are allowed to supplement the language-defined pragmas, and
29746 these are a potential source of non-portability. All GNAT-defined pragmas
29747 are described in @ref{7,,Implementation Defined Pragmas},
29748 and these include several that are specifically
29749 intended to correspond to other vendors’ Ada 83 pragmas.
29750 For migrating from VADS, the pragma @code{Use_VADS_Size} may be useful.
29751 For compatibility with HP Ada 83, GNAT supplies the pragmas
29752 @code{Extend_System}, @code{Ident}, @code{Inline_Generic},
29753 @code{Interface_Name}, @code{Passive}, @code{Suppress_All},
29754 and @code{Volatile}.
29755 Other relevant pragmas include @code{External} and @code{Link_With}.
29756 Some vendor-specific
29757 Ada 83 pragmas (@code{Share_Generic}, @code{Subtitle}, and @code{Title}) are
29759 avoiding compiler rejection of units that contain such pragmas; they are not
29760 relevant in a GNAT context and hence are not otherwise implemented.
29762 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
29763 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{469}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{46a}
29764 @subsection Implementation-defined attributes
29767 Analogous to pragmas, the set of attributes may be extended by an
29768 implementation. All GNAT-defined attributes are described in
29769 @ref{8,,Implementation Defined Attributes},
29770 and these include several that are specifically intended
29771 to correspond to other vendors’ Ada 83 attributes. For migrating from VADS,
29772 the attribute @code{VADS_Size} may be useful. For compatibility with HP
29773 Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
29776 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
29777 @anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{46b}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{46c}
29778 @subsection Libraries
29781 Vendors may supply libraries to supplement the standard Ada API. If Ada 83
29782 code uses vendor-specific libraries then there are several ways to manage
29783 this in Ada 95 and later versions of the standard:
29789 If the source code for the libraries (specs and bodies) are
29790 available, then the libraries can be migrated in the same way as the
29794 If the source code for the specs but not the bodies are
29795 available, then you can reimplement the bodies.
29798 Some features introduced by Ada 95 obviate the need for library support. For
29799 example most Ada 83 vendors supplied a package for unsigned integers. The
29800 Ada 95 modular type feature is the preferred way to handle this need, so
29801 instead of migrating or reimplementing the unsigned integer package it may
29802 be preferable to retrofit the application using modular types.
29805 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
29806 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{46d}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{46e}
29807 @subsection Elaboration order
29810 The implementation can choose any elaboration order consistent with the unit
29811 dependency relationship. This freedom means that some orders can result in
29812 Program_Error being raised due to an ‘Access Before Elaboration’: an attempt
29813 to invoke a subprogram before its body has been elaborated, or to instantiate
29814 a generic before the generic body has been elaborated. By default GNAT
29815 attempts to choose a safe order (one that will not encounter access before
29816 elaboration problems) by implicitly inserting @code{Elaborate} or
29817 @code{Elaborate_All} pragmas where
29818 needed. However, this can lead to the creation of elaboration circularities
29819 and a resulting rejection of the program by gnatbind. This issue is
29820 thoroughly described in the `Elaboration Order Handling in GNAT' appendix
29821 in the @cite{GNAT User’s Guide}.
29822 In brief, there are several
29823 ways to deal with this situation:
29829 Modify the program to eliminate the circularities, e.g., by moving
29830 elaboration-time code into explicitly-invoked procedures
29833 Constrain the elaboration order by including explicit @code{Elaborate_Body} or
29834 @code{Elaborate} pragmas, and then inhibit the generation of implicit
29835 @code{Elaborate_All}
29836 pragmas either globally (as an effect of the `-gnatE' switch) or locally
29837 (by selectively suppressing elaboration checks via pragma
29838 @code{Suppress(Elaboration_Check)} when it is safe to do so).
29841 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
29842 @anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{46f}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{470}
29843 @subsection Target-specific aspects
29846 Low-level applications need to deal with machine addresses, data
29847 representations, interfacing with assembler code, and similar issues. If
29848 such an Ada 83 application is being ported to different target hardware (for
29849 example where the byte endianness has changed) then you will need to
29850 carefully examine the program logic; the porting effort will heavily depend
29851 on the robustness of the original design. Moreover, Ada 95 (and thus
29852 Ada 2005 and Ada 2012) are sometimes
29853 incompatible with typical Ada 83 compiler practices regarding implicit
29854 packing, the meaning of the Size attribute, and the size of access values.
29855 GNAT’s approach to these issues is described in @ref{471,,Representation Clauses}.
29857 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
29858 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{472}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{473}
29859 @section Compatibility with Other Ada Systems
29862 If programs avoid the use of implementation dependent and
29863 implementation defined features, as documented in the
29864 @cite{Ada Reference Manual}, there should be a high degree of portability between
29865 GNAT and other Ada systems. The following are specific items which
29866 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
29867 compilers, but do not affect porting code to GNAT.
29868 (As of January 2007, GNAT is the only compiler available for Ada 2005;
29869 the following issues may or may not arise for Ada 2005 programs
29870 when other compilers appear.)
29876 `Ada 83 Pragmas and Attributes'
29878 Ada 95 compilers are allowed, but not required, to implement the missing
29879 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
29880 GNAT implements all such pragmas and attributes, eliminating this as
29881 a compatibility concern, but some other Ada 95 compilers reject these
29882 pragmas and attributes.
29885 `Specialized Needs Annexes'
29887 GNAT implements the full set of special needs annexes. At the
29888 current time, it is the only Ada 95 compiler to do so. This means that
29889 programs making use of these features may not be portable to other Ada
29890 95 compilation systems.
29893 `Representation Clauses'
29895 Some other Ada 95 compilers implement only the minimal set of
29896 representation clauses required by the Ada 95 reference manual. GNAT goes
29897 far beyond this minimal set, as described in the next section.
29900 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
29901 @anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{474}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{471}
29902 @section Representation Clauses
29905 The Ada 83 reference manual was quite vague in describing both the minimal
29906 required implementation of representation clauses, and also their precise
29907 effects. Ada 95 (and thus also Ada 2005) are much more explicit, but the
29908 minimal set of capabilities required is still quite limited.
29910 GNAT implements the full required set of capabilities in
29911 Ada 95 and Ada 2005, but also goes much further, and in particular
29912 an effort has been made to be compatible with existing Ada 83 usage to the
29913 greatest extent possible.
29915 A few cases exist in which Ada 83 compiler behavior is incompatible with
29916 the requirements in Ada 95 (and thus also Ada 2005). These are instances of
29917 intentional or accidental dependence on specific implementation dependent
29918 characteristics of these Ada 83 compilers. The following is a list of
29919 the cases most likely to arise in existing Ada 83 code.
29927 Some Ada 83 compilers allowed a Size specification to cause implicit
29928 packing of an array or record. This could cause expensive implicit
29929 conversions for change of representation in the presence of derived
29930 types, and the Ada design intends to avoid this possibility.
29931 Subsequent AI’s were issued to make it clear that such implicit
29932 change of representation in response to a Size clause is inadvisable,
29933 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
29934 Reference Manuals as implementation advice that is followed by GNAT.
29935 The problem will show up as an error
29936 message rejecting the size clause. The fix is simply to provide
29937 the explicit pragma @code{Pack}, or for more fine tuned control, provide
29938 a Component_Size clause.
29941 `Meaning of Size Attribute'
29943 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
29944 the minimal number of bits required to hold values of the type. For example,
29945 on a 32-bit machine, the size of @code{Natural} will typically be 31 and not
29946 32 (since no sign bit is required). Some Ada 83 compilers gave 31, and
29947 some 32 in this situation. This problem will usually show up as a compile
29948 time error, but not always. It is a good idea to check all uses of the
29949 ‘Size attribute when porting Ada 83 code. The GNAT specific attribute
29950 Object_Size can provide a useful way of duplicating the behavior of
29951 some Ada 83 compiler systems.
29954 `Size of Access Types'
29956 A common assumption in Ada 83 code is that an access type is in fact a pointer,
29957 and that therefore it will be the same size as a System.Address value. This
29958 assumption is true for GNAT in most cases with one exception. For the case of
29959 a pointer to an unconstrained array type (where the bounds may vary from one
29960 value of the access type to another), the default is to use a ‘fat pointer’,
29961 which is represented as two separate pointers, one to the bounds, and one to
29962 the array. This representation has a number of advantages, including improved
29963 efficiency. However, it may cause some difficulties in porting existing Ada 83
29964 code which makes the assumption that, for example, pointers fit in 32 bits on
29965 a machine with 32-bit addressing.
29967 To get around this problem, GNAT also permits the use of ‘thin pointers’ for
29968 access types in this case (where the designated type is an unconstrained array
29969 type). These thin pointers are indeed the same size as a System.Address value.
29970 To specify a thin pointer, use a size clause for the type, for example:
29973 type X is access all String;
29974 for X'Size use Standard'Address_Size;
29977 which will cause the type X to be represented using a single pointer.
29978 When using this representation, the bounds are right behind the array.
29979 This representation is slightly less efficient, and does not allow quite
29980 such flexibility in the use of foreign pointers or in using the
29981 Unrestricted_Access attribute to create pointers to non-aliased objects.
29982 But for any standard portable use of the access type it will work in
29983 a functionally correct manner and allow porting of existing code.
29984 Note that another way of forcing a thin pointer representation
29985 is to use a component size clause for the element size in an array,
29986 or a record representation clause for an access field in a record.
29988 See the documentation of Unrestricted_Access in the GNAT RM for a
29989 full discussion of possible problems using this attribute in conjunction
29990 with thin pointers.
29993 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
29994 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{475}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{476}
29995 @section Compatibility with HP Ada 83
29998 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
29999 of them can sensibly be implemented. The description of pragmas in
30000 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
30001 applicable to GNAT.
30007 `Default floating-point representation'
30009 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
30015 the package System in GNAT exactly corresponds to the definition in the
30016 Ada 95 reference manual, which means that it excludes many of the
30017 HP Ada 83 extensions. However, a separate package Aux_DEC is provided
30018 that contains the additional definitions, and a special pragma,
30019 Extend_System allows this package to be treated transparently as an
30020 extension of package System.
30023 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
30024 @anchor{share/gnu_free_documentation_license doc}@anchor{477}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{478}
30025 @chapter GNU Free Documentation License
30028 Version 1.3, 3 November 2008
30030 Copyright 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc
30031 @indicateurl{https://fsf.org/}
30033 Everyone is permitted to copy and distribute verbatim copies of this
30034 license document, but changing it is not allowed.
30038 The purpose of this License is to make a manual, textbook, or other
30039 functional and useful document “free” in the sense of freedom: to
30040 assure everyone the effective freedom to copy and redistribute it,
30041 with or without modifying it, either commercially or noncommercially.
30042 Secondarily, this License preserves for the author and publisher a way
30043 to get credit for their work, while not being considered responsible
30044 for modifications made by others.
30046 This License is a kind of “copyleft”, which means that derivative
30047 works of the document must themselves be free in the same sense. It
30048 complements the GNU General Public License, which is a copyleft
30049 license designed for free software.
30051 We have designed this License in order to use it for manuals for free
30052 software, because free software needs free documentation: a free
30053 program should come with manuals providing the same freedoms that the
30054 software does. But this License is not limited to software manuals;
30055 it can be used for any textual work, regardless of subject matter or
30056 whether it is published as a printed book. We recommend this License
30057 principally for works whose purpose is instruction or reference.
30059 `1. APPLICABILITY AND DEFINITIONS'
30061 This License applies to any manual or other work, in any medium, that
30062 contains a notice placed by the copyright holder saying it can be
30063 distributed under the terms of this License. Such a notice grants a
30064 world-wide, royalty-free license, unlimited in duration, to use that
30065 work under the conditions stated herein. The `Document', below,
30066 refers to any such manual or work. Any member of the public is a
30067 licensee, and is addressed as “`you'”. You accept the license if you
30068 copy, modify or distribute the work in a way requiring permission
30069 under copyright law.
30071 A “`Modified Version'” of the Document means any work containing the
30072 Document or a portion of it, either copied verbatim, or with
30073 modifications and/or translated into another language.
30075 A “`Secondary Section'” is a named appendix or a front-matter section of
30076 the Document that deals exclusively with the relationship of the
30077 publishers or authors of the Document to the Document’s overall subject
30078 (or to related matters) and contains nothing that could fall directly
30079 within that overall subject. (Thus, if the Document is in part a
30080 textbook of mathematics, a Secondary Section may not explain any
30081 mathematics.) The relationship could be a matter of historical
30082 connection with the subject or with related matters, or of legal,
30083 commercial, philosophical, ethical or political position regarding
30086 The “`Invariant Sections'” are certain Secondary Sections whose titles
30087 are designated, as being those of Invariant Sections, in the notice
30088 that says that the Document is released under this License. If a
30089 section does not fit the above definition of Secondary then it is not
30090 allowed to be designated as Invariant. The Document may contain zero
30091 Invariant Sections. If the Document does not identify any Invariant
30092 Sections then there are none.
30094 The “`Cover Texts'” are certain short passages of text that are listed,
30095 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
30096 the Document is released under this License. A Front-Cover Text may
30097 be at most 5 words, and a Back-Cover Text may be at most 25 words.
30099 A “`Transparent'” copy of the Document means a machine-readable copy,
30100 represented in a format whose specification is available to the
30101 general public, that is suitable for revising the document
30102 straightforwardly with generic text editors or (for images composed of
30103 pixels) generic paint programs or (for drawings) some widely available
30104 drawing editor, and that is suitable for input to text formatters or
30105 for automatic translation to a variety of formats suitable for input
30106 to text formatters. A copy made in an otherwise Transparent file
30107 format whose markup, or absence of markup, has been arranged to thwart
30108 or discourage subsequent modification by readers is not Transparent.
30109 An image format is not Transparent if used for any substantial amount
30110 of text. A copy that is not “Transparent” is called `Opaque'.
30112 Examples of suitable formats for Transparent copies include plain
30113 ASCII without markup, Texinfo input format, LaTeX input format, SGML
30114 or XML using a publicly available DTD, and standard-conforming simple
30115 HTML, PostScript or PDF designed for human modification. Examples of
30116 transparent image formats include PNG, XCF and JPG. Opaque formats
30117 include proprietary formats that can be read and edited only by
30118 proprietary word processors, SGML or XML for which the DTD and/or
30119 processing tools are not generally available, and the
30120 machine-generated HTML, PostScript or PDF produced by some word
30121 processors for output purposes only.
30123 The “`Title Page'” means, for a printed book, the title page itself,
30124 plus such following pages as are needed to hold, legibly, the material
30125 this License requires to appear in the title page. For works in
30126 formats which do not have any title page as such, “Title Page” means
30127 the text near the most prominent appearance of the work’s title,
30128 preceding the beginning of the body of the text.
30130 The “`publisher'” means any person or entity that distributes
30131 copies of the Document to the public.
30133 A section “`Entitled XYZ'” means a named subunit of the Document whose
30134 title either is precisely XYZ or contains XYZ in parentheses following
30135 text that translates XYZ in another language. (Here XYZ stands for a
30136 specific section name mentioned below, such as “`Acknowledgements'”,
30137 “`Dedications'”, “`Endorsements'”, or “`History'”.)
30138 To “`Preserve the Title'”
30139 of such a section when you modify the Document means that it remains a
30140 section “Entitled XYZ” according to this definition.
30142 The Document may include Warranty Disclaimers next to the notice which
30143 states that this License applies to the Document. These Warranty
30144 Disclaimers are considered to be included by reference in this
30145 License, but only as regards disclaiming warranties: any other
30146 implication that these Warranty Disclaimers may have is void and has
30147 no effect on the meaning of this License.
30149 `2. VERBATIM COPYING'
30151 You may copy and distribute the Document in any medium, either
30152 commercially or noncommercially, provided that this License, the
30153 copyright notices, and the license notice saying this License applies
30154 to the Document are reproduced in all copies, and that you add no other
30155 conditions whatsoever to those of this License. You may not use
30156 technical measures to obstruct or control the reading or further
30157 copying of the copies you make or distribute. However, you may accept
30158 compensation in exchange for copies. If you distribute a large enough
30159 number of copies you must also follow the conditions in section 3.
30161 You may also lend copies, under the same conditions stated above, and
30162 you may publicly display copies.
30164 `3. COPYING IN QUANTITY'
30166 If you publish printed copies (or copies in media that commonly have
30167 printed covers) of the Document, numbering more than 100, and the
30168 Document’s license notice requires Cover Texts, you must enclose the
30169 copies in covers that carry, clearly and legibly, all these Cover
30170 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
30171 the back cover. Both covers must also clearly and legibly identify
30172 you as the publisher of these copies. The front cover must present
30173 the full title with all words of the title equally prominent and
30174 visible. You may add other material on the covers in addition.
30175 Copying with changes limited to the covers, as long as they preserve
30176 the title of the Document and satisfy these conditions, can be treated
30177 as verbatim copying in other respects.
30179 If the required texts for either cover are too voluminous to fit
30180 legibly, you should put the first ones listed (as many as fit
30181 reasonably) on the actual cover, and continue the rest onto adjacent
30184 If you publish or distribute Opaque copies of the Document numbering
30185 more than 100, you must either include a machine-readable Transparent
30186 copy along with each Opaque copy, or state in or with each Opaque copy
30187 a computer-network location from which the general network-using
30188 public has access to download using public-standard network protocols
30189 a complete Transparent copy of the Document, free of added material.
30190 If you use the latter option, you must take reasonably prudent steps,
30191 when you begin distribution of Opaque copies in quantity, to ensure
30192 that this Transparent copy will remain thus accessible at the stated
30193 location until at least one year after the last time you distribute an
30194 Opaque copy (directly or through your agents or retailers) of that
30195 edition to the public.
30197 It is requested, but not required, that you contact the authors of the
30198 Document well before redistributing any large number of copies, to give
30199 them a chance to provide you with an updated version of the Document.
30203 You may copy and distribute a Modified Version of the Document under
30204 the conditions of sections 2 and 3 above, provided that you release
30205 the Modified Version under precisely this License, with the Modified
30206 Version filling the role of the Document, thus licensing distribution
30207 and modification of the Modified Version to whoever possesses a copy
30208 of it. In addition, you must do these things in the Modified Version:
30214 Use in the Title Page (and on the covers, if any) a title distinct
30215 from that of the Document, and from those of previous versions
30216 (which should, if there were any, be listed in the History section
30217 of the Document). You may use the same title as a previous version
30218 if the original publisher of that version gives permission.
30221 List on the Title Page, as authors, one or more persons or entities
30222 responsible for authorship of the modifications in the Modified
30223 Version, together with at least five of the principal authors of the
30224 Document (all of its principal authors, if it has fewer than five),
30225 unless they release you from this requirement.
30228 State on the Title page the name of the publisher of the
30229 Modified Version, as the publisher.
30232 Preserve all the copyright notices of the Document.
30235 Add an appropriate copyright notice for your modifications
30236 adjacent to the other copyright notices.
30239 Include, immediately after the copyright notices, a license notice
30240 giving the public permission to use the Modified Version under the
30241 terms of this License, in the form shown in the Addendum below.
30244 Preserve in that license notice the full lists of Invariant Sections
30245 and required Cover Texts given in the Document’s license notice.
30248 Include an unaltered copy of this License.
30251 Preserve the section Entitled “History”, Preserve its Title, and add
30252 to it an item stating at least the title, year, new authors, and
30253 publisher of the Modified Version as given on the Title Page. If
30254 there is no section Entitled “History” in the Document, create one
30255 stating the title, year, authors, and publisher of the Document as
30256 given on its Title Page, then add an item describing the Modified
30257 Version as stated in the previous sentence.
30260 Preserve the network location, if any, given in the Document for
30261 public access to a Transparent copy of the Document, and likewise
30262 the network locations given in the Document for previous versions
30263 it was based on. These may be placed in the “History” section.
30264 You may omit a network location for a work that was published at
30265 least four years before the Document itself, or if the original
30266 publisher of the version it refers to gives permission.
30269 For any section Entitled “Acknowledgements” or “Dedications”,
30270 Preserve the Title of the section, and preserve in the section all
30271 the substance and tone of each of the contributor acknowledgements
30272 and/or dedications given therein.
30275 Preserve all the Invariant Sections of the Document,
30276 unaltered in their text and in their titles. Section numbers
30277 or the equivalent are not considered part of the section titles.
30280 Delete any section Entitled “Endorsements”. Such a section
30281 may not be included in the Modified Version.
30284 Do not retitle any existing section to be Entitled “Endorsements”
30285 or to conflict in title with any Invariant Section.
30288 Preserve any Warranty Disclaimers.
30291 If the Modified Version includes new front-matter sections or
30292 appendices that qualify as Secondary Sections and contain no material
30293 copied from the Document, you may at your option designate some or all
30294 of these sections as invariant. To do this, add their titles to the
30295 list of Invariant Sections in the Modified Version’s license notice.
30296 These titles must be distinct from any other section titles.
30298 You may add a section Entitled “Endorsements”, provided it contains
30299 nothing but endorsements of your Modified Version by various
30300 parties—for example, statements of peer review or that the text has
30301 been approved by an organization as the authoritative definition of a
30304 You may add a passage of up to five words as a Front-Cover Text, and a
30305 passage of up to 25 words as a Back-Cover Text, to the end of the list
30306 of Cover Texts in the Modified Version. Only one passage of
30307 Front-Cover Text and one of Back-Cover Text may be added by (or
30308 through arrangements made by) any one entity. If the Document already
30309 includes a cover text for the same cover, previously added by you or
30310 by arrangement made by the same entity you are acting on behalf of,
30311 you may not add another; but you may replace the old one, on explicit
30312 permission from the previous publisher that added the old one.
30314 The author(s) and publisher(s) of the Document do not by this License
30315 give permission to use their names for publicity for or to assert or
30316 imply endorsement of any Modified Version.
30318 `5. COMBINING DOCUMENTS'
30320 You may combine the Document with other documents released under this
30321 License, under the terms defined in section 4 above for modified
30322 versions, provided that you include in the combination all of the
30323 Invariant Sections of all of the original documents, unmodified, and
30324 list them all as Invariant Sections of your combined work in its
30325 license notice, and that you preserve all their Warranty Disclaimers.
30327 The combined work need only contain one copy of this License, and
30328 multiple identical Invariant Sections may be replaced with a single
30329 copy. If there are multiple Invariant Sections with the same name but
30330 different contents, make the title of each such section unique by
30331 adding at the end of it, in parentheses, the name of the original
30332 author or publisher of that section if known, or else a unique number.
30333 Make the same adjustment to the section titles in the list of
30334 Invariant Sections in the license notice of the combined work.
30336 In the combination, you must combine any sections Entitled “History”
30337 in the various original documents, forming one section Entitled
30338 “History”; likewise combine any sections Entitled “Acknowledgements”,
30339 and any sections Entitled “Dedications”. You must delete all sections
30340 Entitled “Endorsements”.
30342 `6. COLLECTIONS OF DOCUMENTS'
30344 You may make a collection consisting of the Document and other documents
30345 released under this License, and replace the individual copies of this
30346 License in the various documents with a single copy that is included in
30347 the collection, provided that you follow the rules of this License for
30348 verbatim copying of each of the documents in all other respects.
30350 You may extract a single document from such a collection, and distribute
30351 it individually under this License, provided you insert a copy of this
30352 License into the extracted document, and follow this License in all
30353 other respects regarding verbatim copying of that document.
30355 `7. AGGREGATION WITH INDEPENDENT WORKS'
30357 A compilation of the Document or its derivatives with other separate
30358 and independent documents or works, in or on a volume of a storage or
30359 distribution medium, is called an “aggregate” if the copyright
30360 resulting from the compilation is not used to limit the legal rights
30361 of the compilation’s users beyond what the individual works permit.
30362 When the Document is included in an aggregate, this License does not
30363 apply to the other works in the aggregate which are not themselves
30364 derivative works of the Document.
30366 If the Cover Text requirement of section 3 is applicable to these
30367 copies of the Document, then if the Document is less than one half of
30368 the entire aggregate, the Document’s Cover Texts may be placed on
30369 covers that bracket the Document within the aggregate, or the
30370 electronic equivalent of covers if the Document is in electronic form.
30371 Otherwise they must appear on printed covers that bracket the whole
30376 Translation is considered a kind of modification, so you may
30377 distribute translations of the Document under the terms of section 4.
30378 Replacing Invariant Sections with translations requires special
30379 permission from their copyright holders, but you may include
30380 translations of some or all Invariant Sections in addition to the
30381 original versions of these Invariant Sections. You may include a
30382 translation of this License, and all the license notices in the
30383 Document, and any Warranty Disclaimers, provided that you also include
30384 the original English version of this License and the original versions
30385 of those notices and disclaimers. In case of a disagreement between
30386 the translation and the original version of this License or a notice
30387 or disclaimer, the original version will prevail.
30389 If a section in the Document is Entitled “Acknowledgements”,
30390 “Dedications”, or “History”, the requirement (section 4) to Preserve
30391 its Title (section 1) will typically require changing the actual
30396 You may not copy, modify, sublicense, or distribute the Document
30397 except as expressly provided under this License. Any attempt
30398 otherwise to copy, modify, sublicense, or distribute it is void, and
30399 will automatically terminate your rights under this License.
30401 However, if you cease all violation of this License, then your license
30402 from a particular copyright holder is reinstated (a) provisionally,
30403 unless and until the copyright holder explicitly and finally
30404 terminates your license, and (b) permanently, if the copyright holder
30405 fails to notify you of the violation by some reasonable means prior to
30406 60 days after the cessation.
30408 Moreover, your license from a particular copyright holder is
30409 reinstated permanently if the copyright holder notifies you of the
30410 violation by some reasonable means, this is the first time you have
30411 received notice of violation of this License (for any work) from that
30412 copyright holder, and you cure the violation prior to 30 days after
30413 your receipt of the notice.
30415 Termination of your rights under this section does not terminate the
30416 licenses of parties who have received copies or rights from you under
30417 this License. If your rights have been terminated and not permanently
30418 reinstated, receipt of a copy of some or all of the same material does
30419 not give you any rights to use it.
30421 `10. FUTURE REVISIONS OF THIS LICENSE'
30423 The Free Software Foundation may publish new, revised versions
30424 of the GNU Free Documentation License from time to time. Such new
30425 versions will be similar in spirit to the present version, but may
30426 differ in detail to address new problems or concerns. See
30427 @indicateurl{https://www.gnu.org/copyleft/}.
30429 Each version of the License is given a distinguishing version number.
30430 If the Document specifies that a particular numbered version of this
30431 License “or any later version” applies to it, you have the option of
30432 following the terms and conditions either of that specified version or
30433 of any later version that has been published (not as a draft) by the
30434 Free Software Foundation. If the Document does not specify a version
30435 number of this License, you may choose any version ever published (not
30436 as a draft) by the Free Software Foundation. If the Document
30437 specifies that a proxy can decide which future versions of this
30438 License can be used, that proxy’s public statement of acceptance of a
30439 version permanently authorizes you to choose that version for the
30444 “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
30445 World Wide Web server that publishes copyrightable works and also
30446 provides prominent facilities for anybody to edit those works. A
30447 public wiki that anybody can edit is an example of such a server. A
30448 “Massive Multiauthor Collaboration” (or “MMC”) contained in the
30449 site means any set of copyrightable works thus published on the MMC
30452 “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
30453 license published by Creative Commons Corporation, a not-for-profit
30454 corporation with a principal place of business in San Francisco,
30455 California, as well as future copyleft versions of that license
30456 published by that same organization.
30458 “Incorporate” means to publish or republish a Document, in whole or
30459 in part, as part of another Document.
30461 An MMC is “eligible for relicensing” if it is licensed under this
30462 License, and if all works that were first published under this License
30463 somewhere other than this MMC, and subsequently incorporated in whole
30464 or in part into the MMC, (1) had no cover texts or invariant sections,
30465 and (2) were thus incorporated prior to November 1, 2008.
30467 The operator of an MMC Site may republish an MMC contained in the site
30468 under CC-BY-SA on the same site at any time before August 1, 2009,
30469 provided the MMC is eligible for relicensing.
30471 `ADDENDUM: How to use this License for your documents'
30473 To use this License in a document you have written, include a copy of
30474 the License in the document and put the following copyright and
30475 license notices just after the title page:
30479 Copyright © YEAR YOUR NAME.
30480 Permission is granted to copy, distribute and/or modify this document
30481 under the terms of the GNU Free Documentation License, Version 1.3
30482 or any later version published by the Free Software Foundation;
30483 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
30484 A copy of the license is included in the section entitled “GNU
30485 Free Documentation License”.
30488 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
30489 replace the “with … Texts.” line with this:
30493 with the Invariant Sections being LIST THEIR TITLES, with the
30494 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
30497 If you have Invariant Sections without Cover Texts, or some other
30498 combination of the three, merge those two alternatives to suit the
30501 If your document contains nontrivial examples of program code, we
30502 recommend releasing these examples in parallel under your choice of
30503 free software license, such as the GNU General Public License,
30504 to permit their use in free software.
30506 @node Index,,GNU Free Documentation License,Top