libatomic: Improve cpuid usage in __libat_feat1_init
[official-gcc.git] / gcc / ada / gnat_rm.texi
blob4feef7e1f9fcb15bb26fe3b7a9087620d4f7da11
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename gnat_rm.info
4 @documentencoding UTF-8
5 @ifinfo
6 @*Generated by Sphinx 5.3.0.@*
7 @end ifinfo
8 @settitle GNAT Reference Manual
9 @defindex ge
10 @paragraphindent 0
11 @exampleindent 4
12 @finalout
13 @dircategory GNU Ada Tools 
14 @direntry
15 * gnat_rm: (gnat_rm.info). gnat_rm
16 @end direntry
18 @c %**end of header
20 @copying
21 @quotation
22 GNAT Reference Manual , Jun 27, 2024
24 AdaCore
26 Copyright @copyright{} 2008-2024, Free Software Foundation
27 @end quotation
29 @end copying
31 @titlepage
32 @title GNAT Reference Manual
33 @insertcopying
34 @end titlepage
35 @contents
37 @c %** start of user preamble
39 @c %** end of user preamble
41 @ifnottex
42 @node Top
43 @top GNAT Reference Manual
44 @insertcopying
45 @end ifnottex
47 @c %**start of body
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}@*
54 AdaCore
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}.
63 @menu
64 * About This Guide:: 
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:: 
75 * The GNAT Library:: 
76 * Interfacing to Other Languages:: 
77 * Specialized Needs Annexes:: 
78 * Implementation of Specific Ada Features:: 
79 * Implementation of Ada 2012 Features:: 
80 * GNAT language extensions:: 
81 * Security Hardening Features:: 
82 * Obsolescent Features:: 
83 * Compatibility and Porting Guide:: 
84 * GNU Free Documentation License:: 
85 * Index:: 
87 @detailmenu
88  --- The Detailed Node Listing ---
90 About This Guide
92 * What This Reference Manual Contains:: 
93 * Conventions:: 
94 * Related Information:: 
96 Implementation Defined Pragmas
98 * Pragma Abort_Defer:: 
99 * Pragma Abstract_State:: 
100 * Pragma Ada_83:: 
101 * Pragma Ada_95:: 
102 * Pragma Ada_05:: 
103 * Pragma Ada_2005:: 
104 * Pragma Ada_12:: 
105 * Pragma Ada_2012:: 
106 * Pragma Ada_2022:: 
107 * Pragma Aggregate_Individually_Assign:: 
108 * Pragma Allow_Integer_Address:: 
109 * Pragma Always_Terminates:: 
110 * Pragma Annotate:: 
111 * Pragma Assert:: 
112 * Pragma Assert_And_Cut:: 
113 * Pragma Assertion_Policy:: 
114 * Pragma Assume:: 
115 * Pragma Assume_No_Invalid_Values:: 
116 * Pragma Async_Readers:: 
117 * Pragma Async_Writers:: 
118 * Pragma Attribute_Definition:: 
119 * Pragma C_Pass_By_Copy:: 
120 * Pragma Check:: 
121 * Pragma Check_Float_Overflow:: 
122 * Pragma Check_Name:: 
123 * Pragma Check_Policy:: 
124 * Pragma Comment:: 
125 * Pragma Common_Object:: 
126 * Pragma Compile_Time_Error:: 
127 * Pragma Compile_Time_Warning:: 
128 * Pragma Complete_Representation:: 
129 * Pragma Complex_Representation:: 
130 * Pragma Component_Alignment:: 
131 * Pragma Constant_After_Elaboration:: 
132 * Pragma Contract_Cases:: 
133 * Pragma Convention_Identifier:: 
134 * Pragma CPP_Class:: 
135 * Pragma CPP_Constructor:: 
136 * Pragma CPP_Virtual:: 
137 * Pragma CPP_Vtable:: 
138 * Pragma CPU:: 
139 * Pragma Deadline_Floor:: 
140 * Pragma Debug:: 
141 * Pragma Debug_Policy:: 
142 * Pragma Default_Initial_Condition:: 
143 * Pragma Default_Scalar_Storage_Order:: 
144 * Pragma Default_Storage_Pool:: 
145 * Pragma Depends:: 
146 * Pragma Detect_Blocking:: 
147 * Pragma Disable_Atomic_Synchronization:: 
148 * Pragma Dispatching_Domain:: 
149 * Pragma Effective_Reads:: 
150 * Pragma Effective_Writes:: 
151 * Pragma Elaboration_Checks:: 
152 * Pragma Eliminate:: 
153 * Pragma Enable_Atomic_Synchronization:: 
154 * Pragma Exceptional_Cases:: 
155 * Pragma Export_Function:: 
156 * Pragma Export_Object:: 
157 * Pragma Export_Procedure:: 
158 * Pragma Export_Valued_Procedure:: 
159 * Pragma Extend_System:: 
160 * Pragma Extensions_Allowed:: 
161 * Pragma Extensions_Visible:: 
162 * Pragma External:: 
163 * Pragma External_Name_Casing:: 
164 * Pragma Fast_Math:: 
165 * Pragma Favor_Top_Level:: 
166 * Pragma Finalize_Storage_Only:: 
167 * Pragma Float_Representation:: 
168 * Pragma Ghost:: 
169 * Pragma Global:: 
170 * Pragma Ident:: 
171 * Pragma Ignore_Pragma:: 
172 * Pragma Implementation_Defined:: 
173 * Pragma Implemented:: 
174 * Pragma Implicit_Packing:: 
175 * Pragma Import_Function:: 
176 * Pragma Import_Object:: 
177 * Pragma Import_Procedure:: 
178 * Pragma Import_Valued_Procedure:: 
179 * Pragma Independent:: 
180 * Pragma Independent_Components:: 
181 * Pragma Initial_Condition:: 
182 * Pragma Initialize_Scalars:: 
183 * Pragma Initializes:: 
184 * Pragma Inline_Always:: 
185 * Pragma Inline_Generic:: 
186 * Pragma Interface:: 
187 * Pragma Interface_Name:: 
188 * Pragma Interrupt_Handler:: 
189 * Pragma Interrupt_State:: 
190 * Pragma Interrupts_System_By_Default:: 
191 * Pragma Invariant:: 
192 * Pragma Keep_Names:: 
193 * Pragma License:: 
194 * Pragma Link_With:: 
195 * Pragma Linker_Alias:: 
196 * Pragma Linker_Constructor:: 
197 * Pragma Linker_Destructor:: 
198 * Pragma Linker_Section:: 
199 * Pragma Lock_Free:: 
200 * Pragma Loop_Invariant:: 
201 * Pragma Loop_Optimize:: 
202 * Pragma Loop_Variant:: 
203 * Pragma Machine_Attribute:: 
204 * Pragma Main:: 
205 * Pragma Main_Storage:: 
206 * Pragma Max_Queue_Length:: 
207 * Pragma No_Body:: 
208 * Pragma No_Caching:: 
209 * Pragma No_Component_Reordering:: 
210 * Pragma No_Elaboration_Code_All:: 
211 * Pragma No_Heap_Finalization:: 
212 * Pragma No_Inline:: 
213 * Pragma No_Return:: 
214 * Pragma No_Strict_Aliasing:: 
215 * Pragma No_Tagged_Streams:: 
216 * Pragma Normalize_Scalars:: 
217 * Pragma Obsolescent:: 
218 * Pragma Optimize_Alignment:: 
219 * Pragma Ordered:: 
220 * Pragma Overflow_Mode:: 
221 * Pragma Overriding_Renamings:: 
222 * Pragma Part_Of:: 
223 * Pragma Partition_Elaboration_Policy:: 
224 * Pragma Passive:: 
225 * Pragma Persistent_BSS:: 
226 * Pragma Post:: 
227 * Pragma Postcondition:: 
228 * Pragma Post_Class:: 
229 * Pragma Pre:: 
230 * Pragma Precondition:: 
231 * Pragma Predicate:: 
232 * Pragma Predicate_Failure:: 
233 * Pragma Preelaborable_Initialization:: 
234 * Pragma Prefix_Exception_Messages:: 
235 * Pragma Pre_Class:: 
236 * Pragma Priority_Specific_Dispatching:: 
237 * Pragma Profile:: 
238 * Pragma Profile_Warnings:: 
239 * Pragma Propagate_Exceptions:: 
240 * Pragma Provide_Shift_Operators:: 
241 * Pragma Psect_Object:: 
242 * Pragma Pure_Function:: 
243 * Pragma Rational:: 
244 * Pragma Ravenscar:: 
245 * Pragma Refined_Depends:: 
246 * Pragma Refined_Global:: 
247 * Pragma Refined_Post:: 
248 * Pragma Refined_State:: 
249 * Pragma Relative_Deadline:: 
250 * Pragma Remote_Access_Type:: 
251 * Pragma Rename_Pragma:: 
252 * Pragma Restricted_Run_Time:: 
253 * Pragma Restriction_Warnings:: 
254 * Pragma Reviewable:: 
255 * Pragma Secondary_Stack_Size:: 
256 * Pragma Share_Generic:: 
257 * Pragma Shared:: 
258 * Pragma Short_Circuit_And_Or:: 
259 * Pragma Short_Descriptors:: 
260 * Pragma Side_Effects:: 
261 * Pragma Simple_Storage_Pool_Type:: 
262 * Pragma Source_File_Name:: 
263 * Pragma Source_File_Name_Project:: 
264 * Pragma Source_Reference:: 
265 * Pragma SPARK_Mode:: 
266 * Pragma Static_Elaboration_Desired:: 
267 * Pragma Stream_Convert:: 
268 * Pragma Style_Checks:: 
269 * Pragma Subprogram_Variant:: 
270 * Pragma Subtitle:: 
271 * Pragma Suppress:: 
272 * Pragma Suppress_All:: 
273 * Pragma Suppress_Debug_Info:: 
274 * Pragma Suppress_Exception_Locations:: 
275 * Pragma Suppress_Initialization:: 
276 * Pragma Task_Name:: 
277 * Pragma Task_Storage:: 
278 * Pragma Test_Case:: 
279 * Pragma Thread_Local_Storage:: 
280 * Pragma Time_Slice:: 
281 * Pragma Title:: 
282 * Pragma Type_Invariant:: 
283 * Pragma Type_Invariant_Class:: 
284 * Pragma Unchecked_Union:: 
285 * Pragma Unevaluated_Use_Of_Old:: 
286 * Pragma User_Aspect_Definition:: 
287 * Pragma Unimplemented_Unit:: 
288 * Pragma Universal_Aliasing:: 
289 * Pragma Unmodified:: 
290 * Pragma Unreferenced:: 
291 * Pragma Unreferenced_Objects:: 
292 * Pragma Unreserve_All_Interrupts:: 
293 * Pragma Unsuppress:: 
294 * Pragma Unused:: 
295 * Pragma Use_VADS_Size:: 
296 * Pragma Validity_Checks:: 
297 * Pragma Volatile:: 
298 * Pragma Volatile_Full_Access:: 
299 * Pragma Volatile_Function:: 
300 * Pragma Warning_As_Error:: 
301 * Pragma Warnings:: 
302 * Pragma Weak_External:: 
303 * Pragma Wide_Character_Encoding:: 
305 Implementation Defined Aspects
307 * Aspect Abstract_State:: 
308 * Aspect Always_Terminates:: 
309 * Aspect Annotate:: 
310 * Aspect Async_Readers:: 
311 * Aspect Async_Writers:: 
312 * Aspect Constant_After_Elaboration:: 
313 * Aspect Contract_Cases:: 
314 * Aspect Depends:: 
315 * Aspect Default_Initial_Condition:: 
316 * Aspect Dimension:: 
317 * Aspect Dimension_System:: 
318 * Aspect Disable_Controlled:: 
319 * Aspect Effective_Reads:: 
320 * Aspect Effective_Writes:: 
321 * Aspect Exceptional_Cases:: 
322 * Aspect Extensions_Visible:: 
323 * Aspect Favor_Top_Level:: 
324 * Aspect Ghost:: 
325 * Aspect Ghost_Predicate:: 
326 * Aspect Global:: 
327 * Aspect Initial_Condition:: 
328 * Aspect Initializes:: 
329 * Aspect Inline_Always:: 
330 * Aspect Invariant:: 
331 * Aspect Invariant’Class:: 
332 * Aspect Iterable:: 
333 * Aspect Linker_Section:: 
334 * Aspect Local_Restrictions:: 
335 * Aspect Lock_Free:: 
336 * Aspect Max_Queue_Length:: 
337 * Aspect No_Caching:: 
338 * Aspect No_Elaboration_Code_All:: 
339 * Aspect No_Inline:: 
340 * Aspect No_Tagged_Streams:: 
341 * Aspect No_Task_Parts:: 
342 * Aspect Object_Size:: 
343 * Aspect Obsolescent:: 
344 * Aspect Part_Of:: 
345 * Aspect Persistent_BSS:: 
346 * Aspect Predicate:: 
347 * Aspect Pure_Function:: 
348 * Aspect Refined_Depends:: 
349 * Aspect Refined_Global:: 
350 * Aspect Refined_Post:: 
351 * Aspect Refined_State:: 
352 * Aspect Relaxed_Initialization:: 
353 * Aspect Remote_Access_Type:: 
354 * Aspect Scalar_Storage_Order:: 
355 * Aspect Secondary_Stack_Size:: 
356 * Aspect Shared:: 
357 * Aspect Side_Effects:: 
358 * Aspect Simple_Storage_Pool:: 
359 * Aspect Simple_Storage_Pool_Type:: 
360 * Aspect SPARK_Mode:: 
361 * Aspect Subprogram_Variant:: 
362 * Aspect Suppress_Debug_Info:: 
363 * Aspect Suppress_Initialization:: 
364 * Aspect Test_Case:: 
365 * Aspect Thread_Local_Storage:: 
366 * Aspect Universal_Aliasing:: 
367 * Aspect Unmodified:: 
368 * Aspect Unreferenced:: 
369 * Aspect Unreferenced_Objects:: 
370 * Aspect User_Aspect:: 
371 * Aspect Value_Size:: 
372 * Aspect Volatile_Full_Access:: 
373 * Aspect Volatile_Function:: 
374 * Aspect Warnings:: 
376 Implementation Defined Attributes
378 * Attribute Abort_Signal:: 
379 * Attribute Address_Size:: 
380 * Attribute Asm_Input:: 
381 * Attribute Asm_Output:: 
382 * Attribute Atomic_Always_Lock_Free:: 
383 * Attribute Bit:: 
384 * Attribute Bit_Position:: 
385 * Attribute Code_Address:: 
386 * Attribute Compiler_Version:: 
387 * Attribute Constrained:: 
388 * Attribute Default_Bit_Order:: 
389 * Attribute Default_Scalar_Storage_Order:: 
390 * Attribute Deref:: 
391 * Attribute Descriptor_Size:: 
392 * Attribute Elaborated:: 
393 * Attribute Elab_Body:: 
394 * Attribute Elab_Spec:: 
395 * Attribute Elab_Subp_Body:: 
396 * Attribute Emax:: 
397 * Attribute Enabled:: 
398 * Attribute Enum_Rep:: 
399 * Attribute Enum_Val:: 
400 * Attribute Epsilon:: 
401 * Attribute Fast_Math:: 
402 * Attribute Finalization_Size:: 
403 * Attribute Fixed_Value:: 
404 * Attribute From_Any:: 
405 * Attribute Has_Access_Values:: 
406 * Attribute Has_Discriminants:: 
407 * Attribute Has_Tagged_Values:: 
408 * Attribute Img:: 
409 * Attribute Initialized:: 
410 * Attribute Integer_Value:: 
411 * Attribute Invalid_Value:: 
412 * Attribute Large:: 
413 * Attribute Library_Level:: 
414 * Attribute Loop_Entry:: 
415 * Attribute Machine_Size:: 
416 * Attribute Mantissa:: 
417 * Attribute Maximum_Alignment:: 
418 * Attribute Max_Integer_Size:: 
419 * Attribute Mechanism_Code:: 
420 * Attribute Null_Parameter:: 
421 * Attribute Object_Size:: 
422 * Attribute Old:: 
423 * Attribute Passed_By_Reference:: 
424 * Attribute Pool_Address:: 
425 * Attribute Range_Length:: 
426 * Attribute Restriction_Set:: 
427 * Attribute Result:: 
428 * Attribute Round:: 
429 * Attribute Safe_Emax:: 
430 * Attribute Safe_Large:: 
431 * Attribute Safe_Small:: 
432 * Attribute Scalar_Storage_Order:: 
433 * Attribute Simple_Storage_Pool:: 
434 * Attribute Small:: 
435 * Attribute Small_Denominator:: 
436 * Attribute Small_Numerator:: 
437 * Attribute Storage_Unit:: 
438 * Attribute Stub_Type:: 
439 * Attribute System_Allocator_Alignment:: 
440 * Attribute Target_Name:: 
441 * Attribute To_Address:: 
442 * Attribute To_Any:: 
443 * Attribute Type_Class:: 
444 * Attribute Type_Key:: 
445 * Attribute TypeCode:: 
446 * Attribute Unconstrained_Array:: 
447 * Attribute Universal_Literal_String:: 
448 * Attribute Unrestricted_Access:: 
449 * Attribute Update:: 
450 * Attribute Valid_Value:: 
451 * Attribute Valid_Scalars:: 
452 * Attribute VADS_Size:: 
453 * Attribute Value_Size:: 
454 * Attribute Wchar_T_Size:: 
455 * Attribute Word_Size:: 
457 Standard and Implementation Defined Restrictions
459 * Partition-Wide Restrictions:: 
460 * Program Unit Level Restrictions:: 
462 Partition-Wide Restrictions
464 * Immediate_Reclamation:: 
465 * Max_Asynchronous_Select_Nesting:: 
466 * Max_Entry_Queue_Length:: 
467 * Max_Protected_Entries:: 
468 * Max_Select_Alternatives:: 
469 * Max_Storage_At_Blocking:: 
470 * Max_Task_Entries:: 
471 * Max_Tasks:: 
472 * No_Abort_Statements:: 
473 * No_Access_Parameter_Allocators:: 
474 * No_Access_Subprograms:: 
475 * No_Allocators:: 
476 * No_Anonymous_Allocators:: 
477 * No_Asynchronous_Control:: 
478 * No_Calendar:: 
479 * No_Coextensions:: 
480 * No_Default_Initialization:: 
481 * No_Delay:: 
482 * No_Dependence:: 
483 * No_Direct_Boolean_Operators:: 
484 * No_Dispatch:: 
485 * No_Dispatching_Calls:: 
486 * No_Dynamic_Attachment:: 
487 * No_Dynamic_Priorities:: 
488 * No_Entry_Calls_In_Elaboration_Code:: 
489 * No_Enumeration_Maps:: 
490 * No_Exception_Handlers:: 
491 * No_Exception_Propagation:: 
492 * No_Exception_Registration:: 
493 * No_Exceptions:: 
494 * No_Finalization:: 
495 * No_Fixed_Point:: 
496 * No_Floating_Point:: 
497 * No_Implicit_Conditionals:: 
498 * No_Implicit_Dynamic_Code:: 
499 * No_Implicit_Heap_Allocations:: 
500 * No_Implicit_Protected_Object_Allocations:: 
501 * No_Implicit_Task_Allocations:: 
502 * No_Initialize_Scalars:: 
503 * No_IO:: 
504 * No_Local_Allocators:: 
505 * No_Local_Protected_Objects:: 
506 * No_Local_Tagged_Types:: 
507 * No_Local_Timing_Events:: 
508 * No_Long_Long_Integers:: 
509 * No_Multiple_Elaboration:: 
510 * No_Nested_Finalization:: 
511 * No_Protected_Type_Allocators:: 
512 * No_Protected_Types:: 
513 * No_Recursion:: 
514 * No_Reentrancy:: 
515 * No_Relative_Delay:: 
516 * No_Requeue_Statements:: 
517 * No_Secondary_Stack:: 
518 * No_Select_Statements:: 
519 * No_Specific_Termination_Handlers:: 
520 * No_Specification_of_Aspect:: 
521 * No_Standard_Allocators_After_Elaboration:: 
522 * No_Standard_Storage_Pools:: 
523 * No_Stream_Optimizations:: 
524 * No_Streams:: 
525 * No_Tagged_Type_Registration:: 
526 * No_Task_Allocators:: 
527 * No_Task_At_Interrupt_Priority:: 
528 * No_Task_Attributes_Package:: 
529 * No_Task_Hierarchy:: 
530 * No_Task_Termination:: 
531 * No_Tasking:: 
532 * No_Terminate_Alternatives:: 
533 * No_Unchecked_Access:: 
534 * No_Unchecked_Conversion:: 
535 * No_Unchecked_Deallocation:: 
536 * No_Use_Of_Attribute:: 
537 * No_Use_Of_Entity:: 
538 * No_Use_Of_Pragma:: 
539 * Pure_Barriers:: 
540 * Simple_Barriers:: 
541 * Static_Priorities:: 
542 * Static_Storage_Size:: 
544 Program Unit Level Restrictions
546 * No_Elaboration_Code:: 
547 * No_Dynamic_Accessibility_Checks:: 
548 * No_Dynamic_Sized_Objects:: 
549 * No_Entry_Queue:: 
550 * No_Implementation_Aspect_Specifications:: 
551 * No_Implementation_Attributes:: 
552 * No_Implementation_Identifiers:: 
553 * No_Implementation_Pragmas:: 
554 * No_Implementation_Restrictions:: 
555 * No_Implementation_Units:: 
556 * No_Implicit_Aliasing:: 
557 * No_Implicit_Loops:: 
558 * No_Obsolescent_Features:: 
559 * No_Wide_Characters:: 
560 * Static_Dispatch_Tables:: 
561 * SPARK_05:: 
563 Implementation Advice
565 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
566 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
567 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
568 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
569 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
570 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
571 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
572 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
573 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
574 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
575 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
576 * RM 9.6(30-31); Duration’Small: RM 9 6 30-31 Duration’Small. 
577 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
578 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
579 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
580 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
581 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
582 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
583 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
584 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
585 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
586 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
587 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
588 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
589 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
590 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
591 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
592 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
593 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
594 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
595 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
596 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes. 
597 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
598 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
599 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
600 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
601 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
602 * RM A.18; Containers: RM A 18 Containers. 
603 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
604 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
605 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
606 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
607 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
608 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
609 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
610 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
611 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
612 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
613 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
614 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
615 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
616 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
617 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
618 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
619 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
620 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
621 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
622 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
623 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
624 * RM G; Numerics: RM G Numerics. 
625 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
626 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
627 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
628 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
629 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
631 Intrinsic Subprograms
633 * Intrinsic Operators:: 
634 * Compilation_ISO_Date:: 
635 * Compilation_Date:: 
636 * Compilation_Time:: 
637 * Enclosing_Entity:: 
638 * Exception_Information:: 
639 * Exception_Message:: 
640 * Exception_Name:: 
641 * File:: 
642 * Line:: 
643 * Shifts and Rotates:: 
644 * Source_Location:: 
646 Representation Clauses and Pragmas
648 * Alignment Clauses:: 
649 * Size Clauses:: 
650 * Storage_Size Clauses:: 
651 * Size of Variant Record Objects:: 
652 * Biased Representation:: 
653 * Value_Size and Object_Size Clauses:: 
654 * Component_Size Clauses:: 
655 * Bit_Order Clauses:: 
656 * Effect of Bit_Order on Byte Ordering:: 
657 * Pragma Pack for Arrays:: 
658 * Pragma Pack for Records:: 
659 * Record Representation Clauses:: 
660 * Handling of Records with Holes:: 
661 * Enumeration Clauses:: 
662 * Address Clauses:: 
663 * Use of Address Clauses for Memory-Mapped I/O:: 
664 * Effect of Convention on Representation:: 
665 * Conventions and Anonymous Access Types:: 
666 * Determining the Representations chosen by GNAT:: 
668 The Implementation of Standard I/O
670 * Standard I/O Packages:: 
671 * FORM Strings:: 
672 * Direct_IO:: 
673 * Sequential_IO:: 
674 * Text_IO:: 
675 * Wide_Text_IO:: 
676 * Wide_Wide_Text_IO:: 
677 * Stream_IO:: 
678 * Text Translation:: 
679 * Shared Files:: 
680 * Filenames encoding:: 
681 * File content encoding:: 
682 * Open Modes:: 
683 * Operations on C Streams:: 
684 * Interfacing to C Streams:: 
686 Text_IO
688 * Stream Pointer Positioning:: 
689 * Reading and Writing Non-Regular Files:: 
690 * Get_Immediate:: 
691 * Treating Text_IO Files as Streams:: 
692 * Text_IO Extensions:: 
693 * Text_IO Facilities for Unbounded Strings:: 
695 Wide_Text_IO
697 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
698 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
700 Wide_Wide_Text_IO
702 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
703 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
705 The GNAT Library
707 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
708 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
709 * Ada.Characters.Wide_Latin_9 (a-cwila9.ads): Ada Characters Wide_Latin_9 a-cwila9 ads. 
710 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
711 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
712 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
713 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
714 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
715 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
716 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
717 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
718 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
719 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
720 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
721 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
722 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
723 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
724 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
725 * Ada.Task_Initialization (a-tasini.ads): Ada Task_Initialization a-tasini ads. 
726 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
727 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
728 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
729 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
730 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
731 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
732 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
733 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
734 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
735 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
736 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
737 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
738 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
739 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
740 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
741 * GNAT.Binary_Search (g-binsea.ads): GNAT Binary_Search g-binsea ads. 
742 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
743 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads. 
744 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
745 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
746 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
747 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
748 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
749 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
750 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
751 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
752 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
753 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
754 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
755 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
756 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
757 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
758 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
759 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
760 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
761 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
762 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
763 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
764 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
765 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
766 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
767 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
768 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
769 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
770 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
771 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
772 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
773 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
774 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads. 
775 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
776 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
777 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
778 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
779 * GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads): GNAT Generic_Fast_Math_Functions g-gfmafu ads. 
780 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
781 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
782 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
783 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
784 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
785 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
786 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
787 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
788 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
789 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
790 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
791 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
792 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
793 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
794 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
795 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
796 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
797 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
798 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
799 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
800 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
801 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
802 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
803 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
804 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
805 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
806 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
807 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
808 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
809 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
810 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
811 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
812 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
813 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
814 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
815 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
816 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
817 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
818 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
819 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
820 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
821 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
822 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
823 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
824 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
825 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
826 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
827 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
828 * GNAT.UTF_32 (g-utf_32.ads): GNAT UTF_32 g-utf_32 ads. 
829 * GNAT.UTF_32_Spelling_Checker (g-u3spch.ads): GNAT UTF_32_Spelling_Checker g-u3spch ads. 
830 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
831 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
832 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
833 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
834 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
835 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
836 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
837 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
838 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
839 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
840 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
841 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
842 * System.Memory (s-memory.ads): System Memory s-memory ads. 
843 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
844 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
845 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
846 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
847 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
848 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
849 * System.Rident (s-rident.ads): System Rident s-rident ads. 
850 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
851 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
852 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
853 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
855 Interfacing to Other Languages
857 * Interfacing to C:: 
858 * Interfacing to C++:: 
859 * Interfacing to COBOL:: 
860 * Interfacing to Fortran:: 
861 * Interfacing to non-GNAT Ada code:: 
863 Implementation of Specific Ada Features
865 * Machine Code Insertions:: 
866 * GNAT Implementation of Tasking:: 
867 * GNAT Implementation of Shared Passive Packages:: 
868 * Code Generation for Array Aggregates:: 
869 * The Size of Discriminated Records with Default Discriminants:: 
870 * Image Values For Nonscalar Types:: 
871 * Strict Conformance to the Ada Reference Manual:: 
873 GNAT Implementation of Tasking
875 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
876 * Ensuring Compliance with the Real-Time Annex:: 
877 * Support for Locking Policies:: 
879 Code Generation for Array Aggregates
881 * Static constant aggregates with static bounds:: 
882 * Constant aggregates with unconstrained nominal types:: 
883 * Aggregates with static bounds:: 
884 * Aggregates with nonstatic bounds:: 
885 * Aggregates in assignment statements:: 
887 GNAT language extensions
889 * How to activate the extended GNAT Ada superset:: 
890 * Curated Extensions:: 
891 * Experimental Language Extensions:: 
893 Curated Extensions
895 * Local Declarations Without Block:: 
896 * Conditional when constructs:: 
897 * Fixed lower bounds for array types and subtypes:: 
898 * Prefixed-view notation for calls to primitive subprograms of untagged types:: 
899 * Expression defaults for generic formal functions:: 
900 * String interpolation:: 
901 * Constrained attribute for generic objects:: 
902 * Static aspect on intrinsic functions:: 
904 Experimental Language Extensions
906 * Storage Model:: 
907 * Attribute Super:: 
908 * Simpler accessibility model:: 
909 * Case pattern matching:: 
910 * Mutably Tagged Types with Size’Class Aspect:: 
911 * Generalized Finalization:: 
913 Security Hardening Features
915 * Register Scrubbing:: 
916 * Stack Scrubbing:: 
917 * Hardened Conditionals:: 
918 * Hardened Booleans:: 
919 * Control Flow Redundancy:: 
921 Obsolescent Features
923 * pragma No_Run_Time:: 
924 * pragma Ravenscar:: 
925 * pragma Restricted_Run_Time:: 
926 * pragma Task_Info:: 
927 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
929 Compatibility and Porting Guide
931 * Writing Portable Fixed-Point Declarations:: 
932 * Compatibility with Ada 83:: 
933 * Compatibility between Ada 95 and Ada 2005:: 
934 * Implementation-dependent characteristics:: 
935 * Compatibility with Other Ada Systems:: 
936 * Representation Clauses:: 
937 * Compatibility with HP Ada 83:: 
939 Compatibility with Ada 83
941 * Legal Ada 83 programs that are illegal in Ada 95:: 
942 * More deterministic semantics:: 
943 * Changed semantics:: 
944 * Other language compatibility issues:: 
946 Implementation-dependent characteristics
948 * Implementation-defined pragmas:: 
949 * Implementation-defined attributes:: 
950 * Libraries:: 
951 * Elaboration order:: 
952 * Target-specific aspects:: 
954 @end detailmenu
955 @end menu
957 @node About This Guide,Implementation Defined Pragmas,Top,Top
958 @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}
959 @chapter About This Guide
963 This manual contains useful information in writing programs using the
964 GNAT compiler.  It includes information on implementation dependent
965 characteristics of GNAT, including all the information required by
966 Annex M of the Ada language standard.
968 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
969 invoked in Ada 83 compatibility mode.
970 By default, GNAT assumes Ada 2012,
971 but you can override with a compiler switch
972 to explicitly specify the language version.
973 (Please refer to the `GNAT User’s Guide' for details on these switches.)
974 Throughout this manual, references to ‘Ada’ without a year suffix
975 apply to all the Ada versions of the language.
977 Ada is designed to be highly portable.
978 In general, a program will have the same effect even when compiled by
979 different compilers on different platforms.
980 However, since Ada is designed to be used in a
981 wide variety of applications, it also contains a number of system
982 dependent features to be used in interfacing to the external world.
984 @geindex Implementation-dependent features
986 @geindex Portability
988 Note: Any program that makes use of implementation-dependent features
989 may be non-portable.  You should follow good programming practice and
990 isolate and clearly document any sections of your program that make use
991 of these features in a non-portable manner.
993 @menu
994 * What This Reference Manual Contains:: 
995 * Conventions:: 
996 * Related Information:: 
998 @end menu
1000 @node What This Reference Manual Contains,Conventions,,About This Guide
1001 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
1002 @section What This Reference Manual Contains
1005 This reference manual contains the following chapters:
1008 @itemize *
1010 @item 
1011 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
1012 pragmas, which can be used to extend and enhance the functionality of the
1013 compiler.
1015 @item 
1016 @ref{8,,Implementation Defined Attributes}, lists GNAT
1017 implementation-dependent attributes, which can be used to extend and
1018 enhance the functionality of the compiler.
1020 @item 
1021 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
1022 implementation-dependent restrictions, which can be used to extend and
1023 enhance the functionality of the compiler.
1025 @item 
1026 @ref{a,,Implementation Advice}, provides information on generally
1027 desirable behavior which are not requirements that all compilers must
1028 follow since it cannot be provided on all systems, or which may be
1029 undesirable on some systems.
1031 @item 
1032 @ref{b,,Implementation Defined Characteristics}, provides a guide to
1033 minimizing implementation dependent features.
1035 @item 
1036 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
1037 implemented by GNAT, and how they can be imported into user
1038 application programs.
1040 @item 
1041 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
1042 way that GNAT represents data, and in particular the exact set
1043 of representation clauses and pragmas that is accepted.
1045 @item 
1046 @ref{e,,Standard Library Routines}, provides a listing of packages and a
1047 brief description of the functionality that is provided by Ada’s
1048 extensive set of standard library routines as implemented by GNAT.
1050 @item 
1051 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
1052 implementation of the input-output facilities.
1054 @item 
1055 @ref{10,,The GNAT Library}, is a catalog of packages that complement
1056 the Ada predefined library.
1058 @item 
1059 @ref{11,,Interfacing to Other Languages}, describes how programs
1060 written in Ada using GNAT can be interfaced to other programming
1061 languages.
1063 @item 
1064 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
1065 of the specialized needs annexes.
1067 @item 
1068 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1069 to GNAT’s implementation of machine code insertions, tasking, and several
1070 other features.
1072 @item 
1073 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1074 GNAT implementation of the Ada 2012 language standard.
1076 @item 
1077 @ref{15,,Security Hardening Features} documents GNAT extensions aimed
1078 at security hardening.
1080 @item 
1081 @ref{16,,Obsolescent Features} documents implementation dependent features,
1082 including pragmas and attributes, which are considered obsolescent, since
1083 there are other preferred ways of achieving the same results. These
1084 obsolescent forms are retained for backwards compatibility.
1086 @item 
1087 @ref{17,,Compatibility and Porting Guide} presents some guidelines for
1088 developing portable Ada code, describes the compatibility issues that
1089 may arise between GNAT and other Ada compilation systems (including those
1090 for Ada 83), and shows how GNAT can expedite porting applications
1091 developed in other Ada environments.
1093 @item 
1094 @ref{1,,GNU Free Documentation License} contains the license for this document.
1095 @end itemize
1097 @geindex Ada 95 Language Reference Manual
1099 @geindex Ada 2005 Language Reference Manual
1101 This reference manual assumes a basic familiarity with the Ada 95 language, as
1102 described in the
1103 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1104 It does not require knowledge of the new features introduced by Ada 2005 or
1105 Ada 2012.
1106 All three reference manuals are included in the GNAT documentation
1107 package.
1109 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1110 @anchor{gnat_rm/about_this_guide conventions}@anchor{18}
1111 @section Conventions
1114 @geindex Conventions
1115 @geindex typographical
1117 @geindex Typographical conventions
1119 Following are examples of the typographical and graphic conventions used
1120 in this guide:
1123 @itemize *
1125 @item 
1126 @code{Functions}, @code{utility program names}, @code{standard names},
1127 and @code{classes}.
1129 @item 
1130 @code{Option flags}
1132 @item 
1133 @code{File names}
1135 @item 
1136 @code{Variables}
1138 @item 
1139 `Emphasis'
1141 @item 
1142 [optional information or parameters]
1144 @item 
1145 Examples are described by text
1147 @example
1148 and then shown this way.
1149 @end example
1151 @item 
1152 Commands that are entered by the user are shown as preceded by a prompt string
1153 comprising the @code{$} character followed by a space.
1154 @end itemize
1156 @node Related Information,,Conventions,About This Guide
1157 @anchor{gnat_rm/about_this_guide related-information}@anchor{19}
1158 @section Related Information
1161 See the following documents for further information on GNAT:
1164 @itemize *
1166 @item 
1167 @cite{GNAT User’s Guide for Native Platforms},
1168 which provides information on how to use the
1169 GNAT development environment.
1171 @item 
1172 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1174 @item 
1175 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1176 of the Ada 95 standard.  The annotations describe
1177 detailed aspects of the design decision, and in particular contain useful
1178 sections on Ada 83 compatibility.
1180 @item 
1181 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1183 @item 
1184 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1185 of the Ada 2005 standard.  The annotations describe
1186 detailed aspects of the design decision.
1188 @item 
1189 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1191 @item 
1192 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1193 which contains specific information on compatibility between GNAT and
1194 DEC Ada 83 systems.
1196 @item 
1197 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1198 describes in detail the pragmas and attributes provided by the DEC Ada 83
1199 compiler system.
1200 @end itemize
1202 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1203 @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}
1204 @chapter Implementation Defined Pragmas
1207 Ada defines a set of pragmas that can be used to supply additional
1208 information to the compiler.  These language defined pragmas are
1209 implemented in GNAT and work as described in the Ada Reference Manual.
1211 In addition, Ada allows implementations to define additional pragmas
1212 whose meaning is defined by the implementation.  GNAT provides a number
1213 of these implementation-defined pragmas, which can be used to extend
1214 and enhance the functionality of the compiler.  This section of the GNAT
1215 Reference Manual describes these additional pragmas.
1217 Note that any program using these pragmas might not be portable to other
1218 compilers (although GNAT implements this set of pragmas on all
1219 platforms).  Therefore if portability to other compilers is an important
1220 consideration, the use of these pragmas should be minimized.
1222 @menu
1223 * Pragma Abort_Defer:: 
1224 * Pragma Abstract_State:: 
1225 * Pragma Ada_83:: 
1226 * Pragma Ada_95:: 
1227 * Pragma Ada_05:: 
1228 * Pragma Ada_2005:: 
1229 * Pragma Ada_12:: 
1230 * Pragma Ada_2012:: 
1231 * Pragma Ada_2022:: 
1232 * Pragma Aggregate_Individually_Assign:: 
1233 * Pragma Allow_Integer_Address:: 
1234 * Pragma Always_Terminates:: 
1235 * Pragma Annotate:: 
1236 * Pragma Assert:: 
1237 * Pragma Assert_And_Cut:: 
1238 * Pragma Assertion_Policy:: 
1239 * Pragma Assume:: 
1240 * Pragma Assume_No_Invalid_Values:: 
1241 * Pragma Async_Readers:: 
1242 * Pragma Async_Writers:: 
1243 * Pragma Attribute_Definition:: 
1244 * Pragma C_Pass_By_Copy:: 
1245 * Pragma Check:: 
1246 * Pragma Check_Float_Overflow:: 
1247 * Pragma Check_Name:: 
1248 * Pragma Check_Policy:: 
1249 * Pragma Comment:: 
1250 * Pragma Common_Object:: 
1251 * Pragma Compile_Time_Error:: 
1252 * Pragma Compile_Time_Warning:: 
1253 * Pragma Complete_Representation:: 
1254 * Pragma Complex_Representation:: 
1255 * Pragma Component_Alignment:: 
1256 * Pragma Constant_After_Elaboration:: 
1257 * Pragma Contract_Cases:: 
1258 * Pragma Convention_Identifier:: 
1259 * Pragma CPP_Class:: 
1260 * Pragma CPP_Constructor:: 
1261 * Pragma CPP_Virtual:: 
1262 * Pragma CPP_Vtable:: 
1263 * Pragma CPU:: 
1264 * Pragma Deadline_Floor:: 
1265 * Pragma Debug:: 
1266 * Pragma Debug_Policy:: 
1267 * Pragma Default_Initial_Condition:: 
1268 * Pragma Default_Scalar_Storage_Order:: 
1269 * Pragma Default_Storage_Pool:: 
1270 * Pragma Depends:: 
1271 * Pragma Detect_Blocking:: 
1272 * Pragma Disable_Atomic_Synchronization:: 
1273 * Pragma Dispatching_Domain:: 
1274 * Pragma Effective_Reads:: 
1275 * Pragma Effective_Writes:: 
1276 * Pragma Elaboration_Checks:: 
1277 * Pragma Eliminate:: 
1278 * Pragma Enable_Atomic_Synchronization:: 
1279 * Pragma Exceptional_Cases:: 
1280 * Pragma Export_Function:: 
1281 * Pragma Export_Object:: 
1282 * Pragma Export_Procedure:: 
1283 * Pragma Export_Valued_Procedure:: 
1284 * Pragma Extend_System:: 
1285 * Pragma Extensions_Allowed:: 
1286 * Pragma Extensions_Visible:: 
1287 * Pragma External:: 
1288 * Pragma External_Name_Casing:: 
1289 * Pragma Fast_Math:: 
1290 * Pragma Favor_Top_Level:: 
1291 * Pragma Finalize_Storage_Only:: 
1292 * Pragma Float_Representation:: 
1293 * Pragma Ghost:: 
1294 * Pragma Global:: 
1295 * Pragma Ident:: 
1296 * Pragma Ignore_Pragma:: 
1297 * Pragma Implementation_Defined:: 
1298 * Pragma Implemented:: 
1299 * Pragma Implicit_Packing:: 
1300 * Pragma Import_Function:: 
1301 * Pragma Import_Object:: 
1302 * Pragma Import_Procedure:: 
1303 * Pragma Import_Valued_Procedure:: 
1304 * Pragma Independent:: 
1305 * Pragma Independent_Components:: 
1306 * Pragma Initial_Condition:: 
1307 * Pragma Initialize_Scalars:: 
1308 * Pragma Initializes:: 
1309 * Pragma Inline_Always:: 
1310 * Pragma Inline_Generic:: 
1311 * Pragma Interface:: 
1312 * Pragma Interface_Name:: 
1313 * Pragma Interrupt_Handler:: 
1314 * Pragma Interrupt_State:: 
1315 * Pragma Interrupts_System_By_Default:: 
1316 * Pragma Invariant:: 
1317 * Pragma Keep_Names:: 
1318 * Pragma License:: 
1319 * Pragma Link_With:: 
1320 * Pragma Linker_Alias:: 
1321 * Pragma Linker_Constructor:: 
1322 * Pragma Linker_Destructor:: 
1323 * Pragma Linker_Section:: 
1324 * Pragma Lock_Free:: 
1325 * Pragma Loop_Invariant:: 
1326 * Pragma Loop_Optimize:: 
1327 * Pragma Loop_Variant:: 
1328 * Pragma Machine_Attribute:: 
1329 * Pragma Main:: 
1330 * Pragma Main_Storage:: 
1331 * Pragma Max_Queue_Length:: 
1332 * Pragma No_Body:: 
1333 * Pragma No_Caching:: 
1334 * Pragma No_Component_Reordering:: 
1335 * Pragma No_Elaboration_Code_All:: 
1336 * Pragma No_Heap_Finalization:: 
1337 * Pragma No_Inline:: 
1338 * Pragma No_Return:: 
1339 * Pragma No_Strict_Aliasing:: 
1340 * Pragma No_Tagged_Streams:: 
1341 * Pragma Normalize_Scalars:: 
1342 * Pragma Obsolescent:: 
1343 * Pragma Optimize_Alignment:: 
1344 * Pragma Ordered:: 
1345 * Pragma Overflow_Mode:: 
1346 * Pragma Overriding_Renamings:: 
1347 * Pragma Part_Of:: 
1348 * Pragma Partition_Elaboration_Policy:: 
1349 * Pragma Passive:: 
1350 * Pragma Persistent_BSS:: 
1351 * Pragma Post:: 
1352 * Pragma Postcondition:: 
1353 * Pragma Post_Class:: 
1354 * Pragma Pre:: 
1355 * Pragma Precondition:: 
1356 * Pragma Predicate:: 
1357 * Pragma Predicate_Failure:: 
1358 * Pragma Preelaborable_Initialization:: 
1359 * Pragma Prefix_Exception_Messages:: 
1360 * Pragma Pre_Class:: 
1361 * Pragma Priority_Specific_Dispatching:: 
1362 * Pragma Profile:: 
1363 * Pragma Profile_Warnings:: 
1364 * Pragma Propagate_Exceptions:: 
1365 * Pragma Provide_Shift_Operators:: 
1366 * Pragma Psect_Object:: 
1367 * Pragma Pure_Function:: 
1368 * Pragma Rational:: 
1369 * Pragma Ravenscar:: 
1370 * Pragma Refined_Depends:: 
1371 * Pragma Refined_Global:: 
1372 * Pragma Refined_Post:: 
1373 * Pragma Refined_State:: 
1374 * Pragma Relative_Deadline:: 
1375 * Pragma Remote_Access_Type:: 
1376 * Pragma Rename_Pragma:: 
1377 * Pragma Restricted_Run_Time:: 
1378 * Pragma Restriction_Warnings:: 
1379 * Pragma Reviewable:: 
1380 * Pragma Secondary_Stack_Size:: 
1381 * Pragma Share_Generic:: 
1382 * Pragma Shared:: 
1383 * Pragma Short_Circuit_And_Or:: 
1384 * Pragma Short_Descriptors:: 
1385 * Pragma Side_Effects:: 
1386 * Pragma Simple_Storage_Pool_Type:: 
1387 * Pragma Source_File_Name:: 
1388 * Pragma Source_File_Name_Project:: 
1389 * Pragma Source_Reference:: 
1390 * Pragma SPARK_Mode:: 
1391 * Pragma Static_Elaboration_Desired:: 
1392 * Pragma Stream_Convert:: 
1393 * Pragma Style_Checks:: 
1394 * Pragma Subprogram_Variant:: 
1395 * Pragma Subtitle:: 
1396 * Pragma Suppress:: 
1397 * Pragma Suppress_All:: 
1398 * Pragma Suppress_Debug_Info:: 
1399 * Pragma Suppress_Exception_Locations:: 
1400 * Pragma Suppress_Initialization:: 
1401 * Pragma Task_Name:: 
1402 * Pragma Task_Storage:: 
1403 * Pragma Test_Case:: 
1404 * Pragma Thread_Local_Storage:: 
1405 * Pragma Time_Slice:: 
1406 * Pragma Title:: 
1407 * Pragma Type_Invariant:: 
1408 * Pragma Type_Invariant_Class:: 
1409 * Pragma Unchecked_Union:: 
1410 * Pragma Unevaluated_Use_Of_Old:: 
1411 * Pragma User_Aspect_Definition:: 
1412 * Pragma Unimplemented_Unit:: 
1413 * Pragma Universal_Aliasing:: 
1414 * Pragma Unmodified:: 
1415 * Pragma Unreferenced:: 
1416 * Pragma Unreferenced_Objects:: 
1417 * Pragma Unreserve_All_Interrupts:: 
1418 * Pragma Unsuppress:: 
1419 * Pragma Unused:: 
1420 * Pragma Use_VADS_Size:: 
1421 * Pragma Validity_Checks:: 
1422 * Pragma Volatile:: 
1423 * Pragma Volatile_Full_Access:: 
1424 * Pragma Volatile_Function:: 
1425 * Pragma Warning_As_Error:: 
1426 * Pragma Warnings:: 
1427 * Pragma Weak_External:: 
1428 * Pragma Wide_Character_Encoding:: 
1430 @end menu
1432 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1433 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1c}
1434 @section Pragma Abort_Defer
1437 @geindex Deferring aborts
1439 Syntax:
1441 @example
1442 pragma Abort_Defer;
1443 @end example
1445 This pragma must appear at the start of the statement sequence of a
1446 handled sequence of statements (right after the @code{begin}).  It has
1447 the effect of deferring aborts for the sequence of statements (but not
1448 for the declarations or handlers, if any, associated with this statement
1449 sequence). This can also be useful for adding a polling point in Ada code,
1450 where asynchronous abort of tasks is checked when leaving the statement
1451 sequence, and is lighter than, for example, using @code{delay 0.0;}, since with
1452 zero-cost exception handling, propagating exceptions (implicitly used to
1453 implement task abort) cannot be done reliably in an asynchronous way.
1455 An example of usage would be:
1457 @example
1458 --  Add a polling point to check for task aborts
1460 begin
1461    pragma Abort_Defer;
1462 end;
1463 @end example
1465 @node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
1466 @anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}@anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1e}
1467 @section Pragma Abstract_State
1470 Syntax:
1472 @example
1473 pragma Abstract_State (ABSTRACT_STATE_LIST);
1475 ABSTRACT_STATE_LIST ::=
1476      null
1477   |  STATE_NAME_WITH_OPTIONS
1478   | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1480 STATE_NAME_WITH_OPTIONS ::=
1481      STATE_NAME
1482   | (STATE_NAME with OPTION_LIST)
1484 OPTION_LIST ::= OPTION @{, OPTION@}
1486 OPTION ::=
1487     SIMPLE_OPTION
1488   | NAME_VALUE_OPTION
1490 SIMPLE_OPTION ::= Ghost | Synchronous
1492 NAME_VALUE_OPTION ::=
1493     Part_Of => ABSTRACT_STATE
1494   | External [=> EXTERNAL_PROPERTY_LIST]
1496 EXTERNAL_PROPERTY_LIST ::=
1497      EXTERNAL_PROPERTY
1498   | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
1500 EXTERNAL_PROPERTY ::=
1501     Async_Readers    [=> static_boolean_EXPRESSION]
1502   | Async_Writers    [=> static_boolean_EXPRESSION]
1503   | Effective_Reads  [=> static_boolean_EXPRESSION]
1504   | Effective_Writes [=> static_boolean_EXPRESSION]
1505     others            => static_boolean_EXPRESSION
1507 STATE_NAME ::= defining_identifier
1509 ABSTRACT_STATE ::= name
1510 @end example
1512 For the semantics of this pragma, see the entry for aspect @code{Abstract_State} in
1513 the SPARK 2014 Reference Manual, section 7.1.4.
1515 @node Pragma Ada_83,Pragma Ada_95,Pragma Abstract_State,Implementation Defined Pragmas
1516 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{1f}
1517 @section Pragma Ada_83
1520 Syntax:
1522 @example
1523 pragma Ada_83;
1524 @end example
1526 A configuration pragma that establishes Ada 83 mode for the unit to
1527 which it applies, regardless of the mode set by the command line
1528 switches.  In Ada 83 mode, GNAT attempts to be as compatible with
1529 the syntax and semantics of Ada 83, as defined in the original Ada
1530 83 Reference Manual as possible.  In particular, the keywords added by Ada 95
1531 and Ada 2005 are not recognized, optional package bodies are allowed,
1532 and generics may name types with unknown discriminants without using
1533 the @code{(<>)} notation.  In addition, some but not all of the additional
1534 restrictions of Ada 83 are enforced.
1536 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
1537 Ada 83 code to be compiled and adapted to GNAT with less effort.
1538 Secondly, it aids in keeping code backwards compatible with Ada 83.
1539 However, there is no guarantee that code that is processed correctly
1540 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1541 83 compiler, since GNAT does not enforce all the additional checks
1542 required by Ada 83.
1544 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1545 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{20}
1546 @section Pragma Ada_95
1549 Syntax:
1551 @example
1552 pragma Ada_95;
1553 @end example
1555 A configuration pragma that establishes Ada 95 mode for the unit to which
1556 it applies, regardless of the mode set by the command line switches.
1557 This mode is set automatically for the @code{Ada} and @code{System}
1558 packages and their children, so you need not specify it in these
1559 contexts.  This pragma is useful when writing a reusable component that
1560 itself uses Ada 95 features, but which is intended to be usable from
1561 either Ada 83 or Ada 95 programs.
1563 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1564 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{21}
1565 @section Pragma Ada_05
1568 Syntax:
1570 @example
1571 pragma Ada_05;
1572 pragma Ada_05 (local_NAME);
1573 @end example
1575 A configuration pragma that establishes Ada 2005 mode for the unit to which
1576 it applies, regardless of the mode set by the command line switches.
1577 This pragma is useful when writing a reusable component that
1578 itself uses Ada 2005 features, but which is intended to be usable from
1579 either Ada 83 or Ada 95 programs.
1581 The one argument form (which is not a configuration pragma)
1582 is used for managing the transition from
1583 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1584 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1585 mode will generate a warning. In addition, in Ada_83 or Ada_95
1586 mode, a preference rule is established which does not choose
1587 such an entity unless it is unambiguously specified. This avoids
1588 extra subprograms marked this way from generating ambiguities in
1589 otherwise legal pre-Ada_2005 programs. The one argument form is
1590 intended for exclusive use in the GNAT run-time library.
1592 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1593 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{22}
1594 @section Pragma Ada_2005
1597 Syntax:
1599 @example
1600 pragma Ada_2005;
1601 @end example
1603 This configuration pragma is a synonym for pragma Ada_05 and has the
1604 same syntax and effect.
1606 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1607 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{23}
1608 @section Pragma Ada_12
1611 Syntax:
1613 @example
1614 pragma Ada_12;
1615 pragma Ada_12 (local_NAME);
1616 @end example
1618 A configuration pragma that establishes Ada 2012 mode for the unit to which
1619 it applies, regardless of the mode set by the command line switches.
1620 This mode is set automatically for the @code{Ada} and @code{System}
1621 packages and their children, so you need not specify it in these
1622 contexts.  This pragma is useful when writing a reusable component that
1623 itself uses Ada 2012 features, but which is intended to be usable from
1624 Ada 83, Ada 95, or Ada 2005 programs.
1626 The one argument form, which is not a configuration pragma,
1627 is used for managing the transition from Ada
1628 2005 to Ada 2012 in the run-time library. If an entity is marked
1629 as Ada_2012 only, then referencing the entity in any pre-Ada_2012
1630 mode will generate a warning. In addition, in any pre-Ada_2012
1631 mode, a preference rule is established which does not choose
1632 such an entity unless it is unambiguously specified. This avoids
1633 extra subprograms marked this way from generating ambiguities in
1634 otherwise legal pre-Ada_2012 programs. The one argument form is
1635 intended for exclusive use in the GNAT run-time library.
1637 @node Pragma Ada_2012,Pragma Ada_2022,Pragma Ada_12,Implementation Defined Pragmas
1638 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{24}
1639 @section Pragma Ada_2012
1642 Syntax:
1644 @example
1645 pragma Ada_2012;
1646 @end example
1648 This configuration pragma is a synonym for pragma Ada_12 and has the
1649 same syntax and effect.
1651 @node Pragma Ada_2022,Pragma Aggregate_Individually_Assign,Pragma Ada_2012,Implementation Defined Pragmas
1652 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2022}@anchor{25}
1653 @section Pragma Ada_2022
1656 Syntax:
1658 @example
1659 pragma Ada_2022;
1660 pragma Ada_2022 (local_NAME);
1661 @end example
1663 A configuration pragma that establishes Ada 2022 mode for the unit to which
1664 it applies, regardless of the mode set by the command line switches.
1665 This mode is set automatically for the @code{Ada} and @code{System}
1666 packages and their children, so you need not specify it in these
1667 contexts.  This pragma is useful when writing a reusable component that
1668 itself uses Ada 2022 features, but which is intended to be usable from
1669 Ada 83, Ada 95, Ada 2005 or Ada 2012 programs.
1671 The one argument form, which is not a configuration pragma,
1672 is used for managing the transition from Ada
1673 2012 to Ada 2022 in the run-time library. If an entity is marked
1674 as Ada_2022 only, then referencing the entity in any pre-Ada_2022
1675 mode will generate a warning. In addition, in any pre-Ada_2012
1676 mode, a preference rule is established which does not choose
1677 such an entity unless it is unambiguously specified. This avoids
1678 extra subprograms marked this way from generating ambiguities in
1679 otherwise legal pre-Ada_2022 programs. The one argument form is
1680 intended for exclusive use in the GNAT run-time library.
1682 @node Pragma Aggregate_Individually_Assign,Pragma Allow_Integer_Address,Pragma Ada_2022,Implementation Defined Pragmas
1683 @anchor{gnat_rm/implementation_defined_pragmas pragma-aggregate-individually-assign}@anchor{26}
1684 @section Pragma Aggregate_Individually_Assign
1687 Syntax:
1689 @example
1690 pragma Aggregate_Individually_Assign;
1691 @end example
1693 Where possible, GNAT will store the binary representation of a record aggregate
1694 in memory for space and performance reasons. This configuration pragma changes
1695 this behavior so that record aggregates are instead always converted into
1696 individual assignment statements.
1698 @node Pragma Allow_Integer_Address,Pragma Always_Terminates,Pragma Aggregate_Individually_Assign,Implementation Defined Pragmas
1699 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{27}
1700 @section Pragma Allow_Integer_Address
1703 Syntax:
1705 @example
1706 pragma Allow_Integer_Address;
1707 @end example
1709 In almost all versions of GNAT, @code{System.Address} is a private
1710 type in accordance with the implementation advice in the RM. This
1711 means that integer values,
1712 in particular integer literals, are not allowed as address values.
1713 If the configuration pragma
1714 @code{Allow_Integer_Address} is given, then integer expressions may
1715 be used anywhere a value of type @code{System.Address} is required.
1716 The effect is to introduce an implicit unchecked conversion from the
1717 integer value to type @code{System.Address}. The reverse case of using
1718 an address where an integer type is required is handled analogously.
1719 The following example compiles without errors:
1721 @example
1722 pragma Allow_Integer_Address;
1723 with System; use System;
1724 package AddrAsInt is
1725    X : Integer;
1726    Y : Integer;
1727    for X'Address use 16#1240#;
1728    for Y use at 16#3230#;
1729    m : Address := 16#4000#;
1730    n : constant Address := 4000;
1731    p : constant Address := Address (X + Y);
1732    v : Integer := y'Address;
1733    w : constant Integer := Integer (Y'Address);
1734    type R is new integer;
1735    RR : R := 1000;
1736    Z : Integer;
1737    for Z'Address use RR;
1738 end AddrAsInt;
1739 @end example
1741 Note that pragma @code{Allow_Integer_Address} is ignored if @code{System.Address}
1742 is not a private type. In implementations of @code{GNAT} where
1743 System.Address is a visible integer type,
1744 this pragma serves no purpose but is ignored
1745 rather than rejected to allow common sets of sources to be used
1746 in the two situations.
1748 @node Pragma Always_Terminates,Pragma Annotate,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1749 @anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{28}@anchor{gnat_rm/implementation_defined_pragmas pragma-always-terminates}@anchor{29}
1750 @section Pragma Always_Terminates
1753 Syntax:
1755 @example
1756 pragma Always_Terminates [ (boolean_EXPRESSION) ];
1757 @end example
1759 For the semantics of this pragma, see the entry for aspect @code{Always_Terminates}
1760 in the SPARK 2014 Reference Manual, section 6.1.10.
1762 @node Pragma Annotate,Pragma Assert,Pragma Always_Terminates,Implementation Defined Pragmas
1763 @anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{2a}@anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{2b}
1764 @section Pragma Annotate
1767 Syntax:
1769 @example
1770 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1772 ARG ::= NAME | EXPRESSION
1773 @end example
1775 This pragma is used to annotate programs.  IDENTIFIER identifies
1776 the type of annotation.  GNAT verifies that it is an identifier, but does
1777 not otherwise analyze it. The second optional identifier is also left
1778 unanalyzed, and by convention is used to control the action of the tool to
1779 which the annotation is addressed.  The remaining ARG arguments
1780 can be either string literals or more generally expressions.
1781 String literals (and concatenations of string literals) are assumed to be
1782 either of type
1783 @code{Standard.String} or else @code{Wide_String} or @code{Wide_Wide_String}
1784 depending on the character literals they contain.
1785 All other kinds of arguments are analyzed as expressions, and must be
1786 unambiguous. The last argument if present must have the identifier
1787 @code{Entity} and GNAT verifies that a local name is given.
1789 The analyzed pragma is retained in the tree, but not otherwise processed
1790 by any part of the GNAT compiler, except to generate corresponding note
1791 lines in the generated ALI file. For the format of these note lines, see
1792 the compiler source file lib-writ.ads. This pragma is intended for use by
1793 external tools, including ASIS. The use of pragma Annotate does not
1794 affect the compilation process in any way. This pragma may be used as
1795 a configuration pragma.
1797 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1798 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{2c}
1799 @section Pragma Assert
1802 Syntax:
1804 @example
1805 pragma Assert (
1806   boolean_EXPRESSION
1807   [, string_EXPRESSION]);
1808 @end example
1810 The effect of this pragma depends on whether the corresponding command
1811 line switch is set to activate assertions.  The pragma expands into code
1812 equivalent to the following:
1814 @example
1815 if assertions-enabled then
1816    if not boolean_EXPRESSION then
1817       System.Assertions.Raise_Assert_Failure
1818         (string_EXPRESSION);
1819    end if;
1820 end if;
1821 @end example
1823 The string argument, if given, is the message that will be associated
1824 with the exception occurrence if the exception is raised.  If no second
1825 argument is given, the default message is @code{file}:@code{nnn},
1826 where @code{file} is the name of the source file containing the assert,
1827 and @code{nnn} is the line number of the assert.
1829 Note that, as with the @code{if} statement to which it is equivalent, the
1830 type of the expression is either @code{Standard.Boolean}, or any type derived
1831 from this standard type.
1833 Assert checks can be either checked or ignored. By default they are ignored.
1834 They will be checked if either the command line switch `-gnata' is
1835 used, or if an @code{Assertion_Policy} or @code{Check_Policy} pragma is used
1836 to enable @code{Assert_Checks}.
1838 If assertions are ignored, then there
1839 is no run-time effect (and in particular, any side effects from the
1840 expression will not occur at run time).  (The expression is still
1841 analyzed at compile time, and may cause types to be frozen if they are
1842 mentioned here for the first time).
1844 If assertions are checked, then the given expression is tested, and if
1845 it is @code{False} then @code{System.Assertions.Raise_Assert_Failure} is called
1846 which results in the raising of @code{Assert_Failure} with the given message.
1848 You should generally avoid side effects in the expression arguments of
1849 this pragma, because these side effects will turn on and off with the
1850 setting of the assertions mode, resulting in assertions that have an
1851 effect on the program.  However, the expressions are analyzed for
1852 semantic correctness whether or not assertions are enabled, so turning
1853 assertions on and off cannot affect the legality of a program.
1855 Note that the implementation defined policy @code{DISABLE}, given in a
1856 pragma @code{Assertion_Policy}, can be used to suppress this semantic analysis.
1858 Note: this is a standard language-defined pragma in versions
1859 of Ada from 2005 on. In GNAT, it is implemented in all versions
1860 of Ada, and the DISABLE policy is an implementation-defined
1861 addition.
1863 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1864 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{2d}
1865 @section Pragma Assert_And_Cut
1868 Syntax:
1870 @example
1871 pragma Assert_And_Cut (
1872   boolean_EXPRESSION
1873   [, string_EXPRESSION]);
1874 @end example
1876 The effect of this pragma is identical to that of pragma @code{Assert},
1877 except that in an @code{Assertion_Policy} pragma, the identifier
1878 @code{Assert_And_Cut} is used to control whether it is ignored or checked
1879 (or disabled).
1881 The intention is that this be used within a subprogram when the
1882 given test expresion sums up all the work done so far in the
1883 subprogram, so that the rest of the subprogram can be verified
1884 (informally or formally) using only the entry preconditions,
1885 and the expression in this pragma. This allows dividing up
1886 a subprogram into sections for the purposes of testing or
1887 formal verification. The pragma also serves as useful
1888 documentation.
1890 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1891 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{2e}
1892 @section Pragma Assertion_Policy
1895 Syntax:
1897 @example
1898 pragma Assertion_Policy (CHECK | DISABLE | IGNORE | SUPPRESSIBLE);
1900 pragma Assertion_Policy (
1901     ASSERTION_KIND => POLICY_IDENTIFIER
1902  @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1904 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1906 RM_ASSERTION_KIND ::= Assert                    |
1907                       Static_Predicate          |
1908                       Dynamic_Predicate         |
1909                       Pre                       |
1910                       Pre'Class                 |
1911                       Post                      |
1912                       Post'Class                |
1913                       Type_Invariant            |
1914                       Type_Invariant'Class      |
1915                       Default_Initial_Condition
1917 ID_ASSERTION_KIND ::= Assertions           |
1918                       Assert_And_Cut       |
1919                       Assume               |
1920                       Contract_Cases       |
1921                       Debug                |
1922                       Ghost                |
1923                       Initial_Condition    |
1924                       Invariant            |
1925                       Invariant'Class      |
1926                       Loop_Invariant       |
1927                       Loop_Variant         |
1928                       Postcondition        |
1929                       Precondition         |
1930                       Predicate            |
1931                       Refined_Post         |
1932                       Statement_Assertions |
1933                       Subprogram_Variant
1935 POLICY_IDENTIFIER ::= Check | Disable | Ignore | Suppressible
1936 @end example
1938 This is a standard Ada 2012 pragma that is available as an
1939 implementation-defined pragma in earlier versions of Ada.
1940 The assertion kinds @code{RM_ASSERTION_KIND} are those defined in
1941 the Ada standard. The assertion kinds @code{ID_ASSERTION_KIND}
1942 are implementation defined additions recognized by the GNAT compiler.
1944 The pragma applies in both cases to pragmas and aspects with matching
1945 names, e.g. @code{Pre} applies to the Pre aspect, and @code{Precondition}
1946 applies to both the @code{Precondition} pragma
1947 and the aspect @code{Precondition}. Note that the identifiers for
1948 pragmas Pre_Class and Post_Class are Pre’Class and Post’Class (not
1949 Pre_Class and Post_Class), since these pragmas are intended to be
1950 identical to the corresponding aspects.
1952 If the policy is @code{CHECK}, then assertions are enabled, i.e.
1953 the corresponding pragma or aspect is activated.
1954 If the policy is @code{IGNORE}, then assertions are ignored, i.e.
1955 the corresponding pragma or aspect is deactivated.
1956 This pragma overrides the effect of the `-gnata' switch on the
1957 command line.
1958 If the policy is @code{SUPPRESSIBLE}, then assertions are enabled by default,
1959 however, if the `-gnatp' switch is specified all assertions are ignored.
1961 The implementation defined policy @code{DISABLE} is like
1962 @code{IGNORE} except that it completely disables semantic
1963 checking of the corresponding pragma or aspect. This is
1964 useful when the pragma or aspect argument references subprograms
1965 in a with’ed package which is replaced by a dummy package
1966 for the final build.
1968 The implementation defined assertion kind @code{Assertions} applies to all
1969 assertion kinds. The form with no assertion kind given implies this
1970 choice, so it applies to all assertion kinds (RM defined, and
1971 implementation defined).
1973 The implementation defined assertion kind @code{Statement_Assertions}
1974 applies to @code{Assert}, @code{Assert_And_Cut},
1975 @code{Assume}, @code{Loop_Invariant}, and @code{Loop_Variant}.
1977 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
1978 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2f}
1979 @section Pragma Assume
1982 Syntax:
1984 @example
1985 pragma Assume (
1986   boolean_EXPRESSION
1987   [, string_EXPRESSION]);
1988 @end example
1990 The effect of this pragma is identical to that of pragma @code{Assert},
1991 except that in an @code{Assertion_Policy} pragma, the identifier
1992 @code{Assume} is used to control whether it is ignored or checked
1993 (or disabled).
1995 The intention is that this be used for assumptions about the
1996 external environment. So you cannot expect to verify formally
1997 or informally that the condition is met, this must be
1998 established by examining things outside the program itself.
1999 For example, we may have code that depends on the size of
2000 @code{Long_Long_Integer} being at least 64. So we could write:
2002 @example
2003 pragma Assume (Long_Long_Integer'Size >= 64);
2004 @end example
2006 This assumption cannot be proved from the program itself,
2007 but it acts as a useful run-time check that the assumption
2008 is met, and documents the need to ensure that it is met by
2009 reference to information outside the program.
2011 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
2012 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{30}
2013 @section Pragma Assume_No_Invalid_Values
2016 @geindex Invalid representations
2018 @geindex Invalid values
2020 Syntax:
2022 @example
2023 pragma Assume_No_Invalid_Values (On | Off);
2024 @end example
2026 This is a configuration pragma that controls the assumptions made by the
2027 compiler about the occurrence of invalid representations (invalid values)
2028 in the code.
2030 The default behavior (corresponding to an Off argument for this pragma), is
2031 to assume that values may in general be invalid unless the compiler can
2032 prove they are valid. Consider the following example:
2034 @example
2035 V1 : Integer range 1 .. 10;
2036 V2 : Integer range 11 .. 20;
2038 for J in V2 .. V1 loop
2039    ...
2040 end loop;
2041 @end example
2043 if V1 and V2 have valid values, then the loop is known at compile
2044 time not to execute since the lower bound must be greater than the
2045 upper bound. However in default mode, no such assumption is made,
2046 and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
2047 is given, the compiler will assume that any occurrence of a variable
2048 other than in an explicit @code{'Valid} test always has a valid
2049 value, and the loop above will be optimized away.
2051 The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
2052 you know your code is free of uninitialized variables and other
2053 possible sources of invalid representations, and may result in
2054 more efficient code. A program that accesses an invalid representation
2055 with this pragma in effect is erroneous, so no guarantees can be made
2056 about its behavior.
2058 It is peculiar though permissible to use this pragma in conjunction
2059 with validity checking (-gnatVa). In such cases, accessing invalid
2060 values will generally give an exception, though formally the program
2061 is erroneous so there are no guarantees that this will always be the
2062 case, and it is recommended that these two options not be used together.
2064 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
2065 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{31}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{32}
2066 @section Pragma Async_Readers
2069 Syntax:
2071 @example
2072 pragma Async_Readers [ (static_boolean_EXPRESSION) ];
2073 @end example
2075 For the semantics of this pragma, see the entry for aspect @code{Async_Readers} in
2076 the SPARK 2014 Reference Manual, section 7.1.2.
2078 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
2079 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{33}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{34}
2080 @section Pragma Async_Writers
2083 Syntax:
2085 @example
2086 pragma Async_Writers [ (static_boolean_EXPRESSION) ];
2087 @end example
2089 For the semantics of this pragma, see the entry for aspect @code{Async_Writers} in
2090 the SPARK 2014 Reference Manual, section 7.1.2.
2092 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
2093 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{35}
2094 @section Pragma Attribute_Definition
2097 Syntax:
2099 @example
2100 pragma Attribute_Definition
2101   ([Attribute  =>] ATTRIBUTE_DESIGNATOR,
2102    [Entity     =>] LOCAL_NAME,
2103    [Expression =>] EXPRESSION | NAME);
2104 @end example
2106 If @code{Attribute} is a known attribute name, this pragma is equivalent to
2107 the attribute definition clause:
2109 @example
2110 for Entity'Attribute use Expression;
2111 @end example
2113 If @code{Attribute} is not a recognized attribute name, the pragma is
2114 ignored, and a warning is emitted. This allows source
2115 code to be written that takes advantage of some new attribute, while remaining
2116 compilable with earlier compilers.
2118 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
2119 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{36}
2120 @section Pragma C_Pass_By_Copy
2123 @geindex Passing by copy
2125 Syntax:
2127 @example
2128 pragma C_Pass_By_Copy
2129   ([Max_Size =>] static_integer_EXPRESSION);
2130 @end example
2132 Normally the default mechanism for passing C convention records to C
2133 convention subprograms is to pass them by reference, as suggested by RM
2134 B.3(69).  Use the configuration pragma @code{C_Pass_By_Copy} to change
2135 this default, by requiring that record formal parameters be passed by
2136 copy if all of the following conditions are met:
2139 @itemize *
2141 @item 
2142 The size of the record type does not exceed the value specified for
2143 @code{Max_Size}.
2145 @item 
2146 The record type has @code{Convention C}.
2148 @item 
2149 The formal parameter has this record type, and the subprogram has a
2150 foreign (non-Ada) convention.
2151 @end itemize
2153 If these conditions are met the argument is passed by copy; i.e., in a
2154 manner consistent with what C expects if the corresponding formal in the
2155 C prototype is a struct (rather than a pointer to a struct).
2157 You can also pass records by copy by specifying the convention
2158 @code{C_Pass_By_Copy} for the record type, or by using the extended
2159 @code{Import} and @code{Export} pragmas, which allow specification of
2160 passing mechanisms on a parameter by parameter basis.
2162 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2163 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{37}
2164 @section Pragma Check
2167 @geindex Assertions
2169 @geindex Named assertions
2171 Syntax:
2173 @example
2174 pragma Check (
2175      [Name    =>] CHECK_KIND,
2176      [Check   =>] Boolean_EXPRESSION
2177   [, [Message =>] string_EXPRESSION] );
2179 CHECK_KIND ::= IDENTIFIER           |
2180                Pre'Class            |
2181                Post'Class           |
2182                Type_Invariant'Class |
2183                Invariant'Class
2184 @end example
2186 This pragma is similar to the predefined pragma @code{Assert} except that an
2187 extra identifier argument is present. In conjunction with pragma
2188 @code{Check_Policy}, this can be used to define groups of assertions that can
2189 be independently controlled. The identifier @code{Assertion} is special, it
2190 refers to the normal set of pragma @code{Assert} statements.
2192 Checks introduced by this pragma are normally deactivated by default. They can
2193 be activated either by the command line option `-gnata', which turns on
2194 all checks, or individually controlled using pragma @code{Check_Policy}.
2196 The identifiers @code{Assertions} and @code{Statement_Assertions} are not
2197 permitted as check kinds, since this would cause confusion with the use
2198 of these identifiers in @code{Assertion_Policy} and @code{Check_Policy}
2199 pragmas, where they are used to refer to sets of assertions.
2201 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2202 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{38}
2203 @section Pragma Check_Float_Overflow
2206 @geindex Floating-point overflow
2208 Syntax:
2210 @example
2211 pragma Check_Float_Overflow;
2212 @end example
2214 In Ada, the predefined floating-point types (@code{Short_Float},
2215 @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
2216 defined to be `unconstrained'. This means that even though each
2217 has a well-defined base range, an operation that delivers a result
2218 outside this base range is not required to raise an exception.
2219 This implementation permission accommodates the notion
2220 of infinities in IEEE floating-point, and corresponds to the
2221 efficient execution mode on most machines. GNAT will not raise
2222 overflow exceptions on these machines; instead it will generate
2223 infinities and NaN’s as defined in the IEEE standard.
2225 Generating infinities, although efficient, is not always desirable.
2226 Often the preferable approach is to check for overflow, even at the
2227 (perhaps considerable) expense of run-time performance.
2228 This can be accomplished by defining your own constrained floating-point subtypes – i.e., by supplying explicit
2229 range constraints – and indeed such a subtype
2230 can have the same base range as its base type. For example:
2232 @example
2233 subtype My_Float is Float range Float'Range;
2234 @end example
2236 Here @code{My_Float} has the same range as
2237 @code{Float} but is constrained, so operations on
2238 @code{My_Float} values will be checked for overflow
2239 against this range.
2241 This style will achieve the desired goal, but
2242 it is often more convenient to be able to simply use
2243 the standard predefined floating-point types as long
2244 as overflow checking could be guaranteed.
2245 The @code{Check_Float_Overflow}
2246 configuration pragma achieves this effect. If a unit is compiled
2247 subject to this configuration pragma, then all operations
2248 on predefined floating-point types including operations on
2249 base types of these floating-point types will be treated as
2250 though those types were constrained, and overflow checks
2251 will be generated. The @code{Constraint_Error}
2252 exception is raised if the result is out of range.
2254 This mode can also be set by use of the compiler
2255 switch `-gnateF'.
2257 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2258 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{39}
2259 @section Pragma Check_Name
2262 @geindex Defining check names
2264 @geindex Check names
2265 @geindex defining
2267 Syntax:
2269 @example
2270 pragma Check_Name (check_name_IDENTIFIER);
2271 @end example
2273 This is a configuration pragma that defines a new implementation
2274 defined check name (unless IDENTIFIER matches one of the predefined
2275 check names, in which case the pragma has no effect). Check names
2276 are global to a partition, so if two or more configuration pragmas
2277 are present in a partition mentioning the same name, only one new
2278 check name is introduced.
2280 An implementation defined check name introduced with this pragma may
2281 be used in only three contexts: @code{pragma Suppress},
2282 @code{pragma Unsuppress},
2283 and as the prefix of a @code{Check_Name'Enabled} attribute reference. For
2284 any of these three cases, the check name must be visible. A check
2285 name is visible if it is in the configuration pragmas applying to
2286 the current unit, or if it appears at the start of any unit that
2287 is part of the dependency set of the current unit (e.g., units that
2288 are mentioned in @code{with} clauses).
2290 Check names introduced by this pragma are subject to control by compiler
2291 switches (in particular -gnatp) in the usual manner.
2293 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2294 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{3a}
2295 @section Pragma Check_Policy
2298 @geindex Controlling assertions
2300 @geindex Assertions
2301 @geindex control
2303 @geindex Check pragma control
2305 @geindex Named assertions
2307 Syntax:
2309 @example
2310 pragma Check_Policy
2311  ([Name   =>] CHECK_KIND,
2312   [Policy =>] POLICY_IDENTIFIER);
2314 pragma Check_Policy (
2315     CHECK_KIND => POLICY_IDENTIFIER
2316  @{, CHECK_KIND => POLICY_IDENTIFIER@});
2318 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2320 CHECK_KIND ::= IDENTIFIER           |
2321                Pre'Class            |
2322                Post'Class           |
2323                Type_Invariant'Class |
2324                Invariant'Class
2326 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2327 avoids confusion between the two possible syntax forms for this pragma.
2329 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2330 @end example
2332 This pragma is used to set the checking policy for assertions (specified
2333 by aspects or pragmas), the @code{Debug} pragma, or additional checks
2334 to be checked using the @code{Check} pragma. It may appear either as
2335 a configuration pragma, or within a declarative part of package. In the
2336 latter case, it applies from the point where it appears to the end of
2337 the declarative region (like pragma @code{Suppress}).
2339 The @code{Check_Policy} pragma is similar to the
2340 predefined @code{Assertion_Policy} pragma,
2341 and if the check kind corresponds to one of the assertion kinds that
2342 are allowed by @code{Assertion_Policy}, then the effect is identical.
2344 If the first argument is Debug, then the policy applies to Debug pragmas,
2345 disabling their effect if the policy is @code{OFF}, @code{DISABLE}, or
2346 @code{IGNORE}, and allowing them to execute with normal semantics if
2347 the policy is @code{ON} or @code{CHECK}. In addition if the policy is
2348 @code{DISABLE}, then the procedure call in @code{Debug} pragmas will
2349 be totally ignored and not analyzed semantically.
2351 Finally the first argument may be some other identifier than the above
2352 possibilities, in which case it controls a set of named assertions
2353 that can be checked using pragma @code{Check}. For example, if the pragma:
2355 @example
2356 pragma Check_Policy (Critical_Error, OFF);
2357 @end example
2359 is given, then subsequent @code{Check} pragmas whose first argument is also
2360 @code{Critical_Error} will be disabled.
2362 The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
2363 to turn on corresponding checks. The default for a set of checks for which no
2364 @code{Check_Policy} is given is @code{OFF} unless the compiler switch
2365 `-gnata' is given, which turns on all checks by default.
2367 The check policy settings @code{CHECK} and @code{IGNORE} are recognized
2368 as synonyms for @code{ON} and @code{OFF}. These synonyms are provided for
2369 compatibility with the standard @code{Assertion_Policy} pragma. The check
2370 policy setting @code{DISABLE} causes the second argument of a corresponding
2371 @code{Check} pragma to be completely ignored and not analyzed.
2373 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2374 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{3b}
2375 @section Pragma Comment
2378 Syntax:
2380 @example
2381 pragma Comment (static_string_EXPRESSION);
2382 @end example
2384 This is almost identical in effect to pragma @code{Ident}.  It allows the
2385 placement of a comment into the object file and hence into the
2386 executable file if the operating system permits such usage.  The
2387 difference is that @code{Comment}, unlike @code{Ident}, has
2388 no limitations on placement of the pragma (it can be placed
2389 anywhere in the main source unit), and if more than one pragma
2390 is used, all comments are retained.
2392 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2393 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{3c}
2394 @section Pragma Common_Object
2397 Syntax:
2399 @example
2400 pragma Common_Object (
2401      [Internal =>] LOCAL_NAME
2402   [, [External =>] EXTERNAL_SYMBOL]
2403   [, [Size     =>] EXTERNAL_SYMBOL] );
2405 EXTERNAL_SYMBOL ::=
2406   IDENTIFIER
2407 | static_string_EXPRESSION
2408 @end example
2410 This pragma enables the shared use of variables stored in overlaid
2411 linker areas corresponding to the use of @code{COMMON}
2412 in Fortran.  The single
2413 object @code{LOCAL_NAME} is assigned to the area designated by
2414 the @code{External} argument.
2415 You may define a record to correspond to a series
2416 of fields.  The @code{Size} argument
2417 is syntax checked in GNAT, but otherwise ignored.
2419 @code{Common_Object} is not supported on all platforms.  If no
2420 support is available, then the code generator will issue a message
2421 indicating that the necessary attribute for implementation of this
2422 pragma is not available.
2424 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2425 @anchor{gnat_rm/implementation_defined_pragmas compile-time-error}@anchor{3d}@anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{3e}
2426 @section Pragma Compile_Time_Error
2429 Syntax:
2431 @example
2432 pragma Compile_Time_Error
2433          (boolean_EXPRESSION, static_string_EXPRESSION);
2434 @end example
2436 This pragma can be used to generate additional compile time
2437 error messages. It
2438 is particularly useful in generics, where errors can be issued for
2439 specific problematic instantiations. The first parameter is a boolean
2440 expression. The pragma ensures that the value of an expression
2441 is known at compile time, and has the value False. The set of expressions
2442 whose values are known at compile time includes all static boolean
2443 expressions, and also other values which the compiler can determine
2444 at compile time (e.g., the size of a record type set by an explicit
2445 size representation clause, or the value of a variable which was
2446 initialized to a constant and is known not to have been modified).
2447 If these conditions are not met, an error message is generated using
2448 the value given as the second argument. This string value may contain
2449 embedded ASCII.LF characters to break the message into multiple lines.
2451 @node Pragma Compile_Time_Warning,Pragma Complete_Representation,Pragma Compile_Time_Error,Implementation Defined Pragmas
2452 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{3f}
2453 @section Pragma Compile_Time_Warning
2456 Syntax:
2458 @example
2459 pragma Compile_Time_Warning
2460          (boolean_EXPRESSION, static_string_EXPRESSION);
2461 @end example
2463 Same as pragma Compile_Time_Error, except a warning is issued instead
2464 of an error message. If switch `-gnatw_C' is used, a warning is only issued
2465 if the value of the expression is known to be True at compile time, not when
2466 the value of the expression is not known at compile time.
2467 Note that if this pragma is used in a package that
2468 is with’ed by a client, the client will get the warning even though it
2469 is issued by a with’ed package (normally warnings in with’ed units are
2470 suppressed, but this is a special exception to that rule).
2472 One typical use is within a generic where compile time known characteristics
2473 of formal parameters are tested, and warnings given appropriately. Another use
2474 with a first parameter of True is to warn a client about use of a package,
2475 for example that it is not fully implemented.
2477 In previous versions of the compiler, combining `-gnatwe' with
2478 Compile_Time_Warning resulted in a fatal error. Now the compiler always emits
2479 a warning. You can use @ref{3d,,Pragma Compile_Time_Error} to force the generation of
2480 an error.
2482 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2483 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{40}
2484 @section Pragma Complete_Representation
2487 Syntax:
2489 @example
2490 pragma Complete_Representation;
2491 @end example
2493 This pragma must appear immediately within a record representation
2494 clause. Typical placements are before the first component clause
2495 or after the last component clause. The effect is to give an error
2496 message if any component is missing a component clause. This pragma
2497 may be used to ensure that a record representation clause is
2498 complete, and that this invariant is maintained if fields are
2499 added to the record in the future.
2501 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2502 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{41}
2503 @section Pragma Complex_Representation
2506 Syntax:
2508 @example
2509 pragma Complex_Representation
2510         ([Entity =>] LOCAL_NAME);
2511 @end example
2513 The @code{Entity} argument must be the name of a record type which has
2514 two fields of the same floating-point type.  The effect of this pragma is
2515 to force gcc to use the special internal complex representation form for
2516 this record, which may be more efficient.  Note that this may result in
2517 the code for this type not conforming to standard ABI (application
2518 binary interface) requirements for the handling of record types.  For
2519 example, in some environments, there is a requirement for passing
2520 records by pointer, and the use of this pragma may result in passing
2521 this type in floating-point registers.
2523 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2524 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{42}
2525 @section Pragma Component_Alignment
2528 @geindex Alignments of components
2530 @geindex Pragma Component_Alignment
2532 Syntax:
2534 @example
2535 pragma Component_Alignment (
2536      [Form =>] ALIGNMENT_CHOICE
2537   [, [Name =>] type_LOCAL_NAME]);
2539 ALIGNMENT_CHOICE ::=
2540   Component_Size
2541 | Component_Size_4
2542 | Storage_Unit
2543 | Default
2544 @end example
2546 Specifies the alignment of components in array or record types.
2547 The meaning of the @code{Form} argument is as follows:
2549 @quotation
2551 @geindex Component_Size (in pragma Component_Alignment)
2552 @end quotation
2555 @table @asis
2557 @item `Component_Size'
2559 Aligns scalar components and subcomponents of the array or record type
2560 on boundaries appropriate to their inherent size (naturally
2561 aligned).  For example, 1-byte components are aligned on byte boundaries,
2562 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2563 integer components are aligned on 4-byte boundaries and so on.  These
2564 alignment rules correspond to the normal rules for C compilers on all
2565 machines except the VAX.
2567 @geindex Component_Size_4 (in pragma Component_Alignment)
2569 @item `Component_Size_4'
2571 Naturally aligns components with a size of four or fewer
2572 bytes.  Components that are larger than 4 bytes are placed on the next
2573 4-byte boundary.
2575 @geindex Storage_Unit (in pragma Component_Alignment)
2577 @item `Storage_Unit'
2579 Specifies that array or record components are byte aligned, i.e.,
2580 aligned on boundaries determined by the value of the constant
2581 @code{System.Storage_Unit}.
2583 @geindex Default (in pragma Component_Alignment)
2585 @item `Default'
2587 Specifies that array or record components are aligned on default
2588 boundaries, appropriate to the underlying hardware or operating system or
2589 both. The @code{Default} choice is the same as @code{Component_Size} (natural
2590 alignment).
2591 @end table
2593 If the @code{Name} parameter is present, @code{type_LOCAL_NAME} must
2594 refer to a local record or array type, and the specified alignment
2595 choice applies to the specified type.  The use of
2596 @code{Component_Alignment} together with a pragma @code{Pack} causes the
2597 @code{Component_Alignment} pragma to be ignored.  The use of
2598 @code{Component_Alignment} together with a record representation clause
2599 is only effective for fields not specified by the representation clause.
2601 If the @code{Name} parameter is absent, the pragma can be used as either
2602 a configuration pragma, in which case it applies to one or more units in
2603 accordance with the normal rules for configuration pragmas, or it can be
2604 used within a declarative part, in which case it applies to types that
2605 are declared within this declarative part, or within any nested scope
2606 within this declarative part.  In either case it specifies the alignment
2607 to be applied to any record or array type which has otherwise standard
2608 representation.
2610 If the alignment for a record or array type is not specified (using
2611 pragma @code{Pack}, pragma @code{Component_Alignment}, or a record rep
2612 clause), the GNAT uses the default alignment as described previously.
2614 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2615 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{43}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{44}
2616 @section Pragma Constant_After_Elaboration
2619 Syntax:
2621 @example
2622 pragma Constant_After_Elaboration [ (static_boolean_EXPRESSION) ];
2623 @end example
2625 For the semantics of this pragma, see the entry for aspect
2626 @code{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2628 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2629 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{45}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{46}
2630 @section Pragma Contract_Cases
2633 @geindex Contract cases
2635 Syntax:
2637 @example
2638 pragma Contract_Cases (CONTRACT_CASE @{, CONTRACT_CASE@});
2640 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2642 CASE_GUARD ::= boolean_EXPRESSION | others
2644 CONSEQUENCE ::= boolean_EXPRESSION
2645 @end example
2647 The @code{Contract_Cases} pragma allows defining fine-grain specifications
2648 that can complement or replace the contract given by a precondition and a
2649 postcondition. Additionally, the @code{Contract_Cases} pragma can be used
2650 by testing and formal verification tools. The compiler checks its validity and,
2651 depending on the assertion policy at the point of declaration of the pragma,
2652 it may insert a check in the executable. For code generation, the contract
2653 cases
2655 @example
2656 pragma Contract_Cases (
2657   Cond1 => Pred1,
2658   Cond2 => Pred2);
2659 @end example
2661 are equivalent to
2663 @example
2664 C1 : constant Boolean := Cond1;  --  evaluated at subprogram entry
2665 C2 : constant Boolean := Cond2;  --  evaluated at subprogram entry
2666 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2667 pragma Postcondition (if C1 then Pred1);
2668 pragma Postcondition (if C2 then Pred2);
2669 @end example
2671 The precondition ensures that one and only one of the case guards is
2672 satisfied on entry to the subprogram.
2673 The postcondition ensures that for the case guard that was True on entry,
2674 the corresponding consequence is True on exit. Other consequence expressions
2675 are not evaluated.
2677 A precondition @code{P} and postcondition @code{Q} can also be
2678 expressed as contract cases:
2680 @example
2681 pragma Contract_Cases (P => Q);
2682 @end example
2684 The placement and visibility rules for @code{Contract_Cases} pragmas are
2685 identical to those described for preconditions and postconditions.
2687 The compiler checks that boolean expressions given in case guards and
2688 consequences are valid, where the rules for case guards are the same as
2689 the rule for an expression in @code{Precondition} and the rules for
2690 consequences are the same as the rule for an expression in
2691 @code{Postcondition}. In particular, attributes @code{'Old} and
2692 @code{'Result} can only be used within consequence expressions.
2693 The case guard for the last contract case may be @code{others}, to denote
2694 any case not captured by the previous cases. The
2695 following is an example of use within a package spec:
2697 @example
2698 package Math_Functions is
2699    ...
2700    function Sqrt (Arg : Float) return Float;
2701    pragma Contract_Cases (((Arg in 0.0 .. 99.0) => Sqrt'Result < 10.0,
2702                            Arg >= 100.0         => Sqrt'Result >= 10.0,
2703                            others               => Sqrt'Result = 0.0));
2704    ...
2705 end Math_Functions;
2706 @end example
2708 The meaning of contract cases is that only one case should apply at each
2709 call, as determined by the corresponding case guard evaluating to True,
2710 and that the consequence for this case should hold when the subprogram
2711 returns.
2713 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2714 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{47}
2715 @section Pragma Convention_Identifier
2718 @geindex Conventions
2719 @geindex synonyms
2721 Syntax:
2723 @example
2724 pragma Convention_Identifier (
2725          [Name =>]       IDENTIFIER,
2726          [Convention =>] convention_IDENTIFIER);
2727 @end example
2729 This pragma provides a mechanism for supplying synonyms for existing
2730 convention identifiers. The @code{Name} identifier can subsequently
2731 be used as a synonym for the given convention in other pragmas (including
2732 for example pragma @code{Import} or another @code{Convention_Identifier}
2733 pragma). As an example of the use of this, suppose you had legacy code
2734 which used Fortran77 as the identifier for Fortran. Then the pragma:
2736 @example
2737 pragma Convention_Identifier (Fortran77, Fortran);
2738 @end example
2740 would allow the use of the convention identifier @code{Fortran77} in
2741 subsequent code, avoiding the need to modify the sources. As another
2742 example, you could use this to parameterize convention requirements
2743 according to systems. Suppose you needed to use @code{Stdcall} on
2744 windows systems, and @code{C} on some other system, then you could
2745 define a convention identifier @code{Library} and use a single
2746 @code{Convention_Identifier} pragma to specify which convention
2747 would be used system-wide.
2749 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2750 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{48}
2751 @section Pragma CPP_Class
2754 @geindex Interfacing with C++
2756 Syntax:
2758 @example
2759 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2760 @end example
2762 The argument denotes an entity in the current declarative region that is
2763 declared as a record type. It indicates that the type corresponds to an
2764 externally declared C++ class type, and is to be laid out the same way
2765 that C++ would lay out the type. If the C++ class has virtual primitives
2766 then the record must be declared as a tagged record type.
2768 Types for which @code{CPP_Class} is specified do not have assignment or
2769 equality operators defined (such operations can be imported or declared
2770 as subprograms as required). Initialization is allowed only by constructor
2771 functions (see pragma @code{CPP_Constructor}). Such types are implicitly
2772 limited if not explicitly declared as limited or derived from a limited
2773 type, and an error is issued in that case.
2775 See @ref{49,,Interfacing to C++} for related information.
2777 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
2778 for backward compatibility but its functionality is available
2779 using pragma @code{Import} with @code{Convention} = @code{CPP}.
2781 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2782 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{4a}
2783 @section Pragma CPP_Constructor
2786 @geindex Interfacing with C++
2788 Syntax:
2790 @example
2791 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2792   [, [External_Name =>] static_string_EXPRESSION ]
2793   [, [Link_Name     =>] static_string_EXPRESSION ]);
2794 @end example
2796 This pragma identifies an imported function (imported in the usual way
2797 with pragma @code{Import}) as corresponding to a C++ constructor. If
2798 @code{External_Name} and @code{Link_Name} are not specified then the
2799 @code{Entity} argument is a name that must have been previously mentioned
2800 in a pragma @code{Import} with @code{Convention} = @code{CPP}. Such name
2801 must be of one of the following forms:
2804 @itemize *
2806 @item 
2807 `function' @code{Fname} `return' T`
2809 @item 
2810 `function' @code{Fname} `return' T’Class
2812 @item 
2813 `function' @code{Fname} (…) `return' T`
2815 @item 
2816 `function' @code{Fname} (…) `return' T’Class
2817 @end itemize
2819 where @code{T} is a limited record type imported from C++ with pragma
2820 @code{Import} and @code{Convention} = @code{CPP}.
2822 The first two forms import the default constructor, used when an object
2823 of type @code{T} is created on the Ada side with no explicit constructor.
2824 The latter two forms cover all the non-default constructors of the type.
2825 See the GNAT User’s Guide for details.
2827 If no constructors are imported, it is impossible to create any objects
2828 on the Ada side and the type is implicitly declared abstract.
2830 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
2831 using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
2832 GCC switch).
2833 See @ref{49,,Interfacing to C++} for more related information.
2835 Note: The use of functions returning class-wide types for constructors is
2836 currently obsolete. They are supported for backward compatibility. The
2837 use of functions returning the type T leave the Ada sources more clear
2838 because the imported C++ constructors always return an object of type T;
2839 that is, they never return an object whose type is a descendant of type T.
2841 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2842 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{4b}
2843 @section Pragma CPP_Virtual
2846 @geindex Interfacing to C++
2848 This pragma is now obsolete and, other than generating a warning if warnings
2849 on obsolescent features are enabled, is completely ignored.
2850 It is retained for compatibility
2851 purposes. It used to be required to ensure compatibility with C++, but
2852 is no longer required for that purpose because GNAT generates
2853 the same object layout as the G++ compiler by default.
2855 See @ref{49,,Interfacing to C++} for related information.
2857 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2858 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{4c}
2859 @section Pragma CPP_Vtable
2862 @geindex Interfacing with C++
2864 This pragma is now obsolete and, other than generating a warning if warnings
2865 on obsolescent features are enabled, is completely ignored.
2866 It used to be required to ensure compatibility with C++, but
2867 is no longer required for that purpose because GNAT generates
2868 the same object layout as the G++ compiler by default.
2870 See @ref{49,,Interfacing to C++} for related information.
2872 @node Pragma CPU,Pragma Deadline_Floor,Pragma CPP_Vtable,Implementation Defined Pragmas
2873 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{4d}
2874 @section Pragma CPU
2877 Syntax:
2879 @example
2880 pragma CPU (EXPRESSION);
2881 @end example
2883 This pragma is standard in Ada 2012, but is available in all earlier
2884 versions of Ada as an implementation-defined pragma.
2885 See Ada 2012 Reference Manual for details.
2887 @node Pragma Deadline_Floor,Pragma Debug,Pragma CPU,Implementation Defined Pragmas
2888 @anchor{gnat_rm/implementation_defined_pragmas pragma-deadline-floor}@anchor{4e}
2889 @section Pragma Deadline_Floor
2892 Syntax:
2894 @example
2895 pragma Deadline_Floor (time_span_EXPRESSION);
2896 @end example
2898 This pragma applies only to protected types and specifies the floor
2899 deadline inherited by a task when the task enters a protected object.
2900 It is effective only when the EDF scheduling policy is used.
2902 @node Pragma Debug,Pragma Debug_Policy,Pragma Deadline_Floor,Implementation Defined Pragmas
2903 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{4f}
2904 @section Pragma Debug
2907 Syntax:
2909 @example
2910 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2912 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2913   PROCEDURE_NAME
2914 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2915 @end example
2917 The procedure call argument has the syntactic form of an expression, meeting
2918 the syntactic requirements for pragmas.
2920 If debug pragmas are not enabled or if the condition is present and evaluates
2921 to False, this pragma has no effect. If debug pragmas are enabled, the
2922 semantics of the pragma is exactly equivalent to the procedure call statement
2923 corresponding to the argument with a terminating semicolon. Pragmas are
2924 permitted in sequences of declarations, so you can use pragma @code{Debug} to
2925 intersperse calls to debug procedures in the middle of declarations. Debug
2926 pragmas can be enabled either by use of the command line switch `-gnata'
2927 or by use of the pragma @code{Check_Policy} with a first argument of
2928 @code{Debug}.
2930 @node Pragma Debug_Policy,Pragma Default_Initial_Condition,Pragma Debug,Implementation Defined Pragmas
2931 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{50}
2932 @section Pragma Debug_Policy
2935 Syntax:
2937 @example
2938 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2939 @end example
2941 This pragma is equivalent to a corresponding @code{Check_Policy} pragma
2942 with a first argument of @code{Debug}. It is retained for historical
2943 compatibility reasons.
2945 @node Pragma Default_Initial_Condition,Pragma Default_Scalar_Storage_Order,Pragma Debug_Policy,Implementation Defined Pragmas
2946 @anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{51}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{52}
2947 @section Pragma Default_Initial_Condition
2950 Syntax:
2952 @example
2953 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2954 @end example
2956 For the semantics of this pragma, see the entry for aspect
2957 @code{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2959 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2960 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{53}
2961 @section Pragma Default_Scalar_Storage_Order
2964 @geindex Default_Scalar_Storage_Order
2966 @geindex Scalar_Storage_Order
2968 Syntax:
2970 @example
2971 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
2972 @end example
2974 Normally if no explicit @code{Scalar_Storage_Order} is given for a record
2975 type or array type, then the scalar storage order defaults to the ordinary
2976 default for the target. But this default may be overridden using this pragma.
2977 The pragma may appear as a configuration pragma, or locally within a package
2978 spec or declarative part. In the latter case, it applies to all subsequent
2979 types declared within that package spec or declarative part.
2981 The following example shows the use of this pragma:
2983 @example
2984 pragma Default_Scalar_Storage_Order (High_Order_First);
2985 with System; use System;
2986 package DSSO1 is
2987    type H1 is record
2988       a : Integer;
2989    end record;
2991    type L2 is record
2992       a : Integer;
2993    end record;
2994    for L2'Scalar_Storage_Order use Low_Order_First;
2996    type L2a is new L2;
2998    package Inner is
2999       type H3 is record
3000          a : Integer;
3001       end record;
3003       pragma Default_Scalar_Storage_Order (Low_Order_First);
3005       type L4 is record
3006          a : Integer;
3007       end record;
3008    end Inner;
3010    type H4a is new Inner.L4;
3012    type H5 is record
3013       a : Integer;
3014    end record;
3015 end DSSO1;
3016 @end example
3018 In this example record types with names starting with `L' have @cite{Low_Order_First} scalar
3019 storage order, and record types with names starting with `H' have @code{High_Order_First}.
3020 Note that in the case of @code{H4a}, the order is not inherited
3021 from the parent type. Only an explicitly set @code{Scalar_Storage_Order}
3022 gets inherited on type derivation.
3024 If this pragma is used as a configuration pragma which appears within a
3025 configuration pragma file (as opposed to appearing explicitly at the start
3026 of a single unit), then the binder will require that all units in a partition
3027 be compiled in a similar manner, other than run-time units, which are not
3028 affected by this pragma. Note that the use of this form is discouraged because
3029 it may significantly degrade the run-time performance of the software, instead
3030 the default scalar storage order ought to be changed only on a local basis.
3032 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
3033 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{54}
3034 @section Pragma Default_Storage_Pool
3037 @geindex Default_Storage_Pool
3039 Syntax:
3041 @example
3042 pragma Default_Storage_Pool (storage_pool_NAME | null);
3043 @end example
3045 This pragma is standard in Ada 2012, but is available in all earlier
3046 versions of Ada as an implementation-defined pragma.
3047 See Ada 2012 Reference Manual for details.
3049 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
3050 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{55}@anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{56}
3051 @section Pragma Depends
3054 Syntax:
3056 @example
3057 pragma Depends (DEPENDENCY_RELATION);
3059 DEPENDENCY_RELATION ::=
3060      null
3061   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
3063 DEPENDENCY_CLAUSE ::=
3064     OUTPUT_LIST =>[+] INPUT_LIST
3065   | NULL_DEPENDENCY_CLAUSE
3067 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
3069 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
3071 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
3073 OUTPUT ::= NAME | FUNCTION_RESULT
3074 INPUT  ::= NAME
3076 where FUNCTION_RESULT is a function Result attribute_reference
3077 @end example
3079 For the semantics of this pragma, see the entry for aspect @code{Depends} in the
3080 SPARK 2014 Reference Manual, section 6.1.5.
3082 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
3083 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{57}
3084 @section Pragma Detect_Blocking
3087 Syntax:
3089 @example
3090 pragma Detect_Blocking;
3091 @end example
3093 This is a standard pragma in Ada 2005, that is available in all earlier
3094 versions of Ada as an implementation-defined pragma.
3096 This is a configuration pragma that forces the detection of potentially
3097 blocking operations within a protected operation, and to raise Program_Error
3098 if that happens.
3100 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
3101 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{58}
3102 @section Pragma Disable_Atomic_Synchronization
3105 @geindex Atomic Synchronization
3107 Syntax:
3109 @example
3110 pragma Disable_Atomic_Synchronization [(Entity)];
3111 @end example
3113 Ada requires that accesses (reads or writes) of an atomic variable be
3114 regarded as synchronization points in the case of multiple tasks.
3115 Particularly in the case of multi-processors this may require special
3116 handling, e.g. the generation of memory barriers. This capability may
3117 be turned off using this pragma in cases where it is known not to be
3118 required.
3120 The placement and scope rules for this pragma are the same as those
3121 for @code{pragma Suppress}. In particular it can be used as a
3122 configuration  pragma, or in a declaration sequence where it applies
3123 till the end of the scope. If an @code{Entity} argument is present,
3124 the action applies only to that entity.
3126 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
3127 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{59}
3128 @section Pragma Dispatching_Domain
3131 Syntax:
3133 @example
3134 pragma Dispatching_Domain (EXPRESSION);
3135 @end example
3137 This pragma is standard in Ada 2012, but is available in all earlier
3138 versions of Ada as an implementation-defined pragma.
3139 See Ada 2012 Reference Manual for details.
3141 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
3142 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{5a}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{5b}
3143 @section Pragma Effective_Reads
3146 Syntax:
3148 @example
3149 pragma Effective_Reads [ (static_boolean_EXPRESSION) ];
3150 @end example
3152 For the semantics of this pragma, see the entry for aspect @code{Effective_Reads} in
3153 the SPARK 2014 Reference Manual, section 7.1.2.
3155 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3156 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{5c}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{5d}
3157 @section Pragma Effective_Writes
3160 Syntax:
3162 @example
3163 pragma Effective_Writes [ (static_boolean_EXPRESSION) ];
3164 @end example
3166 For the semantics of this pragma, see the entry for aspect @code{Effective_Writes}
3167 in the SPARK 2014 Reference Manual, section 7.1.2.
3169 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3170 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{5e}
3171 @section Pragma Elaboration_Checks
3174 @geindex Elaboration control
3176 Syntax:
3178 @example
3179 pragma Elaboration_Checks (Dynamic | Static);
3180 @end example
3182 This is a configuration pragma which specifies the elaboration model to be
3183 used during compilation. For more information on the elaboration models of
3184 GNAT, consult the chapter on elaboration order handling in the `GNAT User’s
3185 Guide'.
3187 The pragma may appear in the following contexts:
3190 @itemize *
3192 @item 
3193 Configuration pragmas file
3195 @item 
3196 Prior to the context clauses of a compilation unit’s initial declaration
3197 @end itemize
3199 Any other placement of the pragma will result in a warning and the effects of
3200 the offending pragma will be ignored.
3202 If the pragma argument is @code{Dynamic}, then the dynamic elaboration model is in
3203 effect. If the pragma argument is @code{Static}, then the static elaboration model
3204 is in effect.
3206 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3207 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{5f}
3208 @section Pragma Eliminate
3211 @geindex Elimination of unused subprograms
3213 Syntax:
3215 @example
3216 pragma Eliminate (
3217             [  Unit_Name       => ] IDENTIFIER | SELECTED_COMPONENT ,
3218             [  Entity          => ] IDENTIFIER |
3219                                     SELECTED_COMPONENT |
3220                                     STRING_LITERAL
3221             [, Source_Location =>   SOURCE_TRACE ] );
3223         SOURCE_TRACE    ::= STRING_LITERAL
3224 @end example
3226 This pragma indicates that the given entity is not used in the program to be
3227 compiled and built, thus allowing the compiler to
3228 eliminate the code or data associated with the named entity. Any reference to
3229 an eliminated entity causes a compile-time or link-time error.
3231 The pragma has the following semantics, where @code{U} is the unit specified by
3232 the @code{Unit_Name} argument and @code{E} is the entity specified by the @code{Entity}
3233 argument:
3236 @itemize *
3238 @item 
3239 @code{E} must be a subprogram that is explicitly declared either:
3242 @itemize *
3244 @item 
3245 Within @code{U}, or
3247 @item 
3248 Within a generic package that is instantiated in @code{U}, or
3250 @item 
3251 As an instance of generic subprogram instantiated in @code{U}.
3252 @end itemize
3254 Otherwise the pragma is ignored.
3256 @item 
3257 If @code{E} is overloaded within @code{U} then, in the absence of a
3258 @code{Source_Location} argument, all overloadings are eliminated.
3260 @item 
3261 If @code{E} is overloaded within @code{U} and only some overloadings
3262 are to be eliminated, then each overloading to be eliminated
3263 must be specified in a corresponding pragma @code{Eliminate}
3264 with a @code{Source_Location} argument identifying the line where the
3265 declaration appears, as described below.
3267 @item 
3268 If @code{E} is declared as the result of a generic instantiation, then
3269 a @code{Source_Location} argument is needed, as described below.
3270 @end itemize
3272 Pragma @code{Eliminate} allows a program to be compiled in a system-independent
3273 manner, so that unused entities are eliminated but without
3274 needing to modify the source text. Normally the required set of
3275 @code{Eliminate} pragmas is constructed automatically using the @code{gnatelim} tool.
3277 Any source file change that removes, splits, or
3278 adds lines may make the set of @code{Eliminate} pragmas invalid because their
3279 @code{Source_Location} argument values may get out of date.
3281 Pragma @code{Eliminate} may be used where the referenced entity is a dispatching
3282 operation. In this case all the subprograms to which the given operation can
3283 dispatch are considered to be unused (are never called as a result of a direct
3284 or a dispatching call).
3286 The string literal given for the source location specifies the line number
3287 of the declaration of the entity, using the following syntax for @code{SOURCE_TRACE}:
3289 @example
3290 SOURCE_TRACE     ::= SOURCE_REFERENCE [ LBRACKET SOURCE_TRACE RBRACKET ]
3292 LBRACKET         ::= '['
3293 RBRACKET         ::= ']'
3295 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3297 LINE_NUMBER      ::= DIGIT @{DIGIT@}
3298 @end example
3300 Spaces around the colon in a @code{SOURCE_REFERENCE} are optional.
3302 The source trace that is given as the @code{Source_Location} must obey the
3303 following rules (or else the pragma is ignored), where @code{U} is
3304 the unit @code{U} specified by the @code{Unit_Name} argument and @code{E} is the
3305 subprogram specified by the @code{Entity} argument:
3308 @itemize *
3310 @item 
3311 @code{FILE_NAME} is the short name (with no directory
3312 information) of the Ada source file for @code{U}, using the required syntax
3313 for the underlying file system (e.g. case is significant if the underlying
3314 operating system is case sensitive).
3315 If @code{U} is a package and @code{E} is a subprogram declared in the package
3316 specification and its full declaration appears in the package body,
3317 then the  relevant source file is the one for the package specification;
3318 analogously if @code{U} is a generic package.
3320 @item 
3321 If @code{E} is not declared in a generic instantiation (this includes
3322 generic subprogram instances), the source trace includes only one source
3323 line reference. @code{LINE_NUMBER} gives the line number of the occurrence
3324 of the declaration of @code{E} within the source file (as a decimal literal
3325 without an exponent or point).
3327 @item 
3328 If @code{E} is declared by a generic instantiation, its source trace
3329 (from left to right) starts with the source location of the
3330 declaration of @code{E} in the generic unit and ends with the source
3331 location of the instantiation, given in square brackets. This approach is
3332 applied recursively with nested instantiations: the rightmost (nested
3333 most deeply in square brackets) element of the source trace is the location
3334 of the outermost instantiation, and the leftmost element (that is, outside
3335 of any square brackets) is the location of the declaration of @code{E} in
3336 the generic unit.
3337 @end itemize
3339 Examples:
3341 @quotation
3343 @example
3344 pragma Eliminate (Pkg0, Proc);
3345 -- Eliminate (all overloadings of) Proc in Pkg0
3347 pragma Eliminate (Pkg1, Proc,
3348                   Source_Location => "pkg1.ads:8");
3349 -- Eliminate overloading of Proc at line 8 in pkg1.ads
3351 -- Assume the following file contents:
3352 --   gen_pkg.ads
3353 --   1: generic
3354 --   2:   type T is private;
3355 --   3: package Gen_Pkg is
3356 --   4:   procedure Proc(N : T);
3357 --  ...   ...
3358 --  ... end Gen_Pkg;
3360 --    q.adb
3361 --   1: with Gen_Pkg;
3362 --   2: procedure Q is
3363 --   3:   package Inst_Pkg is new Gen_Pkg(Integer);
3364 --  ...   -- No calls on Inst_Pkg.Proc
3365 --  ... end Q;
3367 -- The following pragma eliminates Inst_Pkg.Proc from Q
3368 pragma Eliminate (Q, Proc,
3369                   Source_Location => "gen_pkg.ads:4[q.adb:3]");
3370 @end example
3371 @end quotation
3373 @node Pragma Enable_Atomic_Synchronization,Pragma Exceptional_Cases,Pragma Eliminate,Implementation Defined Pragmas
3374 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{60}
3375 @section Pragma Enable_Atomic_Synchronization
3378 @geindex Atomic Synchronization
3380 Syntax:
3382 @example
3383 pragma Enable_Atomic_Synchronization [(Entity)];
3384 @end example
3386 Ada requires that accesses (reads or writes) of an atomic variable be
3387 regarded as synchronization points in the case of multiple tasks.
3388 Particularly in the case of multi-processors this may require special
3389 handling, e.g. the generation of memory barriers. This synchronization
3390 is performed by default, but can be turned off using
3391 @code{pragma Disable_Atomic_Synchronization}. The
3392 @code{Enable_Atomic_Synchronization} pragma can be used to turn
3393 it back on.
3395 The placement and scope rules for this pragma are the same as those
3396 for @code{pragma Unsuppress}. In particular it can be used as a
3397 configuration  pragma, or in a declaration sequence where it applies
3398 till the end of the scope. If an @code{Entity} argument is present,
3399 the action applies only to that entity.
3401 @node Pragma Exceptional_Cases,Pragma Export_Function,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3402 @anchor{gnat_rm/implementation_defined_pragmas pragma-exceptional-cases}@anchor{61}
3403 @section Pragma Exceptional_Cases
3406 @geindex Exceptional_Cases
3408 Syntax:
3410 @example
3411 pragma Exceptional_Cases (EXCEPTIONAL_CASE_LIST);
3413 EXCEPTIONAL_CASE_LIST ::= EXCEPTIONAL_CASE @{, EXCEPTIONAL_CASE@}
3414 EXCEPTIONAL_CASE      ::= exception_choice @{'|' exception_choice@} => CONSEQUENCE
3415 CONSEQUENCE           ::= Boolean_expression
3416 @end example
3418 For the semantics of this aspect, see the SPARK 2014 Reference Manual, section
3419 6.1.9.
3421 @node Pragma Export_Function,Pragma Export_Object,Pragma Exceptional_Cases,Implementation Defined Pragmas
3422 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{62}
3423 @section Pragma Export_Function
3426 @geindex Argument passing mechanisms
3428 Syntax:
3430 @example
3431 pragma Export_Function (
3432      [Internal         =>] LOCAL_NAME
3433   [, [External         =>] EXTERNAL_SYMBOL]
3434   [, [Parameter_Types  =>] PARAMETER_TYPES]
3435   [, [Result_Type      =>] result_SUBTYPE_MARK]
3436   [, [Mechanism        =>] MECHANISM]
3437   [, [Result_Mechanism =>] MECHANISM_NAME]);
3439 EXTERNAL_SYMBOL ::=
3440   IDENTIFIER
3441 | static_string_EXPRESSION
3442 | ""
3444 PARAMETER_TYPES ::=
3445   null
3446 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3448 TYPE_DESIGNATOR ::=
3449   subtype_NAME
3450 | subtype_Name ' Access
3452 MECHANISM ::=
3453   MECHANISM_NAME
3454 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3456 MECHANISM_ASSOCIATION ::=
3457   [formal_parameter_NAME =>] MECHANISM_NAME
3459 MECHANISM_NAME ::= Value | Reference
3460 @end example
3462 Use this pragma to make a function externally callable and optionally
3463 provide information on mechanisms to be used for passing parameter and
3464 result values.  We recommend, for the purposes of improving portability,
3465 this pragma always be used in conjunction with a separate pragma
3466 @code{Export}, which must precede the pragma @code{Export_Function}.
3467 GNAT does not require a separate pragma @code{Export}, but if none is
3468 present, @code{Convention Ada} is assumed, which is usually
3469 not what is wanted, so it is usually appropriate to use this
3470 pragma in conjunction with a @code{Export} or @code{Convention}
3471 pragma that specifies the desired foreign convention.
3472 Pragma @code{Export_Function}
3473 (and @code{Export}, if present) must appear in the same declarative
3474 region as the function to which they apply.
3476 The @code{internal_name} must uniquely designate the function to which the
3477 pragma applies.  If more than one function name exists of this name in
3478 the declarative part you must use the @code{Parameter_Types} and
3479 @code{Result_Type} parameters to achieve the required
3480 unique designation.  The @cite{subtype_mark}s in these parameters must
3481 exactly match the subtypes in the corresponding function specification,
3482 using positional notation to match parameters with subtype marks.
3483 The form with an @code{'Access} attribute can be used to match an
3484 anonymous access parameter.
3486 @geindex Suppressing external name
3488 Special treatment is given if the EXTERNAL is an explicit null
3489 string or a static string expressions that evaluates to the null
3490 string. In this case, no external name is generated. This form
3491 still allows the specification of parameter mechanisms.
3493 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3494 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{63}
3495 @section Pragma Export_Object
3498 Syntax:
3500 @example
3501 pragma Export_Object (
3502       [Internal =>] LOCAL_NAME
3503    [, [External =>] EXTERNAL_SYMBOL]
3504    [, [Size     =>] EXTERNAL_SYMBOL]);
3506 EXTERNAL_SYMBOL ::=
3507   IDENTIFIER
3508 | static_string_EXPRESSION
3509 @end example
3511 This pragma designates an object as exported, and apart from the
3512 extended rules for external symbols, is identical in effect to the use of
3513 the normal @code{Export} pragma applied to an object.  You may use a
3514 separate Export pragma (and you probably should from the point of view
3515 of portability), but it is not required.  @code{Size} is syntax checked,
3516 but otherwise ignored by GNAT.
3518 @node Pragma Export_Procedure,Pragma Export_Valued_Procedure,Pragma Export_Object,Implementation Defined Pragmas
3519 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{64}
3520 @section Pragma Export_Procedure
3523 Syntax:
3525 @example
3526 pragma Export_Procedure (
3527      [Internal        =>] LOCAL_NAME
3528   [, [External        =>] EXTERNAL_SYMBOL]
3529   [, [Parameter_Types =>] PARAMETER_TYPES]
3530   [, [Mechanism       =>] MECHANISM]);
3532 EXTERNAL_SYMBOL ::=
3533   IDENTIFIER
3534 | static_string_EXPRESSION
3535 | ""
3537 PARAMETER_TYPES ::=
3538   null
3539 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3541 TYPE_DESIGNATOR ::=
3542   subtype_NAME
3543 | subtype_Name ' Access
3545 MECHANISM ::=
3546   MECHANISM_NAME
3547 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3549 MECHANISM_ASSOCIATION ::=
3550   [formal_parameter_NAME =>] MECHANISM_NAME
3552 MECHANISM_NAME ::= Value | Reference
3553 @end example
3555 This pragma is identical to @code{Export_Function} except that it
3556 applies to a procedure rather than a function and the parameters
3557 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
3558 GNAT does not require a separate pragma @code{Export}, but if none is
3559 present, @code{Convention Ada} is assumed, which is usually
3560 not what is wanted, so it is usually appropriate to use this
3561 pragma in conjunction with a @code{Export} or @code{Convention}
3562 pragma that specifies the desired foreign convention.
3564 @geindex Suppressing external name
3566 Special treatment is given if the EXTERNAL is an explicit null
3567 string or a static string expressions that evaluates to the null
3568 string. In this case, no external name is generated. This form
3569 still allows the specification of parameter mechanisms.
3571 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Procedure,Implementation Defined Pragmas
3572 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{65}
3573 @section Pragma Export_Valued_Procedure
3576 Syntax:
3578 @example
3579 pragma Export_Valued_Procedure (
3580      [Internal        =>] LOCAL_NAME
3581   [, [External        =>] EXTERNAL_SYMBOL]
3582   [, [Parameter_Types =>] PARAMETER_TYPES]
3583   [, [Mechanism       =>] MECHANISM]);
3585 EXTERNAL_SYMBOL ::=
3586   IDENTIFIER
3587 | static_string_EXPRESSION
3588 | ""
3590 PARAMETER_TYPES ::=
3591   null
3592 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3594 TYPE_DESIGNATOR ::=
3595   subtype_NAME
3596 | subtype_Name ' Access
3598 MECHANISM ::=
3599   MECHANISM_NAME
3600 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3602 MECHANISM_ASSOCIATION ::=
3603   [formal_parameter_NAME =>] MECHANISM_NAME
3605 MECHANISM_NAME ::= Value | Reference
3606 @end example
3608 This pragma is identical to @code{Export_Procedure} except that the
3609 first parameter of @code{LOCAL_NAME}, which must be present, must be of
3610 mode @code{out}, and externally the subprogram is treated as a function
3611 with this parameter as the result of the function.  GNAT provides for
3612 this capability to allow the use of @code{out} and @code{in out}
3613 parameters in interfacing to external functions (which are not permitted
3614 in Ada functions).
3615 GNAT does not require a separate pragma @code{Export}, but if none is
3616 present, @code{Convention Ada} is assumed, which is almost certainly
3617 not what is wanted since the whole point of this pragma is to interface
3618 with foreign language functions, so it is usually appropriate to use this
3619 pragma in conjunction with a @code{Export} or @code{Convention}
3620 pragma that specifies the desired foreign convention.
3622 @geindex Suppressing external name
3624 Special treatment is given if the EXTERNAL is an explicit null
3625 string or a static string expressions that evaluates to the null
3626 string. In this case, no external name is generated. This form
3627 still allows the specification of parameter mechanisms.
3629 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3630 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{66}
3631 @section Pragma Extend_System
3634 @geindex System
3635 @geindex extending
3637 @geindex DEC Ada 83
3639 Syntax:
3641 @example
3642 pragma Extend_System ([Name =>] IDENTIFIER);
3643 @end example
3645 This pragma is used to provide backwards compatibility with other
3646 implementations that extend the facilities of package @code{System}.  In
3647 GNAT, @code{System} contains only the definitions that are present in
3648 the Ada RM.  However, other implementations, notably the DEC Ada 83
3649 implementation, provide many extensions to package @code{System}.
3651 For each such implementation accommodated by this pragma, GNAT provides a
3652 package @code{Aux_@var{xxx}}, e.g., @code{Aux_DEC} for the DEC Ada 83
3653 implementation, which provides the required additional definitions.  You
3654 can use this package in two ways.  You can @code{with} it in the normal
3655 way and access entities either by selection or using a @code{use}
3656 clause.  In this case no special processing is required.
3658 However, if existing code contains references such as
3659 @code{System.@var{xxx}} where `xxx' is an entity in the extended
3660 definitions provided in package @code{System}, you may use this pragma
3661 to extend visibility in @code{System} in a non-standard way that
3662 provides greater compatibility with the existing code.  Pragma
3663 @code{Extend_System} is a configuration pragma whose single argument is
3664 the name of the package containing the extended definition
3665 (e.g., @code{Aux_DEC} for the DEC Ada case).  A unit compiled under
3666 control of this pragma will be processed using special visibility
3667 processing that looks in package @code{System.Aux_@var{xxx}} where
3668 @code{Aux_@var{xxx}} is the pragma argument for any entity referenced in
3669 package @code{System}, but not found in package @code{System}.
3671 You can use this pragma either to access a predefined @code{System}
3672 extension supplied with the compiler, for example @code{Aux_DEC} or
3673 you can construct your own extension unit following the above
3674 definition.  Note that such a package is a child of @code{System}
3675 and thus is considered part of the implementation.
3676 To compile it you will have to use the `-gnatg' switch
3677 for compiling System units, as explained in the
3678 GNAT User’s Guide.
3680 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3681 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{67}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{68}
3682 @section Pragma Extensions_Allowed
3685 @geindex Ada Extensions
3687 @geindex GNAT Extensions
3689 Syntax:
3691 @example
3692 pragma Extensions_Allowed (On | Off | All_Extensions);
3693 @end example
3695 This configuration pragma enables (via the “On” or “All_Extensions” argument)
3696 or disables (via the “Off” argument) the implementation extension mode; the
3697 pragma takes precedence over the @code{-gnatX} and @code{-gnatX0} command switches.
3699 If an argument of @code{"On"} is specified, the latest version of the Ada language
3700 is implemented (currently Ada 2022) and, in addition, a curated set of GNAT
3701 specific extensions are recognized. (See the list here
3702 @ref{69,,here})
3704 An argument of @code{"All_Extensions"} has the same effect except that some extra
3705 experimental extensions are enabled (See the list here
3706 @ref{6a,,here})
3708 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3709 @anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{6b}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{6c}
3710 @section Pragma Extensions_Visible
3713 Syntax:
3715 @example
3716 pragma Extensions_Visible [ (static_boolean_EXPRESSION) ];
3717 @end example
3719 For the semantics of this pragma, see the entry for aspect @code{Extensions_Visible}
3720 in the SPARK 2014 Reference Manual, section 6.1.7.
3722 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3723 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{6d}
3724 @section Pragma External
3727 Syntax:
3729 @example
3730 pragma External (
3731   [   Convention    =>] convention_IDENTIFIER,
3732   [   Entity        =>] LOCAL_NAME
3733   [, [External_Name =>] static_string_EXPRESSION ]
3734   [, [Link_Name     =>] static_string_EXPRESSION ]);
3735 @end example
3737 This pragma is identical in syntax and semantics to pragma
3738 @code{Export} as defined in the Ada Reference Manual.  It is
3739 provided for compatibility with some Ada 83 compilers that
3740 used this pragma for exactly the same purposes as pragma
3741 @code{Export} before the latter was standardized.
3743 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3744 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{6e}
3745 @section Pragma External_Name_Casing
3748 @geindex Dec Ada 83 casing compatibility
3750 @geindex External Names
3751 @geindex casing
3753 @geindex Casing of External names
3755 Syntax:
3757 @example
3758 pragma External_Name_Casing (
3759   Uppercase | Lowercase
3760   [, Uppercase | Lowercase | As_Is]);
3761 @end example
3763 This pragma provides control over the casing of external names associated
3764 with Import and Export pragmas.  There are two cases to consider:
3767 @itemize *
3769 @item 
3770 Implicit external names
3772 Implicit external names are derived from identifiers.  The most common case
3773 arises when a standard Ada Import or Export pragma is used with only two
3774 arguments, as in:
3776 @example
3777 pragma Import (C, C_Routine);
3778 @end example
3780 Since Ada is a case-insensitive language, the spelling of the identifier in
3781 the Ada source program does not provide any information on the desired
3782 casing of the external name, and so a convention is needed.  In GNAT the
3783 default treatment is that such names are converted to all lower case
3784 letters.  This corresponds to the normal C style in many environments.
3785 The first argument of pragma @code{External_Name_Casing} can be used to
3786 control this treatment.  If @code{Uppercase} is specified, then the name
3787 will be forced to all uppercase letters.  If @code{Lowercase} is specified,
3788 then the normal default of all lower case letters will be used.
3790 This same implicit treatment is also used in the case of extended DEC Ada 83
3791 compatible Import and Export pragmas where an external name is explicitly
3792 specified using an identifier rather than a string.
3794 @item 
3795 Explicit external names
3797 Explicit external names are given as string literals.  The most common case
3798 arises when a standard Ada Import or Export pragma is used with three
3799 arguments, as in:
3801 @example
3802 pragma Import (C, C_Routine, "C_routine");
3803 @end example
3805 In this case, the string literal normally provides the exact casing required
3806 for the external name.  The second argument of pragma
3807 @code{External_Name_Casing} may be used to modify this behavior.
3808 If @code{Uppercase} is specified, then the name
3809 will be forced to all uppercase letters.  If @code{Lowercase} is specified,
3810 then the name will be forced to all lowercase letters.  A specification of
3811 @code{As_Is} provides the normal default behavior in which the casing is
3812 taken from the string provided.
3813 @end itemize
3815 This pragma may appear anywhere that a pragma is valid. In particular, it
3816 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3817 case it applies to all subsequent compilations, or it can be used as a program
3818 unit pragma, in which case it only applies to the current unit, or it can
3819 be used more locally to control individual Import/Export pragmas.
3821 It was primarily intended for use with OpenVMS systems, where many
3822 compilers convert all symbols to upper case by default.  For interfacing to
3823 such compilers (e.g., the DEC C compiler), it may be convenient to use
3824 the pragma:
3826 @example
3827 pragma External_Name_Casing (Uppercase, Uppercase);
3828 @end example
3830 to enforce the upper casing of all external symbols.
3832 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3833 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{6f}
3834 @section Pragma Fast_Math
3837 Syntax:
3839 @example
3840 pragma Fast_Math;
3841 @end example
3843 This is a configuration pragma which activates a mode in which speed is
3844 considered more important for floating-point operations than absolutely
3845 accurate adherence to the requirements of the standard. Currently the
3846 following operations are affected:
3849 @table @asis
3851 @item `Complex Multiplication'
3853 The normal simple formula for complex multiplication can result in intermediate
3854 overflows for numbers near the end of the range. The Ada standard requires that
3855 this situation be detected and corrected by scaling, but in Fast_Math mode such
3856 cases will simply result in overflow. Note that to take advantage of this you
3857 must instantiate your own version of @code{Ada.Numerics.Generic_Complex_Types}
3858 under control of the pragma, rather than use the preinstantiated versions.
3859 @end table
3861 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3862 @anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{70}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{71}
3863 @section Pragma Favor_Top_Level
3866 Syntax:
3868 @example
3869 pragma Favor_Top_Level (type_LOCAL_NAME);
3870 @end example
3872 The argument of pragma @code{Favor_Top_Level} must be a named access-to-subprogram
3873 type. This pragma is an efficiency hint to the compiler, regarding the use of
3874 @code{'Access} or @code{'Unrestricted_Access} on nested (non-library-level) subprograms.
3875 The pragma means that nested subprograms are not used with this type, or are
3876 rare, so that the generated code should be efficient in the top-level case.
3877 When this pragma is used, dynamically generated trampolines may be used on some
3878 targets for nested subprograms. See restriction @code{No_Implicit_Dynamic_Code}.
3880 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3881 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{72}
3882 @section Pragma Finalize_Storage_Only
3885 Syntax:
3887 @example
3888 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3889 @end example
3891 The argument of pragma @code{Finalize_Storage_Only} must denote a local type which
3892 is derived from @code{Ada.Finalization.Controlled} or @code{Limited_Controlled}. The
3893 pragma suppresses the call to @code{Finalize} for declared library-level objects
3894 of the argument type. This is mostly useful for types where finalization is
3895 only used to deal with storage reclamation since in most environments it is
3896 not necessary to reclaim memory just before terminating execution, hence the
3897 name. Note that this pragma does not suppress Finalize calls for library-level
3898 heap-allocated objects (see pragma @code{No_Heap_Finalization}).
3900 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3901 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{73}
3902 @section Pragma Float_Representation
3905 Syntax:
3907 @example
3908 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3910 FLOAT_REP ::= VAX_Float | IEEE_Float
3911 @end example
3913 In the one argument form, this pragma is a configuration pragma which
3914 allows control over the internal representation chosen for the predefined
3915 floating point types declared in the packages @code{Standard} and
3916 @code{System}. This pragma is only provided for compatibility and has no effect.
3918 The two argument form specifies the representation to be used for
3919 the specified floating-point type. The argument must
3920 be @code{IEEE_Float} to specify the use of IEEE format, as follows:
3923 @itemize *
3925 @item 
3926 For a digits value of 6, 32-bit IEEE short format will be used.
3928 @item 
3929 For a digits value of 15, 64-bit IEEE long format will be used.
3931 @item 
3932 No other value of digits is permitted.
3933 @end itemize
3935 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
3936 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{74}@anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{75}
3937 @section Pragma Ghost
3940 Syntax:
3942 @example
3943 pragma Ghost [ (static_boolean_EXPRESSION) ];
3944 @end example
3946 For the semantics of this pragma, see the entry for aspect @code{Ghost} in the SPARK
3947 2014 Reference Manual, section 6.9.
3949 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
3950 @anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{76}@anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{77}
3951 @section Pragma Global
3954 Syntax:
3956 @example
3957 pragma Global (GLOBAL_SPECIFICATION);
3959 GLOBAL_SPECIFICATION ::=
3960      null
3961   | (GLOBAL_LIST)
3962   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
3964 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
3966 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
3967 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
3968 GLOBAL_ITEM   ::= NAME
3969 @end example
3971 For the semantics of this pragma, see the entry for aspect @code{Global} in the
3972 SPARK 2014 Reference Manual, section 6.1.4.
3974 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
3975 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{78}
3976 @section Pragma Ident
3979 Syntax:
3981 @example
3982 pragma Ident (static_string_EXPRESSION);
3983 @end example
3985 This pragma is identical in effect to pragma @code{Comment}. It is provided
3986 for compatibility with other Ada compilers providing this pragma.
3988 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
3989 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{79}
3990 @section Pragma Ignore_Pragma
3993 Syntax:
3995 @example
3996 pragma Ignore_Pragma (pragma_IDENTIFIER);
3997 @end example
3999 This is a configuration pragma
4000 that takes a single argument that is a simple identifier. Any subsequent
4001 use of a pragma whose pragma identifier matches this argument will be
4002 silently ignored. Any preceding use of a pragma whose pragma identifier
4003 matches this argument will be parsed and then ignored.
4004 This may be useful when legacy code or code intended
4005 for compilation with some other compiler contains pragmas that match the
4006 name, but not the exact implementation, of a GNAT pragma. The use of this
4007 pragma allows such pragmas to be ignored, which may be useful in CodePeer
4008 mode, or during porting of legacy code.
4010 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
4011 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{7a}
4012 @section Pragma Implementation_Defined
4015 Syntax:
4017 @example
4018 pragma Implementation_Defined (local_NAME);
4019 @end example
4021 This pragma marks a previously declared entity as implementation-defined.
4022 For an overloaded entity, applies to the most recent homonym.
4024 @example
4025 pragma Implementation_Defined;
4026 @end example
4028 The form with no arguments appears anywhere within a scope, most
4029 typically a package spec, and indicates that all entities that are
4030 defined within the package spec are Implementation_Defined.
4032 This pragma is used within the GNAT runtime library to identify
4033 implementation-defined entities introduced in language-defined units,
4034 for the purpose of implementing the No_Implementation_Identifiers
4035 restriction.
4037 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
4038 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{7b}
4039 @section Pragma Implemented
4042 Syntax:
4044 @example
4045 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
4047 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
4048 @end example
4050 This is an Ada 2012 representation pragma which applies to protected, task
4051 and synchronized interface primitives. The use of pragma Implemented provides
4052 a way to impose a static requirement on the overriding operation by adhering
4053 to one of the three implementation kinds: entry, protected procedure or any of
4054 the above. This pragma is available in all earlier versions of Ada as an
4055 implementation-defined pragma.
4057 @example
4058 type Synch_Iface is synchronized interface;
4059 procedure Prim_Op (Obj : in out Iface) is abstract;
4060 pragma Implemented (Prim_Op, By_Protected_Procedure);
4062 protected type Prot_1 is new Synch_Iface with
4063    procedure Prim_Op;  --  Legal
4064 end Prot_1;
4066 protected type Prot_2 is new Synch_Iface with
4067    entry Prim_Op;      --  Illegal
4068 end Prot_2;
4070 task type Task_Typ is new Synch_Iface with
4071    entry Prim_Op;      --  Illegal
4072 end Task_Typ;
4073 @end example
4075 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
4076 Implemented determines the runtime behavior of the requeue. Implementation kind
4077 By_Entry guarantees that the action of requeueing will proceed from an entry to
4078 another entry. Implementation kind By_Protected_Procedure transforms the
4079 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
4080 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
4081 the target’s overriding subprogram kind.
4083 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
4084 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{7c}
4085 @section Pragma Implicit_Packing
4088 @geindex Rational Profile
4090 Syntax:
4092 @example
4093 pragma Implicit_Packing;
4094 @end example
4096 This is a configuration pragma that requests implicit packing for packed
4097 arrays for which a size clause is given but no explicit pragma Pack or
4098 specification of Component_Size is present. It also applies to records
4099 where no record representation clause is present. Consider this example:
4101 @example
4102 type R is array (0 .. 7) of Boolean;
4103 for R'Size use 8;
4104 @end example
4106 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
4107 does not change the layout of a composite object. So the Size clause in the
4108 above example is normally rejected, since the default layout of the array uses
4109 8-bit components, and thus the array requires a minimum of 64 bits.
4111 If this declaration is compiled in a region of code covered by an occurrence
4112 of the configuration pragma Implicit_Packing, then the Size clause in this
4113 and similar examples will cause implicit packing and thus be accepted. For
4114 this implicit packing to occur, the type in question must be an array of small
4115 components whose size is known at compile time, and the Size clause must
4116 specify the exact size that corresponds to the number of elements in the array
4117 multiplied by the size in bits of the component type (both single and
4118 multi-dimensioned arrays can be controlled with this pragma).
4120 @geindex Array packing
4122 Similarly, the following example shows the use in the record case
4124 @example
4125 type r is record
4126    a, b, c, d, e, f, g, h : boolean;
4127    chr                    : character;
4128 end record;
4129 for r'size use 16;
4130 @end example
4132 Without a pragma Pack, each Boolean field requires 8 bits, so the
4133 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
4134 sufficient. The use of pragma Implicit_Packing allows this record
4135 declaration to compile without an explicit pragma Pack.
4137 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
4138 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{7d}
4139 @section Pragma Import_Function
4142 Syntax:
4144 @example
4145 pragma Import_Function (
4146      [Internal         =>] LOCAL_NAME,
4147   [, [External         =>] EXTERNAL_SYMBOL]
4148   [, [Parameter_Types  =>] PARAMETER_TYPES]
4149   [, [Result_Type      =>] SUBTYPE_MARK]
4150   [, [Mechanism        =>] MECHANISM]
4151   [, [Result_Mechanism =>] MECHANISM_NAME]);
4153 EXTERNAL_SYMBOL ::=
4154   IDENTIFIER
4155 | static_string_EXPRESSION
4157 PARAMETER_TYPES ::=
4158   null
4159 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4161 TYPE_DESIGNATOR ::=
4162   subtype_NAME
4163 | subtype_Name ' Access
4165 MECHANISM ::=
4166   MECHANISM_NAME
4167 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4169 MECHANISM_ASSOCIATION ::=
4170   [formal_parameter_NAME =>] MECHANISM_NAME
4172 MECHANISM_NAME ::=
4173   Value
4174 | Reference
4175 @end example
4177 This pragma is used in conjunction with a pragma @code{Import} to
4178 specify additional information for an imported function.  The pragma
4179 @code{Import} (or equivalent pragma @code{Interface}) must precede the
4180 @code{Import_Function} pragma and both must appear in the same
4181 declarative part as the function specification.
4183 The @code{Internal} argument must uniquely designate
4184 the function to which the
4185 pragma applies.  If more than one function name exists of this name in
4186 the declarative part you must use the @code{Parameter_Types} and
4187 @code{Result_Type} parameters to achieve the required unique
4188 designation.  Subtype marks in these parameters must exactly match the
4189 subtypes in the corresponding function specification, using positional
4190 notation to match parameters with subtype marks.
4191 The form with an @code{'Access} attribute can be used to match an
4192 anonymous access parameter.
4194 You may optionally use the @code{Mechanism} and @code{Result_Mechanism}
4195 parameters to specify passing mechanisms for the
4196 parameters and result.  If you specify a single mechanism name, it
4197 applies to all parameters.  Otherwise you may specify a mechanism on a
4198 parameter by parameter basis using either positional or named
4199 notation.  If the mechanism is not specified, the default mechanism
4200 is used.
4202 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
4203 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{7e}
4204 @section Pragma Import_Object
4207 Syntax:
4209 @example
4210 pragma Import_Object (
4211      [Internal =>] LOCAL_NAME
4212   [, [External =>] EXTERNAL_SYMBOL]
4213   [, [Size     =>] EXTERNAL_SYMBOL]);
4215 EXTERNAL_SYMBOL ::=
4216   IDENTIFIER
4217 | static_string_EXPRESSION
4218 @end example
4220 This pragma designates an object as imported, and apart from the
4221 extended rules for external symbols, is identical in effect to the use of
4222 the normal @code{Import} pragma applied to an object.  Unlike the
4223 subprogram case, you need not use a separate @code{Import} pragma,
4224 although you may do so (and probably should do so from a portability
4225 point of view).  @code{size} is syntax checked, but otherwise ignored by
4226 GNAT.
4228 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
4229 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{7f}
4230 @section Pragma Import_Procedure
4233 Syntax:
4235 @example
4236 pragma Import_Procedure (
4237      [Internal        =>] LOCAL_NAME
4238   [, [External        =>] EXTERNAL_SYMBOL]
4239   [, [Parameter_Types =>] PARAMETER_TYPES]
4240   [, [Mechanism       =>] MECHANISM]);
4242 EXTERNAL_SYMBOL ::=
4243   IDENTIFIER
4244 | static_string_EXPRESSION
4246 PARAMETER_TYPES ::=
4247   null
4248 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4250 TYPE_DESIGNATOR ::=
4251   subtype_NAME
4252 | subtype_Name ' Access
4254 MECHANISM ::=
4255   MECHANISM_NAME
4256 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4258 MECHANISM_ASSOCIATION ::=
4259   [formal_parameter_NAME =>] MECHANISM_NAME
4261 MECHANISM_NAME ::= Value | Reference
4262 @end example
4264 This pragma is identical to @code{Import_Function} except that it
4265 applies to a procedure rather than a function and the parameters
4266 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
4268 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4269 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{80}
4270 @section Pragma Import_Valued_Procedure
4273 Syntax:
4275 @example
4276 pragma Import_Valued_Procedure (
4277      [Internal        =>] LOCAL_NAME
4278   [, [External        =>] EXTERNAL_SYMBOL]
4279   [, [Parameter_Types =>] PARAMETER_TYPES]
4280   [, [Mechanism       =>] MECHANISM]);
4282 EXTERNAL_SYMBOL ::=
4283   IDENTIFIER
4284 | static_string_EXPRESSION
4286 PARAMETER_TYPES ::=
4287   null
4288 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4290 TYPE_DESIGNATOR ::=
4291   subtype_NAME
4292 | subtype_Name ' Access
4294 MECHANISM ::=
4295   MECHANISM_NAME
4296 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4298 MECHANISM_ASSOCIATION ::=
4299   [formal_parameter_NAME =>] MECHANISM_NAME
4301 MECHANISM_NAME ::= Value | Reference
4302 @end example
4304 This pragma is identical to @code{Import_Procedure} except that the
4305 first parameter of @code{LOCAL_NAME}, which must be present, must be of
4306 mode @code{out}, and externally the subprogram is treated as a function
4307 with this parameter as the result of the function.  The purpose of this
4308 capability is to allow the use of @code{out} and @code{in out}
4309 parameters in interfacing to external functions (which are not permitted
4310 in Ada functions).  You may optionally use the @code{Mechanism}
4311 parameters to specify passing mechanisms for the parameters.
4312 If you specify a single mechanism name, it applies to all parameters.
4313 Otherwise you may specify a mechanism on a parameter by parameter
4314 basis using either positional or named notation.  If the mechanism is not
4315 specified, the default mechanism is used.
4317 Note that it is important to use this pragma in conjunction with a separate
4318 pragma Import that specifies the desired convention, since otherwise the
4319 default convention is Ada, which is almost certainly not what is required.
4321 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4322 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{81}
4323 @section Pragma Independent
4326 Syntax:
4328 @example
4329 pragma Independent (component_LOCAL_NAME);
4330 @end example
4332 This pragma is standard in Ada 2012 mode (which also provides an aspect
4333 of the same name). It is also available as an implementation-defined
4334 pragma in all earlier versions. It specifies that the
4335 designated object or all objects of the designated type must be
4336 independently addressable. This means that separate tasks can safely
4337 manipulate such objects. For example, if two components of a record are
4338 independent, then two separate tasks may access these two components.
4339 This may place
4340 constraints on the representation of the object (for instance prohibiting
4341 tight packing).
4343 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4344 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{82}
4345 @section Pragma Independent_Components
4348 Syntax:
4350 @example
4351 pragma Independent_Components (Local_NAME);
4352 @end example
4354 This pragma is standard in Ada 2012 mode (which also provides an aspect
4355 of the same name). It is also available as an implementation-defined
4356 pragma in all earlier versions. It specifies that the components of the
4357 designated object, or the components of each object of the designated
4358 type, must be
4359 independently addressable. This means that separate tasks can safely
4360 manipulate separate components in the composite object. This may place
4361 constraints on the representation of the object (for instance prohibiting
4362 tight packing).
4364 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4365 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{83}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{84}
4366 @section Pragma Initial_Condition
4369 Syntax:
4371 @example
4372 pragma Initial_Condition (boolean_EXPRESSION);
4373 @end example
4375 For the semantics of this pragma, see the entry for aspect @code{Initial_Condition}
4376 in the SPARK 2014 Reference Manual, section 7.1.6.
4378 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4379 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{85}
4380 @section Pragma Initialize_Scalars
4383 @geindex debugging with Initialize_Scalars
4385 Syntax:
4387 @example
4388 pragma Initialize_Scalars
4389   [ ( TYPE_VALUE_PAIR @{, TYPE_VALUE_PAIR@} ) ];
4391 TYPE_VALUE_PAIR ::=
4392   SCALAR_TYPE => static_EXPRESSION
4394 SCALAR_TYPE :=
4395   Short_Float
4396 | Float
4397 | Long_Float
4398 | Long_Long_Flat
4399 | Signed_8
4400 | Signed_16
4401 | Signed_32
4402 | Signed_64
4403 | Unsigned_8
4404 | Unsigned_16
4405 | Unsigned_32
4406 | Unsigned_64
4407 @end example
4409 This pragma is similar to @code{Normalize_Scalars} conceptually but has two
4410 important differences.
4412 First, there is no requirement for the pragma to be used uniformly in all units
4413 of a partition. In particular, it is fine to use this just for some or all of
4414 the application units of a partition, without needing to recompile the run-time
4415 library. In the case where some units are compiled with the pragma, and some
4416 without, then a declaration of a variable where the type is defined in package
4417 Standard or is locally declared will always be subject to initialization, as
4418 will any declaration of a scalar variable. For composite variables, whether the
4419 variable is initialized may also depend on whether the package in which the
4420 type of the variable is declared is compiled with the pragma.
4422 The other important difference is that the programmer can control the value
4423 used for initializing scalar objects. This effect can be achieved in several
4424 different ways:
4427 @itemize *
4429 @item 
4430 At compile time, the programmer can specify the invalid value for a
4431 particular family of scalar types using the optional arguments of the pragma.
4433 The compile-time approach is intended to optimize the generated code for the
4434 pragma, by possibly using fast operations such as @code{memset}. Note that such
4435 optimizations require using values where the bytes all have the same binary
4436 representation.
4438 @item 
4439 At bind time, the programmer has several options:
4442 @itemize *
4444 @item 
4445 Initialization with invalid values (similar to Normalize_Scalars, though
4446 for Initialize_Scalars it is not always possible to determine the invalid
4447 values in complex cases like signed component fields with nonstandard
4448 sizes).
4450 @item 
4451 Initialization with high values.
4453 @item 
4454 Initialization with low values.
4456 @item 
4457 Initialization with a specific bit pattern.
4458 @end itemize
4460 See the GNAT User’s Guide for binder options for specifying these cases.
4462 The bind-time approach is intended to provide fast turnaround for testing
4463 with different values, without having to recompile the program.
4465 @item 
4466 At execution time, the programmer can specify the invalid values using an
4467 environment variable. See the GNAT User’s Guide for details.
4469 The execution-time approach is intended to provide fast turnaround for
4470 testing with different values, without having to recompile and rebind the
4471 program.
4472 @end itemize
4474 Note that pragma @code{Initialize_Scalars} is particularly useful in conjunction
4475 with the enhanced validity checking that is now provided in GNAT, which checks
4476 for invalid values under more conditions. Using this feature (see description
4477 of the `-gnatV' flag in the GNAT User’s Guide) in conjunction with pragma
4478 @code{Initialize_Scalars} provides a powerful new tool to assist in the detection
4479 of problems caused by uninitialized variables.
4481 Note: the use of @code{Initialize_Scalars} has a fairly extensive effect on the
4482 generated code. This may cause your code to be substantially larger. It may
4483 also cause an increase in the amount of stack required, so it is probably a
4484 good idea to turn on stack checking (see description of stack checking in the
4485 GNAT User’s Guide) when using this pragma.
4487 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4488 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{86}@anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{87}
4489 @section Pragma Initializes
4492 Syntax:
4494 @example
4495 pragma Initializes (INITIALIZATION_LIST);
4497 INITIALIZATION_LIST ::=
4498      null
4499   | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4501 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4503 INPUT_LIST ::=
4504      null
4505   |  INPUT
4506   | (INPUT @{, INPUT@})
4508 INPUT ::= name
4509 @end example
4511 For the semantics of this pragma, see the entry for aspect @code{Initializes} in the
4512 SPARK 2014 Reference Manual, section 7.1.5.
4514 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4515 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{88}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{89}
4516 @section Pragma Inline_Always
4519 Syntax:
4521 @example
4522 pragma Inline_Always (NAME [, NAME]);
4523 @end example
4525 Similar to pragma @code{Inline} except that inlining is unconditional.
4526 Inline_Always instructs the compiler to inline every direct call to the
4527 subprogram or else to emit a compilation error, independently of any
4528 option, in particular `-gnatn' or `-gnatN' or the optimization level.
4529 It is an error to take the address or access of @code{NAME}. It is also an error to
4530 apply this pragma to a primitive operation of a tagged type. Thanks to such
4531 restrictions, the compiler is allowed to remove the out-of-line body of @code{NAME}.
4533 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4534 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{8a}
4535 @section Pragma Inline_Generic
4538 Syntax:
4540 @example
4541 pragma Inline_Generic (GNAME @{, GNAME@});
4543 GNAME ::= generic_unit_NAME | generic_instance_NAME
4544 @end example
4546 This pragma is provided for compatibility with Dec Ada 83. It has
4547 no effect in GNAT (which always inlines generics), other
4548 than to check that the given names are all names of generic units or
4549 generic instances.
4551 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4552 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{8b}
4553 @section Pragma Interface
4556 Syntax:
4558 @example
4559 pragma Interface (
4560      [Convention    =>] convention_identifier,
4561      [Entity        =>] local_NAME
4562   [, [External_Name =>] static_string_expression]
4563   [, [Link_Name     =>] static_string_expression]);
4564 @end example
4566 This pragma is identical in syntax and semantics to
4567 the standard Ada pragma @code{Import}.  It is provided for compatibility
4568 with Ada 83.  The definition is upwards compatible both with pragma
4569 @code{Interface} as defined in the Ada 83 Reference Manual, and also
4570 with some extended implementations of this pragma in certain Ada 83
4571 implementations.  The only difference between pragma @code{Interface}
4572 and pragma @code{Import} is that there is special circuitry to allow
4573 both pragmas to appear for the same subprogram entity (normally it
4574 is illegal to have multiple @code{Import} pragmas). This is useful in
4575 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4576 Ada 83 compilers.
4578 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4579 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{8c}
4580 @section Pragma Interface_Name
4583 Syntax:
4585 @example
4586 pragma Interface_Name (
4587      [Entity        =>] LOCAL_NAME
4588   [, [External_Name =>] static_string_EXPRESSION]
4589   [, [Link_Name     =>] static_string_EXPRESSION]);
4590 @end example
4592 This pragma provides an alternative way of specifying the interface name
4593 for an interfaced subprogram, and is provided for compatibility with Ada
4594 83 compilers that use the pragma for this purpose.  You must provide at
4595 least one of @code{External_Name} or @code{Link_Name}.
4597 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4598 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{8d}
4599 @section Pragma Interrupt_Handler
4602 Syntax:
4604 @example
4605 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4606 @end example
4608 This program unit pragma is supported for parameterless protected procedures
4609 as described in Annex C of the Ada Reference Manual.
4611 @node Pragma Interrupt_State,Pragma Interrupts_System_By_Default,Pragma Interrupt_Handler,Implementation Defined Pragmas
4612 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{8e}
4613 @section Pragma Interrupt_State
4616 Syntax:
4618 @example
4619 pragma Interrupt_State
4620  ([Name  =>] value,
4621   [State =>] SYSTEM | RUNTIME | USER);
4622 @end example
4624 Normally certain interrupts are reserved to the implementation.  Any attempt
4625 to attach an interrupt causes Program_Error to be raised, as described in
4626 RM C.3.2(22).  A typical example is the @code{SIGINT} interrupt used in
4627 many systems for an @code{Ctrl-C} interrupt.  Normally this interrupt is
4628 reserved to the implementation, so that @code{Ctrl-C} can be used to
4629 interrupt execution.  Additionally, signals such as @code{SIGSEGV},
4630 @code{SIGABRT}, @code{SIGFPE} and @code{SIGILL} are often mapped to specific
4631 Ada exceptions, or used to implement run-time functions such as the
4632 @code{abort} statement and stack overflow checking.
4634 Pragma @code{Interrupt_State} provides a general mechanism for overriding
4635 such uses of interrupts.  It subsumes the functionality of pragma
4636 @code{Unreserve_All_Interrupts}.  Pragma @code{Interrupt_State} is not
4637 available on Windows.  On all other platforms than VxWorks,
4638 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4639 and may be used to mark interrupts required by the board support package
4640 as reserved.
4642 Interrupts can be in one of three states:
4645 @itemize *
4647 @item 
4648 System
4650 The interrupt is reserved (no Ada handler can be installed), and the
4651 Ada run-time may not install a handler. As a result you are guaranteed
4652 standard system default action if this interrupt is raised. This also allows
4653 installing a low level handler via C APIs such as sigaction(), outside
4654 of Ada control.
4656 @item 
4657 Runtime
4659 The interrupt is reserved (no Ada handler can be installed). The run time
4660 is allowed to install a handler for internal control purposes, but is
4661 not required to do so.
4663 @item 
4664 User
4666 The interrupt is unreserved.  The user may install an Ada handler via
4667 Ada.Interrupts and pragma Interrupt_Handler or Attach_Handler to provide
4668 some other action.
4669 @end itemize
4671 These states are the allowed values of the @code{State} parameter of the
4672 pragma.  The @code{Name} parameter is a value of the type
4673 @code{Ada.Interrupts.Interrupt_ID}.  Typically, it is a name declared in
4674 @code{Ada.Interrupts.Names}.
4676 This is a configuration pragma, and the binder will check that there
4677 are no inconsistencies between different units in a partition in how a
4678 given interrupt is specified. It may appear anywhere a pragma is legal.
4680 The effect is to move the interrupt to the specified state.
4682 By declaring interrupts to be SYSTEM, you guarantee the standard system
4683 action, such as a core dump.
4685 By declaring interrupts to be USER, you guarantee that you can install
4686 a handler.
4688 Note that certain signals on many operating systems cannot be caught and
4689 handled by applications.  In such cases, the pragma is ignored.  See the
4690 operating system documentation, or the value of the array @code{Reserved}
4691 declared in the spec of package @code{System.OS_Interface}.
4693 Overriding the default state of signals used by the Ada runtime may interfere
4694 with an application’s runtime behavior in the cases of the synchronous signals,
4695 and in the case of the signal used to implement the @code{abort} statement.
4697 @node Pragma Interrupts_System_By_Default,Pragma Invariant,Pragma Interrupt_State,Implementation Defined Pragmas
4698 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupts-system-by-default}@anchor{8f}
4699 @section Pragma Interrupts_System_By_Default
4702 Syntax:
4704 @example
4705 pragma Interrupts_System_By_Default;
4706 @end example
4708 Default all interrupts to the System state as defined above in pragma
4709 @code{Interrupt_State}. This is a configuration pragma.
4711 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupts_System_By_Default,Implementation Defined Pragmas
4712 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{90}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{91}
4713 @section Pragma Invariant
4716 Syntax:
4718 @example
4719 pragma Invariant
4720   ([Entity =>]    private_type_LOCAL_NAME,
4721    [Check  =>]    EXPRESSION
4722    [,[Message =>] String_Expression]);
4723 @end example
4725 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4726 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4727 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4728 requires the use of the aspect syntax, which is not available except in 2012
4729 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4730 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4731 note that the aspect Invariant is a synonym in GNAT for the aspect
4732 Type_Invariant, but there is no pragma Type_Invariant.
4734 The pragma must appear within the visible part of the package specification,
4735 after the type to which its Entity argument appears. As with the Invariant
4736 aspect, the Check expression is not analyzed until the end of the visible
4737 part of the package, so it may contain forward references. The Message
4738 argument, if present, provides the exception message used if the invariant
4739 is violated. If no Message parameter is provided, a default message that
4740 identifies the line on which the pragma appears is used.
4742 It is permissible to have multiple Invariants for the same type entity, in
4743 which case they are and’ed together. It is permissible to use this pragma
4744 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4745 invariant pragma for the same entity.
4747 For further details on the use of this pragma, see the Ada 2012 documentation
4748 of the Type_Invariant aspect.
4750 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4751 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{92}
4752 @section Pragma Keep_Names
4755 Syntax:
4757 @example
4758 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4759 @end example
4761 The @code{LOCAL_NAME} argument
4762 must refer to an enumeration first subtype
4763 in the current declarative part. The effect is to retain the enumeration
4764 literal names for use by @code{Image} and @code{Value} even if a global
4765 @code{Discard_Names} pragma applies. This is useful when you want to
4766 generally suppress enumeration literal names and for example you therefore
4767 use a @code{Discard_Names} pragma in the @code{gnat.adc} file, but you
4768 want to retain the names for specific enumeration types.
4770 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4771 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{93}
4772 @section Pragma License
4775 @geindex License checking
4777 Syntax:
4779 @example
4780 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4781 @end example
4783 This pragma is provided to allow automated checking for appropriate license
4784 conditions with respect to the standard and modified GPL.  A pragma
4785 @code{License}, which is a configuration pragma that typically appears at
4786 the start of a source file or in a separate @code{gnat.adc} file, specifies
4787 the licensing conditions of a unit as follows:
4790 @itemize *
4792 @item 
4793 Unrestricted
4794 This is used for a unit that can be freely used with no license restrictions.
4795 Examples of such units are public domain units, and units from the Ada
4796 Reference Manual.
4798 @item 
4800 This is used for a unit that is licensed under the unmodified GPL, and which
4801 therefore cannot be @code{with}ed by a restricted unit.
4803 @item 
4804 Modified_GPL
4805 This is used for a unit licensed under the GNAT modified GPL that includes
4806 a special exception paragraph that specifically permits the inclusion of
4807 the unit in programs without requiring the entire program to be released
4808 under the GPL.
4810 @item 
4811 Restricted
4812 This is used for a unit that is restricted in that it is not permitted to
4813 depend on units that are licensed under the GPL.  Typical examples are
4814 proprietary code that is to be released under more restrictive license
4815 conditions.  Note that restricted units are permitted to @code{with} units
4816 which are licensed under the modified GPL (this is the whole point of the
4817 modified GPL).
4818 @end itemize
4820 Normally a unit with no @code{License} pragma is considered to have an
4821 unknown license, and no checking is done.  However, standard GNAT headers
4822 are recognized, and license information is derived from them as follows.
4824 A GNAT license header starts with a line containing 78 hyphens.  The following
4825 comment text is searched for the appearance of any of the following strings.
4827 If the string ‘GNU General Public License’ is found, then the unit is assumed
4828 to have GPL license, unless the string ‘As a special exception’ follows, in
4829 which case the license is assumed to be modified GPL.
4831 If one of the strings
4832 ‘This specification is adapted from the Ada Semantic Interface’ or
4833 ‘This specification is derived from the Ada Reference Manual’ is found
4834 then the unit is assumed to be unrestricted.
4836 These default actions means that a program with a restricted license pragma
4837 will automatically get warnings if a GPL unit is inappropriately
4838 @code{with}ed.  For example, the program:
4840 @example
4841 with Sem_Ch3;
4842 with GNAT.Sockets;
4843 procedure Secret_Stuff is
4844   ...
4845 end Secret_Stuff
4846 @end example
4848 if compiled with pragma @code{License} (@code{Restricted}) in a
4849 @code{gnat.adc} file will generate the warning:
4851 @example
4852 1.  with Sem_Ch3;
4853         |
4854    >>> license of withed unit "Sem_Ch3" is incompatible
4856 2.  with GNAT.Sockets;
4857 3.  procedure Secret_Stuff is
4858 @end example
4860 Here we get a warning on @code{Sem_Ch3} since it is part of the GNAT
4861 compiler and is licensed under the
4862 GPL, but no warning for @code{GNAT.Sockets} which is part of the GNAT
4863 run time, and is therefore licensed under the modified GPL.
4865 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4866 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{94}
4867 @section Pragma Link_With
4870 Syntax:
4872 @example
4873 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4874 @end example
4876 This pragma is provided for compatibility with certain Ada 83 compilers.
4877 It has exactly the same effect as pragma @code{Linker_Options} except
4878 that spaces occurring within one of the string expressions are treated
4879 as separators. For example, in the following case:
4881 @example
4882 pragma Link_With ("-labc -ldef");
4883 @end example
4885 results in passing the strings @code{-labc} and @code{-ldef} as two
4886 separate arguments to the linker. In addition pragma Link_With allows
4887 multiple arguments, with the same effect as successive pragmas.
4889 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4890 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{95}
4891 @section Pragma Linker_Alias
4894 Syntax:
4896 @example
4897 pragma Linker_Alias (
4898   [Entity =>] LOCAL_NAME,
4899   [Target =>] static_string_EXPRESSION);
4900 @end example
4902 @code{LOCAL_NAME} must refer to an object that is declared at the library
4903 level. This pragma establishes the given entity as a linker alias for the
4904 given target. It is equivalent to @code{__attribute__((alias))} in GNU C
4905 and causes @code{LOCAL_NAME} to be emitted as an alias for the symbol
4906 @code{static_string_EXPRESSION} in the object file, that is to say no space
4907 is reserved for @code{LOCAL_NAME} by the assembler and it will be resolved
4908 to the same address as @code{static_string_EXPRESSION} by the linker.
4910 The actual linker name for the target must be used (e.g., the fully
4911 encoded name with qualification in Ada, or the mangled name in C++),
4912 or it must be declared using the C convention with @code{pragma Import}
4913 or @code{pragma Export}.
4915 Not all target machines support this pragma. On some of them it is accepted
4916 only if @code{pragma Weak_External} has been applied to @code{LOCAL_NAME}.
4918 @example
4919 --  Example of the use of pragma Linker_Alias
4921 package p is
4922   i : Integer := 1;
4923   pragma Export (C, i);
4925   new_name_for_i : Integer;
4926   pragma Linker_Alias (new_name_for_i, "i");
4927 end p;
4928 @end example
4930 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4931 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{96}
4932 @section Pragma Linker_Constructor
4935 Syntax:
4937 @example
4938 pragma Linker_Constructor (procedure_LOCAL_NAME);
4939 @end example
4941 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4942 is declared at the library level. A procedure to which this pragma is
4943 applied will be treated as an initialization routine by the linker.
4944 It is equivalent to @code{__attribute__((constructor))} in GNU C and
4945 causes @code{procedure_LOCAL_NAME} to be invoked before the entry point
4946 of the executable is called (or immediately after the shared library is
4947 loaded if the procedure is linked in a shared library), in particular
4948 before the Ada run-time environment is set up.
4950 Because of these specific contexts, the set of operations such a procedure
4951 can perform is very limited and the type of objects it can manipulate is
4952 essentially restricted to the elementary types. In particular, it must only
4953 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
4955 This pragma is used by GNAT to implement auto-initialization of shared Stand
4956 Alone Libraries, which provides a related capability without the restrictions
4957 listed above. Where possible, the use of Stand Alone Libraries is preferable
4958 to the use of this pragma.
4960 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
4961 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{97}
4962 @section Pragma Linker_Destructor
4965 Syntax:
4967 @example
4968 pragma Linker_Destructor (procedure_LOCAL_NAME);
4969 @end example
4971 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4972 is declared at the library level. A procedure to which this pragma is
4973 applied will be treated as a finalization routine by the linker.
4974 It is equivalent to @code{__attribute__((destructor))} in GNU C and
4975 causes @code{procedure_LOCAL_NAME} to be invoked after the entry point
4976 of the executable has exited (or immediately before the shared library
4977 is unloaded if the procedure is linked in a shared library), in particular
4978 after the Ada run-time environment is shut down.
4980 See @code{pragma Linker_Constructor} for the set of restrictions that apply
4981 because of these specific contexts.
4983 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
4984 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{98}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{99}
4985 @section Pragma Linker_Section
4988 Syntax:
4990 @example
4991 pragma Linker_Section (
4992   [Entity  =>] LOCAL_NAME,
4993   [Section =>] static_string_EXPRESSION);
4994 @end example
4996 @code{LOCAL_NAME} must refer to an object, type, or subprogram that is
4997 declared at the library level. This pragma specifies the name of the
4998 linker section for the given entity. It is equivalent to
4999 @code{__attribute__((section))} in GNU C and causes @code{LOCAL_NAME} to
5000 be placed in the @code{static_string_EXPRESSION} section of the
5001 executable (assuming the linker doesn’t rename the section).
5002 GNAT also provides an implementation defined aspect of the same name.
5004 In the case of specifying this aspect for a type, the effect is to
5005 specify the corresponding section for all library-level objects of
5006 the type that do not have an explicit linker section set. Note that
5007 this only applies to whole objects, not to components of composite objects.
5009 In the case of a subprogram, the linker section applies to all previously
5010 declared matching overloaded subprograms in the current declarative part
5011 which do not already have a linker section assigned. The linker section
5012 aspect is useful in this case for specifying different linker sections
5013 for different elements of such an overloaded set.
5015 Note that an empty string specifies that no linker section is specified.
5016 This is not quite the same as omitting the pragma or aspect, since it
5017 can be used to specify that one element of an overloaded set of subprograms
5018 has the default linker section, or that one object of a type for which a
5019 linker section is specified should has the default linker section.
5021 The compiler normally places library-level entities in standard sections
5022 depending on the class: procedures and functions generally go in the
5023 @code{.text} section, initialized variables in the @code{.data} section
5024 and uninitialized variables in the @code{.bss} section.
5026 Other, special sections may exist on given target machines to map special
5027 hardware, for example I/O ports or flash memory. This pragma is a means to
5028 defer the final layout of the executable to the linker, thus fully working
5029 at the symbolic level with the compiler.
5031 Some file formats do not support arbitrary sections so not all target
5032 machines support this pragma. The use of this pragma may cause a program
5033 execution to be erroneous if it is used to place an entity into an
5034 inappropriate section (e.g., a modified variable into the @code{.text}
5035 section). See also @code{pragma Persistent_BSS}.
5037 @example
5038 --  Example of the use of pragma Linker_Section
5040 package IO_Card is
5041   Port_A : Integer;
5042   pragma Volatile (Port_A);
5043   pragma Linker_Section (Port_A, ".bss.port_a");
5045   Port_B : Integer;
5046   pragma Volatile (Port_B);
5047   pragma Linker_Section (Port_B, ".bss.port_b");
5049   type Port_Type is new Integer with Linker_Section => ".bss";
5050   PA : Port_Type with Linker_Section => ".bss.PA";
5051   PB : Port_Type; --  ends up in linker section ".bss"
5053   procedure Q with Linker_Section => "Qsection";
5054 end IO_Card;
5055 @end example
5057 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
5058 @anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{9a}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{9b}
5059 @section Pragma Lock_Free
5062 Syntax:
5064 @example
5065 pragma Lock_Free [ (static_boolean_EXPRESSION) ];
5066 @end example
5068 This pragma may be specified for protected types or objects. It specifies that
5069 the implementation of protected operations must be implemented without locks.
5070 Compilation fails if the compiler cannot generate lock-free code for the
5071 operations.
5073 The current conditions required to support this pragma are:
5076 @itemize *
5078 @item 
5079 Protected type declarations may not contain entries
5081 @item 
5082 Protected subprogram declarations may not have nonelementary parameters
5083 @end itemize
5085 In addition, each protected subprogram body must satisfy:
5088 @itemize *
5090 @item 
5091 May reference only one protected component
5093 @item 
5094 May not reference nonconstant entities outside the protected subprogram
5095 scope
5097 @item 
5098 May not contain address representation items, allocators, or quantified
5099 expressions
5101 @item 
5102 May not contain delay, goto, loop, or procedure-call statements
5104 @item 
5105 May not contain exported and imported entities
5107 @item 
5108 May not dereferenced access values
5110 @item 
5111 Function calls and attribute references must be static
5112 @end itemize
5114 If the Lock_Free aspect is specified to be True for a protected unit
5115 and the Ceiling_Locking locking policy is in effect, then the run-time
5116 actions associated with the Ceiling_Locking locking policy (described in
5117 Ada RM D.3) are not performed when a protected operation of the protected
5118 unit is executed.
5120 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
5121 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{9c}
5122 @section Pragma Loop_Invariant
5125 Syntax:
5127 @example
5128 pragma Loop_Invariant ( boolean_EXPRESSION );
5129 @end example
5131 The effect of this pragma is similar to that of pragma @code{Assert},
5132 except that in an @code{Assertion_Policy} pragma, the identifier
5133 @code{Loop_Invariant} is used to control whether it is ignored or checked
5134 (or disabled).
5136 @code{Loop_Invariant} can only appear as one of the items in the sequence
5137 of statements of a loop body, or nested inside block statements that
5138 appear in the sequence of statements of a loop body.
5139 The intention is that it be used to
5140 represent a “loop invariant” assertion, i.e. something that is true each
5141 time through the loop, and which can be used to show that the loop is
5142 achieving its purpose.
5144 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5145 apply to the same loop should be grouped in the same sequence of
5146 statements.
5148 To aid in writing such invariants, the special attribute @code{Loop_Entry}
5149 may be used to refer to the value of an expression on entry to the loop. This
5150 attribute can only be used within the expression of a @code{Loop_Invariant}
5151 pragma. For full details, see documentation of attribute @code{Loop_Entry}.
5153 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
5154 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{9d}
5155 @section Pragma Loop_Optimize
5158 Syntax:
5160 @example
5161 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
5163 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
5164 @end example
5166 This pragma must appear immediately within a loop statement.  It allows the
5167 programmer to specify optimization hints for the enclosing loop.  The hints
5168 are not mutually exclusive and can be freely mixed, but not all combinations
5169 will yield a sensible outcome.
5171 There are five supported optimization hints for a loop:
5174 @itemize *
5176 @item 
5177 Ivdep
5179 The programmer asserts that there are no loop-carried dependencies
5180 which would prevent consecutive iterations of the loop from being
5181 executed simultaneously.
5183 @item 
5184 No_Unroll
5186 The loop must not be unrolled.  This is a strong hint: the compiler will not
5187 unroll a loop marked with this hint.
5189 @item 
5190 Unroll
5192 The loop should be unrolled.  This is a weak hint: the compiler will try to
5193 apply unrolling to this loop preferably to other optimizations, notably
5194 vectorization, but there is no guarantee that the loop will be unrolled.
5196 @item 
5197 No_Vector
5199 The loop must not be vectorized.  This is a strong hint: the compiler will not
5200 vectorize a loop marked with this hint.
5202 @item 
5203 Vector
5205 The loop should be vectorized.  This is a weak hint: the compiler will try to
5206 apply vectorization to this loop preferably to other optimizations, notably
5207 unrolling, but there is no guarantee that the loop will be vectorized.
5208 @end itemize
5210 These hints do not remove the need to pass the appropriate switches to the
5211 compiler in order to enable the relevant optimizations, that is to say
5212 `-funroll-loops' for unrolling and `-ftree-vectorize' for
5213 vectorization.
5215 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
5216 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{9e}
5217 @section Pragma Loop_Variant
5220 Syntax:
5222 @example
5223 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
5224 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
5225 CHANGE_DIRECTION ::= Increases | Decreases
5226 @end example
5228 @code{Loop_Variant} can only appear as one of the items in the sequence
5229 of statements of a loop body, or nested inside block statements that
5230 appear in the sequence of statements of a loop body.
5231 It allows the specification of quantities which must always
5232 decrease or increase in successive iterations of the loop. In its simplest
5233 form, just one expression is specified, whose value must increase or decrease
5234 on each iteration of the loop.
5236 In a more complex form, multiple arguments can be given which are interpreted
5237 in a nesting lexicographic manner. For example:
5239 @example
5240 pragma Loop_Variant (Increases => X, Decreases => Y);
5241 @end example
5243 specifies that each time through the loop either X increases, or X stays
5244 the same and Y decreases. A @code{Loop_Variant} pragma ensures that the
5245 loop is making progress. It can be useful in helping to show informally
5246 or prove formally that the loop always terminates.
5248 @code{Loop_Variant} is an assertion whose effect can be controlled using
5249 an @code{Assertion_Policy} with a check name of @code{Loop_Variant}. The
5250 policy can be @code{Check} to enable the loop variant check, @code{Ignore}
5251 to ignore the check (in which case the pragma has no effect on the program),
5252 or @code{Disable} in which case the pragma is not even checked for correct
5253 syntax.
5255 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5256 apply to the same loop should be grouped in the same sequence of
5257 statements.
5259 The @code{Loop_Entry} attribute may be used within the expressions of the
5260 @code{Loop_Variant} pragma to refer to values on entry to the loop.
5262 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
5263 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{9f}
5264 @section Pragma Machine_Attribute
5267 Syntax:
5269 @example
5270 pragma Machine_Attribute (
5271      [Entity         =>] LOCAL_NAME,
5272      [Attribute_Name =>] static_string_EXPRESSION
5273   [, [Info           =>] static_EXPRESSION @{, static_EXPRESSION@}] );
5274 @end example
5276 Machine-dependent attributes can be specified for types and/or
5277 declarations.  This pragma is semantically equivalent to
5278 @code{__attribute__((@var{attribute_name}))} (if @code{info} is not
5279 specified) or @code{__attribute__((@var{attribute_name(info})))}
5280 or @code{__attribute__((@var{attribute_name(info,...})))} in GNU C,
5281 where `attribute_name' is recognized by the compiler middle-end
5282 or the @code{TARGET_ATTRIBUTE_TABLE} machine specific macro.  Note
5283 that a string literal for the optional parameter @code{info} or the
5284 following ones is transformed by default into an identifier,
5285 which may make this pragma unusable for some attributes.
5286 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
5288 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
5289 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{a0}
5290 @section Pragma Main
5293 Syntax:
5295 @example
5296 pragma Main
5297  (MAIN_OPTION [, MAIN_OPTION]);
5299 MAIN_OPTION ::=
5300   [Stack_Size              =>] static_integer_EXPRESSION
5301 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
5302 | [Time_Slicing_Enabled    =>] static_boolean_EXPRESSION
5303 @end example
5305 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
5306 no effect in GNAT, other than being syntax checked.
5308 @node Pragma Main_Storage,Pragma Max_Queue_Length,Pragma Main,Implementation Defined Pragmas
5309 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{a1}
5310 @section Pragma Main_Storage
5313 Syntax:
5315 @example
5316 pragma Main_Storage
5317   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
5319 MAIN_STORAGE_OPTION ::=
5320   [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
5321 | [TOP_GUARD       =>] static_SIMPLE_EXPRESSION
5322 @end example
5324 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
5325 no effect in GNAT, other than being syntax checked.
5327 @node Pragma Max_Queue_Length,Pragma No_Body,Pragma Main_Storage,Implementation Defined Pragmas
5328 @anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a2}@anchor{gnat_rm/implementation_defined_pragmas pragma-max-queue-length}@anchor{a3}
5329 @section Pragma Max_Queue_Length
5332 Syntax:
5334 @example
5335 pragma Max_Queue_Length (static_integer_EXPRESSION);
5336 @end example
5338 This pragma is used to specify the maximum callers per entry queue for
5339 individual protected entries and entry families. It accepts a single
5340 integer (-1 or more) as a parameter and must appear after the declaration of an
5341 entry.
5343 A value of -1 represents no additional restriction on queue length.
5345 @node Pragma No_Body,Pragma No_Caching,Pragma Max_Queue_Length,Implementation Defined Pragmas
5346 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{a4}
5347 @section Pragma No_Body
5350 Syntax:
5352 @example
5353 pragma No_Body;
5354 @end example
5356 There are a number of cases in which a package spec does not require a body,
5357 and in fact a body is not permitted. GNAT will not permit the spec to be
5358 compiled if there is a body around. The pragma No_Body allows you to provide
5359 a body file, even in a case where no body is allowed. The body file must
5360 contain only comments and a single No_Body pragma. This is recognized by
5361 the compiler as indicating that no body is logically present.
5363 This is particularly useful during maintenance when a package is modified in
5364 such a way that a body needed before is no longer needed. The provision of a
5365 dummy body with a No_Body pragma ensures that there is no interference from
5366 earlier versions of the package body.
5368 @node Pragma No_Caching,Pragma No_Component_Reordering,Pragma No_Body,Implementation Defined Pragmas
5369 @anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{a5}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-caching}@anchor{a6}
5370 @section Pragma No_Caching
5373 Syntax:
5375 @example
5376 pragma No_Caching [ (static_boolean_EXPRESSION) ];
5377 @end example
5379 For the semantics of this pragma, see the entry for aspect @code{No_Caching} in
5380 the SPARK 2014 Reference Manual, section 7.1.2.
5382 @node Pragma No_Component_Reordering,Pragma No_Elaboration_Code_All,Pragma No_Caching,Implementation Defined Pragmas
5383 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-component-reordering}@anchor{a7}
5384 @section Pragma No_Component_Reordering
5387 Syntax:
5389 @example
5390 pragma No_Component_Reordering [([Entity =>] type_LOCAL_NAME)];
5391 @end example
5393 @code{type_LOCAL_NAME} must refer to a record type declaration in the current
5394 declarative part. The effect is to preclude any reordering of components
5395 for the layout of the record, i.e. the record is laid out by the compiler
5396 in the order in which the components are declared textually. The form with
5397 no argument is a configuration pragma which applies to all record types
5398 declared in units to which the pragma applies and there is a requirement
5399 that this pragma be used consistently within a partition.
5401 @node Pragma No_Elaboration_Code_All,Pragma No_Heap_Finalization,Pragma No_Component_Reordering,Implementation Defined Pragmas
5402 @anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{a8}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{a9}
5403 @section Pragma No_Elaboration_Code_All
5406 Syntax:
5408 @example
5409 pragma No_Elaboration_Code_All [(program_unit_NAME)];
5410 @end example
5412 This is a program unit pragma (there is also an equivalent aspect of the
5413 same name) that establishes the restriction @code{No_Elaboration_Code} for
5414 the current unit and any extended main source units (body and subunits).
5415 It also has the effect of enforcing a transitive application of this
5416 aspect, so that if any unit is implicitly or explicitly with’ed by the
5417 current unit, it must also have the @cite{No_Elaboration_Code_All} aspect set.
5418 It may be applied to package or subprogram specs or their generic versions.
5420 @node Pragma No_Heap_Finalization,Pragma No_Inline,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5421 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-heap-finalization}@anchor{aa}
5422 @section Pragma No_Heap_Finalization
5425 Syntax:
5427 @example
5428 pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ];
5429 @end example
5431 Pragma @code{No_Heap_Finalization} may be used as a configuration pragma or as a
5432 type-specific pragma.
5434 In its configuration form, the pragma must appear within a configuration file
5435 such as gnat.adc, without an argument. The pragma suppresses the call to
5436 @code{Finalize} for heap-allocated objects created through library-level named
5437 access-to-object types in cases where the designated type requires finalization
5438 actions.
5440 In its type-specific form, the argument of the pragma must denote a
5441 library-level named access-to-object type. The pragma suppresses the call to
5442 @code{Finalize} for heap-allocated objects created through the specific access type
5443 in cases where the designated type requires finalization actions.
5445 It is still possible to finalize such heap-allocated objects by explicitly
5446 deallocating them.
5448 A library-level named access-to-object type declared within a generic unit will
5449 lose its @code{No_Heap_Finalization} pragma when the corresponding instance does not
5450 appear at the library level.
5452 @node Pragma No_Inline,Pragma No_Return,Pragma No_Heap_Finalization,Implementation Defined Pragmas
5453 @anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{ab}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{ac}
5454 @section Pragma No_Inline
5457 Syntax:
5459 @example
5460 pragma No_Inline (NAME @{, NAME@});
5461 @end example
5463 This pragma suppresses inlining for the callable entity or the instances of
5464 the generic subprogram designated by @code{NAME}, including inlining that
5465 results from the use of pragma @code{Inline}.  This pragma is always active,
5466 in particular it is not subject to the use of option `-gnatn' or
5467 `-gnatN'.  It is illegal to specify both pragma @code{No_Inline} and
5468 pragma @code{Inline_Always} for the same @code{NAME}.
5470 @node Pragma No_Return,Pragma No_Strict_Aliasing,Pragma No_Inline,Implementation Defined Pragmas
5471 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{ad}
5472 @section Pragma No_Return
5475 Syntax:
5477 @example
5478 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5479 @end example
5481 Each @code{procedure_LOCAL_NAME} argument must refer to one or more procedure
5482 declarations in the current declarative part.  A procedure to which this
5483 pragma is applied may not contain any explicit @code{return} statements.
5484 In addition, if the procedure contains any implicit returns from falling
5485 off the end of a statement sequence, then execution of that implicit
5486 return will cause Program_Error to be raised.
5488 One use of this pragma is to identify procedures whose only purpose is to raise
5489 an exception. Another use of this pragma is to suppress incorrect warnings
5490 about missing returns in functions, where the last statement of a function
5491 statement sequence is a call to such a procedure.
5493 Note that in Ada 2005 mode, this pragma is part of the language. It is
5494 available in all earlier versions of Ada as an implementation-defined
5495 pragma.
5497 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Return,Implementation Defined Pragmas
5498 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{ae}
5499 @section Pragma No_Strict_Aliasing
5502 Syntax:
5504 @example
5505 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5506 @end example
5508 @code{type_LOCAL_NAME} must refer to an access type
5509 declaration in the current declarative part.  The effect is to inhibit
5510 strict aliasing optimization for the given type.  The form with no
5511 arguments is a configuration pragma which applies to all access types
5512 declared in units to which the pragma applies. For a detailed
5513 description of the strict aliasing optimization, and the situations
5514 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5515 in the @cite{GNAT User’s Guide}.
5517 This pragma currently has no effects on access to unconstrained array types.
5519 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5520 @anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{af}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{b0}
5521 @section Pragma No_Tagged_Streams
5524 Syntax:
5526 @example
5527 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5528 @end example
5530 Normally when a tagged type is introduced using a full type declaration,
5531 part of the processing includes generating stream access routines to be
5532 used by stream attributes referencing the type (or one of its subtypes
5533 or derived types). This can involve the generation of significant amounts
5534 of code which is wasted space if stream routines are not needed for the
5535 type in question.
5537 The @code{No_Tagged_Streams} pragma causes the generation of these stream
5538 routines to be skipped, and any attempt to use stream operations on
5539 types subject to this pragma will be statically rejected as illegal.
5541 There are two forms of the pragma. The form with no arguments must appear
5542 in a declarative sequence or in the declarations of a package spec. This
5543 pragma affects all subsequent root tagged types declared in the declaration
5544 sequence, and specifies that no stream routines be generated. The form with
5545 an argument (for which there is also a corresponding aspect) specifies a
5546 single root tagged type for which stream routines are not to be generated.
5548 Once the pragma has been given for a particular root tagged type, all subtypes
5549 and derived types of this type inherit the pragma automatically, so the effect
5550 applies to a complete hierarchy (this is necessary to deal with the class-wide
5551 dispatching versions of the stream routines).
5553 When pragmas @code{Discard_Names} and @code{No_Tagged_Streams} are simultaneously
5554 applied to a tagged type its Expanded_Name and External_Tag are initialized
5555 with empty strings. This is useful to avoid exposing entity names at binary
5556 level but has a negative impact on the debuggability of tagged types.
5558 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5559 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{b1}
5560 @section Pragma Normalize_Scalars
5563 Syntax:
5565 @example
5566 pragma Normalize_Scalars;
5567 @end example
5569 This is a language defined pragma which is fully implemented in GNAT.  The
5570 effect is to cause all scalar objects that are not otherwise initialized
5571 to be initialized.  The initial values are implementation dependent and
5572 are as follows:
5575 @table @asis
5577 @item `Standard.Character'
5579 Objects whose root type is Standard.Character are initialized to
5580 Character’Last unless the subtype range excludes NUL (in which case
5581 NUL is used). This choice will always generate an invalid value if
5582 one exists.
5584 @item `Standard.Wide_Character'
5586 Objects whose root type is Standard.Wide_Character are initialized to
5587 Wide_Character’Last unless the subtype range excludes NUL (in which case
5588 NUL is used). This choice will always generate an invalid value if
5589 one exists.
5591 @item `Standard.Wide_Wide_Character'
5593 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5594 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5595 which case NUL is used). This choice will always generate an invalid value if
5596 one exists.
5598 @item `Integer types'
5600 Objects of an integer type are treated differently depending on whether
5601 negative values are present in the subtype. If no negative values are
5602 present, then all one bits is used as the initial value except in the
5603 special case where zero is excluded from the subtype, in which case
5604 all zero bits are used. This choice will always generate an invalid
5605 value if one exists.
5607 For subtypes with negative values present, the largest negative number
5608 is used, except in the unusual case where this largest negative number
5609 is in the subtype, and the largest positive number is not, in which case
5610 the largest positive value is used. This choice will always generate
5611 an invalid value if one exists.
5613 @item `Floating-Point Types'
5615 Objects of all floating-point types are initialized to all 1-bits. For
5616 standard IEEE format, this corresponds to a NaN (not a number) which is
5617 indeed an invalid value.
5619 @item `Fixed-Point Types'
5621 Objects of all fixed-point types are treated as described above for integers,
5622 with the rules applying to the underlying integer value used to represent
5623 the fixed-point value.
5625 @item `Modular types'
5627 Objects of a modular type are initialized to all one bits, except in
5628 the special case where zero is excluded from the subtype, in which
5629 case all zero bits are used. This choice will always generate an
5630 invalid value if one exists.
5632 @item `Enumeration types'
5634 Objects of an enumeration type are initialized to all one-bits, i.e., to
5635 the value @code{2 ** typ'Size - 1} unless the subtype excludes the literal
5636 whose Pos value is zero, in which case a code of zero is used. This choice
5637 will always generate an invalid value if one exists.
5638 @end table
5640 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5641 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{b2}@anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{b3}
5642 @section Pragma Obsolescent
5645 Syntax:
5647 @example
5648 pragma Obsolescent;
5650 pragma Obsolescent (
5651   [Message =>] static_string_EXPRESSION
5652 [,[Version =>] Ada_05]);
5654 pragma Obsolescent (
5655   [Entity  =>] NAME
5656 [,[Message =>] static_string_EXPRESSION
5657 [,[Version =>] Ada_05]]);
5658 @end example
5660 This pragma can occur immediately following a declaration of an entity,
5661 including the case of a record component. If no Entity argument is present,
5662 then this declaration is the one to which the pragma applies. If an Entity
5663 parameter is present, it must either match the name of the entity in this
5664 declaration, or alternatively, the pragma can immediately follow an enumeration
5665 type declaration, where the Entity argument names one of the enumeration
5666 literals.
5668 This pragma is used to indicate that the named entity
5669 is considered obsolescent and should not be used. Typically this is
5670 used when an API must be modified by eventually removing or modifying
5671 existing subprograms or other entities. The pragma can be used at an
5672 intermediate stage when the entity is still present, but will be
5673 removed later.
5675 The effect of this pragma is to output a warning message on a reference to
5676 an entity thus marked that the subprogram is obsolescent if the appropriate
5677 warning option in the compiler is activated. If the @code{Message} parameter is
5678 present, then a second warning message is given containing this text. In
5679 addition, a reference to the entity is considered to be a violation of pragma
5680 @code{Restrictions (No_Obsolescent_Features)}.
5682 This pragma can also be used as a program unit pragma for a package,
5683 in which case the entity name is the name of the package, and the
5684 pragma indicates that the entire package is considered
5685 obsolescent. In this case a client @code{with}ing such a package
5686 violates the restriction, and the @code{with} clause is
5687 flagged with warnings if the warning option is set.
5689 If the @code{Version} parameter is present (which must be exactly
5690 the identifier @code{Ada_05}, no other argument is allowed), then the
5691 indication of obsolescence applies only when compiling in Ada 2005
5692 mode. This is primarily intended for dealing with the situations
5693 in the predefined library where subprograms or packages
5694 have become defined as obsolescent in Ada 2005
5695 (e.g., in @code{Ada.Characters.Handling}), but may be used anywhere.
5697 The following examples show typical uses of this pragma:
5699 @example
5700 package p is
5701    pragma Obsolescent (p, Message => "use pp instead of p");
5702 end p;
5704 package q is
5705    procedure q2;
5706    pragma Obsolescent ("use q2new instead");
5708    type R is new integer;
5709    pragma Obsolescent
5710      (Entity  => R,
5711       Message => "use RR in Ada 2005",
5712       Version => Ada_05);
5714    type M is record
5715       F1 : Integer;
5716       F2 : Integer;
5717       pragma Obsolescent;
5718       F3 : Integer;
5719    end record;
5721    type E is (a, bc, 'd', quack);
5722    pragma Obsolescent (Entity => bc)
5723    pragma Obsolescent (Entity => 'd')
5725    function "+"
5726      (a, b : character) return character;
5727    pragma Obsolescent (Entity => "+");
5728 end;
5729 @end example
5731 Note that, as for all pragmas, if you use a pragma argument identifier,
5732 then all subsequent parameters must also use a pragma argument identifier.
5733 So if you specify @code{Entity =>} for the @code{Entity} argument, and a @code{Message}
5734 argument is present, it must be preceded by @code{Message =>}.
5736 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5737 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{b4}
5738 @section Pragma Optimize_Alignment
5741 @geindex Alignment
5742 @geindex default settings
5744 Syntax:
5746 @example
5747 pragma Optimize_Alignment (TIME | SPACE | OFF);
5748 @end example
5750 This is a configuration pragma which affects the choice of default alignments
5751 for types and objects where no alignment is explicitly specified. There is a
5752 time/space trade-off in the selection of these values. Large alignments result
5753 in more efficient code, at the expense of larger data space, since sizes have
5754 to be increased to match these alignments. Smaller alignments save space, but
5755 the access code is slower. The normal choice of default alignments for types
5756 and individual alignment promotions for objects (which is what you get if you
5757 do not use this pragma, or if you use an argument of OFF), tries to balance
5758 these two requirements.
5760 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5761 First any packed record is given an alignment of 1. Second, if a size is given
5762 for the type, then the alignment is chosen to avoid increasing this size. For
5763 example, consider:
5765 @example
5766 type R is record
5767    X : Integer;
5768    Y : Character;
5769 end record;
5771 for R'Size use 5*8;
5772 @end example
5774 In the default mode, this type gets an alignment of 4, so that access to the
5775 Integer field X are efficient. But this means that objects of the type end up
5776 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5777 allowed to be bigger than the size of the type, but it can waste space if for
5778 example fields of type R appear in an enclosing record. If the above type is
5779 compiled in @code{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5781 However, there is one case in which SPACE is ignored. If a variable length
5782 record (that is a discriminated record with a component which is an array
5783 whose length depends on a discriminant), has a pragma Pack, then it is not
5784 in general possible to set the alignment of such a record to one, so the
5785 pragma is ignored in this case (with a warning).
5787 Specifying SPACE also disables alignment promotions for standalone objects,
5788 which occur when the compiler increases the alignment of a specific object
5789 without changing the alignment of its type.
5791 Specifying SPACE also disables component reordering in unpacked record types,
5792 which can result in larger sizes in order to meet alignment requirements.
5794 Specifying TIME causes larger default alignments to be chosen in the case of
5795 small types with sizes that are not a power of 2. For example, consider:
5797 @example
5798 type R is record
5799    A : Character;
5800    B : Character;
5801    C : Boolean;
5802 end record;
5804 pragma Pack (R);
5805 for R'Size use 17;
5806 @end example
5808 The default alignment for this record is normally 1, but if this type is
5809 compiled in @code{Optimize_Alignment (Time)} mode, then the alignment is set
5810 to 4, which wastes space for objects of the type, since they are now 4 bytes
5811 long, but results in more efficient access when the whole record is referenced.
5813 As noted above, this is a configuration pragma, and there is a requirement
5814 that all units in a partition be compiled with a consistent setting of the
5815 optimization setting. This would normally be achieved by use of a configuration
5816 pragma file containing the appropriate setting. The exception to this rule is
5817 that units with an explicit configuration pragma in the same file as the source
5818 unit are excluded from the consistency check, as are all predefined units. The
5819 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5820 pragma appears at the start of the file.
5822 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5823 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{b5}
5824 @section Pragma Ordered
5827 Syntax:
5829 @example
5830 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5831 @end example
5833 Most enumeration types are from a conceptual point of view unordered.
5834 For example, consider:
5836 @example
5837 type Color is (Red, Blue, Green, Yellow);
5838 @end example
5840 By Ada semantics @code{Blue > Red} and @code{Green > Blue},
5841 but really these relations make no sense; the enumeration type merely
5842 specifies a set of possible colors, and the order is unimportant.
5844 For unordered enumeration types, it is generally a good idea if
5845 clients avoid comparisons (other than equality or inequality) and
5846 explicit ranges. (A `client' is a unit where the type is referenced,
5847 other than the unit where the type is declared, its body, and its subunits.)
5848 For example, if code buried in some client says:
5850 @example
5851 if Current_Color < Yellow then ...
5852 if Current_Color in Blue .. Green then ...
5853 @end example
5855 then the client code is relying on the order, which is undesirable.
5856 It makes the code hard to read and creates maintenance difficulties if
5857 entries have to be added to the enumeration type. Instead,
5858 the code in the client should list the possibilities, or an
5859 appropriate subtype should be declared in the unit that declares
5860 the original enumeration type. E.g., the following subtype could
5861 be declared along with the type @code{Color}:
5863 @example
5864 subtype RBG is Color range Red .. Green;
5865 @end example
5867 and then the client could write:
5869 @example
5870 if Current_Color in RBG then ...
5871 if Current_Color = Blue or Current_Color = Green then ...
5872 @end example
5874 However, some enumeration types are legitimately ordered from a conceptual
5875 point of view. For example, if you declare:
5877 @example
5878 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5879 @end example
5881 then the ordering imposed by the language is reasonable, and
5882 clients can depend on it, writing for example:
5884 @example
5885 if D in Mon .. Fri then ...
5886 if D < Wed then ...
5887 @end example
5889 The pragma `Ordered' is provided to mark enumeration types that
5890 are conceptually ordered, alerting the reader that clients may depend
5891 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5892 rather than one to mark them as unordered, since in our experience,
5893 the great majority of enumeration types are conceptually unordered.
5895 The types @code{Boolean}, @code{Character}, @code{Wide_Character},
5896 and @code{Wide_Wide_Character}
5897 are considered to be ordered types, so each is declared with a
5898 pragma @code{Ordered} in package @code{Standard}.
5900 Normally pragma @code{Ordered} serves only as documentation and a guide for
5901 coding standards, but GNAT provides a warning switch `-gnatw.u' that
5902 requests warnings for inappropriate uses (comparisons and explicit
5903 subranges) for unordered types. If this switch is used, then any
5904 enumeration type not marked with pragma @code{Ordered} will be considered
5905 as unordered, and will generate warnings for inappropriate uses.
5907 Note that generic types are not considered ordered or unordered (since the
5908 template can be instantiated for both cases), so we never generate warnings
5909 for the case of generic enumerated types.
5911 For additional information please refer to the description of the
5912 `-gnatw.u' switch in the GNAT User’s Guide.
5914 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5915 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{b6}
5916 @section Pragma Overflow_Mode
5919 Syntax:
5921 @example
5922 pragma Overflow_Mode
5923  (  [General    =>] MODE
5924   [,[Assertions =>] MODE]);
5926 MODE ::= STRICT | MINIMIZED | ELIMINATED
5927 @end example
5929 This pragma sets the current overflow mode to the given setting. For details
5930 of the meaning of these modes, please refer to the
5931 ‘Overflow Check Handling in GNAT’ appendix in the
5932 GNAT User’s Guide. If only the @code{General} parameter is present,
5933 the given mode applies to all expressions. If both parameters are present,
5934 the @code{General} mode applies to expressions outside assertions, and
5935 the @code{Eliminated} mode applies to expressions within assertions.
5937 The case of the @code{MODE} parameter is ignored,
5938 so @code{MINIMIZED}, @code{Minimized} and
5939 @code{minimized} all have the same effect.
5941 The @code{Overflow_Mode} pragma has the same scoping and placement
5942 rules as pragma @code{Suppress}, so it can occur either as a
5943 configuration pragma, specifying a default for the whole
5944 program, or in a declarative scope, where it applies to the
5945 remaining declarations and statements in that scope.
5947 The pragma @code{Suppress (Overflow_Check)} suppresses
5948 overflow checking, but does not affect the overflow mode.
5950 The pragma @code{Unsuppress (Overflow_Check)} unsuppresses (enables)
5951 overflow checking, but does not affect the overflow mode.
5953 @node Pragma Overriding_Renamings,Pragma Part_Of,Pragma Overflow_Mode,Implementation Defined Pragmas
5954 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{b7}
5955 @section Pragma Overriding_Renamings
5958 @geindex Rational profile
5960 @geindex Rational compatibility
5962 Syntax:
5964 @example
5965 pragma Overriding_Renamings;
5966 @end example
5968 This is a GNAT configuration pragma to simplify porting
5969 legacy code accepted by the Rational
5970 Ada compiler. In the presence of this pragma, a renaming declaration that
5971 renames an inherited operation declared in the same scope is legal if selected
5972 notation is used as in:
5974 @example
5975 pragma Overriding_Renamings;
5977 package R is
5978   function F (..);
5979   ...
5980   function F (..) renames R.F;
5981 end R;
5982 @end example
5984 even though
5985 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5986 declaration of the overriding operation.
5988 @node Pragma Part_Of,Pragma Partition_Elaboration_Policy,Pragma Overriding_Renamings,Implementation Defined Pragmas
5989 @anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{b8}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{b9}
5990 @section Pragma Part_Of
5993 Syntax:
5995 @example
5996 pragma Part_Of (ABSTRACT_STATE);
5998 ABSTRACT_STATE ::= NAME
5999 @end example
6001 For the semantics of this pragma, see the entry for aspect @code{Part_Of} in the
6002 SPARK 2014 Reference Manual, section 7.2.6.
6004 @node Pragma Partition_Elaboration_Policy,Pragma Passive,Pragma Part_Of,Implementation Defined Pragmas
6005 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{ba}
6006 @section Pragma Partition_Elaboration_Policy
6009 Syntax:
6011 @example
6012 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
6014 POLICY_IDENTIFIER ::= Concurrent | Sequential
6015 @end example
6017 This pragma is standard in Ada 2005, but is available in all earlier
6018 versions of Ada as an implementation-defined pragma.
6019 See Ada 2012 Reference Manual for details.
6021 @node Pragma Passive,Pragma Persistent_BSS,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
6022 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{bb}
6023 @section Pragma Passive
6026 Syntax:
6028 @example
6029 pragma Passive [(Semaphore | No)];
6030 @end example
6032 Syntax checked, but otherwise ignored by GNAT.  This is recognized for
6033 compatibility with DEC Ada 83 implementations, where it is used within a
6034 task definition to request that a task be made passive.  If the argument
6035 @code{Semaphore} is present, or the argument is omitted, then DEC Ada 83
6036 treats the pragma as an assertion that the containing task is passive
6037 and that optimization of context switch with this task is permitted and
6038 desired.  If the argument @code{No} is present, the task must not be
6039 optimized.  GNAT does not attempt to optimize any tasks in this manner
6040 (since protected objects are available in place of passive tasks).
6042 For more information on the subject of passive tasks, see the section
6043 ‘Passive Task Optimization’ in the GNAT Users Guide.
6045 @node Pragma Persistent_BSS,Pragma Post,Pragma Passive,Implementation Defined Pragmas
6046 @anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{bc}@anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{bd}
6047 @section Pragma Persistent_BSS
6050 Syntax:
6052 @example
6053 pragma Persistent_BSS [(object_LOCAL_NAME)]
6054 @end example
6056 This pragma allows selected objects to be placed in the @code{.persistent_bss}
6057 section. On some targets the linker and loader provide for special
6058 treatment of this section, allowing a program to be reloaded without
6059 affecting the contents of this data (hence the name persistent).
6061 There are two forms of usage. If an argument is given, it must be the
6062 local name of a library-level object, with no explicit initialization
6063 and whose type is potentially persistent. If no argument is given, then
6064 the pragma is a configuration pragma, and applies to all library-level
6065 objects with no explicit initialization of potentially persistent types.
6067 A potentially persistent type is a scalar type, or an untagged,
6068 non-discriminated record, all of whose components have no explicit
6069 initialization and are themselves of a potentially persistent type,
6070 or an array, all of whose constraints are static, and whose component
6071 type is potentially persistent.
6073 If this pragma is used on a target where this feature is not supported,
6074 then the pragma will be ignored. See also @code{pragma Linker_Section}.
6076 @node Pragma Post,Pragma Postcondition,Pragma Persistent_BSS,Implementation Defined Pragmas
6077 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{be}
6078 @section Pragma Post
6081 @geindex Post
6083 @geindex Checks
6084 @geindex postconditions
6086 Syntax:
6088 @example
6089 pragma Post (Boolean_Expression);
6090 @end example
6092 The @code{Post} pragma is intended to be an exact replacement for
6093 the language-defined
6094 @code{Post} aspect, and shares its restrictions and semantics.
6095 It must appear either immediately following the corresponding
6096 subprogram declaration (only other pragmas may intervene), or
6097 if there is no separate subprogram declaration, then it can
6098 appear at the start of the declarations in a subprogram body
6099 (preceded only by other pragmas).
6101 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
6102 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{bf}
6103 @section Pragma Postcondition
6106 @geindex Postcondition
6108 @geindex Checks
6109 @geindex postconditions
6111 Syntax:
6113 @example
6114 pragma Postcondition (
6115    [Check   =>] Boolean_Expression
6116  [,[Message =>] String_Expression]);
6117 @end example
6119 The @code{Postcondition} pragma allows specification of automatic
6120 postcondition checks for subprograms. These checks are similar to
6121 assertions, but are automatically inserted just prior to the return
6122 statements of the subprogram with which they are associated (including
6123 implicit returns at the end of procedure bodies and associated
6124 exception handlers).
6126 In addition, the boolean expression which is the condition which
6127 must be true may contain references to function’Result in the case
6128 of a function to refer to the returned value.
6130 @code{Postcondition} pragmas may appear either immediately following the
6131 (separate) declaration of a subprogram, or at the start of the
6132 declarations of a subprogram body. Only other pragmas may intervene
6133 (that is appear between the subprogram declaration and its
6134 postconditions, or appear before the postcondition in the
6135 declaration sequence in a subprogram body). In the case of a
6136 postcondition appearing after a subprogram declaration, the
6137 formal arguments of the subprogram are visible, and can be
6138 referenced in the postcondition expressions.
6140 The postconditions are collected and automatically tested just
6141 before any return (implicit or explicit) in the subprogram body.
6142 A postcondition is only recognized if postconditions are active
6143 at the time the pragma is encountered. The compiler switch `gnata'
6144 turns on all postconditions by default, and pragma @code{Check_Policy}
6145 with an identifier of @code{Postcondition} can also be used to
6146 control whether postconditions are active.
6148 The general approach is that postconditions are placed in the spec
6149 if they represent functional aspects which make sense to the client.
6150 For example we might have:
6152 @example
6153 function Direction return Integer;
6154 pragma Postcondition
6155  (Direction'Result = +1
6156     or else
6157   Direction'Result = -1);
6158 @end example
6160 which serves to document that the result must be +1 or -1, and
6161 will test that this is the case at run time if postcondition
6162 checking is active.
6164 Postconditions within the subprogram body can be used to
6165 check that some internal aspect of the implementation,
6166 not visible to the client, is operating as expected.
6167 For instance if a square root routine keeps an internal
6168 counter of the number of times it is called, then we
6169 might have the following postcondition:
6171 @example
6172 Sqrt_Calls : Natural := 0;
6174 function Sqrt (Arg : Float) return Float is
6175   pragma Postcondition
6176     (Sqrt_Calls = Sqrt_Calls'Old + 1);
6177   ...
6178 end Sqrt
6179 @end example
6181 As this example, shows, the use of the @code{Old} attribute
6182 is often useful in postconditions to refer to the state on
6183 entry to the subprogram.
6185 Note that postconditions are only checked on normal returns
6186 from the subprogram. If an abnormal return results from
6187 raising an exception, then the postconditions are not checked.
6189 If a postcondition fails, then the exception
6190 @code{System.Assertions.Assert_Failure} is raised. If
6191 a message argument was supplied, then the given string
6192 will be used as the exception message. If no message
6193 argument was supplied, then the default message has
6194 the form “Postcondition failed at file_name:line”. The
6195 exception is raised in the context of the subprogram
6196 body, so it is possible to catch postcondition failures
6197 within the subprogram body itself.
6199 Within a package spec, normal visibility rules
6200 in Ada would prevent forward references within a
6201 postcondition pragma to functions defined later in
6202 the same package. This would introduce undesirable
6203 ordering constraints. To avoid this problem, all
6204 postcondition pragmas are analyzed at the end of
6205 the package spec, allowing forward references.
6207 The following example shows that this even allows
6208 mutually recursive postconditions as in:
6210 @example
6211 package Parity_Functions is
6212    function Odd  (X : Natural) return Boolean;
6213    pragma Postcondition
6214      (Odd'Result =
6215         (x = 1
6216           or else
6217         (x /= 0 and then Even (X - 1))));
6219    function Even (X : Natural) return Boolean;
6220    pragma Postcondition
6221      (Even'Result =
6222         (x = 0
6223           or else
6224         (x /= 1 and then Odd (X - 1))));
6226 end Parity_Functions;
6227 @end example
6229 There are no restrictions on the complexity or form of
6230 conditions used within @code{Postcondition} pragmas.
6231 The following example shows that it is even possible
6232 to verify performance behavior.
6234 @example
6235 package Sort is
6237    Performance : constant Float;
6238    --  Performance constant set by implementation
6239    --  to match target architecture behavior.
6241    procedure Treesort (Arg : String);
6242    --  Sorts characters of argument using N*logN sort
6243    pragma Postcondition
6244      (Float (Clock - Clock'Old) <=
6245         Float (Arg'Length) *
6246         log (Float (Arg'Length)) *
6247         Performance);
6248 end Sort;
6249 @end example
6251 Note: postcondition pragmas associated with subprograms that are
6252 marked as Inline_Always, or those marked as Inline with front-end
6253 inlining (-gnatN option set) are accepted and legality-checked
6254 by the compiler, but are ignored at run-time even if postcondition
6255 checking is enabled.
6257 Note that pragma @code{Postcondition} differs from the language-defined
6258 @code{Post} aspect (and corresponding @code{Post} pragma) in allowing
6259 multiple occurrences, allowing occurences in the body even if there
6260 is a separate spec, and allowing a second string parameter, and the
6261 use of the pragma identifier @code{Check}. Historically, pragma
6262 @code{Postcondition} was implemented prior to the development of
6263 Ada 2012, and has been retained in its original form for
6264 compatibility purposes.
6266 @node Pragma Post_Class,Pragma Pre,Pragma Postcondition,Implementation Defined Pragmas
6267 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{c0}
6268 @section Pragma Post_Class
6271 @geindex Post
6273 @geindex Checks
6274 @geindex postconditions
6276 Syntax:
6278 @example
6279 pragma Post_Class (Boolean_Expression);
6280 @end example
6282 The @code{Post_Class} pragma is intended to be an exact replacement for
6283 the language-defined
6284 @code{Post'Class} aspect, and shares its restrictions and semantics.
6285 It must appear either immediately following the corresponding
6286 subprogram declaration (only other pragmas may intervene), or
6287 if there is no separate subprogram declaration, then it can
6288 appear at the start of the declarations in a subprogram body
6289 (preceded only by other pragmas).
6291 Note: This pragma is called @code{Post_Class} rather than
6292 @code{Post'Class} because the latter would not be strictly
6293 conforming to the allowed syntax for pragmas. The motivation
6294 for providing pragmas equivalent to the aspects is to allow a program
6295 to be written using the pragmas, and then compiled if necessary
6296 using an Ada compiler that does not recognize the pragmas or
6297 aspects, but is prepared to ignore the pragmas. The assertion
6298 policy that controls this pragma is @code{Post'Class}, not
6299 @code{Post_Class}.
6301 @node Pragma Pre,Pragma Precondition,Pragma Post_Class,Implementation Defined Pragmas
6302 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{c1}
6303 @section Pragma Pre
6306 @geindex Pre
6308 @geindex Checks
6309 @geindex preconditions
6311 Syntax:
6313 @example
6314 pragma Pre (Boolean_Expression);
6315 @end example
6317 The @code{Pre} pragma is intended to be an exact replacement for
6318 the language-defined
6319 @code{Pre} aspect, and shares its restrictions and semantics.
6320 It must appear either immediately following the corresponding
6321 subprogram declaration (only other pragmas may intervene), or
6322 if there is no separate subprogram declaration, then it can
6323 appear at the start of the declarations in a subprogram body
6324 (preceded only by other pragmas).
6326 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
6327 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{c2}
6328 @section Pragma Precondition
6331 @geindex Preconditions
6333 @geindex Checks
6334 @geindex preconditions
6336 Syntax:
6338 @example
6339 pragma Precondition (
6340    [Check   =>] Boolean_Expression
6341  [,[Message =>] String_Expression]);
6342 @end example
6344 The @code{Precondition} pragma is similar to @code{Postcondition}
6345 except that the corresponding checks take place immediately upon
6346 entry to the subprogram, and if a precondition fails, the exception
6347 is raised in the context of the caller, and the attribute ‘Result
6348 cannot be used within the precondition expression.
6350 Otherwise, the placement and visibility rules are identical to those
6351 described for postconditions. The following is an example of use
6352 within a package spec:
6354 @example
6355 package Math_Functions is
6356    ...
6357    function Sqrt (Arg : Float) return Float;
6358    pragma Precondition (Arg >= 0.0)
6359    ...
6360 end Math_Functions;
6361 @end example
6363 @code{Precondition} pragmas may appear either immediately following the
6364 (separate) declaration of a subprogram, or at the start of the
6365 declarations of a subprogram body. Only other pragmas may intervene
6366 (that is appear between the subprogram declaration and its
6367 postconditions, or appear before the postcondition in the
6368 declaration sequence in a subprogram body).
6370 Note: precondition pragmas associated with subprograms that are
6371 marked as Inline_Always, or those marked as Inline with front-end
6372 inlining (-gnatN option set) are accepted and legality-checked
6373 by the compiler, but are ignored at run-time even if precondition
6374 checking is enabled.
6376 Note that pragma @code{Precondition} differs from the language-defined
6377 @code{Pre} aspect (and corresponding @code{Pre} pragma) in allowing
6378 multiple occurrences, allowing occurences in the body even if there
6379 is a separate spec, and allowing a second string parameter, and the
6380 use of the pragma identifier @code{Check}. Historically, pragma
6381 @code{Precondition} was implemented prior to the development of
6382 Ada 2012, and has been retained in its original form for
6383 compatibility purposes.
6385 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
6386 @anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{c3}@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{c4}
6387 @section Pragma Predicate
6390 Syntax:
6392 @example
6393 pragma Predicate
6394   ([Entity =>] type_LOCAL_NAME,
6395    [Check  =>] EXPRESSION);
6396 @end example
6398 This pragma (available in all versions of Ada in GNAT) encompasses both
6399 the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
6400 Ada 2012. A predicate is regarded as static if it has an allowed form
6401 for @code{Static_Predicate} and is otherwise treated as a
6402 @code{Dynamic_Predicate}. Otherwise, predicates specified by this
6403 pragma behave exactly as described in the Ada 2012 reference manual.
6404 For example, if we have
6406 @example
6407 type R is range 1 .. 10;
6408 subtype S is R;
6409 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6410 subtype Q is R
6411 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6412 @end example
6414 the effect is identical to the following Ada 2012 code:
6416 @example
6417 type R is range 1 .. 10;
6418 subtype S is R with
6419   Static_Predicate => S not in 4 .. 6;
6420 subtype Q is R with
6421   Dynamic_Predicate => F(Q) or G(Q);
6422 @end example
6424 Note that there are no pragmas @code{Dynamic_Predicate}
6425 or @code{Static_Predicate}. That is
6426 because these pragmas would affect legality and semantics of
6427 the program and thus do not have a neutral effect if ignored.
6428 The motivation behind providing pragmas equivalent to
6429 corresponding aspects is to allow a program to be written
6430 using the pragmas, and then compiled with a compiler that
6431 will ignore the pragmas. That doesn’t work in the case of
6432 static and dynamic predicates, since if the corresponding
6433 pragmas are ignored, then the behavior of the program is
6434 fundamentally changed (for example a membership test
6435 @code{A in B} would not take into account a predicate
6436 defined for subtype B). When following this approach, the
6437 use of predicates should be avoided.
6439 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6440 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{c5}
6441 @section Pragma Predicate_Failure
6444 Syntax:
6446 @example
6447 pragma Predicate_Failure
6448   ([Entity  =>] type_LOCAL_NAME,
6449    [Message =>] String_Expression);
6450 @end example
6452 The @code{Predicate_Failure} pragma is intended to be an exact replacement for
6453 the language-defined
6454 @code{Predicate_Failure} aspect, and shares its restrictions and semantics.
6456 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6457 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{c6}
6458 @section Pragma Preelaborable_Initialization
6461 Syntax:
6463 @example
6464 pragma Preelaborable_Initialization (DIRECT_NAME);
6465 @end example
6467 This pragma is standard in Ada 2005, but is available in all earlier
6468 versions of Ada as an implementation-defined pragma.
6469 See Ada 2012 Reference Manual for details.
6471 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6472 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c7}
6473 @section Pragma Prefix_Exception_Messages
6476 @geindex Prefix_Exception_Messages
6478 @geindex exception
6480 @geindex Exception_Message
6482 Syntax:
6484 @example
6485 pragma Prefix_Exception_Messages;
6486 @end example
6488 This is an implementation-defined configuration pragma that affects the
6489 behavior of raise statements with a message given as a static string
6490 constant (typically a string literal). In such cases, the string will
6491 be automatically prefixed by the name of the enclosing entity (giving
6492 the package and subprogram containing the raise statement). This helps
6493 to identify where messages are coming from, and this mode is automatic
6494 for the run-time library.
6496 The pragma has no effect if the message is computed with an expression other
6497 than a static string constant, since the assumption in this case is that
6498 the program computes exactly the string it wants. If you still want the
6499 prefixing in this case, you can always call
6500 @code{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6502 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6503 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c8}
6504 @section Pragma Pre_Class
6507 @geindex Pre_Class
6509 @geindex Checks
6510 @geindex preconditions
6512 Syntax:
6514 @example
6515 pragma Pre_Class (Boolean_Expression);
6516 @end example
6518 The @code{Pre_Class} pragma is intended to be an exact replacement for
6519 the language-defined
6520 @code{Pre'Class} aspect, and shares its restrictions and semantics.
6521 It must appear either immediately following the corresponding
6522 subprogram declaration (only other pragmas may intervene), or
6523 if there is no separate subprogram declaration, then it can
6524 appear at the start of the declarations in a subprogram body
6525 (preceded only by other pragmas).
6527 Note: This pragma is called @code{Pre_Class} rather than
6528 @code{Pre'Class} because the latter would not be strictly
6529 conforming to the allowed syntax for pragmas. The motivation
6530 for providing pragmas equivalent to the aspects is to allow a program
6531 to be written using the pragmas, and then compiled if necessary
6532 using an Ada compiler that does not recognize the pragmas or
6533 aspects, but is prepared to ignore the pragmas. The assertion
6534 policy that controls this pragma is @code{Pre'Class}, not
6535 @code{Pre_Class}.
6537 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6538 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c9}
6539 @section Pragma Priority_Specific_Dispatching
6542 Syntax:
6544 @example
6545 pragma Priority_Specific_Dispatching (
6546    POLICY_IDENTIFIER,
6547    first_priority_EXPRESSION,
6548    last_priority_EXPRESSION)
6550 POLICY_IDENTIFIER ::=
6551    EDF_Across_Priorities            |
6552    FIFO_Within_Priorities           |
6553    Non_Preemptive_Within_Priorities |
6554    Round_Robin_Within_Priorities
6555 @end example
6557 This pragma is standard in Ada 2005, but is available in all earlier
6558 versions of Ada as an implementation-defined pragma.
6559 See Ada 2012 Reference Manual for details.
6561 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6562 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{ca}
6563 @section Pragma Profile
6566 Syntax:
6568 @example
6569 pragma Profile (Ravenscar | Restricted | Rational | Jorvik |
6570                 GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
6571 @end example
6573 This pragma is standard in Ada 2005, but is available in all earlier
6574 versions of Ada as an implementation-defined pragma. This is a
6575 configuration pragma that establishes a set of configuration pragmas
6576 that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
6577 @code{Jorvik} is standard in Ada 202x.
6578 The other possibilities (@code{Restricted}, @code{Rational},
6579 @code{GNAT_Extended_Ravenscar}, @code{GNAT_Ravenscar_EDF})
6580 are implementation-defined.  @code{GNAT_Extended_Ravenscar} is an alias for @code{Jorvik}.
6582 The set of configuration pragmas is defined in the following sections.
6585 @itemize *
6587 @item 
6588 Pragma Profile (Ravenscar)
6590 The @code{Ravenscar} profile is standard in Ada 2005,
6591 but is available in all earlier
6592 versions of Ada as an implementation-defined pragma. This profile
6593 establishes the following set of configuration pragmas:
6596 @itemize *
6598 @item 
6599 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6601 [RM D.2.2] Tasks are dispatched following a preemptive
6602 priority-ordered scheduling policy.
6604 @item 
6605 @code{Locking_Policy (Ceiling_Locking)}
6607 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6608 the ceiling priority of the corresponding protected object.
6610 @item 
6611 @code{Detect_Blocking}
6613 This pragma forces the detection of potentially blocking operations within a
6614 protected operation, and to raise Program_Error if that happens.
6615 @end itemize
6617 plus the following set of restrictions:
6620 @itemize *
6622 @item 
6623 @code{Max_Entry_Queue_Length => 1}
6625 No task can be queued on a protected entry.
6627 @item 
6628 @code{Max_Protected_Entries => 1}
6630 @item 
6631 @code{Max_Task_Entries => 0}
6633 No rendezvous statements are allowed.
6635 @item 
6636 @code{No_Abort_Statements}
6638 @item 
6639 @code{No_Dynamic_Attachment}
6641 @item 
6642 @code{No_Dynamic_Priorities}
6644 @item 
6645 @code{No_Implicit_Heap_Allocations}
6647 @item 
6648 @code{No_Local_Protected_Objects}
6650 @item 
6651 @code{No_Local_Timing_Events}
6653 @item 
6654 @code{No_Protected_Type_Allocators}
6656 @item 
6657 @code{No_Relative_Delay}
6659 @item 
6660 @code{No_Requeue_Statements}
6662 @item 
6663 @code{No_Select_Statements}
6665 @item 
6666 @code{No_Specific_Termination_Handlers}
6668 @item 
6669 @code{No_Task_Allocators}
6671 @item 
6672 @code{No_Task_Hierarchy}
6674 @item 
6675 @code{No_Task_Termination}
6677 @item 
6678 @code{Simple_Barriers}
6679 @end itemize
6681 The Ravenscar profile also includes the following restrictions that specify
6682 that there are no semantic dependencies on the corresponding predefined
6683 packages:
6686 @itemize *
6688 @item 
6689 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6691 @item 
6692 @code{No_Dependence => Ada.Calendar}
6694 @item 
6695 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6697 @item 
6698 @code{No_Dependence => Ada.Execution_Time.Timers}
6700 @item 
6701 @code{No_Dependence => Ada.Task_Attributes}
6703 @item 
6704 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6705 @end itemize
6707 This set of configuration pragmas and restrictions correspond to the
6708 definition of the ‘Ravenscar Profile’ for limited tasking, devised and
6709 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6710 A description is also available at
6711 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6713 The original definition of the profile was revised at subsequent IRTAW
6714 meetings. It has been included in the ISO
6715 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6716 and was made part of the Ada 2005 standard.
6717 The formal definition given by
6718 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6719 AI-305) available at
6720 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6721 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6723 The above set is a superset of the restrictions provided by pragma
6724 @code{Profile (Restricted)}, it includes six additional restrictions
6725 (@code{Simple_Barriers}, @code{No_Select_Statements},
6726 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6727 @code{No_Relative_Delay} and @code{No_Task_Termination}).  This means
6728 that pragma @code{Profile (Ravenscar)}, like the pragma
6729 @code{Profile (Restricted)},
6730 automatically causes the use of a simplified,
6731 more efficient version of the tasking run-time library.
6733 @item 
6734 Pragma Profile (Jorvik)
6736 @code{Jorvik} is the new profile added to the Ada 202x draft standard,
6737 previously implemented under the name @code{GNAT_Extended_Ravenscar}.
6739 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6740 by @code{No_Implicit_Task_Allocations} and
6741 @code{No_Implicit_Protected_Object_Allocations}.
6743 The @code{Simple_Barriers} restriction has been replaced by
6744 @code{Pure_Barriers}.
6746 The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
6747 @code{No_Relative_Delay} restrictions have been removed.
6749 Details on the rationale for @code{Jorvik} and implications for use may be
6750 found in @cite{A New Ravenscar-Based Profile} by P. Rogers, J. Ruiz,
6751 T. Gingold and P. Bernardi, in @cite{Reliable Software Technologies – Ada Europe 2017}, Springer-Verlag Lecture Notes in Computer Science,
6752 Number 10300.
6754 @item 
6755 Pragma Profile (GNAT_Ravenscar_EDF)
6757 This profile corresponds to the Ravenscar profile but using
6758 EDF_Across_Priority as the Task_Scheduling_Policy.
6760 @item 
6761 Pragma Profile (Restricted)
6763 This profile corresponds to the GNAT restricted run time. It
6764 establishes the following set of restrictions:
6767 @itemize *
6769 @item 
6770 @code{No_Abort_Statements}
6772 @item 
6773 @code{No_Entry_Queue}
6775 @item 
6776 @code{No_Task_Hierarchy}
6778 @item 
6779 @code{No_Task_Allocators}
6781 @item 
6782 @code{No_Dynamic_Priorities}
6784 @item 
6785 @code{No_Terminate_Alternatives}
6787 @item 
6788 @code{No_Dynamic_Attachment}
6790 @item 
6791 @code{No_Protected_Type_Allocators}
6793 @item 
6794 @code{No_Local_Protected_Objects}
6796 @item 
6797 @code{No_Requeue_Statements}
6799 @item 
6800 @code{No_Task_Attributes_Package}
6802 @item 
6803 @code{Max_Asynchronous_Select_Nesting =  0}
6805 @item 
6806 @code{Max_Task_Entries =  0}
6808 @item 
6809 @code{Max_Protected_Entries = 1}
6811 @item 
6812 @code{Max_Select_Alternatives = 0}
6813 @end itemize
6815 This set of restrictions causes the automatic selection of a simplified
6816 version of the run time that provides improved performance for the
6817 limited set of tasking functionality permitted by this set of restrictions.
6819 @item 
6820 Pragma Profile (Rational)
6822 The Rational profile is intended to facilitate porting legacy code that
6823 compiles with the Rational APEX compiler, even when the code includes non-
6824 conforming Ada constructs.  The profile enables the following three pragmas:
6827 @itemize *
6829 @item 
6830 @code{pragma Implicit_Packing}
6832 @item 
6833 @code{pragma Overriding_Renamings}
6835 @item 
6836 @code{pragma Use_VADS_Size}
6837 @end itemize
6838 @end itemize
6840 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6841 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{cb}
6842 @section Pragma Profile_Warnings
6845 Syntax:
6847 @example
6848 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6849 @end example
6851 This is an implementation-defined pragma that is similar in
6852 effect to @code{pragma Profile} except that instead of
6853 generating @code{Restrictions} pragmas, it generates
6854 @code{Restriction_Warnings} pragmas. The result is that
6855 violations of the profile generate warning messages instead
6856 of error messages.
6858 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6859 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{cc}
6860 @section Pragma Propagate_Exceptions
6863 @geindex Interfacing to C++
6865 Syntax:
6867 @example
6868 pragma Propagate_Exceptions;
6869 @end example
6871 This pragma is now obsolete and, other than generating a warning if warnings
6872 on obsolescent features are enabled, is ignored.
6873 It is retained for compatibility
6874 purposes. It used to be used in connection with optimization of
6875 a now-obsolete mechanism for implementation of exceptions.
6877 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
6878 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{cd}
6879 @section Pragma Provide_Shift_Operators
6882 @geindex Shift operators
6884 Syntax:
6886 @example
6887 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
6888 @end example
6890 This pragma can be applied to a first subtype local name that specifies
6891 either an unsigned or signed type. It has the effect of providing the
6892 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
6893 Rotate_Left and Rotate_Right) for the given type. It is similar to
6894 including the function declarations for these five operators, together
6895 with the pragma Import (Intrinsic, …) statements.
6897 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
6898 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{ce}
6899 @section Pragma Psect_Object
6902 Syntax:
6904 @example
6905 pragma Psect_Object (
6906      [Internal =>] LOCAL_NAME,
6907   [, [External =>] EXTERNAL_SYMBOL]
6908   [, [Size     =>] EXTERNAL_SYMBOL]);
6910 EXTERNAL_SYMBOL ::=
6911   IDENTIFIER
6912 | static_string_EXPRESSION
6913 @end example
6915 This pragma is identical in effect to pragma @code{Common_Object}.
6917 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
6918 @anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{cf}@anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{d0}
6919 @section Pragma Pure_Function
6922 Syntax:
6924 @example
6925 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
6926 @end example
6928 This pragma appears in the same declarative part as a function
6929 declaration (or a set of function declarations if more than one
6930 overloaded declaration exists, in which case the pragma applies
6931 to all entities).  It specifies that the function @code{Entity} is
6932 to be considered pure for the purposes of code generation.  This means
6933 that the compiler can assume that there are no side effects, and
6934 in particular that two identical calls produce the same result in
6935 the same context. It also means that the function can be used in
6936 an address clause.
6938 Note that, quite deliberately, there are no static checks to try
6939 to ensure that this promise is met, so @code{Pure_Function} can be used
6940 with functions that are conceptually pure, even if they do modify
6941 global variables.  For example, a square root function that is
6942 instrumented to count the number of times it is called is still
6943 conceptually pure, and can still be optimized, even though it
6944 modifies a global variable (the count).  Memo functions are another
6945 example (where a table of previous calls is kept and consulted to
6946 avoid re-computation).
6948 Note also that the normal rules excluding optimization of subprograms
6949 in pure units (when parameter types are descended from System.Address,
6950 or when the full view of a parameter type is limited), do not apply
6951 for the Pure_Function case. If you explicitly specify Pure_Function,
6952 the compiler may optimize away calls with identical arguments, and
6953 if that results in unexpected behavior, the proper action is not to
6954 use the pragma for subprograms that are not (conceptually) pure.
6956 Note: Most functions in a @code{Pure} package are automatically pure, and
6957 there is no need to use pragma @code{Pure_Function} for such functions.  One
6958 exception is any function that has at least one formal of type
6959 @code{System.Address} or a type derived from it.  Such functions are not
6960 considered pure by default, since the compiler assumes that the
6961 @code{Address} parameter may be functioning as a pointer and that the
6962 referenced data may change even if the address value does not.
6963 Similarly, imported functions are not considered to be pure by default,
6964 since there is no way of checking that they are in fact pure.  The use
6965 of pragma @code{Pure_Function} for such a function will override these default
6966 assumption, and cause the compiler to treat a designated subprogram as pure
6967 in these cases.
6969 Note: If pragma @code{Pure_Function} is applied to a renamed function, it
6970 applies to the underlying renamed function.  This can be used to
6971 disambiguate cases of overloading where some but not all functions
6972 in a set of overloaded functions are to be designated as pure.
6974 If pragma @code{Pure_Function} is applied to a library-level function, the
6975 function is also considered pure from an optimization point of view, but the
6976 unit is not a Pure unit in the categorization sense. So for example, a function
6977 thus marked is free to @code{with} non-pure units.
6979 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
6980 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{d1}
6981 @section Pragma Rational
6984 Syntax:
6986 @example
6987 pragma Rational;
6988 @end example
6990 This pragma is considered obsolescent, but is retained for
6991 compatibility purposes. It is equivalent to:
6993 @example
6994 pragma Profile (Rational);
6995 @end example
6997 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
6998 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{d2}
6999 @section Pragma Ravenscar
7002 Syntax:
7004 @example
7005 pragma Ravenscar;
7006 @end example
7008 This pragma is considered obsolescent, but is retained for
7009 compatibility purposes. It is equivalent to:
7011 @example
7012 pragma Profile (Ravenscar);
7013 @end example
7015 which is the preferred method of setting the @code{Ravenscar} profile.
7017 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
7018 @anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d3}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{d4}
7019 @section Pragma Refined_Depends
7022 Syntax:
7024 @example
7025 pragma Refined_Depends (DEPENDENCY_RELATION);
7027 DEPENDENCY_RELATION ::=
7028      null
7029   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
7031 DEPENDENCY_CLAUSE ::=
7032     OUTPUT_LIST =>[+] INPUT_LIST
7033   | NULL_DEPENDENCY_CLAUSE
7035 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
7037 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
7039 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
7041 OUTPUT ::= NAME | FUNCTION_RESULT
7042 INPUT  ::= NAME
7044 where FUNCTION_RESULT is a function Result attribute_reference
7045 @end example
7047 For the semantics of this pragma, see the entry for aspect @code{Refined_Depends} in
7048 the SPARK 2014 Reference Manual, section 6.1.5.
7050 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
7051 @anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d5}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{d6}
7052 @section Pragma Refined_Global
7055 Syntax:
7057 @example
7058 pragma Refined_Global (GLOBAL_SPECIFICATION);
7060 GLOBAL_SPECIFICATION ::=
7061      null
7062   | (GLOBAL_LIST)
7063   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
7065 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
7067 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
7068 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
7069 GLOBAL_ITEM   ::= NAME
7070 @end example
7072 For the semantics of this pragma, see the entry for aspect @code{Refined_Global} in
7073 the SPARK 2014 Reference Manual, section 6.1.4.
7075 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
7076 @anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{d7}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d8}
7077 @section Pragma Refined_Post
7080 Syntax:
7082 @example
7083 pragma Refined_Post (boolean_EXPRESSION);
7084 @end example
7086 For the semantics of this pragma, see the entry for aspect @code{Refined_Post} in
7087 the SPARK 2014 Reference Manual, section 7.2.7.
7089 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
7090 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{d9}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{da}
7091 @section Pragma Refined_State
7094 Syntax:
7096 @example
7097 pragma Refined_State (REFINEMENT_LIST);
7099 REFINEMENT_LIST ::=
7100   (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
7102 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
7104 CONSTITUENT_LIST ::=
7105      null
7106   |  CONSTITUENT
7107   | (CONSTITUENT @{, CONSTITUENT@})
7109 CONSTITUENT ::= object_NAME | state_NAME
7110 @end example
7112 For the semantics of this pragma, see the entry for aspect @code{Refined_State} in
7113 the SPARK 2014 Reference Manual, section 7.2.2.
7115 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
7116 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{db}
7117 @section Pragma Relative_Deadline
7120 Syntax:
7122 @example
7123 pragma Relative_Deadline (time_span_EXPRESSION);
7124 @end example
7126 This pragma is standard in Ada 2005, but is available in all earlier
7127 versions of Ada as an implementation-defined pragma.
7128 See Ada 2012 Reference Manual for details.
7130 @node Pragma Remote_Access_Type,Pragma Rename_Pragma,Pragma Relative_Deadline,Implementation Defined Pragmas
7131 @anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{dc}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{dd}
7132 @section Pragma Remote_Access_Type
7135 Syntax:
7137 @example
7138 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
7139 @end example
7141 This pragma appears in the formal part of a generic declaration.
7142 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
7143 the use of a remote access to class-wide type as actual for a formal
7144 access type.
7146 When this pragma applies to a formal access type @code{Entity}, that
7147 type is treated as a remote access to class-wide type in the generic.
7148 It must be a formal general access type, and its designated type must
7149 be the class-wide type of a formal tagged limited private type from the
7150 same generic declaration.
7152 In the generic unit, the formal type is subject to all restrictions
7153 pertaining to remote access to class-wide types. At instantiation, the
7154 actual type must be a remote access to class-wide type.
7156 @node Pragma Rename_Pragma,Pragma Restricted_Run_Time,Pragma Remote_Access_Type,Implementation Defined Pragmas
7157 @anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{de}
7158 @section Pragma Rename_Pragma
7161 @geindex Pragmas
7162 @geindex synonyms
7164 Syntax:
7166 @example
7167 pragma Rename_Pragma (
7168          [New_Name =>] IDENTIFIER,
7169          [Renamed  =>] pragma_IDENTIFIER);
7170 @end example
7172 This pragma provides a mechanism for supplying new names for existing
7173 pragmas. The @code{New_Name} identifier can subsequently be used as a synonym for
7174 the Renamed pragma. For example, suppose you have code that was originally
7175 developed on a compiler that supports Inline_Only as an implementation defined
7176 pragma. And suppose the semantics of pragma Inline_Only are identical to (or at
7177 least very similar to) the GNAT implementation defined pragma
7178 Inline_Always. You could globally replace Inline_Only with Inline_Always.
7180 However, to avoid that source modification, you could instead add a
7181 configuration pragma:
7183 @example
7184 pragma Rename_Pragma (
7185          New_Name => Inline_Only,
7186          Renamed  => Inline_Always);
7187 @end example
7189 Then GNAT will treat “pragma Inline_Only …” as if you had written
7190 “pragma Inline_Always …”.
7192 Pragma Inline_Only will not necessarily mean the same thing as the other Ada
7193 compiler; it’s up to you to make sure the semantics are close enough.
7195 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Rename_Pragma,Implementation Defined Pragmas
7196 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{df}
7197 @section Pragma Restricted_Run_Time
7200 Syntax:
7202 @example
7203 pragma Restricted_Run_Time;
7204 @end example
7206 This pragma is considered obsolescent, but is retained for
7207 compatibility purposes. It is equivalent to:
7209 @example
7210 pragma Profile (Restricted);
7211 @end example
7213 which is the preferred method of setting the restricted run time
7214 profile.
7216 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
7217 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{e0}
7218 @section Pragma Restriction_Warnings
7221 Syntax:
7223 @example
7224 pragma Restriction_Warnings
7225   (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
7226 @end example
7228 This pragma allows a series of restriction identifiers to be
7229 specified (the list of allowed identifiers is the same as for
7230 pragma @code{Restrictions}). For each of these identifiers
7231 the compiler checks for violations of the restriction, but
7232 generates a warning message rather than an error message
7233 if the restriction is violated.
7235 One use of this is in situations where you want to know
7236 about violations of a restriction, but you want to ignore some of
7237 these violations. Consider this example, where you want to set
7238 Ada_95 mode and enable style checks, but you want to know about
7239 any other use of implementation pragmas:
7241 @example
7242 pragma Restriction_Warnings (No_Implementation_Pragmas);
7243 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
7244 pragma Ada_95;
7245 pragma Style_Checks ("2bfhkM160");
7246 pragma Warnings (On, "violation of No_Implementation_Pragmas");
7247 @end example
7249 By including the above lines in a configuration pragmas file,
7250 the Ada_95 and Style_Checks pragmas are accepted without
7251 generating a warning, but any other use of implementation
7252 defined pragmas will cause a warning to be generated.
7254 @node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
7255 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{e1}
7256 @section Pragma Reviewable
7259 Syntax:
7261 @example
7262 pragma Reviewable;
7263 @end example
7265 This pragma is an RM-defined standard pragma, but has no effect on the
7266 program being compiled, or on the code generated for the program.
7268 To obtain the required output specified in RM H.3.1, the compiler must be
7269 run with various special switches as follows:
7272 @itemize *
7274 @item 
7275 `Where compiler-generated run-time checks remain'
7277 The switch `-gnatGL'
7278 may be used to list the expanded code in pseudo-Ada form.
7279 Runtime checks show up in the listing either as explicit
7280 checks or operators marked with @{@} to indicate a check is present.
7282 @item 
7283 `An identification of known exceptions at compile time'
7285 If the program is compiled with `-gnatwa',
7286 the compiler warning messages will indicate all cases where the compiler
7287 detects that an exception is certain to occur at run time.
7289 @item 
7290 `Possible reads of uninitialized variables'
7292 The compiler warns of many such cases, but its output is incomplete.
7293 @end itemize
7296 A supplemental static analysis tool
7297 may be used to obtain a comprehensive list of all
7298 possible points at which uninitialized data may be read.
7301 @itemize *
7303 @item 
7304 `Where run-time support routines are implicitly invoked'
7306 In the output from `-gnatGL',
7307 run-time calls are explicitly listed as calls to the relevant
7308 run-time routine.
7310 @item 
7311 `Object code listing'
7313 This may be obtained either by using the `-S' switch,
7314 or the objdump utility.
7316 @item 
7317 `Constructs known to be erroneous at compile time'
7319 These are identified by warnings issued by the compiler (use `-gnatwa').
7321 @item 
7322 `Stack usage information'
7324 Static stack usage data (maximum per-subprogram) can be obtained via the
7325 `-fstack-usage' switch to the compiler.
7326 Dynamic stack usage data (per task) can be obtained via the `-u' switch
7327 to gnatbind
7328 @end itemize
7332 @itemize *
7334 @item 
7335 `Object code listing of entire partition'
7337 This can be obtained by compiling the partition with `-S',
7338 or by applying objdump
7339 to all the object files that are part of the partition.
7341 @item 
7342 `A description of the run-time model'
7344 The full sources of the run-time are available, and the documentation of
7345 these routines describes how these run-time routines interface to the
7346 underlying operating system facilities.
7348 @item 
7349 `Control and data-flow information'
7350 @end itemize
7353 A supplemental static analysis tool
7354 may be used to obtain complete control and data-flow information, as well as
7355 comprehensive messages identifying possible problems based on this
7356 information.
7358 @node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
7359 @anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e2}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{e3}
7360 @section Pragma Secondary_Stack_Size
7363 Syntax:
7365 @example
7366 pragma Secondary_Stack_Size (integer_EXPRESSION);
7367 @end example
7369 This pragma appears within the task definition of a single task declaration
7370 or a task type declaration (like pragma @code{Storage_Size}) and applies to all
7371 task objects of that type. The argument specifies the size of the secondary
7372 stack to be used by these task objects, and must be of an integer type. The
7373 secondary stack is used to handle functions that return a variable-sized
7374 result, for example a function returning an unconstrained String.
7376 Note this pragma only applies to targets using fixed secondary stacks, like
7377 VxWorks 653 and bare board targets, where a fixed block for the
7378 secondary stack is allocated from the primary stack of the task. By default,
7379 these targets assign a percentage of the primary stack for the secondary stack,
7380 as defined by @code{System.Parameter.Sec_Stack_Percentage}. With this pragma,
7381 an @code{integer_EXPRESSION} of bytes is assigned from the primary stack instead.
7383 For most targets, the pragma does not apply as the secondary stack grows on
7384 demand: allocated as a chain of blocks in the heap. The default size of these
7385 blocks can be modified via the @code{-D} binder option as described in
7386 @cite{GNAT User’s Guide}.
7388 Note that no check is made to see if the secondary stack can fit inside the
7389 primary stack.
7391 Note the pragma cannot appear when the restriction @code{No_Secondary_Stack}
7392 is in effect.
7394 @node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
7395 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{e4}
7396 @section Pragma Share_Generic
7399 Syntax:
7401 @example
7402 pragma Share_Generic (GNAME @{, GNAME@});
7404 GNAME ::= generic_unit_NAME | generic_instance_NAME
7405 @end example
7407 This pragma is provided for compatibility with Dec Ada 83. It has
7408 no effect in GNAT (which does not implement shared generics), other
7409 than to check that the given names are all names of generic units or
7410 generic instances.
7412 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
7413 @anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{e5}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{e6}
7414 @section Pragma Shared
7417 This pragma is provided for compatibility with Ada 83. The syntax and
7418 semantics are identical to pragma Atomic.
7420 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
7421 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{e7}
7422 @section Pragma Short_Circuit_And_Or
7425 Syntax:
7427 @example
7428 pragma Short_Circuit_And_Or;
7429 @end example
7431 This configuration pragma causes any occurrence of the AND operator applied to
7432 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
7433 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
7434 may be useful in the context of certification protocols requiring the use of
7435 short-circuited logical operators. If this configuration pragma occurs locally
7436 within the file being compiled, it applies only to the file being compiled.
7437 There is no requirement that all units in a partition use this option.
7439 @node Pragma Short_Descriptors,Pragma Side_Effects,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
7440 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e8}
7441 @section Pragma Short_Descriptors
7444 Syntax:
7446 @example
7447 pragma Short_Descriptors;
7448 @end example
7450 This pragma is provided for compatibility with other Ada implementations. It
7451 is recognized but ignored by all current versions of GNAT.
7453 @node Pragma Side_Effects,Pragma Simple_Storage_Pool_Type,Pragma Short_Descriptors,Implementation Defined Pragmas
7454 @anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{e9}@anchor{gnat_rm/implementation_defined_pragmas pragma-side-effects}@anchor{ea}
7455 @section Pragma Side_Effects
7458 Syntax:
7460 @example
7461 pragma Side_Effects [ (static_boolean_EXPRESSION) ];
7462 @end example
7464 For the semantics of this pragma, see the entry for aspect
7465 @code{Side_Effects} in the SPARK Reference Manual, section 6.1.11.
7467 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Side_Effects,Implementation Defined Pragmas
7468 @anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{eb}@anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{ec}
7469 @section Pragma Simple_Storage_Pool_Type
7472 @geindex Storage pool
7473 @geindex simple
7475 @geindex Simple storage pool
7477 Syntax:
7479 @example
7480 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
7481 @end example
7483 A type can be established as a ‘simple storage pool type’ by applying
7484 the representation pragma @code{Simple_Storage_Pool_Type} to the type.
7485 A type named in the pragma must be a library-level immutably limited record
7486 type or limited tagged type declared immediately within a package declaration.
7487 The type can also be a limited private type whose full type is allowed as
7488 a simple storage pool type.
7490 For a simple storage pool type @code{SSP}, nonabstract primitive subprograms
7491 @code{Allocate}, @code{Deallocate}, and @code{Storage_Size} can be declared that
7492 are subtype conformant with the following subprogram declarations:
7494 @example
7495 procedure Allocate
7496   (Pool                     : in out SSP;
7497    Storage_Address          : out System.Address;
7498    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7499    Alignment                : System.Storage_Elements.Storage_Count);
7501 procedure Deallocate
7502   (Pool : in out SSP;
7503    Storage_Address          : System.Address;
7504    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7505    Alignment                : System.Storage_Elements.Storage_Count);
7507 function Storage_Size (Pool : SSP)
7508   return System.Storage_Elements.Storage_Count;
7509 @end example
7511 Procedure @code{Allocate} must be declared, whereas @code{Deallocate} and
7512 @code{Storage_Size} are optional. If @code{Deallocate} is not declared, then
7513 applying an unchecked deallocation has no effect other than to set its actual
7514 parameter to null. If @code{Storage_Size} is not declared, then the
7515 @code{Storage_Size} attribute applied to an access type associated with
7516 a pool object of type SSP returns zero. Additional operations can be declared
7517 for a simple storage pool type (such as for supporting a mark/release
7518 storage-management discipline).
7520 An object of a simple storage pool type can be associated with an access
7521 type by specifying the attribute
7522 @ref{ed,,Simple_Storage_Pool}. For example:
7524 @example
7525 My_Pool : My_Simple_Storage_Pool_Type;
7527 type Acc is access My_Data_Type;
7529 for Acc'Simple_Storage_Pool use My_Pool;
7530 @end example
7532 See attribute @ref{ed,,Simple_Storage_Pool}
7533 for further details.
7535 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7536 @anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{ee}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{ef}
7537 @section Pragma Source_File_Name
7540 Syntax:
7542 @example
7543 pragma Source_File_Name (
7544   [Unit_Name     =>] unit_NAME,
7545   Spec_File_Name =>  STRING_LITERAL,
7546   [Index => INTEGER_LITERAL]);
7548 pragma Source_File_Name (
7549   [Unit_Name     =>] unit_NAME,
7550   Body_File_Name =>  STRING_LITERAL,
7551   [Index => INTEGER_LITERAL]);
7552 @end example
7554 Use this to override the normal naming convention.  It is a configuration
7555 pragma, and so has the usual applicability of configuration pragmas
7556 (i.e., it applies to either an entire partition, or to all units in a
7557 compilation, or to a single unit, depending on how it is used).
7558 @code{unit_name} is mapped to @code{file_name_literal}.  The identifier for
7559 the second argument is required, and indicates whether this is the file
7560 name for the spec or for the body.
7562 The optional Index argument should be used when a file contains multiple
7563 units, and when you do not want to use @code{gnatchop} to separate then
7564 into multiple files (which is the recommended procedure to limit the
7565 number of recompilations that are needed when some sources change).
7566 For instance, if the source file @code{source.ada} contains
7568 @example
7569 package B is
7571 end B;
7573 with B;
7574 procedure A is
7575 begin
7576    ..
7577 end A;
7578 @end example
7580 you could use the following configuration pragmas:
7582 @example
7583 pragma Source_File_Name
7584   (B, Spec_File_Name => "source.ada", Index => 1);
7585 pragma Source_File_Name
7586   (A, Body_File_Name => "source.ada", Index => 2);
7587 @end example
7589 Note that the @code{gnatname} utility can also be used to generate those
7590 configuration pragmas.
7592 Another form of the @code{Source_File_Name} pragma allows
7593 the specification of patterns defining alternative file naming schemes
7594 to apply to all files.
7596 @example
7597 pragma Source_File_Name
7598   (  [Spec_File_Name  =>] STRING_LITERAL
7599    [,[Casing          =>] CASING_SPEC]
7600    [,[Dot_Replacement =>] STRING_LITERAL]);
7602 pragma Source_File_Name
7603   (  [Body_File_Name  =>] STRING_LITERAL
7604    [,[Casing          =>] CASING_SPEC]
7605    [,[Dot_Replacement =>] STRING_LITERAL]);
7607 pragma Source_File_Name
7608   (  [Subunit_File_Name =>] STRING_LITERAL
7609    [,[Casing            =>] CASING_SPEC]
7610    [,[Dot_Replacement   =>] STRING_LITERAL]);
7612 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7613 @end example
7615 The first argument is a pattern that contains a single asterisk indicating
7616 the point at which the unit name is to be inserted in the pattern string
7617 to form the file name.  The second argument is optional.  If present it
7618 specifies the casing of the unit name in the resulting file name string.
7619 The default is lower case.  Finally the third argument allows for systematic
7620 replacement of any dots in the unit name by the specified string literal.
7622 Note that Source_File_Name pragmas should not be used if you are using
7623 project files. The reason for this rule is that the project manager is not
7624 aware of these pragmas, and so other tools that use the project file would not
7625 be aware of the intended naming conventions. If you are using project files,
7626 file naming is controlled by Source_File_Name_Project pragmas, which are
7627 usually supplied automatically by the project manager. A pragma
7628 Source_File_Name cannot appear after a @ref{f0,,Pragma Source_File_Name_Project}.
7630 For more details on the use of the @code{Source_File_Name} pragma, see the
7631 sections on @cite{Using Other File Names} and @cite{Alternative File Naming Schemes}
7632 in the @cite{GNAT User’s Guide}.
7634 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7635 @anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{f1}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{f0}
7636 @section Pragma Source_File_Name_Project
7639 This pragma has the same syntax and semantics as pragma Source_File_Name.
7640 It is only allowed as a stand-alone configuration pragma.
7641 It cannot appear after a @ref{ef,,Pragma Source_File_Name}, and
7642 most importantly, once pragma Source_File_Name_Project appears,
7643 no further Source_File_Name pragmas are allowed.
7645 The intention is that Source_File_Name_Project pragmas are always
7646 generated by the Project Manager in a manner consistent with the naming
7647 specified in a project file, and when naming is controlled in this manner,
7648 it is not permissible to attempt to modify this naming scheme using
7649 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7650 known to the project manager).
7652 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7653 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{f2}
7654 @section Pragma Source_Reference
7657 Syntax:
7659 @example
7660 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7661 @end example
7663 This pragma must appear as the first line of a source file.
7664 @code{integer_literal} is the logical line number of the line following
7665 the pragma line (for use in error messages and debugging
7666 information).  @code{string_literal} is a static string constant that
7667 specifies the file name to be used in error messages and debugging
7668 information.  This is most notably used for the output of @code{gnatchop}
7669 with the `-r' switch, to make sure that the original unchopped
7670 source file is the one referred to.
7672 The second argument must be a string literal, it cannot be a static
7673 string expression other than a string literal.  This is because its value
7674 is needed for error messages issued by all phases of the compiler.
7676 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7677 @anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{f3}@anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{f4}
7678 @section Pragma SPARK_Mode
7681 Syntax:
7683 @example
7684 pragma SPARK_Mode [(On | Off)] ;
7685 @end example
7687 In general a program can have some parts that are in SPARK 2014 (and
7688 follow all the rules in the SPARK Reference Manual), and some parts
7689 that are full Ada 2012.
7691 The SPARK_Mode pragma is used to identify which parts are in SPARK
7692 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7693 be used in the following places:
7696 @itemize *
7698 @item 
7699 As a configuration pragma, in which case it sets the default mode for
7700 all units compiled with this pragma.
7702 @item 
7703 Immediately following a library-level subprogram spec
7705 @item 
7706 Immediately within a library-level package body
7708 @item 
7709 Immediately following the @code{private} keyword of a library-level
7710 package spec
7712 @item 
7713 Immediately following the @code{begin} keyword of a library-level
7714 package body
7716 @item 
7717 Immediately within a library-level subprogram body
7718 @end itemize
7720 Normally a subprogram or package spec/body inherits the current mode
7721 that is active at the point it is declared. But this can be overridden
7722 by pragma within the spec or body as above.
7724 The basic consistency rule is that you can’t turn SPARK_Mode back
7725 @code{On}, once you have explicitly (with a pragma) turned if
7726 @code{Off}. So the following rules apply:
7728 If a subprogram spec has SPARK_Mode @code{Off}, then the body must
7729 also have SPARK_Mode @code{Off}.
7731 For a package, we have four parts:
7734 @itemize *
7736 @item 
7737 the package public declarations
7739 @item 
7740 the package private part
7742 @item 
7743 the body of the package
7745 @item 
7746 the elaboration code after @code{begin}
7747 @end itemize
7749 For a package, the rule is that if you explicitly turn SPARK_Mode
7750 @code{Off} for any part, then all the following parts must have
7751 SPARK_Mode @code{Off}. Note that this may require repeating a pragma
7752 SPARK_Mode (@code{Off}) in the body. For example, if we have a
7753 configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
7754 default everywhere, and one particular package spec has pragma
7755 SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
7756 the package body.
7758 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7759 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{f5}
7760 @section Pragma Static_Elaboration_Desired
7763 Syntax:
7765 @example
7766 pragma Static_Elaboration_Desired;
7767 @end example
7769 This pragma is used to indicate that the compiler should attempt to initialize
7770 statically the objects declared in the library unit to which the pragma applies,
7771 when these objects are initialized (explicitly or implicitly) by an aggregate.
7772 In the absence of this pragma, aggregates in object declarations are expanded
7773 into assignments and loops, even when the aggregate components are static
7774 constants. When the aggregate is present the compiler builds a static expression
7775 that requires no run-time code, so that the initialized object can be placed in
7776 read-only data space. If the components are not static, or the aggregate has
7777 more that 100 components, the compiler emits a warning that the pragma cannot
7778 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7779 construction of larger aggregates with static components that include an others
7780 choice.)
7782 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7783 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{f6}
7784 @section Pragma Stream_Convert
7787 Syntax:
7789 @example
7790 pragma Stream_Convert (
7791   [Entity =>] type_LOCAL_NAME,
7792   [Read   =>] function_NAME,
7793   [Write  =>] function_NAME);
7794 @end example
7796 This pragma provides an efficient way of providing user-defined stream
7797 attributes.  Not only is it simpler to use than specifying the attributes
7798 directly, but more importantly, it allows the specification to be made in such
7799 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7800 needed (i.e. unless the stream attributes are actually used); the use of
7801 the Stream_Convert pragma adds no overhead at all, unless the stream
7802 attributes are actually used on the designated type.
7804 The first argument specifies the type for which stream functions are
7805 provided.  The second parameter provides a function used to read values
7806 of this type.  It must name a function whose argument type may be any
7807 subtype, and whose returned type must be the type given as the first
7808 argument to the pragma.
7810 The meaning of the @code{Read} parameter is that if a stream attribute directly
7811 or indirectly specifies reading of the type given as the first parameter,
7812 then a value of the type given as the argument to the Read function is
7813 read from the stream, and then the Read function is used to convert this
7814 to the required target type.
7816 Similarly the @code{Write} parameter specifies how to treat write attributes
7817 that directly or indirectly apply to the type given as the first parameter.
7818 It must have an input parameter of the type specified by the first parameter,
7819 and the return type must be the same as the input type of the Read function.
7820 The effect is to first call the Write function to convert to the given stream
7821 type, and then write the result type to the stream.
7823 The Read and Write functions must not be overloaded subprograms.  If necessary
7824 renamings can be supplied to meet this requirement.
7825 The usage of this attribute is best illustrated by a simple example, taken
7826 from the GNAT implementation of package Ada.Strings.Unbounded:
7828 @example
7829 function To_Unbounded (S : String) return Unbounded_String
7830   renames To_Unbounded_String;
7832 pragma Stream_Convert
7833   (Unbounded_String, To_Unbounded, To_String);
7834 @end example
7836 The specifications of the referenced functions, as given in the Ada
7837 Reference Manual are:
7839 @example
7840 function To_Unbounded_String (Source : String)
7841   return Unbounded_String;
7843 function To_String (Source : Unbounded_String)
7844   return String;
7845 @end example
7847 The effect is that if the value of an unbounded string is written to a stream,
7848 then the representation of the item in the stream is in the same format that
7849 would be used for @code{Standard.String'Output}, and this same representation
7850 is expected when a value of this type is read from the stream. Note that the
7851 value written always includes the bounds, even for Unbounded_String’Write,
7852 since Unbounded_String is not an array type.
7854 Note that the @code{Stream_Convert} pragma is not effective in the case of
7855 a derived type of a non-limited tagged type. If such a type is specified then
7856 the pragma is silently ignored, and the default implementation of the stream
7857 attributes is used instead.
7859 @node Pragma Style_Checks,Pragma Subprogram_Variant,Pragma Stream_Convert,Implementation Defined Pragmas
7860 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{f7}
7861 @section Pragma Style_Checks
7864 Syntax:
7866 @example
7867 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7868                      On | Off [, LOCAL_NAME]);
7869 @end example
7871 This pragma is used in conjunction with compiler switches to control the
7872 built in style checking provided by GNAT.  The compiler switches, if set,
7873 provide an initial setting for the switches, and this pragma may be used
7874 to modify these settings, or the settings may be provided entirely by
7875 the use of the pragma.  This pragma can be used anywhere that a pragma
7876 is legal, including use as a configuration pragma (including use in
7877 the @code{gnat.adc} file).
7879 The form with a string literal specifies which style options are to be
7880 activated.  These are additive, so they apply in addition to any previously
7881 set style check options.  The codes for the options are the same as those
7882 used in the `-gnaty' switch to `gcc' or `gnatmake'.
7883 For example the following two methods can be used to enable
7884 layout checking:
7887 @itemize *
7889 @item 
7890 @example
7891 pragma Style_Checks ("l");
7892 @end example
7894 @item 
7895 @example
7896 gcc -c -gnatyl ...
7897 @end example
7898 @end itemize
7900 The form @code{ALL_CHECKS} activates all standard checks (its use is equivalent
7901 to the use of the @code{gnaty} switch with no options.
7902 See the @cite{GNAT User’s Guide} for details.)
7904 Note: the behavior is slightly different in GNAT mode (@code{-gnatg} used).
7905 In this case, @code{ALL_CHECKS} implies the standard set of GNAT mode style check
7906 options (i.e. equivalent to @code{-gnatyg}).
7908 The forms with @code{Off} and @code{On}
7909 can be used to temporarily disable style checks
7910 as shown in the following example:
7912 @example
7913 pragma Style_Checks ("k"); -- requires keywords in lower case
7914 pragma Style_Checks (Off); -- turn off style checks
7915 NULL;                      -- this will not generate an error message
7916 pragma Style_Checks (On);  -- turn style checks back on
7917 NULL;                      -- this will generate an error message
7918 @end example
7920 Finally the two argument form is allowed only if the first argument is
7921 @code{On} or @code{Off}.  The effect is to turn of semantic style checks
7922 for the specified entity, as shown in the following example:
7924 @example
7925 pragma Style_Checks ("r"); -- require consistency of identifier casing
7926 Arg : Integer;
7927 Rf1 : Integer := ARG;      -- incorrect, wrong case
7928 pragma Style_Checks (Off, Arg);
7929 Rf2 : Integer := ARG;      -- OK, no error
7930 @end example
7932 @node Pragma Subprogram_Variant,Pragma Subtitle,Pragma Style_Checks,Implementation Defined Pragmas
7933 @anchor{gnat_rm/implementation_defined_pragmas pragma-subprogram-variant}@anchor{f8}
7934 @section Pragma Subprogram_Variant
7937 @geindex Subprogram_Variant
7939 Syntax:
7941 @example
7942 pragma Subprogram_Variant (SUBPROGRAM_VARIANT_LIST);
7944 SUBPROGRAM_VARIANT_LIST ::=
7945   STRUCTURAL_SUBPROGRAM_VARIANT_ITEM
7946 | NUMERIC_SUBPROGRAM_VARIANT_ITEMS
7948 NUMERIC_SUBPROGRAM_VARIANT_ITEMS ::=
7949   NUMERIC_SUBPROGRAM_VARIANT_ITEM @{, NUMERIC_SUBPROGRAM_VARIANT_ITEM@}
7951 NUMERIC_SUBPROGRAM_VARIANT_ITEM ::=
7952   CHANGE_DIRECTION => EXPRESSION
7954 STRUCTURAL_SUBPROGRAM_VARIANT_ITEM ::=
7955   STRUCTURAL => EXPRESSION
7957 CHANGE_DIRECTION ::= Increases | Decreases
7958 @end example
7960 The @code{Subprogram_Variant} pragma is intended to be an exact replacement for
7961 the implementation-defined @code{Subprogram_Variant} aspect, and shares its
7962 restrictions and semantics.
7964 @node Pragma Subtitle,Pragma Suppress,Pragma Subprogram_Variant,Implementation Defined Pragmas
7965 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{f9}
7966 @section Pragma Subtitle
7969 Syntax:
7971 @example
7972 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
7973 @end example
7975 This pragma is recognized for compatibility with other Ada compilers
7976 but is ignored by GNAT.
7978 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
7979 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{fa}
7980 @section Pragma Suppress
7983 Syntax:
7985 @example
7986 pragma Suppress (Identifier [, [On =>] Name]);
7987 @end example
7989 This is a standard pragma, and supports all the check names required in
7990 the RM. It is included here because GNAT recognizes some additional check
7991 names that are implementation defined (as permitted by the RM):
7994 @itemize *
7996 @item 
7997 @code{Alignment_Check} can be used to suppress alignment checks
7998 on addresses used in address clauses. Such checks can also be suppressed
7999 by suppressing range checks, but the specific use of @code{Alignment_Check}
8000 allows suppression of alignment checks without suppressing other range checks.
8001 Note that @code{Alignment_Check} is suppressed by default on machines (such as
8002 the x86) with non-strict alignment.
8004 @item 
8005 @code{Atomic_Synchronization} can be used to suppress the special memory
8006 synchronization instructions that are normally generated for access to
8007 @code{Atomic} variables to ensure correct synchronization between tasks
8008 that use such variables for synchronization purposes.
8010 @item 
8011 @code{Duplicated_Tag_Check} Can be used to suppress the check that is generated
8012 for a duplicated tag value when a tagged type is declared.
8014 @item 
8015 @code{Container_Checks} Can be used to suppress all checks within Ada.Containers
8016 and instances of its children, including Tampering_Check.
8018 @item 
8019 @code{Tampering_Check} Can be used to suppress tampering check in the containers.
8021 @item 
8022 @code{Predicate_Check} can be used to control whether predicate checks are
8023 active. It is applicable only to predicates for which the policy is
8024 @code{Check}. Unlike @code{Assertion_Policy}, which determines if a given
8025 predicate is ignored or checked for the whole program, the use of
8026 @code{Suppress} and @code{Unsuppress} with this check name allows a given
8027 predicate to be turned on and off at specific points in the program.
8029 @item 
8030 @code{Validity_Check} can be used specifically to control validity checks.
8031 If @code{Suppress} is used to suppress validity checks, then no validity
8032 checks are performed, including those specified by the appropriate compiler
8033 switch or the @code{Validity_Checks} pragma.
8035 @item 
8036 Additional check names previously introduced by use of the @code{Check_Name}
8037 pragma are also allowed.
8038 @end itemize
8040 Note that pragma Suppress gives the compiler permission to omit
8041 checks, but does not require the compiler to omit checks. The compiler
8042 will generate checks if they are essentially free, even when they are
8043 suppressed. In particular, if the compiler can prove that a certain
8044 check will necessarily fail, it will generate code to do an
8045 unconditional ‘raise’, even if checks are suppressed. The compiler
8046 warns in this case.
8048 Of course, run-time checks are omitted whenever the compiler can prove
8049 that they will not fail, whether or not checks are suppressed.
8051 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
8052 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{fb}
8053 @section Pragma Suppress_All
8056 Syntax:
8058 @example
8059 pragma Suppress_All;
8060 @end example
8062 This pragma can appear anywhere within a unit.
8063 The effect is to apply @code{Suppress (All_Checks)} to the unit
8064 in which it appears.  This pragma is implemented for compatibility with DEC
8065 Ada 83 usage where it appears at the end of a unit, and for compatibility
8066 with Rational Ada, where it appears as a program unit pragma.
8067 The use of the standard Ada pragma @code{Suppress (All_Checks)}
8068 as a normal configuration pragma is the preferred usage in GNAT.
8070 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
8071 @anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{fc}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{fd}
8072 @section Pragma Suppress_Debug_Info
8075 Syntax:
8077 @example
8078 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
8079 @end example
8081 This pragma can be used to suppress generation of debug information
8082 for the specified entity. It is intended primarily for use in debugging
8083 the debugger, and navigating around debugger problems.
8085 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
8086 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{fe}
8087 @section Pragma Suppress_Exception_Locations
8090 Syntax:
8092 @example
8093 pragma Suppress_Exception_Locations;
8094 @end example
8096 In normal mode, a raise statement for an exception by default generates
8097 an exception message giving the file name and line number for the location
8098 of the raise. This is useful for debugging and logging purposes, but this
8099 entails extra space for the strings for the messages. The configuration
8100 pragma @code{Suppress_Exception_Locations} can be used to suppress the
8101 generation of these strings, with the result that space is saved, but the
8102 exception message for such raises is null. This configuration pragma may
8103 appear in a global configuration pragma file, or in a specific unit as
8104 usual. It is not required that this pragma be used consistently within
8105 a partition, so it is fine to have some units within a partition compiled
8106 with this pragma and others compiled in normal mode without it.
8108 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
8109 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{ff}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{100}
8110 @section Pragma Suppress_Initialization
8113 @geindex Suppressing initialization
8115 @geindex Initialization
8116 @geindex suppression of
8118 Syntax:
8120 @example
8121 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_LOCAL_NAME);
8122 @end example
8124 Here variable_or_subtype_LOCAL_NAME is the name introduced by a type
8125 declaration or subtype declaration or the name of a variable introduced by
8126 an object declaration.
8128 In the case of a type or subtype
8129 this pragma suppresses any implicit or explicit initialization
8130 for all variables of the given type or subtype,
8131 including initialization resulting from the use of pragmas
8132 Normalize_Scalars or Initialize_Scalars.
8134 This is considered a representation item, so it cannot be given after
8135 the type is frozen. It applies to all subsequent object declarations,
8136 and also any allocator that creates objects of the type.
8138 If the pragma is given for the first subtype, then it is considered
8139 to apply to the base type and all its subtypes. If the pragma is given
8140 for other than a first subtype, then it applies only to the given subtype.
8141 The pragma may not be given after the type is frozen.
8143 Note that this includes eliminating initialization of discriminants
8144 for discriminated types, and tags for tagged types. In these cases,
8145 you will have to use some non-portable mechanism (e.g. address
8146 overlays or unchecked conversion) to achieve required initialization
8147 of these fields before accessing any object of the corresponding type.
8149 For the variable case, implicit initialization for the named variable
8150 is suppressed, just as though its subtype had been given in a pragma
8151 Suppress_Initialization, as described above.
8153 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
8154 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{101}
8155 @section Pragma Task_Name
8158 Syntax
8160 @example
8161 pragma Task_Name (string_EXPRESSION);
8162 @end example
8164 This pragma appears within a task definition (like pragma
8165 @code{Priority}) and applies to the task in which it appears.  The
8166 argument must be of type String, and provides a name to be used for
8167 the task instance when the task is created.  Note that this expression
8168 is not required to be static, and in particular, it can contain
8169 references to task discriminants.  This facility can be used to
8170 provide different names for different tasks as they are created,
8171 as illustrated in the example below.
8173 The task name is recorded internally in the run-time structures
8174 and is accessible to tools like the debugger.  In addition the
8175 routine @code{Ada.Task_Identification.Image} will return this
8176 string, with a unique task address appended.
8178 @example
8179 --  Example of the use of pragma Task_Name
8181 with Ada.Task_Identification;
8182 use Ada.Task_Identification;
8183 with Text_IO; use Text_IO;
8184 procedure t3 is
8186    type Astring is access String;
8188    task type Task_Typ (Name : access String) is
8189       pragma Task_Name (Name.all);
8190    end Task_Typ;
8192    task body Task_Typ is
8193       Nam : constant String := Image (Current_Task);
8194    begin
8195       Put_Line ("-->" & Nam (1 .. 14) & "<--");
8196    end Task_Typ;
8198    type Ptr_Task is access Task_Typ;
8199    Task_Var : Ptr_Task;
8201 begin
8202    Task_Var :=
8203      new Task_Typ (new String'("This is task 1"));
8204    Task_Var :=
8205      new Task_Typ (new String'("This is task 2"));
8206 end;
8207 @end example
8209 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
8210 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{102}
8211 @section Pragma Task_Storage
8214 Syntax:
8216 @example
8217 pragma Task_Storage (
8218   [Task_Type =>] LOCAL_NAME,
8219   [Top_Guard =>] static_integer_EXPRESSION);
8220 @end example
8222 This pragma specifies the length of the guard area for tasks.  The guard
8223 area is an additional storage area allocated to a task.  A value of zero
8224 means that either no guard area is created or a minimal guard area is
8225 created, depending on the target.  This pragma can appear anywhere a
8226 @code{Storage_Size} attribute definition clause is allowed for a task
8227 type.
8229 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
8230 @anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{103}@anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{104}
8231 @section Pragma Test_Case
8234 @geindex Test cases
8236 Syntax:
8238 @example
8239 pragma Test_Case (
8240    [Name     =>] static_string_Expression
8241   ,[Mode     =>] (Nominal | Robustness)
8242  [, Requires =>  Boolean_Expression]
8243  [, Ensures  =>  Boolean_Expression]);
8244 @end example
8246 The @code{Test_Case} pragma allows defining fine-grain specifications
8247 for use by testing tools.
8248 The compiler checks the validity of the @code{Test_Case} pragma, but its
8249 presence does not lead to any modification of the code generated by the
8250 compiler.
8252 @code{Test_Case} pragmas may only appear immediately following the
8253 (separate) declaration of a subprogram in a package declaration, inside
8254 a package spec unit. Only other pragmas may intervene (that is appear
8255 between the subprogram declaration and a test case).
8257 The compiler checks that boolean expressions given in @code{Requires} and
8258 @code{Ensures} are valid, where the rules for @code{Requires} are the
8259 same as the rule for an expression in @code{Precondition} and the rules
8260 for @code{Ensures} are the same as the rule for an expression in
8261 @code{Postcondition}. In particular, attributes @code{'Old} and
8262 @code{'Result} can only be used within the @code{Ensures}
8263 expression. The following is an example of use within a package spec:
8265 @example
8266 package Math_Functions is
8267    ...
8268    function Sqrt (Arg : Float) return Float;
8269    pragma Test_Case (Name     => "Test 1",
8270                      Mode     => Nominal,
8271                      Requires => Arg < 10000.0,
8272                      Ensures  => Sqrt'Result < 10.0);
8273    ...
8274 end Math_Functions;
8275 @end example
8277 The meaning of a test case is that there is at least one context where
8278 @code{Requires} holds such that, if the associated subprogram is executed in
8279 that context, then @code{Ensures} holds when the subprogram returns.
8280 Mode @code{Nominal} indicates that the input context should also satisfy the
8281 precondition of the subprogram, and the output context should also satisfy its
8282 postcondition. Mode @code{Robustness} indicates that the precondition and
8283 postcondition of the subprogram should be ignored for this test case.
8285 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
8286 @anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{105}@anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{106}
8287 @section Pragma Thread_Local_Storage
8290 @geindex Task specific storage
8292 @geindex TLS (Thread Local Storage)
8294 @geindex Task_Attributes
8296 Syntax:
8298 @example
8299 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
8300 @end example
8302 This pragma specifies that the specified entity, which must be
8303 a variable declared in a library-level package, is to be marked as
8304 “Thread Local Storage” (@code{TLS}). On systems supporting this (which
8305 include Windows, Solaris, GNU/Linux, and VxWorks), this causes each
8306 thread (and hence each Ada task) to see a distinct copy of the variable.
8308 The variable must not have default initialization, and if there is
8309 an explicit initialization, it must be either @code{null} for an
8310 access variable, a static expression for a scalar variable, or a fully
8311 static aggregate for a composite type, that is to say, an aggregate all
8312 of whose components are static, and which does not include packed or
8313 discriminated components.
8315 This provides a low-level mechanism similar to that provided by
8316 the @code{Ada.Task_Attributes} package, but much more efficient
8317 and is also useful in writing interface code that will interact
8318 with foreign threads.
8320 If this pragma is used on a system where @code{TLS} is not supported,
8321 then an error message will be generated and the program will be rejected.
8323 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
8324 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{107}
8325 @section Pragma Time_Slice
8328 Syntax:
8330 @example
8331 pragma Time_Slice (static_duration_EXPRESSION);
8332 @end example
8334 For implementations of GNAT on operating systems where it is possible
8335 to supply a time slice value, this pragma may be used for this purpose.
8336 It is ignored if it is used in a system that does not allow this control,
8337 or if it appears in other than the main program unit.
8339 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
8340 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{108}
8341 @section Pragma Title
8344 Syntax:
8346 @example
8347 pragma Title (TITLING_OPTION [, TITLING OPTION]);
8349 TITLING_OPTION ::=
8350   [Title    =>] STRING_LITERAL,
8351 | [Subtitle =>] STRING_LITERAL
8352 @end example
8354 Syntax checked but otherwise ignored by GNAT.  This is a listing control
8355 pragma used in DEC Ada 83 implementations to provide a title and/or
8356 subtitle for the program listing.  The program listing generated by GNAT
8357 does not have titles or subtitles.
8359 Unlike other pragmas, the full flexibility of named notation is allowed
8360 for this pragma, i.e., the parameters may be given in any order if named
8361 notation is used, and named and positional notation can be mixed
8362 following the normal rules for procedure calls in Ada.
8364 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
8365 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{109}
8366 @section Pragma Type_Invariant
8369 Syntax:
8371 @example
8372 pragma Type_Invariant
8373   ([Entity =>] type_LOCAL_NAME,
8374    [Check  =>] EXPRESSION);
8375 @end example
8377 The @code{Type_Invariant} pragma is intended to be an exact
8378 replacement for the language-defined @code{Type_Invariant}
8379 aspect, and shares its restrictions and semantics. It differs
8380 from the language defined @code{Invariant} pragma in that it
8381 does not permit a string parameter, and it is
8382 controlled by the assertion identifier @code{Type_Invariant}
8383 rather than @code{Invariant}.
8385 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
8386 @anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10a}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{10b}
8387 @section Pragma Type_Invariant_Class
8390 Syntax:
8392 @example
8393 pragma Type_Invariant_Class
8394   ([Entity =>] type_LOCAL_NAME,
8395    [Check  =>] EXPRESSION);
8396 @end example
8398 The @code{Type_Invariant_Class} pragma is intended to be an exact
8399 replacement for the language-defined @code{Type_Invariant'Class}
8400 aspect, and shares its restrictions and semantics.
8402 Note: This pragma is called @code{Type_Invariant_Class} rather than
8403 @code{Type_Invariant'Class} because the latter would not be strictly
8404 conforming to the allowed syntax for pragmas. The motivation
8405 for providing pragmas equivalent to the aspects is to allow a program
8406 to be written using the pragmas, and then compiled if necessary
8407 using an Ada compiler that does not recognize the pragmas or
8408 aspects, but is prepared to ignore the pragmas. The assertion
8409 policy that controls this pragma is @code{Type_Invariant'Class},
8410 not @code{Type_Invariant_Class}.
8412 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
8413 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{10c}
8414 @section Pragma Unchecked_Union
8417 @geindex Unions in C
8419 Syntax:
8421 @example
8422 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
8423 @end example
8425 This pragma is used to specify a representation of a record type that is
8426 equivalent to a C union. It was introduced as a GNAT implementation defined
8427 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
8428 pragma, making it language defined, and GNAT fully implements this extended
8429 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
8430 details, consult the Ada 2012 Reference Manual, section B.3.3.
8432 @node Pragma Unevaluated_Use_Of_Old,Pragma User_Aspect_Definition,Pragma Unchecked_Union,Implementation Defined Pragmas
8433 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{10d}
8434 @section Pragma Unevaluated_Use_Of_Old
8437 @geindex Attribute Old
8439 @geindex Attribute Loop_Entry
8441 @geindex Unevaluated_Use_Of_Old
8443 Syntax:
8445 @example
8446 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
8447 @end example
8449 This pragma controls the processing of attributes Old and Loop_Entry.
8450 If either of these attributes is used in a potentially unevaluated
8451 expression  (e.g. the then or else parts of an if expression), then
8452 normally this usage is considered illegal if the prefix of the attribute
8453 is other than an entity name. The language requires this
8454 behavior for Old, and GNAT copies the same rule for Loop_Entry.
8456 The reason for this rule is that otherwise, we can have a situation
8457 where we save the Old value, and this results in an exception, even
8458 though we might not evaluate the attribute. Consider this example:
8460 @example
8461 package UnevalOld is
8462    K : Character;
8463    procedure U (A : String; C : Boolean)  -- ERROR
8464      with Post => (if C then A(1)'Old = K else True);
8465 end;
8466 @end example
8468 If procedure U is called with a string with a lower bound of 2, and
8469 C false, then an exception would be raised trying to evaluate A(1)
8470 on entry even though the value would not be actually used.
8472 Although the rule guarantees against this possibility, it is sometimes
8473 too restrictive. For example if we know that the string has a lower
8474 bound of 1, then we will never raise an exception.
8475 The pragma @code{Unevaluated_Use_Of_Old} can be
8476 used to modify this behavior. If the argument is @code{Error} then an
8477 error is given (this is the default RM behavior). If the argument is
8478 @code{Warn} then the usage is allowed as legal but with a warning
8479 that an exception might be raised. If the argument is @code{Allow}
8480 then the usage is allowed as legal without generating a warning.
8482 This pragma may appear as a configuration pragma, or in a declarative
8483 part or package specification. In the latter case it applies to
8484 uses up to the end of the corresponding statement sequence or
8485 sequence of package declarations.
8487 @node Pragma User_Aspect_Definition,Pragma Unimplemented_Unit,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
8488 @anchor{gnat_rm/implementation_defined_pragmas pragma-user-aspect-definition}@anchor{10e}
8489 @section Pragma User_Aspect_Definition
8492 Syntax:
8494 @example
8495 pragma User_Aspect_Definition
8496   (Identifier @{, Identifier [(Identifier @{, Identifier@})]@});
8497 @end example
8499 This configuration pragma defines a new aspect, making it available for
8500 subsequent use in a @cite{User_Aspect} aspect specification. The first identifier
8501 is the name of the new aspect. Any subsequent arguments specify the names
8502 of other aspects. A subsequent name for which no parenthesized arguments
8503 are given shall denote either a Boolean-valued non-representation aspect
8504 or an aspect that has been defined by another @cite{User_Aspect_Definition}
8505 pragma. A name for which one or more arguments are given shall be either
8506 @cite{Annotate} or @cite{Local_Restrictions} (and the arguments shall be appropriate
8507 for the named aspect).
8509 This pragma, together with the @cite{User_Aspect} aspect, provides a mechanism
8510 for avoiding textual duplication if some set of aspect specifications
8511 is needed in multiple places. This is somewhat analogous to how profiles
8512 allow avoiding duplication of @cite{Restrictions} pragmas.
8514 The visibility rules for an aspect defined by a @cite{User_Aspect_Definition}
8515 pragma are the same as for a check name introduced by a @cite{Check_Name}
8516 pragma. If multiple definitions are visible for some aspect at some point,
8517 then the definitions must agree. A predefined aspect cannot be redefined.
8519 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma User_Aspect_Definition,Implementation Defined Pragmas
8520 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{10f}
8521 @section Pragma Unimplemented_Unit
8524 Syntax:
8526 @example
8527 pragma Unimplemented_Unit;
8528 @end example
8530 If this pragma occurs in a unit that is processed by the compiler, GNAT
8531 aborts with the message @code{xxx not implemented}, where
8532 @code{xxx} is the name of the current compilation unit.  This pragma is
8533 intended to allow the compiler to handle unimplemented library units in
8534 a clean manner.
8536 The abort only happens if code is being generated.  Thus you can use
8537 specs of unimplemented packages in syntax or semantic checking mode.
8539 @node Pragma Universal_Aliasing,Pragma Unmodified,Pragma Unimplemented_Unit,Implementation Defined Pragmas
8540 @anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{110}@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{111}
8541 @section Pragma Universal_Aliasing
8544 Syntax:
8546 @example
8547 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
8548 @end example
8550 @code{type_LOCAL_NAME} must refer to a type declaration in the current
8551 declarative part.  The effect is to inhibit strict type-based aliasing
8552 optimizations for the given type.  For a detailed description of the
8553 strict type-based aliasing optimizations and the situations in which
8554 they need to be suppressed, see the section on
8555 @code{Optimization and Strict Aliasing} in the @cite{GNAT User’s Guide}.
8557 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Aliasing,Implementation Defined Pragmas
8558 @anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{112}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{113}
8559 @section Pragma Unmodified
8562 @geindex Warnings
8563 @geindex unmodified
8565 Syntax:
8567 @example
8568 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8569 @end example
8571 This pragma signals that the assignable entities (variables,
8572 @code{out} parameters, @code{in out} parameters) whose names are listed are
8573 deliberately not assigned in the current source unit. This
8574 suppresses warnings about the
8575 entities being referenced but not assigned, and in addition a warning will be
8576 generated if one of these entities is in fact assigned in the
8577 same unit as the pragma (or in the corresponding body, or one
8578 of its subunits).
8580 This is particularly useful for clearly signaling that a particular
8581 parameter is not modified, even though the spec suggests that it might
8584 For the variable case, warnings are never given for unreferenced variables
8585 whose name contains one of the substrings
8586 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSE, TMP, TEMP} in any casing. Such names
8587 are typically to be used in cases where such warnings are expected.
8588 Thus it is never necessary to use @code{pragma Unmodified} for such
8589 variables, though it is harmless to do so.
8591 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8592 @anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{114}@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{115}
8593 @section Pragma Unreferenced
8596 @geindex Warnings
8597 @geindex unreferenced
8599 Syntax:
8601 @example
8602 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8603 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8604 @end example
8606 This pragma signals that the entities whose names are listed are
8607 deliberately not referenced in the current source unit after the
8608 occurrence of the pragma. This
8609 suppresses warnings about the
8610 entities being unreferenced, and in addition a warning will be
8611 generated if one of these entities is in fact subsequently referenced in the
8612 same unit as the pragma (or in the corresponding body, or one
8613 of its subunits).
8615 This is particularly useful for clearly signaling that a particular
8616 parameter is not referenced in some particular subprogram implementation
8617 and that this is deliberate. It can also be useful in the case of
8618 objects declared only for their initialization or finalization side
8619 effects.
8621 If @code{LOCAL_NAME} identifies more than one matching homonym in the
8622 current scope, then the entity most recently declared is the one to which
8623 the pragma applies. Note that in the case of accept formals, the pragma
8624 Unreferenced may appear immediately after the keyword @code{do} which
8625 allows the indication of whether or not accept formals are referenced
8626 or not to be given individually for each accept statement.
8628 The left hand side of an assignment does not count as a reference for the
8629 purpose of this pragma. Thus it is fine to assign to an entity for which
8630 pragma Unreferenced is given. However, use of an entity as an actual for
8631 an out parameter does count as a reference unless warnings for unread output
8632 parameters are enabled via @code{-gnatw.o}.
8634 Note that if a warning is desired for all calls to a given subprogram,
8635 regardless of whether they occur in the same unit as the subprogram
8636 declaration, then this pragma should not be used (calls from another
8637 unit would not be flagged); pragma Obsolescent can be used instead
8638 for this purpose, see @ref{b3,,Pragma Obsolescent}.
8640 The second form of pragma @code{Unreferenced} is used within a context
8641 clause. In this case the arguments must be unit names of units previously
8642 mentioned in @code{with} clauses (similar to the usage of pragma
8643 @code{Elaborate_All}). The effect is to suppress warnings about unreferenced
8644 units and unreferenced entities within these units.
8646 For the variable case, warnings are never given for unreferenced variables
8647 whose name contains one of the substrings
8648 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8649 are typically to be used in cases where such warnings are expected.
8650 Thus it is never necessary to use @code{pragma Unreferenced} for such
8651 variables, though it is harmless to do so.
8653 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8654 @anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{116}@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{117}
8655 @section Pragma Unreferenced_Objects
8658 @geindex Warnings
8659 @geindex unreferenced
8661 Syntax:
8663 @example
8664 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8665 @end example
8667 This pragma signals that for the types or subtypes whose names are
8668 listed, objects which are declared with one of these types or subtypes may
8669 not be referenced, and if no references appear, no warnings are given.
8671 This is particularly useful for objects which are declared solely for their
8672 initialization and finalization effect. Such variables are sometimes referred
8673 to as RAII variables (Resource Acquisition Is Initialization). Using this
8674 pragma on the relevant type (most typically a limited controlled type), the
8675 compiler will automatically suppress unwanted warnings about these variables
8676 not being referenced.
8678 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8679 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{118}
8680 @section Pragma Unreserve_All_Interrupts
8683 Syntax:
8685 @example
8686 pragma Unreserve_All_Interrupts;
8687 @end example
8689 Normally certain interrupts are reserved to the implementation.  Any attempt
8690 to attach an interrupt causes Program_Error to be raised, as described in
8691 RM C.3.2(22).  A typical example is the @code{SIGINT} interrupt used in
8692 many systems for a @code{Ctrl-C} interrupt.  Normally this interrupt is
8693 reserved to the implementation, so that @code{Ctrl-C} can be used to
8694 interrupt execution.
8696 If the pragma @code{Unreserve_All_Interrupts} appears anywhere in any unit in
8697 a program, then all such interrupts are unreserved.  This allows the
8698 program to handle these interrupts, but disables their standard
8699 functions.  For example, if this pragma is used, then pressing
8700 @code{Ctrl-C} will not automatically interrupt execution.  However,
8701 a program can then handle the @code{SIGINT} interrupt as it chooses.
8703 For a full list of the interrupts handled in a specific implementation,
8704 see the source code for the spec of @code{Ada.Interrupts.Names} in
8705 file @code{a-intnam.ads}.  This is a target dependent file that contains the
8706 list of interrupts recognized for a given target.  The documentation in
8707 this file also specifies what interrupts are affected by the use of
8708 the @code{Unreserve_All_Interrupts} pragma.
8710 For a more general facility for controlling what interrupts can be
8711 handled, see pragma @code{Interrupt_State}, which subsumes the functionality
8712 of the @code{Unreserve_All_Interrupts} pragma.
8714 @node Pragma Unsuppress,Pragma Unused,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8715 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{119}
8716 @section Pragma Unsuppress
8719 Syntax:
8721 @example
8722 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8723 @end example
8725 This pragma undoes the effect of a previous pragma @code{Suppress}.  If
8726 there is no corresponding pragma @code{Suppress} in effect, it has no
8727 effect.  The range of the effect is the same as for pragma
8728 @code{Suppress}.  The meaning of the arguments is identical to that used
8729 in pragma @code{Suppress}.
8731 One important application is to ensure that checks are on in cases where
8732 code depends on the checks for its correct functioning, so that the code
8733 will compile correctly even if the compiler switches are set to suppress
8734 checks. For example, in a program that depends on external names of tagged
8735 types and wants to ensure that the duplicated tag check occurs even if all
8736 run-time checks are suppressed by a compiler switch, the following
8737 configuration pragma will ensure this test is not suppressed:
8739 @example
8740 pragma Unsuppress (Duplicated_Tag_Check);
8741 @end example
8743 This pragma is standard in Ada 2005. It is available in all earlier versions
8744 of Ada as an implementation-defined pragma.
8746 Note that in addition to the checks defined in the Ada RM, GNAT recognizes a
8747 number of implementation-defined check names. See the description of pragma
8748 @code{Suppress} for full details.
8750 @node Pragma Unused,Pragma Use_VADS_Size,Pragma Unsuppress,Implementation Defined Pragmas
8751 @anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{11a}@anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{11b}
8752 @section Pragma Unused
8755 @geindex Warnings
8756 @geindex unused
8758 Syntax:
8760 @example
8761 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8762 @end example
8764 This pragma signals that the assignable entities (variables,
8765 @code{out} parameters, and @code{in out} parameters) whose names are listed
8766 deliberately do not get assigned or referenced in the current source unit
8767 after the occurrence of the pragma in the current source unit. This
8768 suppresses warnings about the entities that are unreferenced and/or not
8769 assigned, and, in addition, a warning will be generated if one of these
8770 entities gets assigned or subsequently referenced in the same unit as the
8771 pragma (in the corresponding body or one of its subunits).
8773 This is particularly useful for clearly signaling that a particular
8774 parameter is not modified or referenced, even though the spec suggests
8775 that it might be.
8777 For the variable case, warnings are never given for unreferenced
8778 variables whose name contains one of the substrings
8779 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8780 are typically to be used in cases where such warnings are expected.
8781 Thus it is never necessary to use @code{pragma Unused} for such
8782 variables, though it is harmless to do so.
8784 @node Pragma Use_VADS_Size,Pragma Validity_Checks,Pragma Unused,Implementation Defined Pragmas
8785 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{11c}
8786 @section Pragma Use_VADS_Size
8789 @geindex Size
8790 @geindex VADS compatibility
8792 @geindex Rational profile
8794 Syntax:
8796 @example
8797 pragma Use_VADS_Size;
8798 @end example
8800 This is a configuration pragma.  In a unit to which it applies, any use
8801 of the ‘Size attribute is automatically interpreted as a use of the
8802 ‘VADS_Size attribute.  Note that this may result in incorrect semantic
8803 processing of valid Ada 95 or Ada 2005 programs.  This is intended to aid in
8804 the handling of existing code which depends on the interpretation of Size
8805 as implemented in the VADS compiler.  See description of the VADS_Size
8806 attribute for further details.
8808 @node Pragma Validity_Checks,Pragma Volatile,Pragma Use_VADS_Size,Implementation Defined Pragmas
8809 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{11d}
8810 @section Pragma Validity_Checks
8813 Syntax:
8815 @example
8816 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8817 @end example
8819 This pragma is used in conjunction with compiler switches to control the
8820 built-in validity checking provided by GNAT.  The compiler switches, if set
8821 provide an initial setting for the switches, and this pragma may be used
8822 to modify these settings, or the settings may be provided entirely by
8823 the use of the pragma.  This pragma can be used anywhere that a pragma
8824 is legal, including use as a configuration pragma (including use in
8825 the @code{gnat.adc} file).
8827 The form with a string literal specifies which validity options are to be
8828 activated.  The validity checks are first set to include only the default
8829 reference manual settings, and then a string of letters in the string
8830 specifies the exact set of options required.  The form of this string
8831 is exactly as described for the `-gnatVx' compiler switch (see the
8832 GNAT User’s Guide for details).  For example the following two
8833 methods can be used to enable validity checking for mode @code{in} and
8834 @code{in out} subprogram parameters:
8837 @itemize *
8839 @item 
8840 @example
8841 pragma Validity_Checks ("im");
8842 @end example
8844 @item 
8845 @example
8846 $ gcc -c -gnatVim ...
8847 @end example
8848 @end itemize
8850 The form ALL_CHECKS activates all standard checks (its use is equivalent
8851 to the use of the @code{gnatVa} switch).
8853 The forms with @code{Off} and @code{On} can be used to temporarily disable
8854 validity checks as shown in the following example:
8856 @example
8857 pragma Validity_Checks ("c"); -- validity checks for copies
8858 pragma Validity_Checks (Off); -- turn off validity checks
8859 A := B;                       -- B will not be validity checked
8860 pragma Validity_Checks (On);  -- turn validity checks back on
8861 A := C;                       -- C will be validity checked
8862 @end example
8864 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8865 @anchor{gnat_rm/implementation_defined_pragmas id56}@anchor{11e}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{11f}
8866 @section Pragma Volatile
8869 Syntax:
8871 @example
8872 pragma Volatile (LOCAL_NAME);
8873 @end example
8875 This pragma is defined by the Ada Reference Manual, and the GNAT
8876 implementation is fully conformant with this definition.  The reason it
8877 is mentioned in this section is that a pragma of the same name was supplied
8878 in some Ada 83 compilers, including DEC Ada 83.  The Ada 95 / Ada 2005
8879 implementation of pragma Volatile is upwards compatible with the
8880 implementation in DEC Ada 83.
8882 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8883 @anchor{gnat_rm/implementation_defined_pragmas id57}@anchor{120}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{121}
8884 @section Pragma Volatile_Full_Access
8887 Syntax:
8889 @example
8890 pragma Volatile_Full_Access (LOCAL_NAME);
8891 @end example
8893 This is similar in effect to pragma Volatile, except that any reference to the
8894 object is guaranteed to be done only with instructions that read or write all
8895 the bits of the object. Furthermore, if the object is of a composite type,
8896 then any reference to a subcomponent of the object is guaranteed to read
8897 and/or write all the bits of the object.
8899 The intention is that this be suitable for use with memory-mapped I/O devices
8900 on some machines. Note that there are two important respects in which this is
8901 different from @code{pragma Atomic}. First a reference to a @code{Volatile_Full_Access}
8902 object is not a sequential action in the RM 9.10 sense and, therefore, does
8903 not create a synchronization point. Second, in the case of @code{pragma Atomic},
8904 there is no guarantee that all the bits will be accessed if the reference
8905 is not to the whole object; the compiler is allowed (and generally will)
8906 access only part of the object in this case.
8908 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8909 @anchor{gnat_rm/implementation_defined_pragmas id58}@anchor{122}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{123}
8910 @section Pragma Volatile_Function
8913 Syntax:
8915 @example
8916 pragma Volatile_Function [ (static_boolean_EXPRESSION) ];
8917 @end example
8919 For the semantics of this pragma, see the entry for aspect @code{Volatile_Function}
8920 in the SPARK 2014 Reference Manual, section 7.1.2.
8922 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
8923 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{124}
8924 @section Pragma Warning_As_Error
8927 Syntax:
8929 @example
8930 pragma Warning_As_Error (static_string_EXPRESSION);
8931 @end example
8933 This configuration pragma allows the programmer to specify a set
8934 of warnings that will be treated as errors. Any warning that
8935 matches the pattern given by the pragma argument will be treated
8936 as an error. This gives more precise control than -gnatwe,
8937 which treats warnings as errors.
8939 This pragma can apply to regular warnings (messages enabled by -gnatw)
8940 and to style warnings (messages that start with “(style)”,
8941 enabled by -gnaty).
8943 The pattern may contain asterisks, which match zero or more characters
8944 in the message. For example, you can use @code{pragma Warning_As_Error
8945 ("bits of*unused")} to treat the warning message @code{warning: 960 bits of
8946 "a" unused} as an error. All characters other than asterisk are treated
8947 as literal characters in the match. The match is case insensitive; for
8948 example XYZ matches xyz.
8950 Note that the pattern matches if it occurs anywhere within the warning
8951 message string (it is not necessary to put an asterisk at the start and
8952 the end of the message, since this is implied).
8954 Another possibility for the static_string_EXPRESSION which works whether
8955 or not error tags are enabled (`-gnatw.d') is to use a single
8956 `-gnatw' tag string, enclosed in brackets,
8957 as shown in the example below, to treat one category of warnings as errors.
8958 Note that if you want to treat multiple categories of warnings as errors,
8959 you can use multiple pragma Warning_As_Error.
8961 The above use of patterns to match the message applies only to warning
8962 messages generated by the front end. This pragma can also be applied to
8963 warnings provided by the back end and mentioned in @ref{125,,Pragma Warnings}.
8964 By using a single full `-Wxxx' switch in the pragma, such warnings
8965 can also be treated as errors.
8967 The pragma can appear either in a global configuration pragma file
8968 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
8969 configuration pragma file containing:
8971 @example
8972 pragma Warning_As_Error ("[-gnatwj]");
8973 @end example
8975 which will treat all obsolescent feature warnings as errors, the
8976 following program compiles as shown (compile options here are
8977 `-gnatwa.d -gnatl -gnatj55').
8979 @example
8980     1. pragma Warning_As_Error ("*never assigned*");
8981     2. function Warnerr return String is
8982     3.    X : Integer;
8983           |
8984        >>> error: variable "X" is never read and
8985            never assigned [-gnatwv] [warning-as-error]
8987     4.    Y : Integer;
8988           |
8989        >>> warning: variable "Y" is assigned but
8990            never read [-gnatwu]
8992     5. begin
8993     6.    Y := 0;
8994     7.    return %ABC%;
8995                  |
8996        >>> error: use of "%" is an obsolescent
8997            feature (RM J.2(4)), use """ instead
8998            [-gnatwj] [warning-as-error]
9000     8. end;
9002 8 lines: No errors, 3 warnings (2 treated as errors)
9003 @end example
9005 Note that this pragma does not affect the set of warnings issued in
9006 any way, it merely changes the effect of a matching warning if one
9007 is produced as a result of other warnings options. As shown in this
9008 example, if the pragma results in a warning being treated as an error,
9009 the tag is changed from “warning:” to “error:” and the string
9010 “[warning-as-error]” is appended to the end of the message.
9012 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
9013 @anchor{gnat_rm/implementation_defined_pragmas id59}@anchor{126}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{125}
9014 @section Pragma Warnings
9017 Syntax:
9019 @example
9020 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
9022 DETAILS ::= On | Off
9023 DETAILS ::= On | Off, local_NAME
9024 DETAILS ::= static_string_EXPRESSION
9025 DETAILS ::= On | Off, static_string_EXPRESSION
9027 TOOL_NAME ::= GNAT | GNATprove
9029 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
9030 @end example
9032 Note: in Ada 83 mode, a string literal may be used in place of a static string
9033 expression (which does not exist in Ada 83).
9035 Note if the second argument of @code{DETAILS} is a @code{local_NAME} then the
9036 second form is always understood. If the intention is to use
9037 the fourth form, then you can write @code{NAME & ""} to force the
9038 interpretation as a `static_string_EXPRESSION'.
9040 Note: if the first argument is a valid @code{TOOL_NAME}, it will be interpreted
9041 that way. The use of the @code{TOOL_NAME} argument is relevant only to users
9042 of SPARK and GNATprove, see last part of this section for details.
9044 Normally warnings are enabled, with the output being controlled by
9045 the command line switch.  Warnings (@code{Off}) turns off generation of
9046 warnings until a Warnings (@code{On}) is encountered or the end of the
9047 current unit.  If generation of warnings is turned off using this
9048 pragma, then some or all of the warning messages are suppressed,
9049 regardless of the setting of the command line switches.
9051 The @code{Reason} parameter may optionally appear as the last argument
9052 in any of the forms of this pragma. It is intended purely for the
9053 purposes of documenting the reason for the @code{Warnings} pragma.
9054 The compiler will check that the argument is a static string but
9055 otherwise ignore this argument. Other tools may provide specialized
9056 processing for this string.
9058 The form with a single argument (or two arguments if Reason present),
9059 where the first argument is @code{ON} or @code{OFF}
9060 may be used as a configuration pragma.
9062 If the @code{LOCAL_NAME} parameter is present, warnings are suppressed for
9063 the specified entity.  This suppression is effective from the point where
9064 it occurs till the end of the extended scope of the variable (similar to
9065 the scope of @code{Suppress}). This form cannot be used as a configuration
9066 pragma.
9068 In the case where the first argument is other than @code{ON} or
9069 @code{OFF},
9070 the third form with a single static_string_EXPRESSION argument (and possible
9071 reason) provides more precise
9072 control over which warnings are active. The string is a list of letters
9073 specifying which warnings are to be activated and which deactivated. The
9074 code for these letters is the same as the string used in the command
9075 line switch controlling warnings. For a brief summary, use the gnatmake
9076 command with no arguments, which will generate usage information containing
9077 the list of warnings switches supported. For
9078 full details see the section on @code{Warning Message Control} in the
9079 @cite{GNAT User’s Guide}.
9080 This form can also be used as a configuration pragma.
9082 The warnings controlled by the @code{-gnatw} switch are generated by the
9083 front end of the compiler. The GCC back end can provide additional warnings
9084 and they are controlled by the @code{-W} switch. Such warnings can be
9085 identified by the appearance of a string of the form @code{[-W@{xxx@}]} in the
9086 message which designates the @code{-W`xxx'} switch that controls the message.
9087 The form with a single `static_string_EXPRESSION' argument also works for these
9088 warnings, but the string must be a single full @code{-W`xxx'} switch in this
9089 case. The above reference lists a few examples of these additional warnings.
9091 The specified warnings will be in effect until the end of the program
9092 or another pragma @code{Warnings} is encountered. The effect of the pragma is
9093 cumulative. Initially the set of warnings is the standard default set
9094 as possibly modified by compiler switches. Then each pragma Warning
9095 modifies this set of warnings as specified. This form of the pragma may
9096 also be used as a configuration pragma.
9098 The fourth form, with an @code{On|Off} parameter and a string, is used to
9099 control individual messages, based on their text. The string argument
9100 is a pattern that is used to match against the text of individual
9101 warning messages (not including the initial “warning: ” tag).
9103 The pattern may contain asterisks, which match zero or more characters in
9104 the message. For example, you can use
9105 @code{pragma Warnings (Off, "bits of*unused")} to suppress the warning
9106 message @code{warning: 960 bits of "a" unused}. No other regular
9107 expression notations are permitted. All characters other than asterisk in
9108 these three specific cases are treated as literal characters in the match.
9109 The match is case insensitive, for example XYZ matches xyz.
9111 Note that the pattern matches if it occurs anywhere within the warning
9112 message string (it is not necessary to put an asterisk at the start and
9113 the end of the message, since this is implied).
9115 The above use of patterns to match the message applies only to warning
9116 messages generated by the front end. This form of the pragma with a string
9117 argument can also be used to control warnings provided by the back end and
9118 mentioned above. By using a single full @code{-W`xxx'} switch in the pragma,
9119 such warnings can be turned on and off.
9121 There are two ways to use the pragma in this form. The OFF form can be used
9122 as a configuration pragma. The effect is to suppress all warnings (if any)
9123 that match the pattern string throughout the compilation (or match the
9124 -W switch in the back end case).
9126 The second usage is to suppress a warning locally, and in this case, two
9127 pragmas must appear in sequence:
9129 @example
9130 pragma Warnings (Off, Pattern);
9131 ... code where given warning is to be suppressed
9132 pragma Warnings (On, Pattern);
9133 @end example
9135 In this usage, the pattern string must match in the Off and On
9136 pragmas, and (if `-gnatw.w' is given) at least one matching
9137 warning must be suppressed.
9139 Note: if the ON form is not found, then the effect of the OFF form extends
9140 until the end of the file (pragma Warnings is purely textual, so its effect
9141 does not stop at the end of the enclosing scope).
9143 Note: to write a string that will match any warning, use the string
9144 @code{"***"}. It will not work to use a single asterisk or two
9145 asterisks since this looks like an operator name. This form with three
9146 asterisks is similar in effect to specifying @code{pragma Warnings (Off)} except (if @code{-gnatw.w} is given) that a matching
9147 @code{pragma Warnings (On, "***")} will be required. This can be
9148 helpful in avoiding forgetting to turn warnings back on.
9150 Note: the debug flag @code{-gnatd.i} can be
9151 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
9152 be useful in checking whether obsolete pragmas in existing programs are hiding
9153 real problems.
9155 Note: pragma Warnings does not affect the processing of style messages. See
9156 separate entry for pragma Style_Checks for control of style messages.
9158 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
9159 use the version of the pragma with a @code{TOOL_NAME} parameter.
9161 If present, @code{TOOL_NAME} is the name of a tool, currently either @code{GNAT} for the
9162 compiler or @code{GNATprove} for the formal verification tool. A given tool only
9163 takes into account pragma Warnings that do not specify a tool name, or that
9164 specify the matching tool name. This makes it possible to disable warnings
9165 selectively for each tool, and as a consequence to detect useless pragma
9166 Warnings with switch @code{-gnatw.w}.
9168 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
9169 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{127}
9170 @section Pragma Weak_External
9173 Syntax:
9175 @example
9176 pragma Weak_External ([Entity =>] LOCAL_NAME);
9177 @end example
9179 @code{LOCAL_NAME} must refer to an object that is declared at the library
9180 level. This pragma specifies that the given entity should be marked as a
9181 weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
9182 in GNU C and causes @code{LOCAL_NAME} to be emitted as a weak symbol instead
9183 of a regular symbol, that is to say a symbol that does not have to be
9184 resolved by the linker if used in conjunction with a pragma Import.
9186 When a weak symbol is not resolved by the linker, its address is set to
9187 zero. This is useful in writing interfaces to external modules that may
9188 or may not be linked in the final executable, for example depending on
9189 configuration settings.
9191 If a program references at run time an entity to which this pragma has been
9192 applied, and the corresponding symbol was not resolved at link time, then
9193 the execution of the program is erroneous. It is not erroneous to take the
9194 Address of such an entity, for example to guard potential references,
9195 as shown in the example below.
9197 Some file formats do not support weak symbols so not all target machines
9198 support this pragma.
9200 @example
9201 --  Example of the use of pragma Weak_External
9203 package External_Module is
9204   key : Integer;
9205   pragma Import (C, key);
9206   pragma Weak_External (key);
9207   function Present return boolean;
9208 end External_Module;
9210 with System; use System;
9211 package body External_Module is
9212   function Present return boolean is
9213   begin
9214     return key'Address /= System.Null_Address;
9215   end Present;
9216 end External_Module;
9217 @end example
9219 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
9220 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{128}
9221 @section Pragma Wide_Character_Encoding
9224 Syntax:
9226 @example
9227 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
9228 @end example
9230 This pragma specifies the wide character encoding to be used in program
9231 source text appearing subsequently. It is a configuration pragma, but may
9232 also be used at any point that a pragma is allowed, and it is permissible
9233 to have more than one such pragma in a file, allowing multiple encodings
9234 to appear within the same file.
9236 However, note that the pragma cannot immediately precede the relevant
9237 wide character, because then the previous encoding will still be in
9238 effect, causing “illegal character” errors.
9240 The argument can be an identifier or a character literal. In the identifier
9241 case, it is one of @code{HEX}, @code{UPPER}, @code{SHIFT_JIS},
9242 @code{EUC}, @code{UTF8}, or @code{BRACKETS}. In the character literal
9243 case it is correspondingly one of the characters @code{h}, @code{u},
9244 @code{s}, @code{e}, @code{8}, or @code{b}.
9246 Note that when the pragma is used within a file, it affects only the
9247 encoding within that file, and does not affect withed units, specs,
9248 or subunits.
9250 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
9251 @anchor{gnat_rm/implementation_defined_aspects doc}@anchor{129}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{12a}@anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{12b}
9252 @chapter Implementation Defined Aspects
9255 Ada defines (throughout the Ada 2012 reference manual, summarized
9256 in Annex K) a set of aspects that can be specified for certain entities.
9257 These language defined aspects are implemented in GNAT in Ada 2012 mode
9258 and work as described in the Ada 2012 Reference Manual.
9260 In addition, Ada 2012 allows implementations to define additional aspects
9261 whose meaning is defined by the implementation.  GNAT provides
9262 a number of these implementation-defined aspects which can be used
9263 to extend and enhance the functionality of the compiler.  This section of
9264 the GNAT reference manual describes these additional aspects.
9266 Note that any program using these aspects may not be portable to
9267 other compilers (although GNAT implements this set of aspects on all
9268 platforms).  Therefore if portability to other compilers is an important
9269 consideration, you should minimize the use of these aspects.
9271 Note that for many of these aspects, the effect is essentially similar
9272 to the use of a pragma or attribute specification with the same name
9273 applied to the entity. For example, if we write:
9275 @example
9276 type R is range 1 .. 100
9277   with Value_Size => 10;
9278 @end example
9280 then the effect is the same as:
9282 @example
9283 type R is range 1 .. 100;
9284 for R'Value_Size use 10;
9285 @end example
9287 and if we write:
9289 @example
9290 type R is new Integer
9291   with Shared => True;
9292 @end example
9294 then the effect is the same as:
9296 @example
9297 type R is new Integer;
9298 pragma Shared (R);
9299 @end example
9301 In the documentation below, such cases are simply marked
9302 as being boolean aspects equivalent to the corresponding pragma
9303 or attribute definition clause.
9305 @menu
9306 * Aspect Abstract_State:: 
9307 * Aspect Always_Terminates:: 
9308 * Aspect Annotate:: 
9309 * Aspect Async_Readers:: 
9310 * Aspect Async_Writers:: 
9311 * Aspect Constant_After_Elaboration:: 
9312 * Aspect Contract_Cases:: 
9313 * Aspect Depends:: 
9314 * Aspect Default_Initial_Condition:: 
9315 * Aspect Dimension:: 
9316 * Aspect Dimension_System:: 
9317 * Aspect Disable_Controlled:: 
9318 * Aspect Effective_Reads:: 
9319 * Aspect Effective_Writes:: 
9320 * Aspect Exceptional_Cases:: 
9321 * Aspect Extensions_Visible:: 
9322 * Aspect Favor_Top_Level:: 
9323 * Aspect Ghost:: 
9324 * Aspect Ghost_Predicate:: 
9325 * Aspect Global:: 
9326 * Aspect Initial_Condition:: 
9327 * Aspect Initializes:: 
9328 * Aspect Inline_Always:: 
9329 * Aspect Invariant:: 
9330 * Aspect Invariant’Class:: 
9331 * Aspect Iterable:: 
9332 * Aspect Linker_Section:: 
9333 * Aspect Local_Restrictions:: 
9334 * Aspect Lock_Free:: 
9335 * Aspect Max_Queue_Length:: 
9336 * Aspect No_Caching:: 
9337 * Aspect No_Elaboration_Code_All:: 
9338 * Aspect No_Inline:: 
9339 * Aspect No_Tagged_Streams:: 
9340 * Aspect No_Task_Parts:: 
9341 * Aspect Object_Size:: 
9342 * Aspect Obsolescent:: 
9343 * Aspect Part_Of:: 
9344 * Aspect Persistent_BSS:: 
9345 * Aspect Predicate:: 
9346 * Aspect Pure_Function:: 
9347 * Aspect Refined_Depends:: 
9348 * Aspect Refined_Global:: 
9349 * Aspect Refined_Post:: 
9350 * Aspect Refined_State:: 
9351 * Aspect Relaxed_Initialization:: 
9352 * Aspect Remote_Access_Type:: 
9353 * Aspect Scalar_Storage_Order:: 
9354 * Aspect Secondary_Stack_Size:: 
9355 * Aspect Shared:: 
9356 * Aspect Side_Effects:: 
9357 * Aspect Simple_Storage_Pool:: 
9358 * Aspect Simple_Storage_Pool_Type:: 
9359 * Aspect SPARK_Mode:: 
9360 * Aspect Subprogram_Variant:: 
9361 * Aspect Suppress_Debug_Info:: 
9362 * Aspect Suppress_Initialization:: 
9363 * Aspect Test_Case:: 
9364 * Aspect Thread_Local_Storage:: 
9365 * Aspect Universal_Aliasing:: 
9366 * Aspect Unmodified:: 
9367 * Aspect Unreferenced:: 
9368 * Aspect Unreferenced_Objects:: 
9369 * Aspect User_Aspect:: 
9370 * Aspect Value_Size:: 
9371 * Aspect Volatile_Full_Access:: 
9372 * Aspect Volatile_Function:: 
9373 * Aspect Warnings:: 
9375 @end menu
9377 @node Aspect Abstract_State,Aspect Always_Terminates,,Implementation Defined Aspects
9378 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{12c}
9379 @section Aspect Abstract_State
9382 @geindex Abstract_State
9384 This aspect is equivalent to @ref{1e,,pragma Abstract_State}.
9386 @node Aspect Always_Terminates,Aspect Annotate,Aspect Abstract_State,Implementation Defined Aspects
9387 @anchor{gnat_rm/implementation_defined_aspects aspect-always-terminates}@anchor{12d}
9388 @section Aspect Always_Terminates
9391 @geindex Always_Terminates
9393 This boolean aspect is equivalent to @ref{29,,pragma Always_Terminates}.
9395 @node Aspect Annotate,Aspect Async_Readers,Aspect Always_Terminates,Implementation Defined Aspects
9396 @anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{12e}
9397 @section Aspect Annotate
9400 @geindex Annotate
9402 There are three forms of this aspect (where ID is an identifier,
9403 and ARG is a general expression),
9404 corresponding to @ref{2b,,pragma Annotate}.
9407 @table @asis
9409 @item `Annotate => ID'
9411 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9413 @item `Annotate => (ID)'
9415 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9417 @item `Annotate => (ID ,ID @{, ARG@})'
9419 Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
9420 @end table
9422 @node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
9423 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{12f}
9424 @section Aspect Async_Readers
9427 @geindex Async_Readers
9429 This boolean aspect is equivalent to @ref{32,,pragma Async_Readers}.
9431 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
9432 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{130}
9433 @section Aspect Async_Writers
9436 @geindex Async_Writers
9438 This boolean aspect is equivalent to @ref{34,,pragma Async_Writers}.
9440 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
9441 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{131}
9442 @section Aspect Constant_After_Elaboration
9445 @geindex Constant_After_Elaboration
9447 This aspect is equivalent to @ref{44,,pragma Constant_After_Elaboration}.
9449 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
9450 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{132}
9451 @section Aspect Contract_Cases
9454 @geindex Contract_Cases
9456 This aspect is equivalent to @ref{46,,pragma Contract_Cases}, the sequence
9457 of clauses being enclosed in parentheses so that syntactically it is an
9458 aggregate.
9460 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
9461 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{133}
9462 @section Aspect Depends
9465 @geindex Depends
9467 This aspect is equivalent to @ref{56,,pragma Depends}.
9469 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
9470 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{134}
9471 @section Aspect Default_Initial_Condition
9474 @geindex Default_Initial_Condition
9476 This aspect is equivalent to @ref{52,,pragma Default_Initial_Condition}.
9478 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
9479 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{135}
9480 @section Aspect Dimension
9483 @geindex Dimension
9485 The @code{Dimension} aspect is used to specify the dimensions of a given
9486 subtype of a dimensioned numeric type. The aspect also specifies a symbol
9487 used when doing formatted output of dimensioned quantities. The syntax is:
9489 @example
9490 with Dimension =>
9491   ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
9493 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
9495 DIMENSION_VALUE ::=
9496   RATIONAL
9497 | others               => RATIONAL
9498 | DISCRETE_CHOICE_LIST => RATIONAL
9500 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
9501 @end example
9503 This aspect can only be applied to a subtype whose parent type has
9504 a @code{Dimension_System} aspect. The aspect must specify values for
9505 all dimensions of the system. The rational values are the powers of the
9506 corresponding dimensions that are used by the compiler to verify that
9507 physical (numeric) computations are dimensionally consistent. For example,
9508 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
9509 For further examples of the usage
9510 of this aspect, see package @code{System.Dim.Mks}.
9511 Note that when the dimensioned type is an integer type, then any
9512 dimension value must be an integer literal.
9514 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
9515 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{136}
9516 @section Aspect Dimension_System
9519 @geindex Dimension_System
9521 The @code{Dimension_System} aspect is used to define a system of
9522 dimensions that will be used in subsequent subtype declarations with
9523 @code{Dimension} aspects that reference this system. The syntax is:
9525 @example
9526 with Dimension_System => (DIMENSION @{, DIMENSION@});
9528 DIMENSION ::= ([Unit_Name   =>] IDENTIFIER,
9529                [Unit_Symbol =>] SYMBOL,
9530                [Dim_Symbol  =>] SYMBOL)
9532 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
9533 @end example
9535 This aspect is applied to a type, which must be a numeric derived type
9536 (typically a floating-point type), that
9537 will represent values within the dimension system. Each @code{DIMENSION}
9538 corresponds to one particular dimension. A maximum of 7 dimensions may
9539 be specified. @code{Unit_Name} is the name of the dimension (for example
9540 @code{Meter}). @code{Unit_Symbol} is the shorthand used for quantities
9541 of this dimension (for example @code{m} for @code{Meter}).
9542 @code{Dim_Symbol} gives
9543 the identification within the dimension system (typically this is a
9544 single letter, e.g. @code{L} standing for length for unit name @code{Meter}).
9545 The @code{Unit_Symbol} is used in formatted output of dimensioned quantities.
9546 The @code{Dim_Symbol} is used in error messages when numeric operations have
9547 inconsistent dimensions.
9549 GNAT provides the standard definition of the International MKS system in
9550 the run-time package @code{System.Dim.Mks}. You can easily define
9551 similar packages for cgs units or British units, and define conversion factors
9552 between values in different systems. The MKS system is characterized by the
9553 following aspect:
9555 @example
9556 type Mks_Type is new Long_Long_Float with
9557   Dimension_System => (
9558     (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
9559     (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
9560     (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
9561     (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
9562     (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => '@@'),
9563     (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
9564     (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
9565 @end example
9567 Note that in the above type definition, we use the @code{at} symbol (@code{@@}) to
9568 represent a theta character (avoiding the use of extended Latin-1
9569 characters in this context).
9571 See section ‘Performing Dimensionality Analysis in GNAT’ in the GNAT Users
9572 Guide for detailed examples of use of the dimension system.
9574 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
9575 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{137}
9576 @section Aspect Disable_Controlled
9579 @geindex Disable_Controlled
9581 The aspect  @code{Disable_Controlled} is defined for controlled record types. If
9582 active, this aspect causes suppression of all related calls to @code{Initialize},
9583 @code{Adjust}, and @code{Finalize}. The intended use is for conditional compilation,
9584 where for example you might want a record to be controlled or not depending on
9585 whether some run-time check is enabled or suppressed.
9587 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9588 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{138}
9589 @section Aspect Effective_Reads
9592 @geindex Effective_Reads
9594 This aspect is equivalent to @ref{5b,,pragma Effective_Reads}.
9596 @node Aspect Effective_Writes,Aspect Exceptional_Cases,Aspect Effective_Reads,Implementation Defined Aspects
9597 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{139}
9598 @section Aspect Effective_Writes
9601 @geindex Effective_Writes
9603 This aspect is equivalent to @ref{5d,,pragma Effective_Writes}.
9605 @node Aspect Exceptional_Cases,Aspect Extensions_Visible,Aspect Effective_Writes,Implementation Defined Aspects
9606 @anchor{gnat_rm/implementation_defined_aspects aspect-exceptional-cases}@anchor{13a}
9607 @section Aspect Exceptional_Cases
9610 @geindex Exceptional_Cases
9612 This aspect may be specified for procedures and functions with side effects;
9613 it can be used to list exceptions that might be propagated by the subprogram
9614 with side effects in the context of its precondition, and associate them
9615 with a specific postcondition.
9617 For the syntax and semantics of this aspect, see the SPARK 2014 Reference
9618 Manual, section 6.1.9.
9620 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Exceptional_Cases,Implementation Defined Aspects
9621 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{13b}
9622 @section Aspect Extensions_Visible
9625 @geindex Extensions_Visible
9627 This aspect is equivalent to @ref{6c,,pragma Extensions_Visible}.
9629 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9630 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{13c}
9631 @section Aspect Favor_Top_Level
9634 @geindex Favor_Top_Level
9636 This boolean aspect is equivalent to @ref{71,,pragma Favor_Top_Level}.
9638 @node Aspect Ghost,Aspect Ghost_Predicate,Aspect Favor_Top_Level,Implementation Defined Aspects
9639 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{13d}
9640 @section Aspect Ghost
9643 @geindex Ghost
9645 This aspect is equivalent to @ref{75,,pragma Ghost}.
9647 @node Aspect Ghost_Predicate,Aspect Global,Aspect Ghost,Implementation Defined Aspects
9648 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost-predicate}@anchor{13e}
9649 @section Aspect Ghost_Predicate
9652 @geindex Ghost_Predicate
9654 This aspect introduces a subtype predicate that can reference ghost
9655 entities. The subtype cannot appear as a subtype_mark in a membership test.
9657 For the detailed semantics of this aspect, see the entry for subtype predicates
9658 in the SPARK Reference Manual, section 3.2.4.
9660 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost_Predicate,Implementation Defined Aspects
9661 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{13f}
9662 @section Aspect Global
9665 @geindex Global
9667 This aspect is equivalent to @ref{77,,pragma Global}.
9669 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9670 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{140}
9671 @section Aspect Initial_Condition
9674 @geindex Initial_Condition
9676 This aspect is equivalent to @ref{84,,pragma Initial_Condition}.
9678 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9679 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{141}
9680 @section Aspect Initializes
9683 @geindex Initializes
9685 This aspect is equivalent to @ref{87,,pragma Initializes}.
9687 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9688 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{142}
9689 @section Aspect Inline_Always
9692 @geindex Inline_Always
9694 This boolean aspect is equivalent to @ref{89,,pragma Inline_Always}.
9696 @node Aspect Invariant,Aspect Invariant’Class,Aspect Inline_Always,Implementation Defined Aspects
9697 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{143}
9698 @section Aspect Invariant
9701 @geindex Invariant
9703 This aspect is equivalent to @ref{91,,pragma Invariant}. It is a
9704 synonym for the language defined aspect @code{Type_Invariant} except
9705 that it is separately controllable using pragma @code{Assertion_Policy}.
9707 @node Aspect Invariant’Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9708 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{144}
9709 @section Aspect Invariant’Class
9712 @geindex Invariant'Class
9714 This aspect is equivalent to @ref{10b,,pragma Type_Invariant_Class}. It is a
9715 synonym for the language defined aspect @code{Type_Invariant'Class} except
9716 that it is separately controllable using pragma @code{Assertion_Policy}.
9718 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant’Class,Implementation Defined Aspects
9719 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{145}
9720 @section Aspect Iterable
9723 @geindex Iterable
9725 This aspect provides a light-weight mechanism for loops and quantified
9726 expressions over container types, without the overhead imposed by the tampering
9727 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9728 with six named components, of which the last three are optional: @code{First},
9729 @code{Next}, @code{Has_Element}, @code{Element}, @code{Last}, and @code{Previous}.
9730 When only the first three components are specified, only the
9731 @code{for .. in} form of iteration over cursors is available. When @code{Element}
9732 is specified, both this form and the @code{for .. of} form of iteration over
9733 elements are available. If the last two components are specified, reverse
9734 iterations over the container can be specified (analogous to what can be done
9735 over predefined containers that support the @code{Reverse_Iterator} interface).
9736 The following is a typical example of use:
9738 @example
9739 type List is private with
9740     Iterable => (First       => First_Cursor,
9741                  Next        => Advance,
9742                  Has_Element => Cursor_Has_Element
9743                [,Element     => Get_Element]
9744                [,Last        => Last_Cursor]
9745                [,Previous    => Retreat]);
9746 @end example
9749 @itemize *
9751 @item 
9752 The values of @code{First} and @code{Last} are primitive operations of the
9753 container type that return a @code{Cursor}, which must be a type declared in
9754 the container package or visible from it. For example:
9755 @end itemize
9757 @example
9758 function First_Cursor (Cont : Container) return Cursor;
9759 function Last_Cursor  (Cont : Container) return Cursor;
9760 @end example
9763 @itemize *
9765 @item 
9766 The values of @code{Next} and @code{Previous} are primitive operations of the container type that take
9767 both a container and a cursor and yield a cursor. For example:
9768 @end itemize
9770 @example
9771 function Advance (Cont : Container; Position : Cursor) return Cursor;
9772 function Retreat (Cont : Container; Position : Cursor) return Cursor;
9773 @end example
9776 @itemize *
9778 @item 
9779 The value of @code{Has_Element} is a primitive operation of the container type
9780 that takes both a container and a cursor and yields a boolean. For example:
9781 @end itemize
9783 @example
9784 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9785 @end example
9788 @itemize *
9790 @item 
9791 The value of @code{Element} is a primitive operation of the container type that
9792 takes both a container and a cursor and yields an @code{Element_Type}, which must
9793 be a type declared in the container package or visible from it. For example:
9794 @end itemize
9796 @example
9797 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9798 @end example
9800 This aspect is used in the GNAT-defined formal container packages.
9802 @node Aspect Linker_Section,Aspect Local_Restrictions,Aspect Iterable,Implementation Defined Aspects
9803 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{146}
9804 @section Aspect Linker_Section
9807 @geindex Linker_Section
9809 This aspect is equivalent to @ref{99,,pragma Linker_Section}.
9811 @node Aspect Local_Restrictions,Aspect Lock_Free,Aspect Linker_Section,Implementation Defined Aspects
9812 @anchor{gnat_rm/implementation_defined_aspects aspect-local-restrictions}@anchor{147}
9813 @section Aspect Local_Restrictions
9816 @geindex Local_Restrictions
9818 This aspect may be specified for a subprogram (and for other declarations
9819 as described below). It is used to specify that a particular subprogram does
9820 not violate one or more local restrictions, nor can it call a subprogram
9821 that is not subject to the same requirement. Positional aggregate syntax
9822 (with parentheses, not square brackets) may be used to specify more than one
9823 local restriction, as in
9825 @example
9826 procedure Do_Something
9827   with Local_Restrictions => (Some_Restriction, Another_Restriction);
9828 @end example
9830 Parentheses are currently required even in the case of specifying a single
9831 local restriction (this requirement may be relaxed in the future).
9832 Supported local restrictions currently include (only) No_Heap_Allocations and
9833 No_Secondary_Stack.
9834 No_Secondary_Stack corresponds to the GNAT-defined (global) restriction
9835 of the same name. No_Heap_Allocations corresponds to the conjunction of the
9836 Ada-defined restrictions No_Allocators and No_Implicit_Heap_Allocations.
9838 Additional requirements are imposed in order to ensure that restriction
9839 violations cannot be achieved via overriding dispatching operations,
9840 calling through an access-to-subprogram value, calling a generic formal
9841 subprogram, or calling through a subprogram renaming.
9842 For a dispatching operation, an overrider must be subject to (at least) the
9843 same restrictions as the overridden inherited subprogram; similarly, the
9844 actual subprogram corresponding to a generic formal subprogram
9845 in an instantiation must be subject to (at least) the same restrictions
9846 as the formal subprogram. A call through an access-to-subprogram value
9847 is conservatively assumed to violate all local restrictions; tasking-related
9848 constructs (notably entry calls) are treated similarly. A renaming-as-body is
9849 treated like a subprogram body containing a call to the renamed subprogram.
9851 The Local_Restrictions aspect can be specified for a package specification,
9852 in which case the aspect specification also applies to all eligible entities
9853 declared with the package. This includes types. Default initialization of an
9854 object of a given type is treated like a call to an implicitly-declared
9855 initialization subprogram. Such a “call” is subject to the same local
9856 restriction checks as any other call. If a type is subject to a local
9857 restriction, then any violations of that restriction within the default
9858 initialization expressions (if any) of the type are rejected. This may
9859 include “calls” to the default initialization subprograms of other types.
9861 Local_Restrictions aspect specifications are additive (for example, in the
9862 case of a declaration that occurs within nested packages that each have
9863 a Local_Restrictions specification).
9865 @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Local_Restrictions,Implementation Defined Aspects
9866 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{148}
9867 @section Aspect Lock_Free
9870 @geindex Lock_Free
9872 This boolean aspect is equivalent to @ref{9b,,pragma Lock_Free}.
9874 @node Aspect Max_Queue_Length,Aspect No_Caching,Aspect Lock_Free,Implementation Defined Aspects
9875 @anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{149}
9876 @section Aspect Max_Queue_Length
9879 @geindex Max_Queue_Length
9881 This aspect is equivalent to @ref{a3,,pragma Max_Queue_Length}.
9883 @node Aspect No_Caching,Aspect No_Elaboration_Code_All,Aspect Max_Queue_Length,Implementation Defined Aspects
9884 @anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{14a}
9885 @section Aspect No_Caching
9888 @geindex No_Caching
9890 This boolean aspect is equivalent to @ref{a6,,pragma No_Caching}.
9892 @node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect No_Caching,Implementation Defined Aspects
9893 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{14b}
9894 @section Aspect No_Elaboration_Code_All
9897 @geindex No_Elaboration_Code_All
9899 This aspect is equivalent to @ref{a9,,pragma No_Elaboration_Code_All}
9900 for a program unit.
9902 @node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9903 @anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{14c}
9904 @section Aspect No_Inline
9907 @geindex No_Inline
9909 This boolean aspect is equivalent to @ref{ac,,pragma No_Inline}.
9911 @node Aspect No_Tagged_Streams,Aspect No_Task_Parts,Aspect No_Inline,Implementation Defined Aspects
9912 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{14d}
9913 @section Aspect No_Tagged_Streams
9916 @geindex No_Tagged_Streams
9918 This aspect is equivalent to @ref{b0,,pragma No_Tagged_Streams} with an
9919 argument specifying a root tagged type (thus this aspect can only be
9920 applied to such a type).
9922 @node Aspect No_Task_Parts,Aspect Object_Size,Aspect No_Tagged_Streams,Implementation Defined Aspects
9923 @anchor{gnat_rm/implementation_defined_aspects aspect-no-task-parts}@anchor{14e}
9924 @section Aspect No_Task_Parts
9927 @geindex No_Task_Parts
9929 Applies to a type. If True, requires that the type and any descendants
9930 do not have any task parts. The rules for this aspect are the same as
9931 for the language-defined No_Controlled_Parts aspect (see RM-H.4.1),
9932 replacing “controlled” with “task”.
9934 If No_Task_Parts is True for a type T, then the compiler can optimize
9935 away certain tasking-related code that would otherwise be needed
9936 for T’Class, because descendants of T might contain tasks.
9938 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Task_Parts,Implementation Defined Aspects
9939 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{14f}
9940 @section Aspect Object_Size
9943 @geindex Object_Size
9945 This aspect is equivalent to @ref{150,,attribute Object_Size}.
9947 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9948 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{151}
9949 @section Aspect Obsolescent
9952 @geindex Obsolescent
9954 This aspect is equivalent to @ref{b3,,pragma Obsolescent}. Note that the
9955 evaluation of this aspect happens at the point of occurrence, it is not
9956 delayed until the freeze point.
9958 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9959 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{152}
9960 @section Aspect Part_Of
9963 @geindex Part_Of
9965 This aspect is equivalent to @ref{b9,,pragma Part_Of}.
9967 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9968 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{153}
9969 @section Aspect Persistent_BSS
9972 @geindex Persistent_BSS
9974 This boolean aspect is equivalent to @ref{bd,,pragma Persistent_BSS}.
9976 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9977 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{154}
9978 @section Aspect Predicate
9981 @geindex Predicate
9983 This aspect is equivalent to @ref{c4,,pragma Predicate}. It is thus
9984 similar to the language defined aspects @code{Dynamic_Predicate}
9985 and @code{Static_Predicate} except that whether the resulting
9986 predicate is static or dynamic is controlled by the form of the
9987 expression. It is also separately controllable using pragma
9988 @code{Assertion_Policy}.
9990 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9991 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{155}
9992 @section Aspect Pure_Function
9995 @geindex Pure_Function
9997 This boolean aspect is equivalent to @ref{d0,,pragma Pure_Function}.
9999 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
10000 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{156}
10001 @section Aspect Refined_Depends
10004 @geindex Refined_Depends
10006 This aspect is equivalent to @ref{d4,,pragma Refined_Depends}.
10008 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
10009 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{157}
10010 @section Aspect Refined_Global
10013 @geindex Refined_Global
10015 This aspect is equivalent to @ref{d6,,pragma Refined_Global}.
10017 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
10018 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{158}
10019 @section Aspect Refined_Post
10022 @geindex Refined_Post
10024 This aspect is equivalent to @ref{d8,,pragma Refined_Post}.
10026 @node Aspect Refined_State,Aspect Relaxed_Initialization,Aspect Refined_Post,Implementation Defined Aspects
10027 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{159}
10028 @section Aspect Refined_State
10031 @geindex Refined_State
10033 This aspect is equivalent to @ref{da,,pragma Refined_State}.
10035 @node Aspect Relaxed_Initialization,Aspect Remote_Access_Type,Aspect Refined_State,Implementation Defined Aspects
10036 @anchor{gnat_rm/implementation_defined_aspects aspect-relaxed-initialization}@anchor{15a}
10037 @section Aspect Relaxed_Initialization
10040 @geindex Refined_Initialization
10042 For the syntax and semantics of this aspect, see the SPARK 2014 Reference
10043 Manual, section 6.10.
10045 @node Aspect Remote_Access_Type,Aspect Scalar_Storage_Order,Aspect Relaxed_Initialization,Implementation Defined Aspects
10046 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{15b}
10047 @section Aspect Remote_Access_Type
10050 @geindex Remote_Access_Type
10052 This aspect is equivalent to @ref{dd,,pragma Remote_Access_Type}.
10054 @node Aspect Scalar_Storage_Order,Aspect Secondary_Stack_Size,Aspect Remote_Access_Type,Implementation Defined Aspects
10055 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{15c}
10056 @section Aspect Scalar_Storage_Order
10059 @geindex Scalar_Storage_Order
10061 This aspect is equivalent to a @ref{15d,,attribute Scalar_Storage_Order}.
10063 @node Aspect Secondary_Stack_Size,Aspect Shared,Aspect Scalar_Storage_Order,Implementation Defined Aspects
10064 @anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{15e}
10065 @section Aspect Secondary_Stack_Size
10068 @geindex Secondary_Stack_Size
10070 This aspect is equivalent to @ref{e3,,pragma Secondary_Stack_Size}.
10072 @node Aspect Shared,Aspect Side_Effects,Aspect Secondary_Stack_Size,Implementation Defined Aspects
10073 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{15f}
10074 @section Aspect Shared
10077 @geindex Shared
10079 This boolean aspect is equivalent to @ref{e6,,pragma Shared}
10080 and is thus a synonym for aspect @code{Atomic}.
10082 @node Aspect Side_Effects,Aspect Simple_Storage_Pool,Aspect Shared,Implementation Defined Aspects
10083 @anchor{gnat_rm/implementation_defined_aspects aspect-side-effects}@anchor{160}
10084 @section Aspect Side_Effects
10087 @geindex Side_Effects
10089 This aspect is equivalent to @ref{ea,,pragma Side_Effects}.
10091 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Side_Effects,Implementation Defined Aspects
10092 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{161}
10093 @section Aspect Simple_Storage_Pool
10096 @geindex Simple_Storage_Pool
10098 This aspect is equivalent to @ref{ed,,attribute Simple_Storage_Pool}.
10100 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
10101 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{162}
10102 @section Aspect Simple_Storage_Pool_Type
10105 @geindex Simple_Storage_Pool_Type
10107 This boolean aspect is equivalent to @ref{ec,,pragma Simple_Storage_Pool_Type}.
10109 @node Aspect SPARK_Mode,Aspect Subprogram_Variant,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
10110 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{163}
10111 @section Aspect SPARK_Mode
10114 @geindex SPARK_Mode
10116 This aspect is equivalent to @ref{f4,,pragma SPARK_Mode} and
10117 may be specified for either or both of the specification and body
10118 of a subprogram or package.
10120 @node Aspect Subprogram_Variant,Aspect Suppress_Debug_Info,Aspect SPARK_Mode,Implementation Defined Aspects
10121 @anchor{gnat_rm/implementation_defined_aspects aspect-subprogram-variant}@anchor{164}
10122 @section Aspect Subprogram_Variant
10125 @geindex Subprogram_Variant
10127 For the syntax and semantics of this aspect, see the SPARK 2014 Reference
10128 Manual, section 6.1.8.
10130 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect Subprogram_Variant,Implementation Defined Aspects
10131 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{165}
10132 @section Aspect Suppress_Debug_Info
10135 @geindex Suppress_Debug_Info
10137 This boolean aspect is equivalent to @ref{fd,,pragma Suppress_Debug_Info}.
10139 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
10140 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{166}
10141 @section Aspect Suppress_Initialization
10144 @geindex Suppress_Initialization
10146 This boolean aspect is equivalent to @ref{100,,pragma Suppress_Initialization}.
10148 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
10149 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{167}
10150 @section Aspect Test_Case
10153 @geindex Test_Case
10155 This aspect is equivalent to @ref{104,,pragma Test_Case}.
10157 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
10158 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{168}
10159 @section Aspect Thread_Local_Storage
10162 @geindex Thread_Local_Storage
10164 This boolean aspect is equivalent to @ref{106,,pragma Thread_Local_Storage}.
10166 @node Aspect Universal_Aliasing,Aspect Unmodified,Aspect Thread_Local_Storage,Implementation Defined Aspects
10167 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{169}
10168 @section Aspect Universal_Aliasing
10171 @geindex Universal_Aliasing
10173 This boolean aspect is equivalent to @ref{111,,pragma Universal_Aliasing}.
10175 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Aliasing,Implementation Defined Aspects
10176 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{16a}
10177 @section Aspect Unmodified
10180 @geindex Unmodified
10182 This boolean aspect is equivalent to @ref{113,,pragma Unmodified}.
10184 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
10185 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{16b}
10186 @section Aspect Unreferenced
10189 @geindex Unreferenced
10191 This boolean aspect is equivalent to @ref{115,,pragma Unreferenced}.
10193 When using the @code{-gnat2022} switch, this aspect is also supported on formal
10194 parameters, which is in particular the only form possible for expression
10195 functions.
10197 @node Aspect Unreferenced_Objects,Aspect User_Aspect,Aspect Unreferenced,Implementation Defined Aspects
10198 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{16c}
10199 @section Aspect Unreferenced_Objects
10202 @geindex Unreferenced_Objects
10204 This boolean aspect is equivalent to @ref{117,,pragma Unreferenced_Objects}.
10206 @node Aspect User_Aspect,Aspect Value_Size,Aspect Unreferenced_Objects,Implementation Defined Aspects
10207 @anchor{gnat_rm/implementation_defined_aspects aspect-user-aspect}@anchor{16d}
10208 @section Aspect User_Aspect
10211 @geindex User_Aspect
10213 This aspect takes an argument that is the name of an aspect defined by a
10214 User_Aspect_Definition configuration pragma.
10215 A User_Aspect aspect specification is semantically equivalent to
10216 replicating the set of aspect specifications associated with the named
10217 pragma-defined aspect.
10219 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect User_Aspect,Implementation Defined Aspects
10220 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{16e}
10221 @section Aspect Value_Size
10224 @geindex Value_Size
10226 This aspect is equivalent to @ref{16f,,attribute Value_Size}.
10228 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
10229 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{170}
10230 @section Aspect Volatile_Full_Access
10233 @geindex Volatile_Full_Access
10235 This boolean aspect is equivalent to @ref{121,,pragma Volatile_Full_Access}.
10237 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
10238 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{171}
10239 @section Aspect Volatile_Function
10242 @geindex Volatile_Function
10244 This boolean aspect is equivalent to @ref{123,,pragma Volatile_Function}.
10246 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
10247 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{172}
10248 @section Aspect Warnings
10251 @geindex Warnings
10253 This aspect is equivalent to the two argument form of @ref{125,,pragma Warnings},
10254 where the first argument is @code{ON} or @code{OFF} and the second argument
10255 is the entity.
10257 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
10258 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{173}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{174}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}
10259 @chapter Implementation Defined Attributes
10262 Ada defines (throughout the Ada reference manual,
10263 summarized in Annex K),
10264 a set of attributes that provide useful additional functionality in all
10265 areas of the language.  These language defined attributes are implemented
10266 in GNAT and work as described in the Ada Reference Manual.
10268 In addition, Ada allows implementations to define additional
10269 attributes whose meaning is defined by the implementation.  GNAT provides
10270 a number of these implementation-dependent attributes which can be used
10271 to extend and enhance the functionality of the compiler.  This section of
10272 the GNAT reference manual describes these additional attributes.  It also
10273 describes additional implementation-dependent features of standard
10274 language-defined attributes.
10276 Note that any program using these attributes may not be portable to
10277 other compilers (although GNAT implements this set of attributes on all
10278 platforms).  Therefore if portability to other compilers is an important
10279 consideration, you should minimize the use of these attributes.
10281 @menu
10282 * Attribute Abort_Signal:: 
10283 * Attribute Address_Size:: 
10284 * Attribute Asm_Input:: 
10285 * Attribute Asm_Output:: 
10286 * Attribute Atomic_Always_Lock_Free:: 
10287 * Attribute Bit:: 
10288 * Attribute Bit_Position:: 
10289 * Attribute Code_Address:: 
10290 * Attribute Compiler_Version:: 
10291 * Attribute Constrained:: 
10292 * Attribute Default_Bit_Order:: 
10293 * Attribute Default_Scalar_Storage_Order:: 
10294 * Attribute Deref:: 
10295 * Attribute Descriptor_Size:: 
10296 * Attribute Elaborated:: 
10297 * Attribute Elab_Body:: 
10298 * Attribute Elab_Spec:: 
10299 * Attribute Elab_Subp_Body:: 
10300 * Attribute Emax:: 
10301 * Attribute Enabled:: 
10302 * Attribute Enum_Rep:: 
10303 * Attribute Enum_Val:: 
10304 * Attribute Epsilon:: 
10305 * Attribute Fast_Math:: 
10306 * Attribute Finalization_Size:: 
10307 * Attribute Fixed_Value:: 
10308 * Attribute From_Any:: 
10309 * Attribute Has_Access_Values:: 
10310 * Attribute Has_Discriminants:: 
10311 * Attribute Has_Tagged_Values:: 
10312 * Attribute Img:: 
10313 * Attribute Initialized:: 
10314 * Attribute Integer_Value:: 
10315 * Attribute Invalid_Value:: 
10316 * Attribute Large:: 
10317 * Attribute Library_Level:: 
10318 * Attribute Loop_Entry:: 
10319 * Attribute Machine_Size:: 
10320 * Attribute Mantissa:: 
10321 * Attribute Maximum_Alignment:: 
10322 * Attribute Max_Integer_Size:: 
10323 * Attribute Mechanism_Code:: 
10324 * Attribute Null_Parameter:: 
10325 * Attribute Object_Size:: 
10326 * Attribute Old:: 
10327 * Attribute Passed_By_Reference:: 
10328 * Attribute Pool_Address:: 
10329 * Attribute Range_Length:: 
10330 * Attribute Restriction_Set:: 
10331 * Attribute Result:: 
10332 * Attribute Round:: 
10333 * Attribute Safe_Emax:: 
10334 * Attribute Safe_Large:: 
10335 * Attribute Safe_Small:: 
10336 * Attribute Scalar_Storage_Order:: 
10337 * Attribute Simple_Storage_Pool:: 
10338 * Attribute Small:: 
10339 * Attribute Small_Denominator:: 
10340 * Attribute Small_Numerator:: 
10341 * Attribute Storage_Unit:: 
10342 * Attribute Stub_Type:: 
10343 * Attribute System_Allocator_Alignment:: 
10344 * Attribute Target_Name:: 
10345 * Attribute To_Address:: 
10346 * Attribute To_Any:: 
10347 * Attribute Type_Class:: 
10348 * Attribute Type_Key:: 
10349 * Attribute TypeCode:: 
10350 * Attribute Unconstrained_Array:: 
10351 * Attribute Universal_Literal_String:: 
10352 * Attribute Unrestricted_Access:: 
10353 * Attribute Update:: 
10354 * Attribute Valid_Value:: 
10355 * Attribute Valid_Scalars:: 
10356 * Attribute VADS_Size:: 
10357 * Attribute Value_Size:: 
10358 * Attribute Wchar_T_Size:: 
10359 * Attribute Word_Size:: 
10361 @end menu
10363 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
10364 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{175}
10365 @section Attribute Abort_Signal
10368 @geindex Abort_Signal
10370 @code{Standard'Abort_Signal} (@code{Standard} is the only allowed
10371 prefix) provides the entity for the special exception used to signal
10372 task abort or asynchronous transfer of control.  Normally this attribute
10373 should only be used in the tasking runtime (it is highly peculiar, and
10374 completely outside the normal semantics of Ada, for a user program to
10375 intercept the abort exception).
10377 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
10378 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{176}
10379 @section Attribute Address_Size
10382 @geindex Size of `@w{`}Address`@w{`}
10384 @geindex Address_Size
10386 @code{Standard'Address_Size} (@code{Standard} is the only allowed
10387 prefix) is a static constant giving the number of bits in an
10388 @code{Address}. It is the same value as System.Address’Size,
10389 but has the advantage of being static, while a direct
10390 reference to System.Address’Size is nonstatic because Address
10391 is a private type.
10393 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
10394 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{177}
10395 @section Attribute Asm_Input
10398 @geindex Asm_Input
10400 The @code{Asm_Input} attribute denotes a function that takes two
10401 parameters.  The first is a string, the second is an expression of the
10402 type designated by the prefix.  The first (string) argument is required
10403 to be a static expression, and is the constraint for the parameter,
10404 (e.g., what kind of register is required).  The second argument is the
10405 value to be used as the input argument.  The possible values for the
10406 constant are the same as those used in the RTL, and are dependent on
10407 the configuration file used to built the GCC back end.
10408 @ref{178,,Machine Code Insertions}
10410 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
10411 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{179}
10412 @section Attribute Asm_Output
10415 @geindex Asm_Output
10417 The @code{Asm_Output} attribute denotes a function that takes two
10418 parameters.  The first is a string, the second is the name of a variable
10419 of the type designated by the attribute prefix.  The first (string)
10420 argument is required to be a static expression and designates the
10421 constraint for the parameter (e.g., what kind of register is
10422 required).  The second argument is the variable to be updated with the
10423 result.  The possible values for constraint are the same as those used in
10424 the RTL, and are dependent on the configuration file used to build the
10425 GCC back end.  If there are no output operands, then this argument may
10426 either be omitted, or explicitly given as @code{No_Output_Operands}.
10427 @ref{178,,Machine Code Insertions}
10429 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
10430 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{17a}
10431 @section Attribute Atomic_Always_Lock_Free
10434 @geindex Atomic_Always_Lock_Free
10436 The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type. The
10437 result indicates whether atomic operations are supported by the target
10438 for the given type.
10440 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
10441 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{17b}
10442 @section Attribute Bit
10445 @geindex Bit
10447 @code{obj'Bit}, where @code{obj} is any object, yields the bit
10448 offset within the storage unit (byte) that contains the first bit of
10449 storage allocated for the object.  The value of this attribute is of the
10450 type `universal_integer' and is always a nonnegative number smaller
10451 than @code{System.Storage_Unit}.
10453 For an object that is a variable or a constant allocated in a register,
10454 the value is zero.  (The use of this attribute does not force the
10455 allocation of a variable to memory).
10457 For an object that is a formal parameter, this attribute applies
10458 to either the matching actual parameter or to a copy of the
10459 matching actual parameter.
10461 For an access object the value is zero.  Note that
10462 @code{obj.all'Bit} is subject to an @code{Access_Check} for the
10463 designated object.  Similarly for a record component
10464 @code{X.C'Bit} is subject to a discriminant check and
10465 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
10466 are subject to index checks.
10468 This attribute is designed to be compatible with the DEC Ada 83 definition
10469 and implementation of the @code{Bit} attribute.
10471 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
10472 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{17c}
10473 @section Attribute Bit_Position
10476 @geindex Bit_Position
10478 @code{R.C'Bit_Position}, where @code{R} is a record object and @code{C} is one
10479 of the fields of the record type, yields the bit
10480 offset within the record contains the first bit of
10481 storage allocated for the object.  The value of this attribute is of the
10482 type `universal_integer'.  The value depends only on the field
10483 @code{C} and is independent of the alignment of
10484 the containing record @code{R}.
10486 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
10487 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{17d}
10488 @section Attribute Code_Address
10491 @geindex Code_Address
10493 @geindex Subprogram address
10495 @geindex Address of subprogram code
10497 The @code{'Address}
10498 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
10499 intended effect seems to be to provide
10500 an address value which can be used to call the subprogram by means of
10501 an address clause as in the following example:
10503 @example
10504 procedure K is ...
10506 procedure L;
10507 for L'Address use K'Address;
10508 pragma Import (Ada, L);
10509 @end example
10511 A call to @code{L} is then expected to result in a call to @code{K}.
10512 In Ada 83, where there were no access-to-subprogram values, this was
10513 a common work-around for getting the effect of an indirect call.
10514 GNAT implements the above use of @code{Address} and the technique
10515 illustrated by the example code works correctly.
10517 However, for some purposes, it is useful to have the address of the start
10518 of the generated code for the subprogram.  On some architectures, this is
10519 not necessarily the same as the @code{Address} value described above.
10520 For example, the @code{Address} value may reference a subprogram
10521 descriptor rather than the subprogram itself.
10523 The @code{'Code_Address} attribute, which can only be applied to
10524 subprogram entities, always returns the address of the start of the
10525 generated code of the specified subprogram, which may or may not be
10526 the same value as is returned by the corresponding @code{'Address}
10527 attribute.
10529 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
10530 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{17e}
10531 @section Attribute Compiler_Version
10534 @geindex Compiler_Version
10536 @code{Standard'Compiler_Version} (@code{Standard} is the only allowed
10537 prefix) yields a static string identifying the version of the compiler
10538 being used to compile the unit containing the attribute reference.
10540 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
10541 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{17f}
10542 @section Attribute Constrained
10545 @geindex Constrained
10547 In addition to the usage of this attribute in the Ada RM, GNAT
10548 also permits the use of the @code{'Constrained} attribute
10549 in a generic template
10550 for any type, including types without discriminants. The value of this
10551 attribute in the generic instance when applied to a scalar type or a
10552 record type without discriminants is always @code{True}. This usage is
10553 compatible with older Ada compilers, including notably DEC Ada.
10555 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
10556 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{180}
10557 @section Attribute Default_Bit_Order
10560 @geindex Big endian
10562 @geindex Little endian
10564 @geindex Default_Bit_Order
10566 @code{Standard'Default_Bit_Order} (@code{Standard} is the only
10567 allowed prefix), provides the value @code{System.Default_Bit_Order}
10568 as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
10569 @code{Low_Order_First}).  This is used to construct the definition of
10570 @code{Default_Bit_Order} in package @code{System}.
10572 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
10573 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{181}
10574 @section Attribute Default_Scalar_Storage_Order
10577 @geindex Big endian
10579 @geindex Little endian
10581 @geindex Default_Scalar_Storage_Order
10583 @code{Standard'Default_Scalar_Storage_Order} (@code{Standard} is the only
10584 allowed prefix), provides the current value of the default scalar storage
10585 order (as specified using pragma @code{Default_Scalar_Storage_Order}, or
10586 equal to @code{Default_Bit_Order} if unspecified) as a
10587 @code{System.Bit_Order} value. This is a static attribute.
10589 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
10590 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{182}
10591 @section Attribute Deref
10594 @geindex Deref
10596 The attribute @code{typ'Deref(expr)} where @code{expr} is of type @code{System.Address} yields
10597 the variable of type @code{typ} that is located at the given address. It is similar
10598 to @code{(totyp (expr).all)}, where @code{totyp} is an unchecked conversion from address to
10599 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
10600 used on the left side of an assignment.
10602 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
10603 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{183}
10604 @section Attribute Descriptor_Size
10607 @geindex Descriptor
10609 @geindex Dope vector
10611 @geindex Descriptor_Size
10613 Nonstatic attribute @code{Descriptor_Size} returns the size in bits of the
10614 descriptor allocated for a type.  The result is non-zero only for unconstrained
10615 array types and the returned value is of type universal integer.  In GNAT, an
10616 array descriptor contains bounds information and is located immediately before
10617 the first element of the array.
10619 @example
10620 type Unconstr_Array is array (Short_Short_Integer range <>) of Positive;
10621 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
10622 @end example
10624 The attribute takes into account any padding due to the alignment of the
10625 component type. In the example above, the descriptor contains two values
10626 of type @code{Short_Short_Integer} representing the low and high bound. But,
10627 since @code{Positive} has an alignment of 4, the size of the descriptor is
10628 @code{2 * Short_Short_Integer'Size} rounded up to the next multiple of 32,
10629 which yields a size of 32 bits, i.e. including 16 bits of padding.
10631 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
10632 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{184}
10633 @section Attribute Elaborated
10636 @geindex Elaborated
10638 The prefix of the @code{'Elaborated} attribute must be a unit name.  The
10639 value is a Boolean which indicates whether or not the given unit has been
10640 elaborated.  This attribute is primarily intended for internal use by the
10641 generated code for dynamic elaboration checking, but it can also be used
10642 in user programs.  The value will always be True once elaboration of all
10643 units has been completed.  An exception is for units which need no
10644 elaboration, the value is always False for such units.
10646 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
10647 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{185}
10648 @section Attribute Elab_Body
10651 @geindex Elab_Body
10653 This attribute can only be applied to a program unit name.  It returns
10654 the entity for the corresponding elaboration procedure for elaborating
10655 the body of the referenced unit.  This is used in the main generated
10656 elaboration procedure by the binder and is not normally used in any
10657 other context.  However, there may be specialized situations in which it
10658 is useful to be able to call this elaboration procedure from Ada code,
10659 e.g., if it is necessary to do selective re-elaboration to fix some
10660 error.
10662 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
10663 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{186}
10664 @section Attribute Elab_Spec
10667 @geindex Elab_Spec
10669 This attribute can only be applied to a program unit name.  It returns
10670 the entity for the corresponding elaboration procedure for elaborating
10671 the spec of the referenced unit.  This is used in the main
10672 generated elaboration procedure by the binder and is not normally used
10673 in any other context.  However, there may be specialized situations in
10674 which it is useful to be able to call this elaboration procedure from
10675 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
10676 some error.
10678 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
10679 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{187}
10680 @section Attribute Elab_Subp_Body
10683 @geindex Elab_Subp_Body
10685 This attribute can only be applied to a library level subprogram
10686 name and is only allowed in CodePeer mode. It returns the entity
10687 for the corresponding elaboration procedure for elaborating the body
10688 of the referenced subprogram unit. This is used in the main generated
10689 elaboration procedure by the binder in CodePeer mode only and is unrecognized
10690 otherwise.
10692 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
10693 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{188}
10694 @section Attribute Emax
10697 @geindex Ada 83 attributes
10699 @geindex Emax
10701 The @code{Emax} attribute is provided for compatibility with Ada 83.  See
10702 the Ada 83 reference manual for an exact description of the semantics of
10703 this attribute.
10705 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
10706 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{189}
10707 @section Attribute Enabled
10710 @geindex Enabled
10712 The @code{Enabled} attribute allows an application program to check at compile
10713 time to see if the designated check is currently enabled. The prefix is a
10714 simple identifier, referencing any predefined check name (other than
10715 @code{All_Checks}) or a check name introduced by pragma Check_Name. If
10716 no argument is given for the attribute, the check is for the general state
10717 of the check, if an argument is given, then it is an entity name, and the
10718 check indicates whether an @code{Suppress} or @code{Unsuppress} has been
10719 given naming the entity (if not, then the argument is ignored).
10721 Note that instantiations inherit the check status at the point of the
10722 instantiation, so a useful idiom is to have a library package that
10723 introduces a check name with @code{pragma Check_Name}, and then contains
10724 generic packages or subprograms which use the @code{Enabled} attribute
10725 to see if the check is enabled. A user of this package can then issue
10726 a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
10727 the package or subprogram, controlling whether the check will be present.
10729 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
10730 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{18a}
10731 @section Attribute Enum_Rep
10734 @geindex Representation of enums
10736 @geindex Enum_Rep
10738 Note that this attribute is now standard in Ada 202x and is available
10739 as an implementation defined attribute for earlier Ada versions.
10741 For every enumeration subtype @code{S}, @code{S'Enum_Rep} denotes a
10742 function with the following spec:
10744 @example
10745 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
10746 @end example
10748 It is also allowable to apply @code{Enum_Rep} directly to an object of an
10749 enumeration type or to a non-overloaded enumeration
10750 literal.  In this case @code{S'Enum_Rep} is equivalent to
10751 @code{typ'Enum_Rep(S)} where @code{typ} is the type of the
10752 enumeration literal or object.
10754 The function returns the representation value for the given enumeration
10755 value.  This will be equal to value of the @code{Pos} attribute in the
10756 absence of an enumeration representation clause.  This is a static
10757 attribute (i.e., the result is static if the argument is static).
10759 @code{S'Enum_Rep} can also be used with integer types and objects,
10760 in which case it simply returns the integer value.  The reason for this
10761 is to allow it to be used for @code{(<>)} discrete formal arguments in
10762 a generic unit that can be instantiated with either enumeration types
10763 or integer types.  Note that if @code{Enum_Rep} is used on a modular
10764 type whose upper bound exceeds the upper bound of the largest signed
10765 integer type, and the argument is a variable, so that the universal
10766 integer calculation is done at run time, then the call to @code{Enum_Rep}
10767 may raise @code{Constraint_Error}.
10769 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10770 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{18b}
10771 @section Attribute Enum_Val
10774 @geindex Representation of enums
10776 @geindex Enum_Val
10778 Note that this attribute is now standard in Ada 202x and is available
10779 as an implementation defined attribute for earlier Ada versions.
10781 For every enumeration subtype @code{S}, @code{S'Enum_Val} denotes a
10782 function with the following spec:
10784 @example
10785 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10786 @end example
10788 The function returns the enumeration value whose representation matches the
10789 argument, or raises Constraint_Error if no enumeration literal of the type
10790 has the matching value.
10791 This will be equal to value of the @code{Val} attribute in the
10792 absence of an enumeration representation clause.  This is a static
10793 attribute (i.e., the result is static if the argument is static).
10795 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10796 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{18c}
10797 @section Attribute Epsilon
10800 @geindex Ada 83 attributes
10802 @geindex Epsilon
10804 The @code{Epsilon} attribute is provided for compatibility with Ada 83.  See
10805 the Ada 83 reference manual for an exact description of the semantics of
10806 this attribute.
10808 @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
10809 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{18d}
10810 @section Attribute Fast_Math
10813 @geindex Fast_Math
10815 @code{Standard'Fast_Math} (@code{Standard} is the only allowed
10816 prefix) yields a static Boolean value that is True if pragma
10817 @code{Fast_Math} is active, and False otherwise.
10819 @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
10820 @anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{18e}
10821 @section Attribute Finalization_Size
10824 @geindex Finalization_Size
10826 The prefix of attribute @code{Finalization_Size} must be an object or
10827 a non-class-wide type. This attribute returns the size of any hidden data
10828 reserved by the compiler to handle finalization-related actions. The type of
10829 the attribute is `universal_integer'.
10831 @code{Finalization_Size} yields a value of zero for a type with no controlled
10832 parts, an object whose type has no controlled parts, or an object of a
10833 class-wide type whose tag denotes a type with no controlled parts.
10835 Note that only heap-allocated objects contain finalization data.
10837 @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
10838 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{18f}
10839 @section Attribute Fixed_Value
10842 @geindex Fixed_Value
10844 For every fixed-point type @code{S}, @code{S'Fixed_Value} denotes a
10845 function with the following specification:
10847 @example
10848 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10849 @end example
10851 The value returned is the fixed-point value @code{V} such that:
10853 @example
10854 V = Arg * S'Small
10855 @end example
10857 The effect is thus similar to first converting the argument to the
10858 integer type used to represent @code{S}, and then doing an unchecked
10859 conversion to the fixed-point type.  The difference is
10860 that there are full range checks, to ensure that the result is in range.
10861 This attribute is primarily intended for use in implementation of the
10862 input-output functions for fixed-point values.
10864 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10865 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{190}
10866 @section Attribute From_Any
10869 @geindex From_Any
10871 This internal attribute is used for the generation of remote subprogram
10872 stubs in the context of the Distributed Systems Annex.
10874 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10875 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{191}
10876 @section Attribute Has_Access_Values
10879 @geindex Access values
10880 @geindex testing for
10882 @geindex Has_Access_Values
10884 The prefix of the @code{Has_Access_Values} attribute is a type.  The result
10885 is a Boolean value which is True if the is an access type, or is a composite
10886 type with a component (at any nesting depth) that is an access type, and is
10887 False otherwise.
10888 The intended use of this attribute is in conjunction with generic
10889 definitions.  If the attribute is applied to a generic private type, it
10890 indicates whether or not the corresponding actual type has access values.
10892 @node Attribute Has_Discriminants,Attribute Has_Tagged_Values,Attribute Has_Access_Values,Implementation Defined Attributes
10893 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{192}
10894 @section Attribute Has_Discriminants
10897 @geindex Discriminants
10898 @geindex testing for
10900 @geindex Has_Discriminants
10902 The prefix of the @code{Has_Discriminants} attribute is a type.  The result
10903 is a Boolean value which is True if the type has discriminants, and False
10904 otherwise.  The intended use of this attribute is in conjunction with generic
10905 definitions.  If the attribute is applied to a generic private type, it
10906 indicates whether or not the corresponding actual type has discriminants.
10908 @node Attribute Has_Tagged_Values,Attribute Img,Attribute Has_Discriminants,Implementation Defined Attributes
10909 @anchor{gnat_rm/implementation_defined_attributes attribute-has-tagged-values}@anchor{193}
10910 @section Attribute Has_Tagged_Values
10913 @geindex Tagged values
10914 @geindex testing for
10916 @geindex Has_Tagged_Values
10918 The prefix of the @code{Has_Tagged_Values} attribute is a type. The result is a
10919 Boolean value which is True if the type is a composite type (array or record)
10920 that is either a tagged type or has a subcomponent that is tagged, and is False
10921 otherwise. The intended use of this attribute is in conjunction with generic
10922 definitions. If the attribute is applied to a generic private type, it
10923 indicates whether or not the corresponding actual type has access values.
10925 @node Attribute Img,Attribute Initialized,Attribute Has_Tagged_Values,Implementation Defined Attributes
10926 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{194}
10927 @section Attribute Img
10930 @geindex Img
10932 The @code{Img} attribute differs from @code{Image} in that, while both can be
10933 applied directly to an object, @code{Img} cannot be applied to types.
10935 Example usage of the attribute:
10937 @example
10938 Put_Line ("X = " & X'Img);
10939 @end example
10941 which has the same meaning as the more verbose:
10943 @example
10944 Put_Line ("X = " & T'Image (X));
10945 @end example
10947 where @code{T} is the (sub)type of the object @code{X}.
10949 Note that technically, in analogy to @code{Image},
10950 @code{X'Img} returns a parameterless function
10951 that returns the appropriate string when called. This means that
10952 @code{X'Img} can be renamed as a function-returning-string, or used
10953 in an instantiation as a function parameter.
10955 @node Attribute Initialized,Attribute Integer_Value,Attribute Img,Implementation Defined Attributes
10956 @anchor{gnat_rm/implementation_defined_attributes attribute-initialized}@anchor{195}
10957 @section Attribute Initialized
10960 @geindex Initialized
10962 For the syntax and semantics of this attribute, see the SPARK 2014 Reference
10963 Manual, section 6.10.
10965 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Initialized,Implementation Defined Attributes
10966 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{196}
10967 @section Attribute Integer_Value
10970 @geindex Integer_Value
10972 For every integer type @code{S}, @code{S'Integer_Value} denotes a
10973 function with the following spec:
10975 @example
10976 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10977 @end example
10979 The value returned is the integer value @code{V}, such that:
10981 @example
10982 Arg = V * T'Small
10983 @end example
10985 where @code{T} is the type of @code{Arg}.
10986 The effect is thus similar to first doing an unchecked conversion from
10987 the fixed-point type to its corresponding implementation type, and then
10988 converting the result to the target integer type.  The difference is
10989 that there are full range checks, to ensure that the result is in range.
10990 This attribute is primarily intended for use in implementation of the
10991 standard input-output functions for fixed-point values.
10993 @node Attribute Invalid_Value,Attribute Large,Attribute Integer_Value,Implementation Defined Attributes
10994 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{197}
10995 @section Attribute Invalid_Value
10998 @geindex Invalid_Value
11000 For every scalar type S, S’Invalid_Value returns an undefined value of the
11001 type. If possible this value is an invalid representation for the type. The
11002 value returned is identical to the value used to initialize an otherwise
11003 uninitialized value of the type if pragma Initialize_Scalars is used,
11004 including the ability to modify the value with the binder -Sxx flag and
11005 relevant environment variables at run time.
11007 @node Attribute Large,Attribute Library_Level,Attribute Invalid_Value,Implementation Defined Attributes
11008 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{198}
11009 @section Attribute Large
11012 @geindex Ada 83 attributes
11014 @geindex Large
11016 The @code{Large} attribute is provided for compatibility with Ada 83.  See
11017 the Ada 83 reference manual for an exact description of the semantics of
11018 this attribute.
11020 @node Attribute Library_Level,Attribute Loop_Entry,Attribute Large,Implementation Defined Attributes
11021 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{199}
11022 @section Attribute Library_Level
11025 @geindex Library_Level
11027 @code{P'Library_Level}, where P is an entity name,
11028 returns a Boolean value which is True if the entity is declared
11029 at the library level, and False otherwise. Note that within a
11030 generic instantiation, the name of the generic unit denotes the
11031 instance, which means that this attribute can be used to test
11032 if a generic is instantiated at the library level, as shown
11033 in this example:
11035 @example
11036 generic
11037   ...
11038 package Gen is
11039   pragma Compile_Time_Error
11040     (not Gen'Library_Level,
11041      "Gen can only be instantiated at library level");
11042   ...
11043 end Gen;
11044 @end example
11046 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Library_Level,Implementation Defined Attributes
11047 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{19a}
11048 @section Attribute Loop_Entry
11051 @geindex Loop_Entry
11053 Syntax:
11055 @example
11056 X'Loop_Entry [(loop_name)]
11057 @end example
11059 The @code{Loop_Entry} attribute is used to refer to the value that an
11060 expression had upon entry to a given loop in much the same way that the
11061 @code{Old} attribute in a subprogram postcondition can be used to refer
11062 to the value an expression had upon entry to the subprogram. The
11063 relevant loop is either identified by the given loop name, or it is the
11064 innermost enclosing loop when no loop name is given.
11066 A @code{Loop_Entry} attribute can only occur within an @code{Assert},
11067 @code{Assert_And_Cut}, @code{Assume}, @code{Loop_Variant} or @code{Loop_Invariant} pragma.
11068 In addition, such a pragma must be one of the items in the sequence
11069 of statements of a loop body, or nested inside block statements that
11070 appear in the sequence of statements of a loop body.
11071 A common use of @code{Loop_Entry} is to compare the current value of objects with
11072 their initial value at loop entry, in a @code{Loop_Invariant} pragma.
11074 The effect of using @code{X'Loop_Entry} is the same as declaring
11075 a constant initialized with the initial value of @code{X} at loop
11076 entry. This copy is not performed if the loop is not entered, or if the
11077 corresponding pragmas are ignored or disabled.
11079 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
11080 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{19b}
11081 @section Attribute Machine_Size
11084 @geindex Machine_Size
11086 This attribute is identical to the @code{Object_Size} attribute.  It is
11087 provided for compatibility with the DEC Ada 83 attribute of this name.
11089 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
11090 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{19c}
11091 @section Attribute Mantissa
11094 @geindex Ada 83 attributes
11096 @geindex Mantissa
11098 The @code{Mantissa} attribute is provided for compatibility with Ada 83.  See
11099 the Ada 83 reference manual for an exact description of the semantics of
11100 this attribute.
11102 @node Attribute Maximum_Alignment,Attribute Max_Integer_Size,Attribute Mantissa,Implementation Defined Attributes
11103 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{19d}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{19e}
11104 @section Attribute Maximum_Alignment
11107 @geindex Alignment
11108 @geindex maximum
11110 @geindex Maximum_Alignment
11112 @code{Standard'Maximum_Alignment} (@code{Standard} is the only
11113 allowed prefix) provides the maximum useful alignment value for the
11114 target.  This is a static value that can be used to specify the alignment
11115 for an object, guaranteeing that it is properly aligned in all
11116 cases.
11118 @node Attribute Max_Integer_Size,Attribute Mechanism_Code,Attribute Maximum_Alignment,Implementation Defined Attributes
11119 @anchor{gnat_rm/implementation_defined_attributes attribute-max-integer-size}@anchor{19f}
11120 @section Attribute Max_Integer_Size
11123 @geindex Max_Integer_Size
11125 @code{Standard'Max_Integer_Size} (@code{Standard} is the only allowed
11126 prefix) provides the size of the largest supported integer type for
11127 the target. The result is a static constant.
11129 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Max_Integer_Size,Implementation Defined Attributes
11130 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{1a0}
11131 @section Attribute Mechanism_Code
11134 @geindex Return values
11135 @geindex passing mechanism
11137 @geindex Parameters
11138 @geindex passing mechanism
11140 @geindex Mechanism_Code
11142 @code{func'Mechanism_Code} yields an integer code for the
11143 mechanism used for the result of function @code{func}, and
11144 @code{subprog'Mechanism_Code (n)} yields the mechanism
11145 used for formal parameter number `n' (a static integer value, with 1
11146 meaning the first parameter) of subprogram @code{subprog}.  The code returned is:
11149 @table @asis
11151 @item `1'
11153 by copy (value)
11155 @item `2'
11157 by reference
11158 @end table
11160 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
11161 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{1a1}
11162 @section Attribute Null_Parameter
11165 @geindex Zero address
11166 @geindex passing
11168 @geindex Null_Parameter
11170 A reference @code{T'Null_Parameter} denotes an imaginary object of
11171 type or subtype @code{T} allocated at machine address zero.  The attribute
11172 is allowed only as the default expression of a formal parameter, or as
11173 an actual expression of a subprogram call.  In either case, the
11174 subprogram must be imported.
11176 The identity of the object is represented by the address zero in the
11177 argument list, independent of the passing mechanism (explicit or
11178 default).
11180 This capability is needed to specify that a zero address should be
11181 passed for a record or other composite object passed by reference.
11182 There is no way of indicating this without the @code{Null_Parameter}
11183 attribute.
11185 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
11186 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{150}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{1a2}
11187 @section Attribute Object_Size
11190 @geindex Size
11191 @geindex used for objects
11193 @geindex Object_Size
11195 The size of an object is not necessarily the same as the size of the type
11196 of an object.  This is because by default object sizes are increased to be
11197 a multiple of the alignment of the object.  For example,
11198 @code{Natural'Size} is
11199 31, but by default objects of type @code{Natural} will have a size of 32 bits.
11200 Similarly, a record containing an integer and a character:
11202 @example
11203 type Rec is record
11204    I : Integer;
11205    C : Character;
11206 end record;
11207 @end example
11209 will have a size of 40 (that is @code{Rec'Size} will be 40).  The
11210 alignment will be 4, because of the
11211 integer field, and so the default size of record objects for this type
11212 will be 64 (8 bytes).
11214 If the alignment of the above record is specified to be 1, then the
11215 object size will be 40 (5 bytes). This is true by default, and also
11216 an object size of 40 can be explicitly specified in this case.
11218 A consequence of this capability is that different object sizes can be
11219 given to subtypes that would otherwise be considered in Ada to be
11220 statically matching.  But it makes no sense to consider such subtypes
11221 as statically matching.  Consequently, GNAT adds a rule
11222 to the static matching rules that requires object sizes to match.
11223 Consider this example:
11225 @example
11226  1. procedure BadAVConvert is
11227  2.    type R is new Integer;
11228  3.    subtype R1 is R range 1 .. 10;
11229  4.    subtype R2 is R range 1 .. 10;
11230  5.    for R1'Object_Size use 8;
11231  6.    for R2'Object_Size use 16;
11232  7.    type R1P is access all R1;
11233  8.    type R2P is access all R2;
11234  9.    R1PV : R1P := new R1'(4);
11235 10.    R2PV : R2P;
11236 11. begin
11237 12.    R2PV := R2P (R1PV);
11238                |
11239        >>> target designated subtype not compatible with
11240            type "R1" defined at line 3
11242 13. end;
11243 @end example
11245 In the absence of lines 5 and 6,
11246 types @code{R1} and @code{R2} statically match and
11247 hence the conversion on line 12 is legal. But since lines 5 and 6
11248 cause the object sizes to differ, GNAT considers that types
11249 @code{R1} and @code{R2} are not statically matching, and line 12
11250 generates the diagnostic shown above.
11252 Similar additional checks are performed in other contexts requiring
11253 statically matching subtypes.
11255 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
11256 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{1a3}
11257 @section Attribute Old
11260 @geindex Old
11262 In addition to the usage of @code{Old} defined in the Ada 2012 RM (usage
11263 within @code{Post} aspect), GNAT also permits the use of this attribute
11264 in implementation defined pragmas @code{Postcondition},
11265 @code{Contract_Cases} and @code{Test_Case}. Also usages of
11266 @code{Old} which would be illegal according to the Ada 2012 RM
11267 definition are allowed under control of
11268 implementation defined pragma @code{Unevaluated_Use_Of_Old}.
11270 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
11271 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{1a4}
11272 @section Attribute Passed_By_Reference
11275 @geindex Parameters
11276 @geindex when passed by reference
11278 @geindex Passed_By_Reference
11280 @code{typ'Passed_By_Reference} for any subtype @cite{typ} returns
11281 a value of type @code{Boolean} value that is @code{True} if the type is
11282 normally passed by reference and @code{False} if the type is normally
11283 passed by copy in calls.  For scalar types, the result is always @code{False}
11284 and is static.  For non-scalar types, the result is nonstatic.
11286 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
11287 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{1a5}
11288 @section Attribute Pool_Address
11291 @geindex Pool_Address
11293 @code{X'Pool_Address} for any object @code{X} returns the address
11294 of X within its storage pool. This is the same as
11295 @code{X'Address}, except that for an unconstrained array whose
11296 bounds are allocated just before the first component,
11297 @code{X'Pool_Address} returns the address of those bounds,
11298 whereas @code{X'Address} returns the address of the first
11299 component.
11301 Here, we are interpreting ‘storage pool’ broadly to mean
11302 @code{wherever the object is allocated}, which could be a
11303 user-defined storage pool,
11304 the global heap, on the stack, or in a static memory area.
11305 For an object created by @code{new}, @code{Ptr.all'Pool_Address} is
11306 what is passed to @code{Allocate} and returned from @code{Deallocate}.
11308 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
11309 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{1a6}
11310 @section Attribute Range_Length
11313 @geindex Range_Length
11315 @code{typ'Range_Length} for any discrete type @cite{typ} yields
11316 the number of values represented by the subtype (zero for a null
11317 range).  The result is static for static subtypes.  @code{Range_Length}
11318 applied to the index subtype of a one dimensional array always gives the
11319 same result as @code{Length} applied to the array itself.
11321 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
11322 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{1a7}
11323 @section Attribute Restriction_Set
11326 @geindex Restriction_Set
11328 @geindex Restrictions
11330 This attribute allows compile time testing of restrictions that
11331 are currently in effect. It is primarily intended for specializing
11332 code in the run-time based on restrictions that are active (e.g.
11333 don’t need to save fpt registers if restriction No_Floating_Point
11334 is known to be in effect), but can be used anywhere.
11336 There are two forms:
11338 @example
11339 System'Restriction_Set (partition_boolean_restriction_NAME)
11340 System'Restriction_Set (No_Dependence => library_unit_NAME);
11341 @end example
11343 In the case of the first form, the only restriction names
11344 allowed are parameterless restrictions that are checked
11345 for consistency at bind time. For a complete list see the
11346 subtype @code{System.Rident.Partition_Boolean_Restrictions}.
11348 The result returned is True if the restriction is known to
11349 be in effect, and False if the restriction is known not to
11350 be in effect. An important guarantee is that the value of
11351 a Restriction_Set attribute is known to be consistent throughout
11352 all the code of a partition.
11354 This is trivially achieved if the entire partition is compiled
11355 with a consistent set of restriction pragmas. However, the
11356 compilation model does not require this. It is possible to
11357 compile one set of units with one set of pragmas, and another
11358 set of units with another set of pragmas. It is even possible
11359 to compile a spec with one set of pragmas, and then WITH the
11360 same spec with a different set of pragmas. Inconsistencies
11361 in the actual use of the restriction are checked at bind time.
11363 In order to achieve the guarantee of consistency for the
11364 Restriction_Set pragma, we consider that a use of the pragma
11365 that yields False is equivalent to a violation of the
11366 restriction.
11368 So for example if you write
11370 @example
11371 if System'Restriction_Set (No_Floating_Point) then
11372    ...
11373 else
11374    ...
11375 end if;
11376 @end example
11378 And the result is False, so that the else branch is executed,
11379 you can assume that this restriction is not set for any unit
11380 in the partition. This is checked by considering this use of
11381 the restriction pragma to be a violation of the restriction
11382 No_Floating_Point. This means that no other unit can attempt
11383 to set this restriction (if some unit does attempt to set it,
11384 the binder will refuse to bind the partition).
11386 Technical note: The restriction name and the unit name are
11387 intepreted entirely syntactically, as in the corresponding
11388 Restrictions pragma, they are not analyzed semantically,
11389 so they do not have a type.
11391 @node Attribute Result,Attribute Round,Attribute Restriction_Set,Implementation Defined Attributes
11392 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{1a8}
11393 @section Attribute Result
11396 @geindex Result
11398 @code{function'Result} can only be used with in a Postcondition pragma
11399 for a function. The prefix must be the name of the corresponding function. This
11400 is used to refer to the result of the function in the postcondition expression.
11401 For a further discussion of the use of this attribute and examples of its use,
11402 see the description of pragma Postcondition.
11404 @node Attribute Round,Attribute Safe_Emax,Attribute Result,Implementation Defined Attributes
11405 @anchor{gnat_rm/implementation_defined_attributes attribute-round}@anchor{1a9}
11406 @section Attribute Round
11409 @geindex Round
11411 In addition to the usage of this attribute in the Ada RM, GNAT
11412 also permits the use of the @code{'Round} attribute for ordinary
11413 fixed point types.
11415 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Round,Implementation Defined Attributes
11416 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{1aa}
11417 @section Attribute Safe_Emax
11420 @geindex Ada 83 attributes
11422 @geindex Safe_Emax
11424 The @code{Safe_Emax} attribute is provided for compatibility with Ada 83.  See
11425 the Ada 83 reference manual for an exact description of the semantics of
11426 this attribute.
11428 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
11429 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{1ab}
11430 @section Attribute Safe_Large
11433 @geindex Ada 83 attributes
11435 @geindex Safe_Large
11437 The @code{Safe_Large} attribute is provided for compatibility with Ada 83.  See
11438 the Ada 83 reference manual for an exact description of the semantics of
11439 this attribute.
11441 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
11442 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{1ac}
11443 @section Attribute Safe_Small
11446 @geindex Ada 83 attributes
11448 @geindex Safe_Small
11450 The @code{Safe_Small} attribute is provided for compatibility with Ada 83.  See
11451 the Ada 83 reference manual for an exact description of the semantics of
11452 this attribute.
11454 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
11455 @anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{15d}@anchor{gnat_rm/implementation_defined_attributes id4}@anchor{1ad}
11456 @section Attribute Scalar_Storage_Order
11459 @geindex Endianness
11461 @geindex Scalar storage order
11463 @geindex Scalar_Storage_Order
11465 For every array or record type @code{S}, the representation attribute
11466 @code{Scalar_Storage_Order} denotes the order in which storage elements
11467 that make up scalar components are ordered within S. The value given must
11468 be a static expression of type System.Bit_Order. The following is an example
11469 of the use of this feature:
11471 @example
11472 --  Component type definitions
11474 subtype Yr_Type is Natural range 0 .. 127;
11475 subtype Mo_Type is Natural range 1 .. 12;
11476 subtype Da_Type is Natural range 1 .. 31;
11478 --  Record declaration
11480 type Date is record
11481    Years_Since_1980 : Yr_Type;
11482    Month            : Mo_Type;
11483    Day_Of_Month     : Da_Type;
11484 end record;
11486 --  Record representation clause
11488 for Date use record
11489    Years_Since_1980 at 0 range 0  ..  6;
11490    Month            at 0 range 7  .. 10;
11491    Day_Of_Month     at 0 range 11 .. 15;
11492 end record;
11494 --  Attribute definition clauses
11496 for Date'Bit_Order use System.High_Order_First;
11497 for Date'Scalar_Storage_Order use System.High_Order_First;
11498 --  If Scalar_Storage_Order is specified, it must be consistent with
11499 --  Bit_Order, so it's best to always define the latter explicitly if
11500 --  the former is used.
11501 @end example
11503 Other properties are as for the standard representation attribute @code{Bit_Order}
11504 defined by Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
11506 For a record type @code{T}, if @code{T'Scalar_Storage_Order} is
11507 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
11508 this means that if a @code{Scalar_Storage_Order} attribute definition
11509 clause is not confirming, then the type’s @code{Bit_Order} shall be
11510 specified explicitly and set to the same value.
11512 Derived types inherit an explicitly set scalar storage order from their parent
11513 types. This may be overridden for the derived type by giving an explicit scalar
11514 storage order for it. However, for a record extension, the derived type must
11515 have the same scalar storage order as the parent type.
11517 A component of a record type that is itself a record or an array and that does
11518 not start and end on a byte boundary must have have the same scalar storage
11519 order as the record type. A component of a bit-packed array type that is itself
11520 a record or an array must have the same scalar storage order as the array type.
11522 No component of a type that has an explicit @code{Scalar_Storage_Order}
11523 attribute definition may be aliased.
11525 A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
11526 with a value equal to @code{System.Default_Bit_Order}) has no effect.
11528 If the opposite storage order is specified, then whenever the value of
11529 a scalar component of an object of type @code{S} is read, the storage
11530 elements of the enclosing machine scalar are first reversed (before
11531 retrieving the component value, possibly applying some shift and mask
11532 operatings on the enclosing machine scalar), and the opposite operation
11533 is done for writes.
11535 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
11536 are relaxed. Instead, the following rules apply:
11539 @itemize *
11541 @item 
11542 the underlying storage elements are those at positions
11543 @code{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
11545 @item 
11546 the sequence of underlying storage elements shall have
11547 a size no greater than the largest machine scalar
11549 @item 
11550 the enclosing machine scalar is defined as the smallest machine
11551 scalar starting at a position no greater than
11552 @code{position + first_bit / storage_element_size} and covering
11553 storage elements at least up to @code{position + (last_bit + storage_element_size - 1) / storage_element_size}
11555 @item 
11556 the position of the component is interpreted relative to that machine
11557 scalar.
11558 @end itemize
11560 If no scalar storage order is specified for a type (either directly, or by
11561 inheritance in the case of a derived type), then the default is normally
11562 the native ordering of the target, but this default can be overridden using
11563 pragma @code{Default_Scalar_Storage_Order}.
11565 If a component of @code{T} is itself of a record or array type, the specfied
11566 @code{Scalar_Storage_Order} does `not' apply to that nested type: an explicit
11567 attribute definition clause must be provided for the component type as well
11568 if desired.
11570 Representation changes that explicitly or implicitly toggle the scalar storage
11571 order are not supported and may result in erroneous execution of the program,
11572 except when performed by means of an instance of @code{Ada.Unchecked_Conversion}.
11574 In particular, overlays are not supported and a warning is given for them:
11576 @example
11577 type Rec_LE is record
11578    I : Integer;
11579 end record;
11581 for Rec_LE use record
11582    I at 0 range 0 .. 31;
11583 end record;
11585 for Rec_LE'Bit_Order use System.Low_Order_First;
11586 for Rec_LE'Scalar_Storage_Order use System.Low_Order_First;
11588 type Rec_BE is record
11589    I : Integer;
11590 end record;
11592 for Rec_BE use record
11593    I at 0 range 0 .. 31;
11594 end record;
11596 for Rec_BE'Bit_Order use System.High_Order_First;
11597 for Rec_BE'Scalar_Storage_Order use System.High_Order_First;
11599 R_LE : Rec_LE;
11601 R_BE : Rec_BE;
11602 for R_BE'Address use R_LE'Address;
11603 @end example
11605 @code{warning: overlay changes scalar storage order [enabled by default]}
11607 In most cases, such representation changes ought to be replaced by an
11608 instantiation of a function or procedure provided by @code{GNAT.Byte_Swapping}.
11610 Note that the scalar storage order only affects the in-memory data
11611 representation. It has no effect on the representation used by stream
11612 attributes.
11614 Note that debuggers may be unable to display the correct value of scalar
11615 components of a type for which the opposite storage order is specified.
11617 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
11618 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{ed}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{1ae}
11619 @section Attribute Simple_Storage_Pool
11622 @geindex Storage pool
11623 @geindex simple
11625 @geindex Simple storage pool
11627 @geindex Simple_Storage_Pool
11629 For every nonformal, nonderived access-to-object type @code{Acc}, the
11630 representation attribute @code{Simple_Storage_Pool} may be specified
11631 via an attribute_definition_clause (or by specifying the equivalent aspect):
11633 @example
11634 My_Pool : My_Simple_Storage_Pool_Type;
11636 type Acc is access My_Data_Type;
11638 for Acc'Simple_Storage_Pool use My_Pool;
11639 @end example
11641 The name given in an attribute_definition_clause for the
11642 @code{Simple_Storage_Pool} attribute shall denote a variable of
11643 a ‘simple storage pool type’ (see pragma @cite{Simple_Storage_Pool_Type}).
11645 The use of this attribute is only allowed for a prefix denoting a type
11646 for which it has been specified. The type of the attribute is the type
11647 of the variable specified as the simple storage pool of the access type,
11648 and the attribute denotes that variable.
11650 It is illegal to specify both @code{Storage_Pool} and @code{Simple_Storage_Pool}
11651 for the same access type.
11653 If the @code{Simple_Storage_Pool} attribute has been specified for an access
11654 type, then applying the @code{Storage_Pool} attribute to the type is flagged
11655 with a warning and its evaluation raises the exception @code{Program_Error}.
11657 If the Simple_Storage_Pool attribute has been specified for an access
11658 type @code{S}, then the evaluation of the attribute @code{S'Storage_Size}
11659 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
11660 which is intended to indicate the number of storage elements reserved for
11661 the simple storage pool. If the Storage_Size function has not been defined
11662 for the simple storage pool type, then this attribute returns zero.
11664 If an access type @code{S} has a specified simple storage pool of type
11665 @code{SSP}, then the evaluation of an allocator for that access type calls
11666 the primitive @code{Allocate} procedure for type @code{SSP}, passing
11667 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
11668 semantics of such allocators is the same as those defined for allocators
11669 in section 13.11 of the @cite{Ada Reference Manual}, with the term
11670 `simple storage pool' substituted for `storage pool'.
11672 If an access type @code{S} has a specified simple storage pool of type
11673 @code{SSP}, then a call to an instance of the @code{Ada.Unchecked_Deallocation}
11674 for that access type invokes the primitive @code{Deallocate} procedure
11675 for type @code{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
11676 parameter. The detailed semantics of such unchecked deallocations is the same
11677 as defined in section 13.11.2 of the Ada Reference Manual, except that the
11678 term `simple storage pool' is substituted for `storage pool'.
11680 @node Attribute Small,Attribute Small_Denominator,Attribute Simple_Storage_Pool,Implementation Defined Attributes
11681 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{1af}
11682 @section Attribute Small
11685 @geindex Ada 83 attributes
11687 @geindex Small
11689 The @code{Small} attribute is defined in Ada 95 (and Ada 2005) only for
11690 fixed-point types.
11691 GNAT also allows this attribute to be applied to floating-point types
11692 for compatibility with Ada 83.  See
11693 the Ada 83 reference manual for an exact description of the semantics of
11694 this attribute when applied to floating-point types.
11696 @node Attribute Small_Denominator,Attribute Small_Numerator,Attribute Small,Implementation Defined Attributes
11697 @anchor{gnat_rm/implementation_defined_attributes attribute-small-denominator}@anchor{1b0}
11698 @section Attribute Small_Denominator
11701 @geindex Small
11703 @geindex Small_Denominator
11705 @code{typ'Small_Denominator} for any fixed-point subtype @cite{typ} yields the
11706 denominator in the representation of @code{typ'Small} as a rational number
11707 with coprime factors (i.e. as an irreducible fraction).
11709 @node Attribute Small_Numerator,Attribute Storage_Unit,Attribute Small_Denominator,Implementation Defined Attributes
11710 @anchor{gnat_rm/implementation_defined_attributes attribute-small-numerator}@anchor{1b1}
11711 @section Attribute Small_Numerator
11714 @geindex Small
11716 @geindex Small_Numerator
11718 @code{typ'Small_Numerator} for any fixed-point subtype @cite{typ} yields the
11719 numerator in the representation of @code{typ'Small} as a rational number
11720 with coprime factors (i.e. as an irreducible fraction).
11722 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small_Numerator,Implementation Defined Attributes
11723 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{1b2}
11724 @section Attribute Storage_Unit
11727 @geindex Storage_Unit
11729 @code{Standard'Storage_Unit} (@code{Standard} is the only allowed
11730 prefix) provides the same value as @code{System.Storage_Unit}.
11732 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
11733 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{1b3}
11734 @section Attribute Stub_Type
11737 @geindex Stub_Type
11739 The GNAT implementation of remote access-to-classwide types is
11740 organized as described in AARM section E.4 (20.t): a value of an RACW type
11741 (designating a remote object) is represented as a normal access
11742 value, pointing to a “stub” object which in turn contains the
11743 necessary information to contact the designated remote object. A
11744 call on any dispatching operation of such a stub object does the
11745 remote call, if necessary, using the information in the stub object
11746 to locate the target partition, etc.
11748 For a prefix @code{T} that denotes a remote access-to-classwide type,
11749 @code{T'Stub_Type} denotes the type of the corresponding stub objects.
11751 By construction, the layout of @code{T'Stub_Type} is identical to that of
11752 type @code{RACW_Stub_Type} declared in the internal implementation-defined
11753 unit @code{System.Partition_Interface}. Use of this attribute will create
11754 an implicit dependency on this unit.
11756 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
11757 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{1b4}
11758 @section Attribute System_Allocator_Alignment
11761 @geindex Alignment
11762 @geindex allocator
11764 @geindex System_Allocator_Alignment
11766 @code{Standard'System_Allocator_Alignment} (@code{Standard} is the only
11767 allowed prefix) provides the observable guaranteed to be honored by
11768 the system allocator (malloc). This is a static value that can be used
11769 in user storage pools based on malloc either to reject allocation
11770 with alignment too large or to enable a realignment circuitry if the
11771 alignment request is larger than this value.
11773 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
11774 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{1b5}
11775 @section Attribute Target_Name
11778 @geindex Target_Name
11780 @code{Standard'Target_Name} (@code{Standard} is the only allowed
11781 prefix) provides a static string value that identifies the target
11782 for the current compilation. For GCC implementations, this is the
11783 standard gcc target name without the terminating slash (for
11784 example, GNAT 5.0 on windows yields “i586-pc-mingw32msv”).
11786 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
11787 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{1b6}
11788 @section Attribute To_Address
11791 @geindex To_Address
11793 The @code{System'To_Address}
11794 (@code{System} is the only allowed prefix)
11795 denotes a function identical to
11796 @code{System.Storage_Elements.To_Address} except that
11797 it is a static attribute.  This means that if its argument is
11798 a static expression, then the result of the attribute is a
11799 static expression.  This means that such an expression can be
11800 used in contexts (e.g., preelaborable packages) which require a
11801 static expression and where the function call could not be used
11802 (since the function call is always nonstatic, even if its
11803 argument is static). The argument must be in the range
11804 -(2**(m-1)) .. 2**m-1, where m is the memory size
11805 (typically 32 or 64). Negative values are intepreted in a
11806 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
11807 a 32 bits machine).
11809 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
11810 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{1b7}
11811 @section Attribute To_Any
11814 @geindex To_Any
11816 This internal attribute is used for the generation of remote subprogram
11817 stubs in the context of the Distributed Systems Annex.
11819 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
11820 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1b8}
11821 @section Attribute Type_Class
11824 @geindex Type_Class
11826 @code{typ'Type_Class} for any type or subtype @cite{typ} yields
11827 the value of the type class for the full type of @cite{typ}.  If
11828 @cite{typ} is a generic formal type, the value is the value for the
11829 corresponding actual subtype.  The value of this attribute is of type
11830 @code{System.Aux_DEC.Type_Class}, which has the following definition:
11832 @example
11833 type Type_Class is
11834   (Type_Class_Enumeration,
11835    Type_Class_Integer,
11836    Type_Class_Fixed_Point,
11837    Type_Class_Floating_Point,
11838    Type_Class_Array,
11839    Type_Class_Record,
11840    Type_Class_Access,
11841    Type_Class_Task,
11842    Type_Class_Address);
11843 @end example
11845 Protected types yield the value @code{Type_Class_Task}, which thus
11846 applies to all concurrent types.  This attribute is designed to
11847 be compatible with the DEC Ada 83 attribute of the same name.
11849 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
11850 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1b9}
11851 @section Attribute Type_Key
11854 @geindex Type_Key
11856 The @code{Type_Key} attribute is applicable to a type or subtype and
11857 yields a value of type Standard.String containing encoded information
11858 about the type or subtype. This provides improved compatibility with
11859 other implementations that support this attribute.
11861 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
11862 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1ba}
11863 @section Attribute TypeCode
11866 @geindex TypeCode
11868 This internal attribute is used for the generation of remote subprogram
11869 stubs in the context of the Distributed Systems Annex.
11871 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
11872 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1bb}
11873 @section Attribute Unconstrained_Array
11876 @geindex Unconstrained_Array
11878 The @code{Unconstrained_Array} attribute can be used with a prefix that
11879 denotes any type or subtype. It is a static attribute that yields
11880 @code{True} if the prefix designates an unconstrained array,
11881 and @code{False} otherwise. In a generic instance, the result is
11882 still static, and yields the result of applying this test to the
11883 generic actual.
11885 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
11886 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1bc}
11887 @section Attribute Universal_Literal_String
11890 @geindex Named numbers
11891 @geindex representation of
11893 @geindex Universal_Literal_String
11895 The prefix of @code{Universal_Literal_String} must be a named
11896 number.  The static result is the string consisting of the characters of
11897 the number as defined in the original source.  This allows the user
11898 program to access the actual text of named numbers without intermediate
11899 conversions and without the need to enclose the strings in quotes (which
11900 would preclude their use as numbers).
11902 For example, the following program prints the first 50 digits of pi:
11904 @example
11905 with Text_IO; use Text_IO;
11906 with Ada.Numerics;
11907 procedure Pi is
11908 begin
11909    Put (Ada.Numerics.Pi'Universal_Literal_String);
11910 end;
11911 @end example
11913 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11914 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1bd}
11915 @section Attribute Unrestricted_Access
11918 @geindex Access
11919 @geindex unrestricted
11921 @geindex Unrestricted_Access
11923 The @code{Unrestricted_Access} attribute is similar to @code{Access}
11924 except that all accessibility and aliased view checks are omitted.  This
11925 is a user-beware attribute.
11927 For objects, it is similar to @code{Address}, for which it is a
11928 desirable replacement where the value desired is an access type.
11929 In other words, its effect is similar to first applying the
11930 @code{Address} attribute and then doing an unchecked conversion to a
11931 desired access type.
11933 For subprograms, @code{P'Unrestricted_Access} may be used where
11934 @code{P'Access} would be illegal, to construct a value of a
11935 less-nested named access type that designates a more-nested
11936 subprogram. This value may be used in indirect calls, so long as the
11937 more-nested subprogram still exists; once the subprogram containing it
11938 has returned, such calls are erroneous. For example:
11940 @example
11941 package body P is
11943    type Less_Nested is not null access procedure;
11944    Global : Less_Nested;
11946    procedure P1 is
11947    begin
11948       Global.all;
11949    end P1;
11951    procedure P2 is
11952       Local_Var : Integer;
11954       procedure More_Nested is
11955       begin
11956          ... Local_Var ...
11957       end More_Nested;
11958    begin
11959       Global := More_Nested'Unrestricted_Access;
11960       P1;
11961    end P2;
11963 end P;
11964 @end example
11966 When P1 is called from P2, the call via Global is OK, but if P1 were
11967 called after P2 returns, it would be an erroneous use of a dangling
11968 pointer.
11970 For objects, it is possible to use @code{Unrestricted_Access} for any
11971 type. However, if the result is of an access-to-unconstrained array
11972 subtype, then the resulting pointer has the same scope as the context
11973 of the attribute, and must not be returned to some enclosing scope.
11974 For instance, if a function uses @code{Unrestricted_Access} to create
11975 an access-to-unconstrained-array and returns that value to the caller,
11976 the result will involve dangling pointers. In addition, it is only
11977 valid to create pointers to unconstrained arrays using this attribute
11978 if the pointer has the normal default ‘fat’ representation where a
11979 pointer has two components, one points to the array and one points to
11980 the bounds. If a size clause is used to force ‘thin’ representation
11981 for a pointer to unconstrained where there is only space for a single
11982 pointer, then the resulting pointer is not usable.
11984 In the simple case where a direct use of Unrestricted_Access attempts
11985 to make a thin pointer for a non-aliased object, the compiler will
11986 reject the use as illegal, as shown in the following example:
11988 @example
11989 with System; use System;
11990 procedure SliceUA2 is
11991    type A is access all String;
11992    for A'Size use Standard'Address_Size;
11994    procedure P (Arg : A) is
11995    begin
11996       null;
11997    end P;
11999    X : String := "hello world!";
12000    X2 : aliased String := "hello world!";
12002    AV : A := X'Unrestricted_Access;    -- ERROR
12003              |
12004 >>> illegal use of Unrestricted_Access attribute
12005 >>> attempt to generate thin pointer to unaliased object
12007 begin
12008    P (X'Unrestricted_Access);          -- ERROR
12009       |
12010 >>> illegal use of Unrestricted_Access attribute
12011 >>> attempt to generate thin pointer to unaliased object
12013    P (X(7 .. 12)'Unrestricted_Access); -- ERROR
12014       |
12015 >>> illegal use of Unrestricted_Access attribute
12016 >>> attempt to generate thin pointer to unaliased object
12018    P (X2'Unrestricted_Access);         -- OK
12019 end;
12020 @end example
12022 but other cases cannot be detected by the compiler, and are
12023 considered to be erroneous. Consider the following example:
12025 @example
12026 with System; use System;
12027 with System; use System;
12028 procedure SliceUA is
12029    type AF is access all String;
12031    type A is access all String;
12032    for A'Size use Standard'Address_Size;
12034    procedure P (Arg : A) is
12035    begin
12036       if Arg'Length /= 6 then
12037          raise Program_Error;
12038       end if;
12039    end P;
12041    X : String := "hello world!";
12042    Y : AF := X (7 .. 12)'Unrestricted_Access;
12044 begin
12045    P (A (Y));
12046 end;
12047 @end example
12049 A normal unconstrained array value
12050 or a constrained array object marked as aliased has the bounds in memory
12051 just before the array, so a thin pointer can retrieve both the data and
12052 the bounds.  But in this case, the non-aliased object @code{X} does not have the
12053 bounds before the string.  If the size clause for type @code{A}
12054 were not present, then the pointer
12055 would be a fat pointer, where one component is a pointer to the bounds,
12056 and all would be well.  But with the size clause present, the conversion from
12057 fat pointer to thin pointer in the call loses the bounds, and so this
12058 is erroneous, and the program likely raises a @code{Program_Error} exception.
12060 In general, it is advisable to completely
12061 avoid mixing the use of thin pointers and the use of
12062 @code{Unrestricted_Access} where the designated type is an
12063 unconstrained array.  The use of thin pointers should be restricted to
12064 cases of porting legacy code that implicitly assumes the size of pointers,
12065 and such code should not in any case be using this attribute.
12067 Another erroneous situation arises if the attribute is
12068 applied to a constant. The resulting pointer can be used to access the
12069 constant, but the effect of trying to modify a constant in this manner
12070 is not well-defined. Consider this example:
12072 @example
12073 P : constant Integer := 4;
12074 type R is access all Integer;
12075 RV : R := P'Unrestricted_Access;
12077 RV.all := 3;
12078 @end example
12080 Here we attempt to modify the constant P from 4 to 3, but the compiler may
12081 or may not notice this attempt, and subsequent references to P may yield
12082 either the value 3 or the value 4 or the assignment may blow up if the
12083 compiler decides to put P in read-only memory. One particular case where
12084 @code{Unrestricted_Access} can be used in this way is to modify the
12085 value of an @code{in} parameter:
12087 @example
12088 procedure K (S : in String) is
12089    type R is access all Character;
12090    RV : R := S (3)'Unrestricted_Access;
12091 begin
12092    RV.all := 'a';
12093 end;
12094 @end example
12096 In general this is a risky approach. It may appear to “work” but such uses of
12097 @code{Unrestricted_Access} are potentially non-portable, even from one version
12098 of GNAT to another, so are best avoided if possible.
12100 @node Attribute Update,Attribute Valid_Value,Attribute Unrestricted_Access,Implementation Defined Attributes
12101 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1be}
12102 @section Attribute Update
12105 @geindex Update
12107 The @code{Update} attribute creates a copy of an array or record value
12108 with one or more modified components. The syntax is:
12110 @example
12111 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
12112 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
12113 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
12114                 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
12116 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
12117 INDEX_EXPRESSION_LIST_LIST                   ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
12118 INDEX_EXPRESSION_LIST                        ::= ( EXPRESSION @{, EXPRESSION @} )
12119 @end example
12121 where @code{PREFIX} is the name of an array or record object, the
12122 association list in parentheses does not contain an @code{others}
12123 choice and the box symbol @code{<>} may not appear in any
12124 expression. The effect is to yield a copy of the array or record value
12125 which is unchanged apart from the components mentioned in the
12126 association list, which are changed to the indicated value. The
12127 original value of the array or record value is not affected. For
12128 example:
12130 @example
12131 type Arr is Array (1 .. 5) of Integer;
12133 Avar1 : Arr := (1,2,3,4,5);
12134 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
12135 @end example
12137 yields a value for @code{Avar2} of 1,10,20,20,5 with @code{Avar1}
12138 begin unmodified. Similarly:
12140 @example
12141 type Rec is A, B, C : Integer;
12143 Rvar1 : Rec := (A => 1, B => 2, C => 3);
12144 Rvar2 : Rec := Rvar1'Update (B => 20);
12145 @end example
12147 yields a value for @code{Rvar2} of (A => 1, B => 20, C => 3),
12148 with @code{Rvar1} being unmodifed.
12149 Note that the value of the attribute reference is computed
12150 completely before it is used. This means that if you write:
12152 @example
12153 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
12154 @end example
12156 then the value of @code{Avar1} is not modified if @code{Function_Call}
12157 raises an exception, unlike the effect of a series of direct assignments
12158 to elements of @code{Avar1}. In general this requires that
12159 two extra complete copies of the object are required, which should be
12160 kept in mind when considering efficiency.
12162 The @code{Update} attribute cannot be applied to prefixes of a limited
12163 type, and cannot reference discriminants in the case of a record type.
12164 The accessibility level of an Update attribute result object is defined
12165 as for an aggregate.
12167 In the record case, no component can be mentioned more than once. In
12168 the array case, two overlapping ranges can appear in the association list,
12169 in which case the modifications are processed left to right.
12171 Multi-dimensional arrays can be modified, as shown by this example:
12173 @example
12174 A : array (1 .. 10, 1 .. 10) of Integer;
12176 A := A'Update ((1, 2) => 20, (3, 4) => 30);
12177 @end example
12179 which changes element (1,2) to 20 and (3,4) to 30.
12181 @node Attribute Valid_Value,Attribute Valid_Scalars,Attribute Update,Implementation Defined Attributes
12182 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-value}@anchor{1bf}
12183 @section Attribute Valid_Value
12186 @geindex Valid_Value
12188 The @code{'Valid_Value} attribute is defined for enumeration types other than
12189 those in package Standard. This attribute is a function that takes
12190 a String, and returns Boolean. @code{T'Valid_Value (S)} returns True
12191 if and only if @code{T'Value (S)} would not raise Constraint_Error.
12193 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Valid_Value,Implementation Defined Attributes
12194 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1c0}
12195 @section Attribute Valid_Scalars
12198 @geindex Valid_Scalars
12200 The @code{'Valid_Scalars} attribute is intended to make it easier to check the
12201 validity of scalar subcomponents of composite objects. The attribute is defined
12202 for any prefix @code{P} which denotes an object. Prefix @code{P} can be any type
12203 except for tagged private or @code{Unchecked_Union} types. The value of the
12204 attribute is of type @code{Boolean}.
12206 @code{P'Valid_Scalars} yields @code{True} if and only if the evaluation of
12207 @code{C'Valid} yields @code{True} for every scalar subcomponent @code{C} of @code{P}, or if
12208 @code{P} has no scalar subcomponents. Attribute @code{'Valid_Scalars} is equivalent
12209 to attribute @code{'Valid} for scalar types.
12211 It is not specified in what order the subcomponents are checked, nor whether
12212 any more are checked after any one of them is determined to be invalid. If the
12213 prefix @code{P} is of a class-wide type @code{T'Class} (where @code{T} is the associated
12214 specific type), or if the prefix @code{P} is of a specific tagged type @code{T}, then
12215 only the subcomponents of @code{T} are checked; in other words, components of
12216 extensions of @code{T} are not checked even if @code{T'Class (P)'Tag /= T'Tag}.
12218 The compiler will issue a warning if it can be determined at compile time that
12219 the prefix of the attribute has no scalar subcomponents.
12221 Note: @code{Valid_Scalars} can generate a lot of code, especially in the case of
12222 a large variant record. If the attribute is called in many places in the same
12223 program applied to objects of the same type, it can reduce program size to
12224 write a function with a single use of the attribute, and then call that
12225 function from multiple places.
12227 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
12228 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1c1}
12229 @section Attribute VADS_Size
12232 @geindex Size
12233 @geindex VADS compatibility
12235 @geindex VADS_Size
12237 The @code{'VADS_Size} attribute is intended to make it easier to port
12238 legacy code which relies on the semantics of @code{'Size} as implemented
12239 by the VADS Ada 83 compiler.  GNAT makes a best effort at duplicating the
12240 same semantic interpretation.  In particular, @code{'VADS_Size} applied
12241 to a predefined or other primitive type with no Size clause yields the
12242 Object_Size (for example, @code{Natural'Size} is 32 rather than 31 on
12243 typical machines).  In addition @code{'VADS_Size} applied to an object
12244 gives the result that would be obtained by applying the attribute to
12245 the corresponding type.
12247 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
12248 @anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{16f}@anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1c2}
12249 @section Attribute Value_Size
12252 @geindex Size
12253 @geindex setting for not-first subtype
12255 @geindex Value_Size
12257 @code{type'Value_Size} is the number of bits required to represent
12258 a value of the given subtype.  It is the same as @code{type'Size},
12259 but, unlike @code{Size}, may be set for non-first subtypes.
12261 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
12262 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1c3}
12263 @section Attribute Wchar_T_Size
12266 @geindex Wchar_T_Size
12268 @code{Standard'Wchar_T_Size} (@code{Standard} is the only allowed
12269 prefix) provides the size in bits of the C @code{wchar_t} type
12270 primarily for constructing the definition of this type in
12271 package @code{Interfaces.C}. The result is a static constant.
12273 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
12274 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1c4}
12275 @section Attribute Word_Size
12278 @geindex Word_Size
12280 @code{Standard'Word_Size} (@code{Standard} is the only allowed
12281 prefix) provides the value @code{System.Word_Size}. The result is
12282 a static constant.
12284 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
12285 @anchor{gnat_rm/standard_and_implementation_defined_restrictions doc}@anchor{1c5}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1c6}@anchor{gnat_rm/standard_and_implementation_defined_restrictions standard-and-implementation-defined-restrictions}@anchor{9}
12286 @chapter Standard and Implementation Defined Restrictions
12289 All Ada Reference Manual-defined Restriction identifiers are implemented:
12292 @itemize *
12294 @item 
12295 language-defined restrictions (see 13.12.1)
12297 @item 
12298 tasking restrictions (see D.7)
12300 @item 
12301 high integrity restrictions (see H.4)
12302 @end itemize
12304 GNAT implements additional restriction identifiers. All restrictions, whether
12305 language defined or GNAT-specific, are listed in the following.
12307 @menu
12308 * Partition-Wide Restrictions:: 
12309 * Program Unit Level Restrictions:: 
12311 @end menu
12313 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
12314 @anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1c7}@anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1c8}
12315 @section Partition-Wide Restrictions
12318 There are two separate lists of restriction identifiers. The first
12319 set requires consistency throughout a partition (in other words, if the
12320 restriction identifier is used for any compilation unit in the partition,
12321 then all compilation units in the partition must obey the restriction).
12323 @menu
12324 * Immediate_Reclamation:: 
12325 * Max_Asynchronous_Select_Nesting:: 
12326 * Max_Entry_Queue_Length:: 
12327 * Max_Protected_Entries:: 
12328 * Max_Select_Alternatives:: 
12329 * Max_Storage_At_Blocking:: 
12330 * Max_Task_Entries:: 
12331 * Max_Tasks:: 
12332 * No_Abort_Statements:: 
12333 * No_Access_Parameter_Allocators:: 
12334 * No_Access_Subprograms:: 
12335 * No_Allocators:: 
12336 * No_Anonymous_Allocators:: 
12337 * No_Asynchronous_Control:: 
12338 * No_Calendar:: 
12339 * No_Coextensions:: 
12340 * No_Default_Initialization:: 
12341 * No_Delay:: 
12342 * No_Dependence:: 
12343 * No_Direct_Boolean_Operators:: 
12344 * No_Dispatch:: 
12345 * No_Dispatching_Calls:: 
12346 * No_Dynamic_Attachment:: 
12347 * No_Dynamic_Priorities:: 
12348 * No_Entry_Calls_In_Elaboration_Code:: 
12349 * No_Enumeration_Maps:: 
12350 * No_Exception_Handlers:: 
12351 * No_Exception_Propagation:: 
12352 * No_Exception_Registration:: 
12353 * No_Exceptions:: 
12354 * No_Finalization:: 
12355 * No_Fixed_Point:: 
12356 * No_Floating_Point:: 
12357 * No_Implicit_Conditionals:: 
12358 * No_Implicit_Dynamic_Code:: 
12359 * No_Implicit_Heap_Allocations:: 
12360 * No_Implicit_Protected_Object_Allocations:: 
12361 * No_Implicit_Task_Allocations:: 
12362 * No_Initialize_Scalars:: 
12363 * No_IO:: 
12364 * No_Local_Allocators:: 
12365 * No_Local_Protected_Objects:: 
12366 * No_Local_Tagged_Types:: 
12367 * No_Local_Timing_Events:: 
12368 * No_Long_Long_Integers:: 
12369 * No_Multiple_Elaboration:: 
12370 * No_Nested_Finalization:: 
12371 * No_Protected_Type_Allocators:: 
12372 * No_Protected_Types:: 
12373 * No_Recursion:: 
12374 * No_Reentrancy:: 
12375 * No_Relative_Delay:: 
12376 * No_Requeue_Statements:: 
12377 * No_Secondary_Stack:: 
12378 * No_Select_Statements:: 
12379 * No_Specific_Termination_Handlers:: 
12380 * No_Specification_of_Aspect:: 
12381 * No_Standard_Allocators_After_Elaboration:: 
12382 * No_Standard_Storage_Pools:: 
12383 * No_Stream_Optimizations:: 
12384 * No_Streams:: 
12385 * No_Tagged_Type_Registration:: 
12386 * No_Task_Allocators:: 
12387 * No_Task_At_Interrupt_Priority:: 
12388 * No_Task_Attributes_Package:: 
12389 * No_Task_Hierarchy:: 
12390 * No_Task_Termination:: 
12391 * No_Tasking:: 
12392 * No_Terminate_Alternatives:: 
12393 * No_Unchecked_Access:: 
12394 * No_Unchecked_Conversion:: 
12395 * No_Unchecked_Deallocation:: 
12396 * No_Use_Of_Attribute:: 
12397 * No_Use_Of_Entity:: 
12398 * No_Use_Of_Pragma:: 
12399 * Pure_Barriers:: 
12400 * Simple_Barriers:: 
12401 * Static_Priorities:: 
12402 * Static_Storage_Size:: 
12404 @end menu
12406 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
12407 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1c9}
12408 @subsection Immediate_Reclamation
12411 @geindex Immediate_Reclamation
12413 [RM H.4] This restriction ensures that, except for storage occupied by
12414 objects created by allocators and not deallocated via unchecked
12415 deallocation, any storage reserved at run time for an object is
12416 immediately reclaimed when the object no longer exists.
12418 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
12419 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1ca}
12420 @subsection Max_Asynchronous_Select_Nesting
12423 @geindex Max_Asynchronous_Select_Nesting
12425 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
12426 selects. Violations of this restriction with a value of zero are
12427 detected at compile time. Violations of this restriction with values
12428 other than zero cause Storage_Error to be raised.
12430 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
12431 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1cb}
12432 @subsection Max_Entry_Queue_Length
12435 @geindex Max_Entry_Queue_Length
12437 [RM D.7] This restriction is a declaration that any protected entry compiled in
12438 the scope of the restriction has at most the specified number of
12439 tasks waiting on the entry at any one time, and so no queue is required.
12440 Note that this restriction is checked at run time. Violation of this
12441 restriction results in the raising of Program_Error exception at the point of
12442 the call.
12444 @geindex Max_Entry_Queue_Depth
12446 The restriction @code{Max_Entry_Queue_Depth} is recognized as a
12447 synonym for @code{Max_Entry_Queue_Length}. This is retained for historical
12448 compatibility purposes (and a warning will be generated for its use if
12449 warnings on obsolescent features are activated).
12451 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
12452 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1cc}
12453 @subsection Max_Protected_Entries
12456 @geindex Max_Protected_Entries
12458 [RM D.7] Specifies the maximum number of entries per protected type. The
12459 bounds of every entry family of a protected unit shall be static, or shall be
12460 defined by a discriminant of a subtype whose corresponding bound is static.
12462 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
12463 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1cd}
12464 @subsection Max_Select_Alternatives
12467 @geindex Max_Select_Alternatives
12469 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
12471 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
12472 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1ce}
12473 @subsection Max_Storage_At_Blocking
12476 @geindex Max_Storage_At_Blocking
12478 [RM D.7] Specifies the maximum portion (in storage elements) of a task’s
12479 Storage_Size that can be retained by a blocked task. A violation of this
12480 restriction causes Storage_Error to be raised.
12482 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
12483 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1cf}
12484 @subsection Max_Task_Entries
12487 @geindex Max_Task_Entries
12489 [RM D.7] Specifies the maximum number of entries
12490 per task.  The bounds of every entry family
12491 of a task unit shall be static, or shall be
12492 defined by a discriminant of a subtype whose
12493 corresponding bound is static.
12495 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
12496 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1d0}
12497 @subsection Max_Tasks
12500 @geindex Max_Tasks
12502 [RM D.7] Specifies the maximum number of task that may be created, not
12503 counting the creation of the environment task.  Violations of this
12504 restriction with a value of zero are detected at compile
12505 time. Violations of this restriction with values other than zero cause
12506 Storage_Error to be raised.
12508 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
12509 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1d1}
12510 @subsection No_Abort_Statements
12513 @geindex No_Abort_Statements
12515 [RM D.7] There are no abort_statements, and there are
12516 no calls to Task_Identification.Abort_Task.
12518 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
12519 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1d2}
12520 @subsection No_Access_Parameter_Allocators
12523 @geindex No_Access_Parameter_Allocators
12525 [RM H.4] This restriction ensures at compile time that there are no
12526 occurrences of an allocator as the actual parameter to an access
12527 parameter.
12529 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
12530 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1d3}
12531 @subsection No_Access_Subprograms
12534 @geindex No_Access_Subprograms
12536 [RM H.4] This restriction ensures at compile time that there are no
12537 declarations of access-to-subprogram types.
12539 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
12540 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1d4}
12541 @subsection No_Allocators
12544 @geindex No_Allocators
12546 [RM H.4] This restriction ensures at compile time that there are no
12547 occurrences of an allocator.
12549 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
12550 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1d5}
12551 @subsection No_Anonymous_Allocators
12554 @geindex No_Anonymous_Allocators
12556 [RM H.4] This restriction ensures at compile time that there are no
12557 occurrences of an allocator of anonymous access type.
12559 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
12560 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1d6}
12561 @subsection No_Asynchronous_Control
12564 @geindex No_Asynchronous_Control
12566 [RM J.13] This restriction ensures at compile time that there are no semantic
12567 dependences on the predefined package Asynchronous_Task_Control.
12569 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
12570 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1d7}
12571 @subsection No_Calendar
12574 @geindex No_Calendar
12576 [GNAT] This restriction ensures at compile time that there are no semantic
12577 dependences on package Calendar.
12579 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
12580 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1d8}
12581 @subsection No_Coextensions
12584 @geindex No_Coextensions
12586 [RM H.4] This restriction ensures at compile time that there are no
12587 coextensions. See 3.10.2.
12589 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
12590 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1d9}
12591 @subsection No_Default_Initialization
12594 @geindex No_Default_Initialization
12596 [GNAT] This restriction prohibits any instance of default initialization
12597 of variables or components. The binder implements a consistency check that
12598 prevents any unit without the restriction from with’ing a unit with the
12599 restriction (this allows the generation of initialization procedures to
12600 be skipped, since you can be sure that no call is ever generated to an
12601 initialization procedure in a unit with the restriction active). If used
12602 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
12603 is to prohibit all cases of variables declared without a specific
12604 initializer (including the case of OUT scalar parameters).
12606 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
12607 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1da}
12608 @subsection No_Delay
12611 @geindex No_Delay
12613 [RM H.4] This restriction ensures at compile time that there are no
12614 delay statements and no semantic dependences on package Calendar.
12616 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
12617 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1db}
12618 @subsection No_Dependence
12621 @geindex No_Dependence
12623 [RM 13.12.1] This restriction ensures at compile time that there are no
12624 dependences on a library unit. For GNAT, this includes implicit implementation
12625 dependences on units of the runtime library that are created by the compiler
12626 to support specific constructs of the language. Here are some examples:
12629 @itemize *
12631 @item 
12632 @code{System.Arith_64}: 64-bit arithmetics for 32-bit platforms,
12634 @item 
12635 @code{System.Arith_128}: 128-bit arithmetics for 64-bit platforms,
12637 @item 
12638 @code{System.Memory}: heap memory allocation routines,
12640 @item 
12641 @code{System.Memory_Compare}: memory comparison routine (aka @code{memcmp} for C),
12643 @item 
12644 @code{System.Memory_Copy}: memory copy routine (aka @code{memcpy} for C),
12646 @item 
12647 @code{System.Memory_Move}: memoy move routine (aka @code{memmove} for C),
12649 @item 
12650 @code{System.Memory_Set}: memory set routine (aka @code{memset} for C),
12652 @item 
12653 @code{System.Stack_Checking[.Operations]}: stack checking without MMU,
12655 @item 
12656 @code{System.GCC}: support routines from the GCC library.
12657 @end itemize
12659 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
12660 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1dc}
12661 @subsection No_Direct_Boolean_Operators
12664 @geindex No_Direct_Boolean_Operators
12666 [GNAT] This restriction ensures that no logical operators (and/or/xor)
12667 are used on operands of type Boolean (or any type derived from Boolean).
12668 This is intended for use in safety critical programs where the certification
12669 protocol requires the use of short-circuit (and then, or else) forms for all
12670 composite boolean operations.
12672 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
12673 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1dd}
12674 @subsection No_Dispatch
12677 @geindex No_Dispatch
12679 [RM H.4] This restriction ensures at compile time that there are no
12680 occurrences of @code{T'Class}, for any (tagged) subtype @code{T}.
12682 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
12683 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1de}
12684 @subsection No_Dispatching_Calls
12687 @geindex No_Dispatching_Calls
12689 [GNAT] This restriction ensures at compile time that the code generated by the
12690 compiler involves no dispatching calls. The use of this restriction allows the
12691 safe use of record extensions, classwide membership tests and other classwide
12692 features not involving implicit dispatching. This restriction ensures that
12693 the code contains no indirect calls through a dispatching mechanism. Note that
12694 this includes internally-generated calls created by the compiler, for example
12695 in the implementation of class-wide objects assignments. The
12696 membership test is allowed in the presence of this restriction, because its
12697 implementation requires no dispatching.
12698 This restriction is comparable to the official Ada restriction
12699 @code{No_Dispatch} except that it is a bit less restrictive in that it allows
12700 all classwide constructs that do not imply dispatching.
12701 The following example indicates constructs that violate this restriction.
12703 @example
12704 package Pkg is
12705   type T is tagged record
12706     Data : Natural;
12707   end record;
12708   procedure P (X : T);
12710   type DT is new T with record
12711     More_Data : Natural;
12712   end record;
12713   procedure Q (X : DT);
12714 end Pkg;
12716 with Pkg; use Pkg;
12717 procedure Example is
12718   procedure Test (O : T'Class) is
12719     N : Natural := O'Size; --  Error: Dispatching call
12720     C : T'Class := O;      --  Error: implicit Dispatching Call
12721   begin
12722     if O in DT'Class then  --  OK   : Membership test
12723        Q (DT (O));         --  OK   : Type conversion plus direct call
12724     else
12725        P (O);              --  Error: Dispatching call
12726     end if;
12727   end Test;
12729   Obj : DT;
12730 begin
12731   P (Obj);                 --  OK   : Direct call
12732   P (T (Obj));             --  OK   : Type conversion plus direct call
12733   P (T'Class (Obj));       --  Error: Dispatching call
12735   Test (Obj);              --  OK   : Type conversion
12737   if Obj in T'Class then   --  OK   : Membership test
12738      null;
12739   end if;
12740 end Example;
12741 @end example
12743 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
12744 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1df}
12745 @subsection No_Dynamic_Attachment
12748 @geindex No_Dynamic_Attachment
12750 [RM D.7] This restriction ensures that there is no call to any of the
12751 operations defined in package Ada.Interrupts
12752 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
12753 Detach_Handler, and Reference).
12755 @geindex No_Dynamic_Interrupts
12757 The restriction @code{No_Dynamic_Interrupts} is recognized as a
12758 synonym for @code{No_Dynamic_Attachment}. This is retained for historical
12759 compatibility purposes (and a warning will be generated for its use if
12760 warnings on obsolescent features are activated).
12762 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
12763 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1e0}
12764 @subsection No_Dynamic_Priorities
12767 @geindex No_Dynamic_Priorities
12769 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
12771 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
12772 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1e1}
12773 @subsection No_Entry_Calls_In_Elaboration_Code
12776 @geindex No_Entry_Calls_In_Elaboration_Code
12778 [GNAT] This restriction ensures at compile time that no task or protected entry
12779 calls are made during elaboration code.  As a result of the use of this
12780 restriction, the compiler can assume that no code past an accept statement
12781 in a task can be executed at elaboration time.
12783 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
12784 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1e2}
12785 @subsection No_Enumeration_Maps
12788 @geindex No_Enumeration_Maps
12790 [GNAT] This restriction ensures at compile time that no operations requiring
12791 enumeration maps are used (that is Image and Value attributes applied
12792 to enumeration types).
12794 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
12795 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1e3}
12796 @subsection No_Exception_Handlers
12799 @geindex No_Exception_Handlers
12801 [GNAT] This restriction ensures at compile time that there are no explicit
12802 exception handlers. It also indicates that no exception propagation will
12803 be provided. In this mode, exceptions may be raised but will result in
12804 an immediate call to the last chance handler, a routine that the user
12805 must define with the following profile:
12807 @example
12808 procedure Last_Chance_Handler
12809   (Source_Location : System.Address; Line : Integer);
12810 pragma Export (C, Last_Chance_Handler,
12811                "__gnat_last_chance_handler");
12812 @end example
12814 The parameter is a C null-terminated string representing a message to be
12815 associated with the exception (typically the source location of the raise
12816 statement generated by the compiler). The Line parameter when nonzero
12817 represents the line number in the source program where the raise occurs.
12819 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
12820 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1e4}
12821 @subsection No_Exception_Propagation
12824 @geindex No_Exception_Propagation
12826 [GNAT] This restriction guarantees that exceptions are never propagated
12827 to an outer subprogram scope. The only case in which an exception may
12828 be raised is when the handler is statically in the same subprogram, so
12829 that the effect of a raise is essentially like a goto statement. Any
12830 other raise statement (implicit or explicit) will be considered
12831 unhandled. Exception handlers are allowed, but may not contain an
12832 exception occurrence identifier (exception choice). In addition, use of
12833 the package GNAT.Current_Exception is not permitted, and reraise
12834 statements (raise with no operand) are not permitted.
12836 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
12837 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1e5}
12838 @subsection No_Exception_Registration
12841 @geindex No_Exception_Registration
12843 [GNAT] This restriction ensures at compile time that no stream operations for
12844 types Exception_Id or Exception_Occurrence are used. This also makes it
12845 impossible to pass exceptions to or from a partition with this restriction
12846 in a distributed environment. If this restriction is active, the generated
12847 code is simplified by omitting the otherwise-required global registration
12848 of exceptions when they are declared.
12850 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
12851 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1e6}
12852 @subsection No_Exceptions
12855 @geindex No_Exceptions
12857 [RM H.4] This restriction ensures at compile time that there are no
12858 raise statements and no exception handlers and also suppresses the
12859 generation of language-defined run-time checks.
12861 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
12862 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1e7}
12863 @subsection No_Finalization
12866 @geindex No_Finalization
12868 [GNAT] This restriction disables the language features described in
12869 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
12870 performed by the compiler to support these features. The following types
12871 are no longer considered controlled when this restriction is in effect:
12874 @itemize *
12876 @item 
12877 @code{Ada.Finalization.Controlled}
12879 @item 
12880 @code{Ada.Finalization.Limited_Controlled}
12882 @item 
12883 Derivations from @code{Controlled} or @code{Limited_Controlled}
12885 @item 
12886 Class-wide types
12888 @item 
12889 Protected types
12891 @item 
12892 Task types
12894 @item 
12895 Array and record types with controlled components
12896 @end itemize
12898 The compiler no longer generates code to initialize, finalize or adjust an
12899 object or a nested component, either declared on the stack or on the heap. The
12900 deallocation of a controlled object no longer finalizes its contents.
12902 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
12903 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1e8}
12904 @subsection No_Fixed_Point
12907 @geindex No_Fixed_Point
12909 [RM H.4] This restriction ensures at compile time that there are no
12910 occurrences of fixed point types and operations.
12912 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
12913 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1e9}
12914 @subsection No_Floating_Point
12917 @geindex No_Floating_Point
12919 [RM H.4] This restriction ensures at compile time that there are no
12920 occurrences of floating point types and operations.
12922 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
12923 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1ea}
12924 @subsection No_Implicit_Conditionals
12927 @geindex No_Implicit_Conditionals
12929 [GNAT] This restriction ensures that the generated code does not contain any
12930 implicit conditionals, either by modifying the generated code where possible,
12931 or by rejecting any construct that would otherwise generate an implicit
12932 conditional. Note that this check does not include run time constraint
12933 checks, which on some targets may generate implicit conditionals as
12934 well. To control the latter, constraint checks can be suppressed in the
12935 normal manner. Constructs generating implicit conditionals include comparisons
12936 of composite objects and the Max/Min attributes.
12938 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12939 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1eb}
12940 @subsection No_Implicit_Dynamic_Code
12943 @geindex No_Implicit_Dynamic_Code
12945 @geindex trampoline
12947 [GNAT] This restriction prevents the compiler from building ‘trampolines’.
12948 This is a structure that is built on the stack and contains dynamic
12949 code to be executed at run time. On some targets, a trampoline is
12950 built for the following features: @code{Access},
12951 @code{Unrestricted_Access}, or @code{Address} of a nested subprogram;
12952 nested task bodies; primitive operations of nested tagged types.
12953 Trampolines do not work on machines that prevent execution of stack
12954 data. For example, on windows systems, enabling DEP (data execution
12955 protection) will cause trampolines to raise an exception.
12956 Trampolines are also quite slow at run time.
12958 On many targets, trampolines have been largely eliminated. Look at the
12959 version of system.ads for your target — if it has
12960 Always_Compatible_Rep equal to False, then trampolines are largely
12961 eliminated. In particular, a trampoline is built for the following
12962 features: @code{Address} of a nested subprogram;
12963 @code{Access} or @code{Unrestricted_Access} of a nested subprogram,
12964 but only if pragma Favor_Top_Level applies, or the access type has a
12965 foreign-language convention; primitive operations of nested tagged
12966 types.
12968 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12969 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1ec}
12970 @subsection No_Implicit_Heap_Allocations
12973 @geindex No_Implicit_Heap_Allocations
12975 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12977 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12978 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1ed}
12979 @subsection No_Implicit_Protected_Object_Allocations
12982 @geindex No_Implicit_Protected_Object_Allocations
12984 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12985 protected object.
12987 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12988 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1ee}
12989 @subsection No_Implicit_Task_Allocations
12992 @geindex No_Implicit_Task_Allocations
12994 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12996 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12997 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1ef}
12998 @subsection No_Initialize_Scalars
13001 @geindex No_Initialize_Scalars
13003 [GNAT] This restriction ensures that no unit in the partition is compiled with
13004 pragma Initialize_Scalars. This allows the generation of more efficient
13005 code, and in particular eliminates dummy null initialization routines that
13006 are otherwise generated for some record and array types.
13008 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
13009 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1f0}
13010 @subsection No_IO
13013 @geindex No_IO
13015 [RM H.4] This restriction ensures at compile time that there are no
13016 dependences on any of the library units Sequential_IO, Direct_IO,
13017 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
13019 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
13020 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1f1}
13021 @subsection No_Local_Allocators
13024 @geindex No_Local_Allocators
13026 [RM H.4] This restriction ensures at compile time that there are no
13027 occurrences of an allocator in subprograms, generic subprograms, tasks,
13028 and entry bodies.
13030 @node No_Local_Protected_Objects,No_Local_Tagged_Types,No_Local_Allocators,Partition-Wide Restrictions
13031 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1f2}
13032 @subsection No_Local_Protected_Objects
13035 @geindex No_Local_Protected_Objects
13037 [RM D.7] This restriction ensures at compile time that protected objects are
13038 only declared at the library level.
13040 @node No_Local_Tagged_Types,No_Local_Timing_Events,No_Local_Protected_Objects,Partition-Wide Restrictions
13041 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-tagged-types}@anchor{1f3}
13042 @subsection No_Local_Tagged_Types
13045 @geindex No_Local_Tagged_Types
13047 [GNAT] This restriction ensures at compile time that tagged types are only
13048 declared at the library level.
13050 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Tagged_Types,Partition-Wide Restrictions
13051 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1f4}
13052 @subsection No_Local_Timing_Events
13055 @geindex No_Local_Timing_Events
13057 [RM D.7] All objects of type Ada.Real_Time.Timing_Events.Timing_Event are
13058 declared at the library level.
13060 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
13061 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1f5}
13062 @subsection No_Long_Long_Integers
13065 @geindex No_Long_Long_Integers
13067 [GNAT] This partition-wide restriction forbids any explicit reference to
13068 type Standard.Long_Long_Integer, and also forbids declaring range types whose
13069 implicit base type is Long_Long_Integer, and modular types whose size exceeds
13070 Long_Integer’Size.
13072 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
13073 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1f6}
13074 @subsection No_Multiple_Elaboration
13077 @geindex No_Multiple_Elaboration
13079 [GNAT] When this restriction is active and the static elaboration model is
13080 used, and -fpreserve-control-flow is not used, the compiler is allowed to
13081 suppress the elaboration counter normally associated with the unit, even if
13082 the unit has elaboration code. This counter is typically used to check for
13083 access before elaboration and to control multiple elaboration attempts. If the
13084 restriction is used, then the situations in which multiple elaboration is
13085 possible, including non-Ada main programs and Stand Alone libraries, are not
13086 permitted and will be diagnosed by the binder.
13088 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
13089 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1f7}
13090 @subsection No_Nested_Finalization
13093 @geindex No_Nested_Finalization
13095 [RM D.7] All objects requiring finalization are declared at the library level.
13097 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
13098 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1f8}
13099 @subsection No_Protected_Type_Allocators
13102 @geindex No_Protected_Type_Allocators
13104 [RM D.7] This restriction ensures at compile time that there are no allocator
13105 expressions that attempt to allocate protected objects.
13107 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
13108 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1f9}
13109 @subsection No_Protected_Types
13112 @geindex No_Protected_Types
13114 [RM H.4] This restriction ensures at compile time that there are no
13115 declarations of protected types or protected objects.
13117 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
13118 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1fa}
13119 @subsection No_Recursion
13122 @geindex No_Recursion
13124 [RM H.4] A program execution is erroneous if a subprogram is invoked as
13125 part of its execution.
13127 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
13128 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1fb}
13129 @subsection No_Reentrancy
13132 @geindex No_Reentrancy
13134 [RM H.4] A program execution is erroneous if a subprogram is executed by
13135 two tasks at the same time.
13137 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
13138 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1fc}
13139 @subsection No_Relative_Delay
13142 @geindex No_Relative_Delay
13144 [RM D.7] This restriction ensures at compile time that there are no delay
13145 relative statements and prevents expressions such as @code{delay 1.23;} from
13146 appearing in source code.
13148 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
13149 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1fd}
13150 @subsection No_Requeue_Statements
13153 @geindex No_Requeue_Statements
13155 [RM D.7] This restriction ensures at compile time that no requeue statements
13156 are permitted and prevents keyword @code{requeue} from being used in source
13157 code.
13159 @geindex No_Requeue
13161 The restriction @code{No_Requeue} is recognized as a
13162 synonym for @code{No_Requeue_Statements}. This is retained for historical
13163 compatibility purposes (and a warning will be generated for its use if
13164 warnings on oNobsolescent features are activated).
13166 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
13167 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1fe}
13168 @subsection No_Secondary_Stack
13171 @geindex No_Secondary_Stack
13173 [GNAT] This restriction ensures at compile time that the generated code
13174 does not contain any reference to the secondary stack.  The secondary
13175 stack is used to implement functions returning unconstrained objects
13176 (arrays or records) on some targets. Suppresses the allocation of
13177 secondary stacks for tasks (excluding the environment task) at run time.
13179 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
13180 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1ff}
13181 @subsection No_Select_Statements
13184 @geindex No_Select_Statements
13186 [RM D.7] This restriction ensures at compile time no select statements of any
13187 kind are permitted, that is the keyword @code{select} may not appear.
13189 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
13190 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{200}
13191 @subsection No_Specific_Termination_Handlers
13194 @geindex No_Specific_Termination_Handlers
13196 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
13197 or to Ada.Task_Termination.Specific_Handler.
13199 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
13200 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{201}
13201 @subsection No_Specification_of_Aspect
13204 @geindex No_Specification_of_Aspect
13206 [RM 13.12.1] This restriction checks at compile time that no aspect
13207 specification, attribute definition clause, or pragma is given for a
13208 given aspect.
13210 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
13211 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{202}
13212 @subsection No_Standard_Allocators_After_Elaboration
13215 @geindex No_Standard_Allocators_After_Elaboration
13217 [RM D.7] Specifies that an allocator using a standard storage pool
13218 should never be evaluated at run time after the elaboration of the
13219 library items of the partition has completed. Otherwise, Storage_Error
13220 is raised.
13222 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
13223 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{203}
13224 @subsection No_Standard_Storage_Pools
13227 @geindex No_Standard_Storage_Pools
13229 [GNAT] This restriction ensures at compile time that no access types
13230 use the standard default storage pool.  Any access type declared must
13231 have an explicit Storage_Pool attribute defined specifying a
13232 user-defined storage pool.
13234 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
13235 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{204}
13236 @subsection No_Stream_Optimizations
13239 @geindex No_Stream_Optimizations
13241 [GNAT] This restriction affects the performance of stream operations on types
13242 @code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
13243 compiler uses block reads and writes when manipulating @code{String} objects
13244 due to their superior performance. When this restriction is in effect, the
13245 compiler performs all IO operations on a per-character basis.
13247 @node No_Streams,No_Tagged_Type_Registration,No_Stream_Optimizations,Partition-Wide Restrictions
13248 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{205}
13249 @subsection No_Streams
13252 @geindex No_Streams
13254 [GNAT] This restriction ensures at compile/bind time that there are no
13255 stream objects created and no use of stream attributes.
13256 This restriction does not forbid dependences on the package
13257 @code{Ada.Streams}. So it is permissible to with
13258 @code{Ada.Streams} (or another package that does so itself)
13259 as long as no actual stream objects are created and no
13260 stream attributes are used.
13262 Note that the use of restriction allows optimization of tagged types,
13263 since they do not need to worry about dispatching stream operations.
13264 To take maximum advantage of this space-saving optimization, any
13265 unit declaring a tagged type should be compiled with the restriction,
13266 though this is not required.
13268 When pragmas @code{Discard_Names} and @code{Restrictions (No_Streams)} simultaneously
13269 apply to a tagged type, its Expanded_Name and External_Tag are also initialized
13270 with empty strings. In particular, both these pragmas can be applied as
13271 configuration pragmas to avoid exposing entity names at binary level for the
13272 entire partition.
13274 @node No_Tagged_Type_Registration,No_Task_Allocators,No_Streams,Partition-Wide Restrictions
13275 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tagged-type-registration}@anchor{206}
13276 @subsection No_Tagged_Type_Registration
13279 @geindex No_Tagged_Type_Registration
13281 [GNAT] If this restriction is active, then class-wide streaming
13282 attributes are not supported. In addition, the subprograms in
13283 Ada.Tags are not supported.
13284 If this restriction is active, the generated code is simplified by
13285 omitting the otherwise-required global registration of tagged types when they
13286 are declared. This restriction may be necessary in order to also apply
13287 the No_Elaboration_Code restriction.
13289 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Tagged_Type_Registration,Partition-Wide Restrictions
13290 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{207}
13291 @subsection No_Task_Allocators
13294 @geindex No_Task_Allocators
13296 [RM D.7] There are no allocators for task types
13297 or types containing task subcomponents.
13299 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
13300 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{208}
13301 @subsection No_Task_At_Interrupt_Priority
13304 @geindex No_Task_At_Interrupt_Priority
13306 [GNAT] This restriction ensures at compile time that there is no
13307 Interrupt_Priority aspect or pragma for a task or a task type. As
13308 a consequence, the tasks are always created with a priority below
13309 that an interrupt priority.
13311 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
13312 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{209}
13313 @subsection No_Task_Attributes_Package
13316 @geindex No_Task_Attributes_Package
13318 [GNAT] This restriction ensures at compile time that there are no implicit or
13319 explicit dependencies on the package @code{Ada.Task_Attributes}.
13321 @geindex No_Task_Attributes
13323 The restriction @code{No_Task_Attributes} is recognized as a synonym
13324 for @code{No_Task_Attributes_Package}. This is retained for historical
13325 compatibility purposes (and a warning will be generated for its use if
13326 warnings on obsolescent features are activated).
13328 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
13329 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{20a}
13330 @subsection No_Task_Hierarchy
13333 @geindex No_Task_Hierarchy
13335 [RM D.7] All (non-environment) tasks depend
13336 directly on the environment task of the partition.
13338 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
13339 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{20b}
13340 @subsection No_Task_Termination
13343 @geindex No_Task_Termination
13345 [RM D.7] Tasks that terminate are erroneous.
13347 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
13348 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{20c}
13349 @subsection No_Tasking
13352 @geindex No_Tasking
13354 [GNAT] This restriction prevents the declaration of tasks or task types
13355 throughout the partition.  It is similar in effect to the use of
13356 @code{Max_Tasks => 0} except that violations are caught at compile time
13357 and cause an error message to be output either by the compiler or
13358 binder.
13360 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
13361 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{20d}
13362 @subsection No_Terminate_Alternatives
13365 @geindex No_Terminate_Alternatives
13367 [RM D.7] There are no selective accepts with terminate alternatives.
13369 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
13370 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{20e}
13371 @subsection No_Unchecked_Access
13374 @geindex No_Unchecked_Access
13376 [RM H.4] This restriction ensures at compile time that there are no
13377 occurrences of the Unchecked_Access attribute.
13379 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
13380 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{20f}
13381 @subsection No_Unchecked_Conversion
13384 @geindex No_Unchecked_Conversion
13386 [RM J.13] This restriction ensures at compile time that there are no semantic
13387 dependences on the predefined generic function Unchecked_Conversion.
13389 @node No_Unchecked_Deallocation,No_Use_Of_Attribute,No_Unchecked_Conversion,Partition-Wide Restrictions
13390 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{210}
13391 @subsection No_Unchecked_Deallocation
13394 @geindex No_Unchecked_Deallocation
13396 [RM J.13] This restriction ensures at compile time that there are no semantic
13397 dependences on the predefined generic procedure Unchecked_Deallocation.
13399 @node No_Use_Of_Attribute,No_Use_Of_Entity,No_Unchecked_Deallocation,Partition-Wide Restrictions
13400 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-attribute}@anchor{211}
13401 @subsection No_Use_Of_Attribute
13404 @geindex No_Use_Of_Attribute
13406 [RM 13.12.1] This is a standard Ada 2012 restriction that is GNAT defined in
13407 earlier versions of Ada.
13409 @node No_Use_Of_Entity,No_Use_Of_Pragma,No_Use_Of_Attribute,Partition-Wide Restrictions
13410 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{212}
13411 @subsection No_Use_Of_Entity
13414 @geindex No_Use_Of_Entity
13416 [GNAT] This restriction ensures at compile time that there are no references
13417 to the entity given in the form
13419 @example
13420 No_Use_Of_Entity => Name
13421 @end example
13423 where @code{Name} is the fully qualified entity, for example
13425 @example
13426 No_Use_Of_Entity => Ada.Text_IO.Put_Line
13427 @end example
13429 @node No_Use_Of_Pragma,Pure_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
13430 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-pragma}@anchor{213}
13431 @subsection No_Use_Of_Pragma
13434 @geindex No_Use_Of_Pragma
13436 [RM 13.12.1] This is a standard Ada 2012 restriction that is GNAT defined in
13437 earlier versions of Ada.
13439 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Pragma,Partition-Wide Restrictions
13440 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{214}
13441 @subsection Pure_Barriers
13444 @geindex Pure_Barriers
13446 [GNAT] This restriction ensures at compile time that protected entry
13447 barriers are restricted to:
13450 @itemize *
13452 @item 
13453 components of the protected object (excluding selection from dereferences),
13455 @item 
13456 constant declarations,
13458 @item 
13459 named numbers,
13461 @item 
13462 enumeration literals,
13464 @item 
13465 integer literals,
13467 @item 
13468 real literals,
13470 @item 
13471 character literals,
13473 @item 
13474 implicitly defined comparison operators,
13476 @item 
13477 uses of the Standard.”not” operator,
13479 @item 
13480 short-circuit operator,
13482 @item 
13483 the Count attribute
13484 @end itemize
13486 This restriction is a relaxation of the Simple_Barriers restriction,
13487 but still ensures absence of side effects, exceptions, and recursion
13488 during the evaluation of the barriers.
13490 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
13491 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{215}
13492 @subsection Simple_Barriers
13495 @geindex Simple_Barriers
13497 [RM D.7] This restriction ensures at compile time that barriers in entry
13498 declarations for protected types are restricted to either static boolean
13499 expressions or references to simple boolean variables defined in the private
13500 part of the protected type.  No other form of entry barriers is permitted.
13502 @geindex Boolean_Entry_Barriers
13504 The restriction @code{Boolean_Entry_Barriers} is recognized as a
13505 synonym for @code{Simple_Barriers}. This is retained for historical
13506 compatibility purposes (and a warning will be generated for its use if
13507 warnings on obsolescent features are activated).
13509 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
13510 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{216}
13511 @subsection Static_Priorities
13514 @geindex Static_Priorities
13516 [GNAT] This restriction ensures at compile time that all priority expressions
13517 are static, and that there are no dependences on the package
13518 @code{Ada.Dynamic_Priorities}.
13520 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
13521 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{217}
13522 @subsection Static_Storage_Size
13525 @geindex Static_Storage_Size
13527 [GNAT] This restriction ensures at compile time that any expression appearing
13528 in a Storage_Size pragma or attribute definition clause is static.
13530 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
13531 @anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{218}@anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{219}
13532 @section Program Unit Level Restrictions
13535 The second set of restriction identifiers
13536 does not require partition-wide consistency.
13537 The restriction may be enforced for a single
13538 compilation unit without any effect on any of the
13539 other compilation units in the partition.
13541 @menu
13542 * No_Elaboration_Code:: 
13543 * No_Dynamic_Accessibility_Checks:: 
13544 * No_Dynamic_Sized_Objects:: 
13545 * No_Entry_Queue:: 
13546 * No_Implementation_Aspect_Specifications:: 
13547 * No_Implementation_Attributes:: 
13548 * No_Implementation_Identifiers:: 
13549 * No_Implementation_Pragmas:: 
13550 * No_Implementation_Restrictions:: 
13551 * No_Implementation_Units:: 
13552 * No_Implicit_Aliasing:: 
13553 * No_Implicit_Loops:: 
13554 * No_Obsolescent_Features:: 
13555 * No_Wide_Characters:: 
13556 * Static_Dispatch_Tables:: 
13557 * SPARK_05:: 
13559 @end menu
13561 @node No_Elaboration_Code,No_Dynamic_Accessibility_Checks,,Program Unit Level Restrictions
13562 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{21a}
13563 @subsection No_Elaboration_Code
13566 @geindex No_Elaboration_Code
13568 [GNAT] This restriction ensures at compile time that no elaboration code is
13569 generated.  Note that this is not the same condition as is enforced
13570 by pragma @code{Preelaborate}.  There are cases in which pragma
13571 @code{Preelaborate} still permits code to be generated (e.g., code
13572 to initialize a large array to all zeroes), and there are cases of units
13573 which do not meet the requirements for pragma @code{Preelaborate},
13574 but for which no elaboration code is generated.  Generally, it is
13575 the case that preelaborable units will meet the restrictions, with
13576 the exception of large aggregates initialized with an others_clause,
13577 and exception declarations (which generate calls to a run-time
13578 registry procedure).  This restriction is enforced on
13579 a unit by unit basis, it need not be obeyed consistently
13580 throughout a partition.
13582 In the case of aggregates with others, if the aggregate has a dynamic
13583 size, there is no way to eliminate the elaboration code (such dynamic
13584 bounds would be incompatible with @code{Preelaborate} in any case). If
13585 the bounds are static, then use of this restriction actually modifies
13586 the code choice of the compiler to avoid generating a loop, and instead
13587 generate the aggregate statically if possible, no matter how many times
13588 the data for the others clause must be repeatedly generated.
13590 It is not possible to precisely document
13591 the constructs which are compatible with this restriction, since,
13592 unlike most other restrictions, this is not a restriction on the
13593 source code, but a restriction on the generated object code. For
13594 example, if the source contains a declaration:
13596 @example
13597 Val : constant Integer := X;
13598 @end example
13600 where X is not a static constant, it may be possible, depending
13601 on complex optimization circuitry, for the compiler to figure
13602 out the value of X at compile time, in which case this initialization
13603 can be done by the loader, and requires no initialization code. It
13604 is not possible to document the precise conditions under which the
13605 optimizer can figure this out.
13607 Note that this the implementation of this restriction requires full
13608 code generation. If it is used in conjunction with “semantics only”
13609 checking, then some cases of violations may be missed.
13611 When this restriction is active, we are not requesting control-flow
13612 preservation with -fpreserve-control-flow, and the static elaboration model is
13613 used, the compiler is allowed to suppress the elaboration counter normally
13614 associated with the unit. This counter is typically used to check for access
13615 before elaboration and to control multiple elaboration attempts.
13617 @node No_Dynamic_Accessibility_Checks,No_Dynamic_Sized_Objects,No_Elaboration_Code,Program Unit Level Restrictions
13618 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-accessibility-checks}@anchor{21b}
13619 @subsection No_Dynamic_Accessibility_Checks
13622 @geindex No_Dynamic_Accessibility_Checks
13624 [GNAT] No dynamic accessibility checks are generated when this restriction is
13625 in effect. Instead, dangling references are prevented via more conservative
13626 compile-time checking. More specifically, existing compile-time checks are
13627 enforced but with more conservative assumptions about the accessibility levels
13628 of the relevant entities. These conservative assumptions eliminate the need for
13629 dynamic accessibility checks.
13631 These new rules for computing (at compile-time) the accessibility level of an
13632 anonymous access type T are as follows:
13635 @itemize *
13637 @item 
13638 If T is a function result type then, from the caller’s perspective, its level
13639 is that of the innermost master enclosing the function call. From the callee’s
13640 perspective, the level of parameters and local variables of the callee is
13641 statically deeper than the level of T.
13643 For any other accessibility level L such that the level of parameters and local
13644 variables of the callee is statically deeper than L, the level of T (from the
13645 callee’s perspective) is also statically deeper than L.
13647 @item 
13648 If T is the type of a formal parameter then, from the caller’s perspective,
13649 its level is at least as deep as that of the type of the corresponding actual
13650 parameter (whatever that actual parameter might be). From the callee’s
13651 perspective, the level of parameters and local variables of the callee is
13652 statically deeper than the level of T.
13654 @item 
13655 If T is the type of a discriminant then its level is that of the discriminated
13656 type.
13658 @item 
13659 If T is the type of a stand-alone object then its level is the level of the
13660 object.
13662 @item 
13663 In all other cases, the level of T is as defined by the existing rules of Ada.
13664 @end itemize
13666 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Dynamic_Accessibility_Checks,Program Unit Level Restrictions
13667 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{21c}
13668 @subsection No_Dynamic_Sized_Objects
13671 @geindex No_Dynamic_Sized_Objects
13673 [GNAT] This restriction disallows certain constructs that might lead to the
13674 creation of dynamic-sized composite objects (or array or discriminated type).
13675 An array subtype indication is illegal if the bounds are not static
13676 or references to discriminants of an enclosing type.
13677 A discriminated subtype indication is illegal if the type has
13678 discriminant-dependent array components or a variant part, and the
13679 discriminants are not static. In addition, array and record aggregates are
13680 illegal in corresponding cases. Note that this restriction does not forbid
13681 access discriminants. It is often a good idea to combine this restriction
13682 with No_Secondary_Stack.
13684 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
13685 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{21d}
13686 @subsection No_Entry_Queue
13689 @geindex No_Entry_Queue
13691 [GNAT] This restriction is a declaration that any protected entry compiled in
13692 the scope of the restriction has at most one task waiting on the entry
13693 at any one time, and so no queue is required.  This restriction is not
13694 checked at compile time.  A program execution is erroneous if an attempt
13695 is made to queue a second task on such an entry.
13697 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
13698 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{21e}
13699 @subsection No_Implementation_Aspect_Specifications
13702 @geindex No_Implementation_Aspect_Specifications
13704 [RM 13.12.1] This restriction checks at compile time that no
13705 GNAT-defined aspects are present.  With this restriction, the only
13706 aspects that can be used are those defined in the Ada Reference Manual.
13708 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
13709 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{21f}
13710 @subsection No_Implementation_Attributes
13713 @geindex No_Implementation_Attributes
13715 [RM 13.12.1] This restriction checks at compile time that no
13716 GNAT-defined attributes are present.  With this restriction, the only
13717 attributes that can be used are those defined in the Ada Reference
13718 Manual.
13720 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
13721 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{220}
13722 @subsection No_Implementation_Identifiers
13725 @geindex No_Implementation_Identifiers
13727 [RM 13.12.1] This restriction checks at compile time that no
13728 implementation-defined identifiers (marked with pragma Implementation_Defined)
13729 occur within language-defined packages.
13731 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
13732 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{221}
13733 @subsection No_Implementation_Pragmas
13736 @geindex No_Implementation_Pragmas
13738 [RM 13.12.1] This restriction checks at compile time that no
13739 GNAT-defined pragmas are present.  With this restriction, the only
13740 pragmas that can be used are those defined in the Ada Reference Manual.
13742 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
13743 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{222}
13744 @subsection No_Implementation_Restrictions
13747 @geindex No_Implementation_Restrictions
13749 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
13750 identifiers (other than @code{No_Implementation_Restrictions} itself)
13751 are present.  With this restriction, the only other restriction identifiers
13752 that can be used are those defined in the Ada Reference Manual.
13754 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
13755 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{223}
13756 @subsection No_Implementation_Units
13759 @geindex No_Implementation_Units
13761 [RM 13.12.1] This restriction checks at compile time that there is no
13762 mention in the context clause of any implementation-defined descendants
13763 of packages Ada, Interfaces, or System.
13765 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
13766 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{224}
13767 @subsection No_Implicit_Aliasing
13770 @geindex No_Implicit_Aliasing
13772 [GNAT] This restriction, which is not required to be partition-wide consistent,
13773 requires an explicit aliased keyword for an object to which ‘Access,
13774 ‘Unchecked_Access, or ‘Address is applied, and forbids entirely the use of
13775 the ‘Unrestricted_Access attribute for objects. Note: the reason that
13776 Unrestricted_Access is forbidden is that it would require the prefix
13777 to be aliased, and in such cases, it can always be replaced by
13778 the standard attribute Unchecked_Access which is preferable.
13780 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
13781 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{225}
13782 @subsection No_Implicit_Loops
13785 @geindex No_Implicit_Loops
13787 [GNAT] This restriction ensures that the generated code of the unit marked
13788 with this restriction does not contain any implicit @code{for} loops, either by
13789 modifying the generated code where possible, or by rejecting any construct
13790 that would otherwise generate an implicit @code{for} loop. If this restriction is
13791 active, it is possible to build large array aggregates with all static
13792 components without generating an intermediate temporary, and without generating
13793 a loop to initialize individual components. Otherwise, a loop is created for
13794 arrays larger than about 5000 scalar components. Note that if this restriction
13795 is set in the spec of a package, it will not apply to its body.
13797 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
13798 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{226}
13799 @subsection No_Obsolescent_Features
13802 @geindex No_Obsolescent_Features
13804 [RM 13.12.1] This restriction checks at compile time that no obsolescent
13805 features are used, as defined in Annex J of the Ada Reference Manual.
13807 @node No_Wide_Characters,Static_Dispatch_Tables,No_Obsolescent_Features,Program Unit Level Restrictions
13808 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{227}
13809 @subsection No_Wide_Characters
13812 @geindex No_Wide_Characters
13814 [GNAT] This restriction ensures at compile time that no uses of the types
13815 @code{Wide_Character} or @code{Wide_String} or corresponding wide
13816 wide types
13817 appear, and that no wide or wide wide string or character literals
13818 appear in the program (that is literals representing characters not in
13819 type @code{Character}).
13821 @node Static_Dispatch_Tables,SPARK_05,No_Wide_Characters,Program Unit Level Restrictions
13822 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{228}
13823 @subsection Static_Dispatch_Tables
13826 @geindex Static_Dispatch_Tables
13828 [GNAT] This restriction checks at compile time that all the artifacts
13829 associated with dispatch tables can be placed in read-only memory.
13831 @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions
13832 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{229}
13833 @subsection SPARK_05
13836 @geindex SPARK_05
13838 [GNAT] This restriction no longer has any effect and is superseded by
13839 SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
13840 a codebase respects SPARK 2014 restrictions, mark the code with pragma or
13841 aspect @code{SPARK_Mode}, and run the tool GNATprove at Stone assurance level, as
13842 follows:
13844 @example
13845 gnatprove -P project.gpr --mode=stone
13846 @end example
13848 or equivalently:
13850 @example
13851 gnatprove -P project.gpr --mode=check_all
13852 @end example
13854 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13855 @anchor{gnat_rm/implementation_advice doc}@anchor{22a}@anchor{gnat_rm/implementation_advice id1}@anchor{22b}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}
13856 @chapter Implementation Advice
13859 The main text of the Ada Reference Manual describes the required
13860 behavior of all Ada compilers, and the GNAT compiler conforms to
13861 these requirements.
13863 In addition, there are sections throughout the Ada Reference Manual headed
13864 by the phrase ‘Implementation advice’.  These sections are not normative,
13865 i.e., they do not specify requirements that all compilers must
13866 follow.  Rather they provide advice on generally desirable behavior.
13867 They are not requirements, because they describe behavior that cannot
13868 be provided on all systems, or may be undesirable on some systems.
13870 As far as practical, GNAT follows the implementation advice in
13871 the Ada Reference Manual.  Each such RM section corresponds to a section
13872 in this chapter whose title specifies the
13873 RM section number and paragraph number and the subject of
13874 the advice.  The contents of each section consists of the RM text within
13875 quotation marks,
13876 followed by the GNAT interpretation of the advice.  Most often, this simply says
13877 ‘followed’, which means that GNAT follows the advice.  However, in a
13878 number of cases, GNAT deliberately deviates from this advice, in which
13879 case the text describes what GNAT does and why.
13881 @geindex Error detection
13883 @menu
13884 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
13885 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
13886 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
13887 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
13888 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
13889 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
13890 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
13891 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
13892 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
13893 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
13894 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
13895 * RM 9.6(30-31); Duration’Small: RM 9 6 30-31 Duration’Small. 
13896 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
13897 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
13898 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
13899 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
13900 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
13901 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
13902 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
13903 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
13904 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
13905 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
13906 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
13907 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
13908 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
13909 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
13910 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
13911 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
13912 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
13913 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
13914 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
13915 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes. 
13916 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
13917 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
13918 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
13919 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
13920 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
13921 * RM A.18; Containers: RM A 18 Containers. 
13922 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
13923 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
13924 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
13925 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
13926 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
13927 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
13928 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
13929 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
13930 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
13931 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
13932 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
13933 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
13934 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
13935 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
13936 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
13937 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
13938 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
13939 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
13940 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
13941 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
13942 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
13943 * RM G; Numerics: RM G Numerics. 
13944 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
13945 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
13946 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
13947 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
13948 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
13950 @end menu
13952 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13953 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{22c}
13954 @section RM 1.1.3(20): Error Detection
13957 @quotation
13959 “If an implementation detects the use of an unsupported Specialized Needs
13960 Annex feature at run time, it should raise @code{Program_Error} if
13961 feasible.”
13962 @end quotation
13964 Not relevant.  All specialized needs annex features are either supported,
13965 or diagnosed at compile time.
13967 @geindex Child Units
13969 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13970 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{22d}
13971 @section RM 1.1.3(31): Child Units
13974 @quotation
13976 “If an implementation wishes to provide implementation-defined
13977 extensions to the functionality of a language-defined library unit, it
13978 should normally do so by adding children to the library unit.”
13979 @end quotation
13981 Followed.
13983 @geindex Bounded errors
13985 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13986 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{22e}
13987 @section RM 1.1.5(12): Bounded Errors
13990 @quotation
13992 “If an implementation detects a bounded error or erroneous
13993 execution, it should raise @code{Program_Error}.”
13994 @end quotation
13996 Followed in all cases in which the implementation detects a bounded
13997 error or erroneous execution.  Not all such situations are detected at
13998 runtime.
14000 @geindex Pragmas
14002 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
14003 @anchor{gnat_rm/implementation_advice id2}@anchor{22f}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{230}
14004 @section RM 2.8(16): Pragmas
14007 @quotation
14009 “Normally, implementation-defined pragmas should have no semantic effect
14010 for error-free programs; that is, if the implementation-defined pragmas
14011 are removed from a working program, the program should still be legal,
14012 and should still have the same semantics.”
14013 @end quotation
14015 The following implementation defined pragmas are exceptions to this
14016 rule:
14019 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx} 
14020 @headitem
14022 Pragma
14024 @tab
14026 Explanation
14028 @item
14030 `Abort_Defer'
14032 @tab
14034 Affects semantics
14036 @item
14038 `Ada_83'
14040 @tab
14042 Affects legality
14044 @item
14046 `Assert'
14048 @tab
14050 Affects semantics
14052 @item
14054 `CPP_Class'
14056 @tab
14058 Affects semantics
14060 @item
14062 `CPP_Constructor'
14064 @tab
14066 Affects semantics
14068 @item
14070 `Debug'
14072 @tab
14074 Affects semantics
14076 @item
14078 `Interface_Name'
14080 @tab
14082 Affects semantics
14084 @item
14086 `Machine_Attribute'
14088 @tab
14090 Affects semantics
14092 @item
14094 `Unimplemented_Unit'
14096 @tab
14098 Affects legality
14100 @item
14102 `Unchecked_Union'
14104 @tab
14106 Affects semantics
14108 @end multitable
14111 In each of the above cases, it is essential to the purpose of the pragma
14112 that this advice not be followed.  For details see
14113 @ref{7,,Implementation Defined Pragmas}.
14115 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
14116 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{231}
14117 @section RM 2.8(17-19): Pragmas
14120 @quotation
14122 “Normally, an implementation should not define pragmas that can
14123 make an illegal program legal, except as follows:
14126 @itemize *
14128 @item 
14129 A pragma used to complete a declaration, such as a pragma @code{Import};
14131 @item 
14132 A pragma used to configure the environment by adding, removing, or
14133 replacing @code{library_items}.”
14134 @end itemize
14135 @end quotation
14137 See @ref{230,,RM 2.8(16); Pragmas}.
14139 @geindex Character Sets
14141 @geindex Alternative Character Sets
14143 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
14144 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{232}
14145 @section RM 3.5.2(5): Alternative Character Sets
14148 @quotation
14150 “If an implementation supports a mode with alternative interpretations
14151 for @code{Character} and @code{Wide_Character}, the set of graphic
14152 characters of @code{Character} should nevertheless remain a proper
14153 subset of the set of graphic characters of @code{Wide_Character}.  Any
14154 character set ‘localizations’ should be reflected in the results of
14155 the subprograms defined in the language-defined package
14156 @code{Characters.Handling} (see A.3) available in such a mode.  In a mode with
14157 an alternative interpretation of @code{Character}, the implementation should
14158 also support a corresponding change in what is a legal
14159 @code{identifier_letter}.”
14160 @end quotation
14162 Not all wide character modes follow this advice, in particular the JIS
14163 and IEC modes reflect standard usage in Japan, and in these encoding,
14164 the upper half of the Latin-1 set is not part of the wide-character
14165 subset, since the most significant bit is used for wide character
14166 encoding.  However, this only applies to the external forms.  Internally
14167 there is no such restriction.
14169 @geindex Integer types
14171 @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
14172 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{233}
14173 @section RM 3.5.4(28): Integer Types
14176 @quotation
14178 “An implementation should support @code{Long_Integer} in addition to
14179 @code{Integer} if the target machine supports 32-bit (or longer)
14180 arithmetic.  No other named integer subtypes are recommended for package
14181 @code{Standard}.  Instead, appropriate named integer subtypes should be
14182 provided in the library package @code{Interfaces} (see B.2).”
14183 @end quotation
14185 @code{Long_Integer} is supported.  Other standard integer types are supported
14186 so this advice is not fully followed.  These types
14187 are supported for convenient interface to C, and so that all hardware
14188 types of the machine are easily available.
14190 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
14191 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{234}
14192 @section RM 3.5.4(29): Integer Types
14195 @quotation
14197 “An implementation for a two’s complement machine should support
14198 modular types with a binary modulus up to @code{System.Max_Int*2+2}.  An
14199 implementation should support a non-binary modules up to @code{Integer'Last}.”
14200 @end quotation
14202 Followed.
14204 @geindex Enumeration values
14206 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
14207 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{235}
14208 @section RM 3.5.5(8): Enumeration Values
14211 @quotation
14213 “For the evaluation of a call on @code{S'Pos} for an enumeration
14214 subtype, if the value of the operand does not correspond to the internal
14215 code for any enumeration literal of its type (perhaps due to an
14216 un-initialized variable), then the implementation should raise
14217 @code{Program_Error}.  This is particularly important for enumeration
14218 types with noncontiguous internal codes specified by an
14219 enumeration_representation_clause.”
14220 @end quotation
14222 Followed.
14224 @geindex Float types
14226 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
14227 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{236}
14228 @section RM 3.5.7(17): Float Types
14231 @quotation
14233 “An implementation should support @code{Long_Float} in addition to
14234 @code{Float} if the target machine supports 11 or more digits of
14235 precision.  No other named floating point subtypes are recommended for
14236 package @code{Standard}.  Instead, appropriate named floating point subtypes
14237 should be provided in the library package @code{Interfaces} (see B.2).”
14238 @end quotation
14240 @code{Short_Float} and @code{Long_Long_Float} are also provided.  The
14241 former provides improved compatibility with other implementations
14242 supporting this type.  The latter corresponds to the highest precision
14243 floating-point type supported by the hardware.  On most machines, this
14244 will be the same as @code{Long_Float}, but on some machines, it will
14245 correspond to the IEEE extended form.  The notable case is all x86
14246 implementations, where @code{Long_Long_Float} corresponds to the 80-bit
14247 extended precision format supported in hardware on this processor.
14248 Note that the 128-bit format on SPARC is not supported, since this
14249 is a software rather than a hardware format.
14251 @geindex Multidimensional arrays
14253 @geindex Arrays
14254 @geindex multidimensional
14256 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration’Small,RM 3 5 7 17 Float Types,Implementation Advice
14257 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{237}
14258 @section RM 3.6.2(11): Multidimensional Arrays
14261 @quotation
14263 “An implementation should normally represent multidimensional arrays in
14264 row-major order, consistent with the notation used for multidimensional
14265 array aggregates (see 4.3.3).  However, if a pragma @code{Convention}
14266 (@code{Fortran}, …) applies to a multidimensional array type, then
14267 column-major order should be used instead (see B.5, `Interfacing with Fortran').”
14268 @end quotation
14270 Followed.
14272 @geindex Duration'Small
14274 @node RM 9 6 30-31 Duration’Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
14275 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{238}
14276 @section RM 9.6(30-31): Duration’Small
14279 @quotation
14281 “Whenever possible in an implementation, the value of @code{Duration'Small}
14282 should be no greater than 100 microseconds.”
14283 @end quotation
14285 Followed.  (@code{Duration'Small} = 10**(-9)).
14287 @quotation
14289 “The time base for @code{delay_relative_statements} should be monotonic;
14290 it need not be the same time base as used for @code{Calendar.Clock}.”
14291 @end quotation
14293 Followed.
14295 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration’Small,Implementation Advice
14296 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{239}
14297 @section RM 10.2.1(12): Consistent Representation
14300 @quotation
14302 “In an implementation, a type declared in a pre-elaborated package should
14303 have the same representation in every elaboration of a given version of
14304 the package, whether the elaborations occur in distinct executions of
14305 the same program, or in executions of distinct programs or partitions
14306 that include the given version.”
14307 @end quotation
14309 Followed, except in the case of tagged types.  Tagged types involve
14310 implicit pointers to a local copy of a dispatch table, and these pointers
14311 have representations which thus depend on a particular elaboration of the
14312 package.  It is not easy to see how it would be possible to follow this
14313 advice without severely impacting efficiency of execution.
14315 @geindex Exception information
14317 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
14318 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{23a}
14319 @section RM 11.4.1(19): Exception Information
14322 @quotation
14324 “@code{Exception_Message} by default and @code{Exception_Information}
14325 should produce information useful for
14326 debugging.  @code{Exception_Message} should be short, about one
14327 line.  @code{Exception_Information} can be long.  @code{Exception_Message}
14328 should not include the
14329 @code{Exception_Name}.  @code{Exception_Information} should include both
14330 the @code{Exception_Name} and the @code{Exception_Message}.”
14331 @end quotation
14333 Followed.  For each exception that doesn’t have a specified
14334 @code{Exception_Message}, the compiler generates one containing the location
14335 of the raise statement.  This location has the form ‘file_name:line’, where
14336 file_name is the short file name (without path information) and line is the line
14337 number in the file.  Note that in the case of the Zero Cost Exception
14338 mechanism, these messages become redundant with the Exception_Information that
14339 contains a full backtrace of the calling sequence, so they are disabled.
14340 To disable explicitly the generation of the source location message, use the
14341 Pragma @code{Discard_Names}.
14343 @geindex Suppression of checks
14345 @geindex Checks
14346 @geindex suppression of
14348 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
14349 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{23b}
14350 @section RM 11.5(28): Suppression of Checks
14353 @quotation
14355 “The implementation should minimize the code executed for checks that
14356 have been suppressed.”
14357 @end quotation
14359 Followed.
14361 @geindex Representation clauses
14363 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
14364 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{23c}
14365 @section RM 13.1 (21-24): Representation Clauses
14368 @quotation
14370 “The recommended level of support for all representation items is
14371 qualified as follows:
14373 An implementation need not support representation items containing
14374 nonstatic expressions, except that an implementation should support a
14375 representation item for a given entity if each nonstatic expression in
14376 the representation item is a name that statically denotes a constant
14377 declared before the entity.”
14378 @end quotation
14380 Followed.  In fact, GNAT goes beyond the recommended level of support
14381 by allowing nonstatic expressions in some representation clauses even
14382 without the need to declare constants initialized with the values of
14383 such expressions. For example:
14385 @example
14386 X : Integer;
14387 Y : Float;
14388 for Y'Address use X'Address;
14389 @end example
14391 is accepted directly by GNAT.
14393 @quotation
14395 “An implementation need not support a specification for the @code{Size}
14396 for a given composite subtype, nor the size or storage place for an
14397 object (including a component) of a given composite subtype, unless the
14398 constraints on the subtype and its composite subcomponents (if any) are
14399 all static constraints.”
14400 @end quotation
14402 Followed.  Size Clauses are not permitted on nonstatic components, as
14403 described above.
14405 @quotation
14407 “An aliased component, or a component whose type is by-reference, should
14408 always be allocated at an addressable location.”
14409 @end quotation
14411 Followed.
14413 @geindex Packed types
14415 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
14416 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{23d}
14417 @section RM 13.2(6-8): Packed Types
14420 @quotation
14422 “If a type is packed, then the implementation should try to minimize
14423 storage allocated to objects of the type, possibly at the expense of
14424 speed of accessing components, subject to reasonable complexity in
14425 addressing calculations.
14427 The recommended level of support pragma @code{Pack} is:
14429 For a packed record type, the components should be packed as tightly as
14430 possible subject to the Sizes of the component subtypes, and subject to
14431 any `record_representation_clause' that applies to the type; the
14432 implementation may, but need not, reorder components or cross aligned
14433 word boundaries to improve the packing.  A component whose @code{Size} is
14434 greater than the word size may be allocated an integral number of words.”
14435 @end quotation
14437 Followed.  Tight packing of arrays is supported for all component sizes
14438 up to 64-bits. If the array component size is 1 (that is to say, if
14439 the component is a boolean type or an enumeration type with two values)
14440 then values of the type are implicitly initialized to zero. This
14441 happens both for objects of the packed type, and for objects that have a
14442 subcomponent of the packed type.
14444 @geindex Address clauses
14446 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
14447 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{23e}
14448 @section RM 13.3(14-19): Address Clauses
14451 @quotation
14453 “For an array @code{X}, @code{X'Address} should point at the first
14454 component of the array, and not at the array bounds.”
14455 @end quotation
14457 Followed.
14459 @quotation
14461 “The recommended level of support for the @code{Address} attribute is:
14463 @code{X'Address} should produce a useful result if @code{X} is an
14464 object that is aliased or of a by-reference type, or is an entity whose
14465 @code{Address} has been specified.”
14466 @end quotation
14468 Followed.  A valid address will be produced even if none of those
14469 conditions have been met.  If necessary, the object is forced into
14470 memory to ensure the address is valid.
14472 @quotation
14474 “An implementation should support @code{Address} clauses for imported
14475 subprograms.”
14476 @end quotation
14478 Followed.
14480 @quotation
14482 “Objects (including subcomponents) that are aliased or of a by-reference
14483 type should be allocated on storage element boundaries.”
14484 @end quotation
14486 Followed.
14488 @quotation
14490 “If the @code{Address} of an object is specified, or it is imported or exported,
14491 then the implementation should not perform optimizations based on
14492 assumptions of no aliases.”
14493 @end quotation
14495 Followed.
14497 @geindex Alignment clauses
14499 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
14500 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{23f}
14501 @section RM 13.3(29-35): Alignment Clauses
14504 @quotation
14506 “The recommended level of support for the @code{Alignment} attribute for
14507 subtypes is:
14509 An implementation should support specified Alignments that are factors
14510 and multiples of the number of storage elements per word, subject to the
14511 following:”
14512 @end quotation
14514 Followed.
14516 @quotation
14518 “An implementation need not support specified Alignments for
14519 combinations of Sizes and Alignments that cannot be easily
14520 loaded and stored by available machine instructions.”
14521 @end quotation
14523 Followed.
14525 @quotation
14527 “An implementation need not support specified Alignments that are
14528 greater than the maximum @code{Alignment} the implementation ever returns by
14529 default.”
14530 @end quotation
14532 Followed.
14534 @quotation
14536 “The recommended level of support for the @code{Alignment} attribute for
14537 objects is:
14539 Same as above, for subtypes, but in addition:”
14540 @end quotation
14542 Followed.
14544 @quotation
14546 “For stand-alone library-level objects of statically constrained
14547 subtypes, the implementation should support all alignments
14548 supported by the target linker.  For example, page alignment is likely to
14549 be supported for such objects, but not for subtypes.”
14550 @end quotation
14552 Followed.
14554 @geindex Size clauses
14556 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
14557 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{240}
14558 @section RM 13.3(42-43): Size Clauses
14561 @quotation
14563 “The recommended level of support for the @code{Size} attribute of
14564 objects is:
14566 A @code{Size} clause should be supported for an object if the specified
14567 @code{Size} is at least as large as its subtype’s @code{Size}, and
14568 corresponds to a size in storage elements that is a multiple of the
14569 object’s @code{Alignment} (if the @code{Alignment} is nonzero).”
14570 @end quotation
14572 Followed.
14574 @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
14575 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{241}
14576 @section RM 13.3(50-56): Size Clauses
14579 @quotation
14581 “If the @code{Size} of a subtype is specified, and allows for efficient
14582 independent addressability (see 9.10) on the target architecture, then
14583 the @code{Size} of the following objects of the subtype should equal the
14584 @code{Size} of the subtype:
14586 Aliased objects (including components).”
14587 @end quotation
14589 Followed.
14591 @quotation
14593 “@cite{Size} clause on a composite subtype should not affect the
14594 internal layout of components.”
14595 @end quotation
14597 Followed. But note that this can be overridden by use of the implementation
14598 pragma Implicit_Packing in the case of packed arrays.
14600 @quotation
14602 “The recommended level of support for the @code{Size} attribute of subtypes is:
14604 The @code{Size} (if not specified) of a static discrete or fixed point
14605 subtype should be the number of bits needed to represent each value
14606 belonging to the subtype using an unbiased representation, leaving space
14607 for a sign bit only if the subtype contains negative values.  If such a
14608 subtype is a first subtype, then an implementation should support a
14609 specified @code{Size} for it that reflects this representation.”
14610 @end quotation
14612 Followed.
14614 @quotation
14616 “For a subtype implemented with levels of indirection, the @code{Size}
14617 should include the size of the pointers, but not the size of what they
14618 point at.”
14619 @end quotation
14621 Followed.
14623 @geindex Component_Size clauses
14625 @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
14626 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{242}
14627 @section RM 13.3(71-73): Component Size Clauses
14630 @quotation
14632 “The recommended level of support for the @code{Component_Size}
14633 attribute is:
14635 An implementation need not support specified @code{Component_Sizes} that are
14636 less than the @code{Size} of the component subtype.”
14637 @end quotation
14639 Followed.
14641 @quotation
14643 “An implementation should support specified Component_Sizes that
14644 are factors and multiples of the word size.  For such
14645 Component_Sizes, the array should contain no gaps between
14646 components.  For other Component_Sizes (if supported), the array
14647 should contain no gaps between components when packing is also
14648 specified; the implementation should forbid this combination in cases
14649 where it cannot support a no-gaps representation.”
14650 @end quotation
14652 Followed.
14654 @geindex Enumeration representation clauses
14656 @geindex Representation clauses
14657 @geindex enumeration
14659 @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
14660 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{243}
14661 @section RM 13.4(9-10): Enumeration Representation Clauses
14664 @quotation
14666 “The recommended level of support for enumeration representation clauses
14669 An implementation need not support enumeration representation clauses
14670 for boolean types, but should at minimum support the internal codes in
14671 the range @code{System.Min_Int .. System.Max_Int}.”
14672 @end quotation
14674 Followed.
14676 @geindex Record representation clauses
14678 @geindex Representation clauses
14679 @geindex records
14681 @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
14682 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{244}
14683 @section RM 13.5.1(17-22): Record Representation Clauses
14686 @quotation
14688 “The recommended level of support for
14689 `record_representation_clause's is:
14691 An implementation should support storage places that can be extracted
14692 with a load, mask, shift sequence of machine code, and set with a load,
14693 shift, mask, store sequence, given the available machine instructions
14694 and run-time model.”
14695 @end quotation
14697 Followed.
14699 @quotation
14701 “A storage place should be supported if its size is equal to the
14702 @code{Size} of the component subtype, and it starts and ends on a
14703 boundary that obeys the @code{Alignment} of the component subtype.”
14704 @end quotation
14706 Followed.
14708 @quotation
14710 “If the default bit ordering applies to the declaration of a given type,
14711 then for a component whose subtype’s @code{Size} is less than the word
14712 size, any storage place that does not cross an aligned word boundary
14713 should be supported.”
14714 @end quotation
14716 Followed.
14718 @quotation
14720 “An implementation may reserve a storage place for the tag field of a
14721 tagged type, and disallow other components from overlapping that place.”
14722 @end quotation
14724 Followed.  The storage place for the tag field is the beginning of the tagged
14725 record, and its size is Address’Size.  GNAT will reject an explicit component
14726 clause for the tag field.
14728 @quotation
14730 “An implementation need not support a `component_clause' for a
14731 component of an extension part if the storage place is not after the
14732 storage places of all components of the parent type, whether or not
14733 those storage places had been specified.”
14734 @end quotation
14736 Followed.  The above advice on record representation clauses is followed,
14737 and all mentioned features are implemented.
14739 @geindex Storage place attributes
14741 @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
14742 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{245}
14743 @section RM 13.5.2(5): Storage Place Attributes
14746 @quotation
14748 “If a component is represented using some form of pointer (such as an
14749 offset) to the actual data of the component, and this data is contiguous
14750 with the rest of the object, then the storage place attributes should
14751 reflect the place of the actual data, not the pointer.  If a component is
14752 allocated discontinuously from the rest of the object, then a warning
14753 should be generated upon reference to one of its storage place
14754 attributes.”
14755 @end quotation
14757 Followed.  There are no such components in GNAT.
14759 @geindex Bit ordering
14761 @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
14762 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{246}
14763 @section RM 13.5.3(7-8): Bit Ordering
14766 @quotation
14768 “The recommended level of support for the non-default bit ordering is:
14770 The implementation should support the nondefault bit ordering in addition
14771 to the default bit ordering.”
14772 @end quotation
14774 Followed.
14776 @geindex Address
14777 @geindex as private type
14779 @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
14780 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{247}
14781 @section RM 13.7(37): Address as Private
14784 @quotation
14786 “@cite{Address} should be of a private type.”
14787 @end quotation
14789 Followed.
14791 @geindex Operations
14792 @geindex on `@w{`}Address`@w{`}
14794 @geindex Address
14795 @geindex operations of
14797 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14798 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{248}
14799 @section RM 13.7.1(16): Address Operations
14802 @quotation
14804 “Operations in @code{System} and its children should reflect the target
14805 environment semantics as closely as is reasonable.  For example, on most
14806 machines, it makes sense for address arithmetic to ‘wrap around’.
14807 Operations that do not make sense should raise @code{Program_Error}.”
14808 @end quotation
14810 Followed.  Address arithmetic is modular arithmetic that wraps around.  No
14811 operation raises @code{Program_Error}, since all operations make sense.
14813 @geindex Unchecked conversion
14815 @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
14816 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{249}
14817 @section RM 13.9(14-17): Unchecked Conversion
14820 @quotation
14822 “The @code{Size} of an array object should not include its bounds; hence,
14823 the bounds should not be part of the converted data.”
14824 @end quotation
14826 Followed.
14828 @quotation
14830 “The implementation should not generate unnecessary run-time checks to
14831 ensure that the representation of @code{S} is a representation of the
14832 target type.  It should take advantage of the permission to return by
14833 reference when possible.  Restrictions on unchecked conversions should be
14834 avoided unless required by the target environment.”
14835 @end quotation
14837 Followed.  There are no restrictions on unchecked conversion.  A warning is
14838 generated if the source and target types do not have the same size since
14839 the semantics in this case may be target dependent.
14841 @quotation
14843 “The recommended level of support for unchecked conversions is:
14845 Unchecked conversions should be supported and should be reversible in
14846 the cases where this clause defines the result.  To enable meaningful use
14847 of unchecked conversion, a contiguous representation should be used for
14848 elementary subtypes, for statically constrained array subtypes whose
14849 component subtype is one of the subtypes described in this paragraph,
14850 and for record subtypes without discriminants whose component subtypes
14851 are described in this paragraph.”
14852 @end quotation
14854 Followed.
14856 @geindex Heap usage
14857 @geindex implicit
14859 @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
14860 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{24a}
14861 @section RM 13.11(23-25): Implicit Heap Usage
14864 @quotation
14866 “An implementation should document any cases in which it dynamically
14867 allocates heap storage for a purpose other than the evaluation of an
14868 allocator.”
14869 @end quotation
14871 Followed, the only other points at which heap storage is dynamically
14872 allocated are as follows:
14875 @itemize *
14877 @item 
14878 At initial elaboration time, to allocate dynamically sized global
14879 objects.
14881 @item 
14882 To allocate space for a task when a task is created.
14884 @item 
14885 To extend the secondary stack dynamically when needed.  The secondary
14886 stack is used for returning variable length results.
14887 @end itemize
14890 @quotation
14892 “A default (implementation-provided) storage pool for an
14893 access-to-constant type should not have overhead to support deallocation of
14894 individual objects.”
14895 @end quotation
14897 Followed.
14899 @quotation
14901 “A storage pool for an anonymous access type should be created at the
14902 point of an allocator for the type, and be reclaimed when the designated
14903 object becomes inaccessible.”
14904 @end quotation
14906 Followed.
14908 @geindex Unchecked deallocation
14910 @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
14911 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{24b}
14912 @section RM 13.11.2(17): Unchecked Deallocation
14915 @quotation
14917 “For a standard storage pool, @code{Free} should actually reclaim the
14918 storage.”
14919 @end quotation
14921 Followed.
14923 @geindex Stream oriented attributes
14925 @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
14926 @anchor{gnat_rm/implementation_advice rm-13-13-2-1-6-stream-oriented-attributes}@anchor{24c}
14927 @section RM 13.13.2(1.6): Stream Oriented Attributes
14930 @quotation
14932 “If not specified, the value of Stream_Size for an elementary type
14933 should be the number of bits that corresponds to the minimum number of
14934 stream elements required by the first subtype of the type, rounded up
14935 to the nearest factor or multiple of the word size that is also a
14936 multiple of the stream element size.”
14937 @end quotation
14939 Followed, except that the number of stream elements is 1, 2, 3, 4 or 8.
14940 The Stream_Size may be used to override the default choice.
14942 The default implementation is based on direct binary representations and is
14943 therefore target- and endianness-dependent.  To address this issue, GNAT also
14944 supplies an alternate implementation of the stream attributes @code{Read} and
14945 @code{Write}, which uses the target-independent XDR standard representation for
14946 scalar types. This XDR alternative can be enabled via the binder switch -xdr.
14948 @geindex XDR representation
14950 @geindex Read attribute
14952 @geindex Write attribute
14954 @geindex Stream oriented attributes
14956 @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
14957 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{24d}
14958 @section RM A.1(52): Names of Predefined Numeric Types
14961 @quotation
14963 “If an implementation provides additional named predefined integer types,
14964 then the names should end with @code{Integer} as in
14965 @code{Long_Integer}.  If an implementation provides additional named
14966 predefined floating point types, then the names should end with
14967 @code{Float} as in @code{Long_Float}.”
14968 @end quotation
14970 Followed.
14972 @geindex Ada.Characters.Handling
14974 @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
14975 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{24e}
14976 @section RM A.3.2(49): @code{Ada.Characters.Handling}
14979 @quotation
14981 “If an implementation provides a localized definition of @code{Character}
14982 or @code{Wide_Character}, then the effects of the subprograms in
14983 @code{Characters.Handling} should reflect the localizations.
14984 See also 3.5.2.”
14985 @end quotation
14987 Followed.  GNAT provides no such localized definitions.
14989 @geindex Bounded-length strings
14991 @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
14992 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{24f}
14993 @section RM A.4.4(106): Bounded-Length String Handling
14996 @quotation
14998 “Bounded string objects should not be implemented by implicit pointers
14999 and dynamic allocation.”
15000 @end quotation
15002 Followed.  No implicit pointers or dynamic allocation are used.
15004 @geindex Random number generation
15006 @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
15007 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{250}
15008 @section RM A.5.2(46-47): Random Number Generation
15011 @quotation
15013 “Any storage associated with an object of type @code{Generator} should be
15014 reclaimed on exit from the scope of the object.”
15015 @end quotation
15017 Followed.
15019 @quotation
15021 “If the generator period is sufficiently long in relation to the number
15022 of distinct initiator values, then each possible value of
15023 @code{Initiator} passed to @code{Reset} should initiate a sequence of
15024 random numbers that does not, in a practical sense, overlap the sequence
15025 initiated by any other value.  If this is not possible, then the mapping
15026 between initiator values and generator states should be a rapidly
15027 varying function of the initiator value.”
15028 @end quotation
15030 Followed.  The generator period is sufficiently long for the first
15031 condition here to hold true.
15033 @geindex Get_Immediate
15035 @node RM A 10 7 23 Get_Immediate,RM A 18 Containers,RM A 5 2 46-47 Random Number Generation,Implementation Advice
15036 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{251}
15037 @section RM A.10.7(23): @code{Get_Immediate}
15040 @quotation
15042 “The @code{Get_Immediate} procedures should be implemented with
15043 unbuffered input.  For a device such as a keyboard, input should be
15044 available if a key has already been typed, whereas for a disk
15045 file, input should always be available except at end of file.  For a file
15046 associated with a keyboard-like device, any line-editing features of the
15047 underlying operating system should be disabled during the execution of
15048 @code{Get_Immediate}.”
15049 @end quotation
15051 Followed on all targets except VxWorks. For VxWorks, there is no way to
15052 provide this functionality that does not result in the input buffer being
15053 flushed before the @code{Get_Immediate} call. A special unit
15054 @code{Interfaces.Vxworks.IO} is provided that contains routines to enable
15055 this functionality.
15057 @geindex Containers
15059 @node RM A 18 Containers,RM B 1 39-41 Pragma Export,RM A 10 7 23 Get_Immediate,Implementation Advice
15060 @anchor{gnat_rm/implementation_advice rm-a-18-containers}@anchor{252}
15061 @section RM A.18: @code{Containers}
15064 All implementation advice pertaining to Ada.Containers and its
15065 child units (that is, all implementation advice occurring within
15066 section A.18 and its subsections) is followed except for A.18.24(17):
15068 @quotation
15070 “Bounded ordered set objects should be implemented without implicit pointers or dynamic allocation. “
15071 @end quotation
15073 The implementations of the two Reference_Preserving_Key functions of
15074 the generic package Ada.Containers.Bounded_Ordered_Sets each currently make
15075 use of dynamic allocation; other operations on bounded ordered set objects
15076 follow the implementation advice.
15078 @geindex Export
15080 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 18 Containers,Implementation Advice
15081 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{253}
15082 @section RM B.1(39-41): Pragma @code{Export}
15085 @quotation
15087 “If an implementation supports pragma @code{Export} to a given language,
15088 then it should also allow the main subprogram to be written in that
15089 language.  It should support some mechanism for invoking the elaboration
15090 of the Ada library units included in the system, and for invoking the
15091 finalization of the environment task.  On typical systems, the
15092 recommended mechanism is to provide two subprograms whose link names are
15093 @code{adainit} and @code{adafinal}.  @code{adainit} should contain the
15094 elaboration code for library units.  @code{adafinal} should contain the
15095 finalization code.  These subprograms should have no effect the second
15096 and subsequent time they are called.”
15097 @end quotation
15099 Followed.
15101 @quotation
15103 “Automatic elaboration of pre-elaborated packages should be
15104 provided when pragma @code{Export} is supported.”
15105 @end quotation
15107 Followed when the main program is in Ada.  If the main program is in a
15108 foreign language, then
15109 @code{adainit} must be called to elaborate pre-elaborated
15110 packages.
15112 @quotation
15114 “For each supported convention `L' other than @code{Intrinsic}, an
15115 implementation should support @code{Import} and @code{Export} pragmas
15116 for objects of `L'-compatible types and for subprograms, and pragma
15117 @cite{Convention} for `L'-eligible types and for subprograms,
15118 presuming the other language has corresponding features.  Pragma
15119 @code{Convention} need not be supported for scalar types.”
15120 @end quotation
15122 Followed.
15124 @geindex Package Interfaces
15126 @geindex Interfaces
15128 @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
15129 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{254}
15130 @section RM B.2(12-13): Package @code{Interfaces}
15133 @quotation
15135 “For each implementation-defined convention identifier, there should be a
15136 child package of package Interfaces with the corresponding name.  This
15137 package should contain any declarations that would be useful for
15138 interfacing to the language (implementation) represented by the
15139 convention.  Any declarations useful for interfacing to any language on
15140 the given hardware architecture should be provided directly in
15141 @code{Interfaces}.”
15142 @end quotation
15144 Followed.
15146 @quotation
15148 “An implementation supporting an interface to C, COBOL, or Fortran should
15149 provide the corresponding package or packages described in the following
15150 clauses.”
15151 @end quotation
15153 Followed.  GNAT provides all the packages described in this section.
15155 @geindex C
15156 @geindex interfacing with
15158 @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
15159 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{255}
15160 @section RM B.3(63-71): Interfacing with C
15163 @quotation
15165 “An implementation should support the following interface correspondences
15166 between Ada and C.”
15167 @end quotation
15169 Followed.
15171 @quotation
15173 “An Ada procedure corresponds to a void-returning C function.”
15174 @end quotation
15176 Followed.
15178 @quotation
15180 “An Ada function corresponds to a non-void C function.”
15181 @end quotation
15183 Followed.
15185 @quotation
15187 “An Ada @code{in} scalar parameter is passed as a scalar argument to a C
15188 function.”
15189 @end quotation
15191 Followed.
15193 @quotation
15195 “An Ada @code{in} parameter of an access-to-object type with designated
15196 type @code{T} is passed as a @code{t*} argument to a C function,
15197 where @code{t} is the C type corresponding to the Ada type @code{T}.”
15198 @end quotation
15200 Followed.
15202 @quotation
15204 “An Ada access @code{T} parameter, or an Ada @code{out} or @code{in out}
15205 parameter of an elementary type @code{T}, is passed as a @code{t*}
15206 argument to a C function, where @code{t} is the C type corresponding to
15207 the Ada type @code{T}.  In the case of an elementary @code{out} or
15208 @code{in out} parameter, a pointer to a temporary copy is used to
15209 preserve by-copy semantics.”
15210 @end quotation
15212 Followed.
15214 @quotation
15216 “An Ada parameter of a record type @code{T}, of any mode, is passed as a
15217 @code{t*} argument to a C function, where @code{t} is the C
15218 structure corresponding to the Ada type @code{T}.”
15219 @end quotation
15221 Followed.  This convention may be overridden by the use of the C_Pass_By_Copy
15222 pragma, or Convention, or by explicitly specifying the mechanism for a given
15223 call using an extended import or export pragma.
15225 @quotation
15227 “An Ada parameter of an array type with component type @code{T}, of any
15228 mode, is passed as a @code{t*} argument to a C function, where
15229 @code{t} is the C type corresponding to the Ada type @code{T}.”
15230 @end quotation
15232 Followed.
15234 @quotation
15236 “An Ada parameter of an access-to-subprogram type is passed as a pointer
15237 to a C function whose prototype corresponds to the designated
15238 subprogram’s specification.”
15239 @end quotation
15241 Followed.
15243 @geindex COBOL
15244 @geindex interfacing with
15246 @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
15247 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{256}
15248 @section RM B.4(95-98): Interfacing with COBOL
15251 @quotation
15253 “An Ada implementation should support the following interface
15254 correspondences between Ada and COBOL.”
15255 @end quotation
15257 Followed.
15259 @quotation
15261 “An Ada access @code{T} parameter is passed as a @code{BY REFERENCE} data item of
15262 the COBOL type corresponding to @code{T}.”
15263 @end quotation
15265 Followed.
15267 @quotation
15269 “An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
15270 the corresponding COBOL type.”
15271 @end quotation
15273 Followed.
15275 @quotation
15277 “Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
15278 COBOL type corresponding to the Ada parameter type; for scalars, a local
15279 copy is used if necessary to ensure by-copy semantics.”
15280 @end quotation
15282 Followed.
15284 @geindex Fortran
15285 @geindex interfacing with
15287 @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
15288 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{257}
15289 @section RM B.5(22-26): Interfacing with Fortran
15292 @quotation
15294 “An Ada implementation should support the following interface
15295 correspondences between Ada and Fortran:”
15296 @end quotation
15298 Followed.
15300 @quotation
15302 “An Ada procedure corresponds to a Fortran subroutine.”
15303 @end quotation
15305 Followed.
15307 @quotation
15309 “An Ada function corresponds to a Fortran function.”
15310 @end quotation
15312 Followed.
15314 @quotation
15316 “An Ada parameter of an elementary, array, or record type @code{T} is
15317 passed as a @code{T} argument to a Fortran procedure, where @code{T} is
15318 the Fortran type corresponding to the Ada type @code{T}, and where the
15319 INTENT attribute of the corresponding dummy argument matches the Ada
15320 formal parameter mode; the Fortran implementation’s parameter passing
15321 conventions are used.  For elementary types, a local copy is used if
15322 necessary to ensure by-copy semantics.”
15323 @end quotation
15325 Followed.
15327 @quotation
15329 “An Ada parameter of an access-to-subprogram type is passed as a
15330 reference to a Fortran procedure whose interface corresponds to the
15331 designated subprogram’s specification.”
15332 @end quotation
15334 Followed.
15336 @geindex Machine operations
15338 @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
15339 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{258}
15340 @section RM C.1(3-5): Access to Machine Operations
15343 @quotation
15345 “The machine code or intrinsic support should allow access to all
15346 operations normally available to assembly language programmers for the
15347 target environment, including privileged instructions, if any.”
15348 @end quotation
15350 Followed.
15352 @quotation
15354 “The interfacing pragmas (see Annex B) should support interface to
15355 assembler; the default assembler should be associated with the
15356 convention identifier @code{Assembler}.”
15357 @end quotation
15359 Followed.
15361 @quotation
15363 “If an entity is exported to assembly language, then the implementation
15364 should allocate it at an addressable location, and should ensure that it
15365 is retained by the linking process, even if not otherwise referenced
15366 from the Ada code.  The implementation should assume that any call to a
15367 machine code or assembler subprogram is allowed to read or update every
15368 object that is specified as exported.”
15369 @end quotation
15371 Followed.
15373 @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
15374 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{259}
15375 @section RM C.1(10-16): Access to Machine Operations
15378 @quotation
15380 “The implementation should ensure that little or no overhead is
15381 associated with calling intrinsic and machine-code subprograms.”
15382 @end quotation
15384 Followed for both intrinsics and machine-code subprograms.
15386 @quotation
15388 “It is recommended that intrinsic subprograms be provided for convenient
15389 access to any machine operations that provide special capabilities or
15390 efficiency and that are not otherwise available through the language
15391 constructs.”
15392 @end quotation
15394 Followed.  A full set of machine operation intrinsic subprograms is provided.
15396 @quotation
15398 “Atomic read-modify-write operations—e.g., test and set, compare and
15399 swap, decrement and test, enqueue/dequeue.”
15400 @end quotation
15402 Followed on any target supporting such operations.
15404 @quotation
15406 “Standard numeric functions—e.g.:, sin, log.”
15407 @end quotation
15409 Followed on any target supporting such operations.
15411 @quotation
15413 “String manipulation operations—e.g.:, translate and test.”
15414 @end quotation
15416 Followed on any target supporting such operations.
15418 @quotation
15420 “Vector operations—e.g.:, compare vector against thresholds.”
15421 @end quotation
15423 Followed on any target supporting such operations.
15425 @quotation
15427 “Direct operations on I/O ports.”
15428 @end quotation
15430 Followed on any target supporting such operations.
15432 @geindex Interrupt support
15434 @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
15435 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{25a}
15436 @section RM C.3(28): Interrupt Support
15439 @quotation
15441 “If the @code{Ceiling_Locking} policy is not in effect, the
15442 implementation should provide means for the application to specify which
15443 interrupts are to be blocked during protected actions, if the underlying
15444 system allows for a finer-grain control of interrupt blocking.”
15445 @end quotation
15447 Followed.  The underlying system does not allow for finer-grain control
15448 of interrupt blocking.
15450 @geindex Protected procedure handlers
15452 @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
15453 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{25b}
15454 @section RM C.3.1(20-21): Protected Procedure Handlers
15457 @quotation
15459 “Whenever possible, the implementation should allow interrupt handlers to
15460 be called directly by the hardware.”
15461 @end quotation
15463 Followed on any target where the underlying operating system permits
15464 such direct calls.
15466 @quotation
15468 “Whenever practical, violations of any
15469 implementation-defined restrictions should be detected before run time.”
15470 @end quotation
15472 Followed.  Compile time warnings are given when possible.
15474 @geindex Package `@w{`}Interrupts`@w{`}
15476 @geindex Interrupts
15478 @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
15479 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{25c}
15480 @section RM C.3.2(25): Package @code{Interrupts}
15483 @quotation
15485 “If implementation-defined forms of interrupt handler procedures are
15486 supported, such as protected procedures with parameters, then for each
15487 such form of a handler, a type analogous to @code{Parameterless_Handler}
15488 should be specified in a child package of @code{Interrupts}, with the
15489 same operations as in the predefined package Interrupts.”
15490 @end quotation
15492 Followed.
15494 @geindex Pre-elaboration requirements
15496 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
15497 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{25d}
15498 @section RM C.4(14): Pre-elaboration Requirements
15501 @quotation
15503 “It is recommended that pre-elaborated packages be implemented in such a
15504 way that there should be little or no code executed at run time for the
15505 elaboration of entities not already covered by the Implementation
15506 Requirements.”
15507 @end quotation
15509 Followed.  Executable code is generated in some cases, e.g., loops
15510 to initialize large arrays.
15512 @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
15513 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{25e}
15514 @section RM C.5(8): Pragma @code{Discard_Names}
15517 @quotation
15519 “If the pragma applies to an entity, then the implementation should
15520 reduce the amount of storage used for storing names associated with that
15521 entity.”
15522 @end quotation
15524 Followed.
15526 @geindex Package Task_Attributes
15528 @geindex Task_Attributes
15530 @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
15531 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{25f}
15532 @section RM C.7.2(30): The Package Task_Attributes
15535 @quotation
15537 “Some implementations are targeted to domains in which memory use at run
15538 time must be completely deterministic.  For such implementations, it is
15539 recommended that the storage for task attributes will be pre-allocated
15540 statically and not from the heap.  This can be accomplished by either
15541 placing restrictions on the number and the size of the task’s
15542 attributes, or by using the pre-allocated storage for the first @code{N}
15543 attribute objects, and the heap for the others.  In the latter case,
15544 @code{N} should be documented.”
15545 @end quotation
15547 Not followed.  This implementation is not targeted to such a domain.
15549 @geindex Locking Policies
15551 @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
15552 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{260}
15553 @section RM D.3(17): Locking Policies
15556 @quotation
15558 “The implementation should use names that end with @code{_Locking} for
15559 locking policies defined by the implementation.”
15560 @end quotation
15562 Followed.  Two implementation-defined locking policies are defined,
15563 whose names (@code{Inheritance_Locking} and
15564 @code{Concurrent_Readers_Locking}) follow this suggestion.
15566 @geindex Entry queuing policies
15568 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
15569 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{261}
15570 @section RM D.4(16): Entry Queuing Policies
15573 @quotation
15575 “Names that end with @code{_Queuing} should be used
15576 for all implementation-defined queuing policies.”
15577 @end quotation
15579 Followed.  No such implementation-defined queuing policies exist.
15581 @geindex Preemptive abort
15583 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
15584 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{262}
15585 @section RM D.6(9-10): Preemptive Abort
15588 @quotation
15590 “Even though the `abort_statement' is included in the list of
15591 potentially blocking operations (see 9.5.1), it is recommended that this
15592 statement be implemented in a way that never requires the task executing
15593 the `abort_statement' to block.”
15594 @end quotation
15596 Followed.
15598 @quotation
15600 “On a multi-processor, the delay associated with aborting a task on
15601 another processor should be bounded; the implementation should use
15602 periodic polling, if necessary, to achieve this.”
15603 @end quotation
15605 Followed.
15607 @geindex Tasking restrictions
15609 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
15610 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{263}
15611 @section RM D.7(21): Tasking Restrictions
15614 @quotation
15616 “When feasible, the implementation should take advantage of the specified
15617 restrictions to produce a more efficient implementation.”
15618 @end quotation
15620 GNAT currently takes advantage of these restrictions by providing an optimized
15621 run time when the Ravenscar profile and the GNAT restricted run time set
15622 of restrictions are specified.  See pragma @code{Profile (Ravenscar)} and
15623 pragma @code{Profile (Restricted)} for more details.
15625 @geindex Time
15626 @geindex monotonic
15628 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
15629 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{264}
15630 @section RM D.8(47-49): Monotonic Time
15633 @quotation
15635 “When appropriate, implementations should provide configuration
15636 mechanisms to change the value of @code{Tick}.”
15637 @end quotation
15639 Such configuration mechanisms are not appropriate to this implementation
15640 and are thus not supported.
15642 @quotation
15644 “It is recommended that @code{Calendar.Clock} and @code{Real_Time.Clock}
15645 be implemented as transformations of the same time base.”
15646 @end quotation
15648 Followed.
15650 @quotation
15652 “It is recommended that the best time base which exists in
15653 the underlying system be available to the application through
15654 @code{Clock}.  @cite{Best} may mean highest accuracy or largest range.”
15655 @end quotation
15657 Followed.
15659 @geindex Partition communication subsystem
15661 @geindex PCS
15663 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
15664 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{265}
15665 @section RM E.5(28-29): Partition Communication Subsystem
15668 @quotation
15670 “Whenever possible, the PCS on the called partition should allow for
15671 multiple tasks to call the RPC-receiver with different messages and
15672 should allow them to block until the corresponding subprogram body
15673 returns.”
15674 @end quotation
15676 Followed by GLADE, a separately supplied PCS that can be used with
15677 GNAT.
15679 @quotation
15681 “The @code{Write} operation on a stream of type @code{Params_Stream_Type}
15682 should raise @code{Storage_Error} if it runs out of space trying to
15683 write the @code{Item} into the stream.”
15684 @end quotation
15686 Followed by GLADE, a separately supplied PCS that can be used with
15687 GNAT.
15689 @geindex COBOL support
15691 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
15692 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{266}
15693 @section RM F(7): COBOL Support
15696 @quotation
15698 “If COBOL (respectively, C) is widely supported in the target
15699 environment, implementations supporting the Information Systems Annex
15700 should provide the child package @code{Interfaces.COBOL} (respectively,
15701 @code{Interfaces.C}) specified in Annex B and should support a
15702 @code{convention_identifier} of COBOL (respectively, C) in the interfacing
15703 pragmas (see Annex B), thus allowing Ada programs to interface with
15704 programs written in that language.”
15705 @end quotation
15707 Followed.
15709 @geindex Decimal radix support
15711 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15712 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{267}
15713 @section RM F.1(2): Decimal Radix Support
15716 @quotation
15718 “Packed decimal should be used as the internal representation for objects
15719 of subtype @code{S} when @code{S}’Machine_Radix = 10.”
15720 @end quotation
15722 Not followed.  GNAT ignores @code{S}’Machine_Radix and always uses binary
15723 representations.
15725 @geindex Numerics
15727 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15728 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{268}
15729 @section RM G: Numerics
15732 @quotation
15734 “If Fortran (respectively, C) is widely supported in the target
15735 environment, implementations supporting the Numerics Annex
15736 should provide the child package @code{Interfaces.Fortran} (respectively,
15737 @code{Interfaces.C}) specified in Annex B and should support a
15738 @code{convention_identifier} of Fortran (respectively, C) in the interfacing
15739 pragmas (see Annex B), thus allowing Ada programs to interface with
15740 programs written in that language.”
15741 @end quotation
15743 Followed.
15745 @geindex Complex types
15747 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15748 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{269}
15749 @section RM G.1.1(56-58): Complex Types
15752 @quotation
15754 “Because the usual mathematical meaning of multiplication of a complex
15755 operand and a real operand is that of the scaling of both components of
15756 the former by the latter, an implementation should not perform this
15757 operation by first promoting the real operand to complex type and then
15758 performing a full complex multiplication.  In systems that, in the
15759 future, support an Ada binding to IEC 559:1989, the latter technique
15760 will not generate the required result when one of the components of the
15761 complex operand is infinite.  (Explicit multiplication of the infinite
15762 component by the zero component obtained during promotion yields a NaN
15763 that propagates into the final result.) Analogous advice applies in the
15764 case of multiplication of a complex operand and a pure-imaginary
15765 operand, and in the case of division of a complex operand by a real or
15766 pure-imaginary operand.”
15767 @end quotation
15769 Not followed.
15771 @quotation
15773 “Similarly, because the usual mathematical meaning of addition of a
15774 complex operand and a real operand is that the imaginary operand remains
15775 unchanged, an implementation should not perform this operation by first
15776 promoting the real operand to complex type and then performing a full
15777 complex addition.  In implementations in which the @code{Signed_Zeros}
15778 attribute of the component type is @code{True} (and which therefore
15779 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15780 predefined arithmetic operations), the latter technique will not
15781 generate the required result when the imaginary component of the complex
15782 operand is a negatively signed zero.  (Explicit addition of the negative
15783 zero to the zero obtained during promotion yields a positive zero.)
15784 Analogous advice applies in the case of addition of a complex operand
15785 and a pure-imaginary operand, and in the case of subtraction of a
15786 complex operand and a real or pure-imaginary operand.”
15787 @end quotation
15789 Not followed.
15791 @quotation
15793 “Implementations in which @code{Real'Signed_Zeros} is @code{True} should
15794 attempt to provide a rational treatment of the signs of zero results and
15795 result components.  As one example, the result of the @code{Argument}
15796 function should have the sign of the imaginary component of the
15797 parameter @code{X} when the point represented by that parameter lies on
15798 the positive real axis; as another, the sign of the imaginary component
15799 of the @code{Compose_From_Polar} function should be the same as
15800 (respectively, the opposite of) that of the @code{Argument} parameter when that
15801 parameter has a value of zero and the @code{Modulus} parameter has a
15802 nonnegative (respectively, negative) value.”
15803 @end quotation
15805 Followed.
15807 @geindex Complex elementary functions
15809 @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
15810 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{26a}
15811 @section RM G.1.2(49): Complex Elementary Functions
15814 @quotation
15816 “Implementations in which @code{Complex_Types.Real'Signed_Zeros} is
15817 @code{True} should attempt to provide a rational treatment of the signs
15818 of zero results and result components.  For example, many of the complex
15819 elementary functions have components that are odd functions of one of
15820 the parameter components; in these cases, the result component should
15821 have the sign of the parameter component at the origin.  Other complex
15822 elementary functions have zero components whose sign is opposite that of
15823 a parameter component at the origin, or is always positive or always
15824 negative.”
15825 @end quotation
15827 Followed.
15829 @geindex Accuracy requirements
15831 @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
15832 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{26b}
15833 @section RM G.2.4(19): Accuracy Requirements
15836 @quotation
15838 “The versions of the forward trigonometric functions without a
15839 @code{Cycle} parameter should not be implemented by calling the
15840 corresponding version with a @code{Cycle} parameter of
15841 @code{2.0*Numerics.Pi}, since this will not provide the required
15842 accuracy in some portions of the domain.  For the same reason, the
15843 version of @code{Log} without a @code{Base} parameter should not be
15844 implemented by calling the corresponding version with a @code{Base}
15845 parameter of @code{Numerics.e}.”
15846 @end quotation
15848 Followed.
15850 @geindex Complex arithmetic accuracy
15852 @geindex Accuracy
15853 @geindex complex arithmetic
15855 @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
15856 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{26c}
15857 @section RM G.2.6(15): Complex Arithmetic Accuracy
15860 @quotation
15862 “The version of the @code{Compose_From_Polar} function without a
15863 @code{Cycle} parameter should not be implemented by calling the
15864 corresponding version with a @code{Cycle} parameter of
15865 @code{2.0*Numerics.Pi}, since this will not provide the required
15866 accuracy in some portions of the domain.”
15867 @end quotation
15869 Followed.
15871 @geindex Sequential elaboration policy
15873 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15874 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{26d}
15875 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15878 @quotation
15880 “If the partition elaboration policy is @code{Sequential} and the
15881 Environment task becomes permanently blocked during elaboration then the
15882 partition is deadlocked and it is recommended that the partition be
15883 immediately terminated.”
15884 @end quotation
15886 Not followed.
15888 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15889 @anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{26e}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{26f}@anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}
15890 @chapter Implementation Defined Characteristics
15893 In addition to the implementation dependent pragmas and attributes, and the
15894 implementation advice, there are a number of other Ada features that are
15895 potentially implementation dependent and are designated as
15896 implementation-defined. These are mentioned throughout the Ada Reference
15897 Manual, and are summarized in Annex M.
15899 A requirement for conforming Ada compilers is that they provide
15900 documentation describing how the implementation deals with each of these
15901 issues.  In this chapter you will find each point in Annex M listed,
15902 followed by a description of how GNAT handles the implementation dependence.
15904 You can use this chapter as a guide to minimizing implementation
15905 dependent features in your programs if portability to other compilers
15906 and other operating systems is an important consideration.  The numbers
15907 in each entry below correspond to the paragraph numbers in the Ada
15908 Reference Manual.
15911 @itemize *
15913 @item 
15914 “Whether or not each recommendation given in Implementation
15915 Advice is followed.  See 1.1.2(37).”
15916 @end itemize
15918 See @ref{a,,Implementation Advice}.
15921 @itemize *
15923 @item 
15924 “Capacity limitations of the implementation.  See 1.1.3(3).”
15925 @end itemize
15927 The complexity of programs that can be processed is limited only by the
15928 total amount of available virtual memory, and disk space for the
15929 generated object files.
15932 @itemize *
15934 @item 
15935 “Variations from the standard that are impractical to avoid
15936 given the implementation’s execution environment.  See 1.1.3(6).”
15937 @end itemize
15939 There are no variations from the standard.
15942 @itemize *
15944 @item 
15945 “Which code_statements cause external
15946 interactions.  See 1.1.3(10).”
15947 @end itemize
15949 Any `code_statement' can potentially cause external interactions.
15952 @itemize *
15954 @item 
15955 “The coded representation for the text of an Ada
15956 program.  See 2.1(4).”
15957 @end itemize
15959 See separate section on source representation.
15962 @itemize *
15964 @item 
15965 “The semantics of an Ada program whose text is not in
15966 Normalization Form C.  See 2.1(4).”
15967 @end itemize
15969 See separate section on source representation.
15972 @itemize *
15974 @item 
15975 “The representation for an end of line.  See 2.2(2).”
15976 @end itemize
15978 See separate section on source representation.
15981 @itemize *
15983 @item 
15984 “Maximum supported line length and lexical element
15985 length.  See 2.2(15).”
15986 @end itemize
15988 The maximum line length is 255 characters and the maximum length of
15989 a lexical element is also 255 characters. This is the default setting
15990 if not overridden by the use of compiler switch `-gnaty' (which
15991 sets the maximum to 79) or `-gnatyMnn' which allows the maximum
15992 line length to be specified to be any value up to 32767. The maximum
15993 length of a lexical element is the same as the maximum line length.
15996 @itemize *
15998 @item 
15999 “Implementation defined pragmas.  See 2.8(14).”
16000 @end itemize
16002 See @ref{7,,Implementation Defined Pragmas}.
16005 @itemize *
16007 @item 
16008 “Effect of pragma @code{Optimize}.  See 2.8(27).”
16009 @end itemize
16011 Pragma @code{Optimize}, if given with a @code{Time} or @code{Space}
16012 parameter, checks that the optimization flag is set, and aborts if it is
16013 not.
16016 @itemize *
16018 @item 
16019 “The message string associated with the Assertion_Error exception raised
16020 by the failure of a predicate check if there is no applicable
16021 Predicate_Failure aspect.  See 3.2.4(31).”
16022 @end itemize
16024 In the case of a Dynamic_Predicate aspect, the string is
16025 “Dynamic_Predicate failed at <source position>”, where
16026 “<source position>” might be something like “foo.adb:123”.
16027 The Static_Predicate case is handled analogously.
16030 @itemize *
16032 @item 
16033 “The predefined integer types declared in
16034 @code{Standard}.  See 3.5.4(25).”
16035 @end itemize
16038 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16039 @headitem
16041 Type
16043 @tab
16045 Representation
16047 @item
16049 `Short_Short_Integer'
16051 @tab
16053 8-bit signed
16055 @item
16057 `Short_Integer'
16059 @tab
16061 16-bit signed
16063 @item
16065 `Integer'
16067 @tab
16069 32-bit signed
16071 @item
16073 `Long_Integer'
16075 @tab
16077 64-bit signed (on most 64-bit targets,
16078 depending on the C definition of long)
16079 32-bit signed (on all other targets)
16081 @item
16083 `Long_Long_Integer'
16085 @tab
16087 64-bit signed
16089 @item
16091 `Long_Long_Long_Integer'
16093 @tab
16095 128-bit signed (on 64-bit targets)
16096 64-bit signed (on 32-bit targets)
16098 @end multitable
16102 @itemize *
16104 @item 
16105 “Any nonstandard integer types and the operators defined
16106 for them.  See 3.5.4(26).”
16107 @end itemize
16109 There are no nonstandard integer types.
16112 @itemize *
16114 @item 
16115 “Any nonstandard real types and the operators defined for
16116 them.  See 3.5.6(8).”
16117 @end itemize
16119 There are no nonstandard real types.
16122 @itemize *
16124 @item 
16125 “What combinations of requested decimal precision and range
16126 are supported for floating point types.  See 3.5.7(7).”
16127 @end itemize
16129 The precision and range are defined by the IEEE Standard for Floating-Point
16130 Arithmetic (IEEE 754-2019).
16133 @itemize *
16135 @item 
16136 “The predefined floating point types declared in
16137 @code{Standard}.  See 3.5.7(16).”
16138 @end itemize
16141 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16142 @headitem
16144 Type
16146 @tab
16148 Representation
16150 @item
16152 `Short_Float'
16154 @tab
16156 IEEE Binary32 (Single)
16158 @item
16160 `Float'
16162 @tab
16164 IEEE Binary32 (Single)
16166 @item
16168 `Long_Float'
16170 @tab
16172 IEEE Binary64 (Double)
16174 @item
16176 `Long_Long_Float'
16178 @tab
16180 IEEE Binary64 (Double) on non-x86 architectures
16181 IEEE 80-bit Extended on x86 architecture
16183 @end multitable
16186 The default rounding mode specified by the IEEE 754 Standard is assumed both
16187 for static and dynamic computations (that is, round to nearest, ties to even).
16188 The input routines yield correctly rounded values for Short_Float, Float, and
16189 Long_Float at least. The output routines can compute up to twice as many exact
16190 digits as the value of @code{T'Digits} for any type, for example 30 digits for
16191 Long_Float; if more digits are requested, zeros are printed.
16194 @itemize *
16196 @item 
16197 “The small of an ordinary fixed point type.  See 3.5.9(8).”
16198 @end itemize
16200 The small is the largest power of two that does not exceed the delta.
16203 @itemize *
16205 @item 
16206 “What combinations of small, range, and digits are
16207 supported for fixed point types.  See 3.5.9(10).”
16208 @end itemize
16210 For an ordinary fixed point type, on 32-bit platforms, the small must lie in
16211 2.0**(-80) .. 2.0**80 and the range in -9.0E+36 .. 9.0E+36; any combination
16212 is permitted that does not result in a mantissa larger than 63 bits.
16214 On 64-bit platforms, the small must lie in 2.0**(-127) .. 2.0**127 and the
16215 range in -1.0E+76 .. 1.0E+76; any combination is permitted that does not
16216 result in a mantissa larger than 63 bits, and any combination is permitted
16217 that results in a mantissa between 64 and 127 bits if the small is the
16218 ratio of two integers that lie in 1 .. 2.0**127.
16220 If the small is the ratio of two integers with 64-bit magnitude on 32-bit
16221 platforms and 128-bit magnitude on 64-bit platforms, which is the case if
16222 no @code{small} clause is provided, then the operations of the fixed point
16223 type are entirely implemented by means of integer instructions.  In the
16224 other cases, some operations, in particular input and output, may be
16225 implemented by means of floating-point instructions and may be affected
16226 by accuracy issues on architectures other than x86.
16228 For a decimal fixed point type, on 32-bit platforms, the small must lie in
16229 1.0E-18 .. 1.0E+18 and the digits in 1 .. 18.  On 64-bit platforms, the
16230 small must lie in 1.0E-38 .. 1.0E+38 and the digits in 1 .. 38.
16233 @itemize *
16235 @item 
16236 “The result of @code{Tags.Expanded_Name} for types declared
16237 within an unnamed `block_statement'.  See 3.9(10).”
16238 @end itemize
16240 Block numbers of the form @code{B@var{nnn}}, where `nnn' is a
16241 decimal integer are allocated.
16244 @itemize *
16246 @item 
16247 “The sequence of characters of the value returned by Tags.Expanded_Name
16248 (respectively, Tags.Wide_Expanded_Name) when some of the graphic
16249 characters of Tags.Wide_Wide_Expanded_Name are not defined in Character
16250 (respectively, Wide_Character).  See 3.9(10.1).”
16251 @end itemize
16253 This is handled in the same way as the implementation-defined behavior
16254 referenced in A.4.12(34).
16257 @itemize *
16259 @item 
16260 “Implementation-defined attributes.  See 4.1.4(12).”
16261 @end itemize
16263 See @ref{8,,Implementation Defined Attributes}.
16266 @itemize *
16268 @item 
16269 “The value of the parameter to Empty for some container aggregates.
16270 See 4.3.5(40).”
16271 @end itemize
16273 As per the suggestion given in the Annotated Ada RM, the default value
16274 of the formal parameter is used if one exists and zero is used otherwise.
16277 @itemize *
16279 @item 
16280 “The maximum number of chunks for a parallel reduction expression without
16281 a chunk_specification.  See 4.5.10(21).”
16282 @end itemize
16284 Feature unimplemented.
16287 @itemize *
16289 @item 
16290 “Rounding of real static expressions which are exactly half-way between
16291 two machine numbers.  See 4.9(38).”
16292 @end itemize
16294 Round to even is used in all such cases.
16297 @itemize *
16299 @item 
16300 “The maximum number of chunks for a parallel generalized iterator without
16301 a chunk_specification.  See 5.5.2(10).”
16302 @end itemize
16304 Feature unimplemented.
16307 @itemize *
16309 @item 
16310 “The number of chunks for an array component iterator.  See 5.5.2(11).”
16311 @end itemize
16313 Feature unimplemented.
16316 @itemize *
16318 @item 
16319 “Any extensions of the Global aspect.  See 6.1.2(43).”
16320 @end itemize
16322 Feature unimplemented.
16325 @itemize *
16327 @item 
16328 “The circumstances the implementation passes in the null value for a view
16329 conversion of an access type used as an out parameter.  See 6.4.1(19).”
16330 @end itemize
16332 Difficult to characterize.
16335 @itemize *
16337 @item 
16338 “Any extensions of the Default_Initial_Condition aspect.  See 7.3.3(11).”
16339 @end itemize
16341 SPARK allows specifying `null' as the Default_Initial_Condition
16342 aspect of a type. See the SPARK reference manual for further details.
16345 @itemize *
16347 @item 
16348 “Any implementation-defined time types.  See 9.6(6).”
16349 @end itemize
16351 There are no implementation-defined time types.
16354 @itemize *
16356 @item 
16357 “The time base associated with relative delays.  See 9.6(20).”
16358 @end itemize
16360 See 9.6(20).  The time base used is that provided by the C library
16361 function @code{gettimeofday}.
16364 @itemize *
16366 @item 
16367 “The time base of the type @code{Calendar.Time}.  See 9.6(23).”
16368 @end itemize
16370 The time base used is that provided by the C library function
16371 @code{gettimeofday}.
16374 @itemize *
16376 @item 
16377 “The time zone used for package @code{Calendar}
16378 operations.  See 9.6(24).”
16379 @end itemize
16381 The time zone used by package @code{Calendar} is the current system time zone
16382 setting for local time, as accessed by the C library function
16383 @code{localtime}.
16386 @itemize *
16388 @item 
16389 “Any limit on `delay_until_statements' of
16390 `select_statements'.  See 9.6(29).”
16391 @end itemize
16393 There are no such limits.
16396 @itemize *
16398 @item 
16399 “The result of Calendar.Formatting.Image if its argument represents more
16400 than 100 hours.  See 9.6.1(86).”
16401 @end itemize
16403 Calendar.Time_Error is raised.
16406 @itemize *
16408 @item 
16409 “Implementation-defined conflict check policies.  See 9.10.1(5).”
16410 @end itemize
16412 There are no implementation-defined conflict check policies.
16415 @itemize *
16417 @item 
16418 “The representation for a compilation.  See 10.1(2).”
16419 @end itemize
16421 A compilation is represented by a sequence of files presented to the
16422 compiler in a single invocation of the `gcc' command.
16425 @itemize *
16427 @item 
16428 “Any restrictions on compilations that contain multiple
16429 compilation_units.  See 10.1(4).”
16430 @end itemize
16432 No single file can contain more than one compilation unit, but any
16433 sequence of files can be presented to the compiler as a single
16434 compilation.
16437 @itemize *
16439 @item 
16440 “The mechanisms for creating an environment and for adding
16441 and replacing compilation units.  See 10.1.4(3).”
16442 @end itemize
16444 See separate section on compilation model.
16447 @itemize *
16449 @item 
16450 “The manner of explicitly assigning library units to a
16451 partition.  See 10.2(2).”
16452 @end itemize
16454 If a unit contains an Ada main program, then the Ada units for the partition
16455 are determined by recursive application of the rules in the Ada Reference
16456 Manual section 10.2(2-6).  In other words, the Ada units will be those that
16457 are needed by the main program, and then this definition of need is applied
16458 recursively to those units, and the partition contains the transitive
16459 closure determined by this relationship.  In short, all the necessary units
16460 are included, with no need to explicitly specify the list.  If additional
16461 units are required, e.g., by foreign language units, then all units must be
16462 mentioned in the context clause of one of the needed Ada units.
16464 If the partition contains no main program, or if the main program is in
16465 a language other than Ada, then GNAT
16466 provides the binder options `-z' and `-n' respectively, and in
16467 this case a list of units can be explicitly supplied to the binder for
16468 inclusion in the partition (all units needed by these units will also
16469 be included automatically).  For full details on the use of these
16470 options, refer to `GNAT Make Program gnatmake' in the
16471 @cite{GNAT User’s Guide}.
16474 @itemize *
16476 @item 
16477 “The implementation-defined means, if any, of specifying which compilation
16478 units are needed by a given compilation unit.  See 10.2(2).”
16479 @end itemize
16481 The units needed by a given compilation unit are as defined in
16482 the Ada Reference Manual section 10.2(2-6).  There are no
16483 implementation-defined pragmas or other implementation-defined
16484 means for specifying needed units.
16487 @itemize *
16489 @item 
16490 “The manner of designating the main subprogram of a
16491 partition.  See 10.2(7).”
16492 @end itemize
16494 The main program is designated by providing the name of the
16495 corresponding @code{ALI} file as the input parameter to the binder.
16498 @itemize *
16500 @item 
16501 “The order of elaboration of `library_items'.  See 10.2(18).”
16502 @end itemize
16504 The first constraint on ordering is that it meets the requirements of
16505 Chapter 10 of the Ada Reference Manual.  This still leaves some
16506 implementation-dependent choices, which are resolved by analyzing
16507 the elaboration code of each unit and identifying implicit
16508 elaboration-order dependencies.
16511 @itemize *
16513 @item 
16514 “Parameter passing and function return for the main
16515 subprogram.  See 10.2(21).”
16516 @end itemize
16518 The main program has no parameters.  It may be a procedure, or a function
16519 returning an integer type.  In the latter case, the returned integer
16520 value is the return code of the program (overriding any value that
16521 may have been set by a call to @code{Ada.Command_Line.Set_Exit_Status}).
16524 @itemize *
16526 @item 
16527 “The mechanisms for building and running partitions.  See 10.2(24).”
16528 @end itemize
16530 GNAT itself supports programs with only a single partition. The GNATDIST
16531 tool provided with the GLADE package (which also includes an implementation
16532 of the PCS) provides a completely flexible method for building and running
16533 programs consisting of multiple partitions. See the separate GLADE manual
16534 for details.
16537 @itemize *
16539 @item 
16540 “The details of program execution, including program
16541 termination.  See 10.2(25).”
16542 @end itemize
16544 See separate section on compilation model.
16547 @itemize *
16549 @item 
16550 “The semantics of any non-active partitions supported by the
16551 implementation.  See 10.2(28).”
16552 @end itemize
16554 Passive partitions are supported on targets where shared memory is
16555 provided by the operating system. See the GLADE reference manual for
16556 further details.
16559 @itemize *
16561 @item 
16562 “The information returned by @code{Exception_Message}.  See 11.4.1(10).”
16563 @end itemize
16565 Exception message returns the null string unless a specific message has
16566 been passed by the program.
16569 @itemize *
16571 @item 
16572 “The result of @code{Exceptions.Exception_Name} for types
16573 declared within an unnamed `block_statement'.  See 11.4.1(12).”
16574 @end itemize
16576 Blocks have implementation defined names of the form @code{B@var{nnn}}
16577 where `nnn' is an integer.
16580 @itemize *
16582 @item 
16583 “The information returned by
16584 @code{Exception_Information}.  See 11.4.1(13).”
16585 @end itemize
16587 @code{Exception_Information} returns a string in the following format:
16589 @example
16590 *Exception_Name:* nnnnn
16591 *Message:* mmmmm
16592 *PID:* ppp
16593 *Load address:* 0xhhhh
16594 *Call stack traceback locations:*
16595 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
16596 @end example
16598 where
16600 @quotation
16603 @itemize *
16605 @item 
16606 @code{nnnn} is the fully qualified name of the exception in all upper
16607 case letters. This line is always present.
16609 @item 
16610 @code{mmmm} is the message (this line present only if message is non-null)
16612 @item 
16613 @code{ppp} is the Process Id value as a decimal integer (this line is
16614 present only if the Process Id is nonzero). Currently we are
16615 not making use of this field.
16617 @item 
16618 The Load address line, the Call stack traceback locations line and the
16619 following values are present only if at least one traceback location was
16620 recorded. The Load address indicates the address at which the main executable
16621 was loaded; this line may not be present if operating system hasn’t relocated
16622 the main executable. The values are given in C style format, with lower case
16623 letters for a-f, and only as many digits present as are necessary.
16624 The line terminator sequence at the end of each line, including
16625 the last line is a single @code{LF} character (@code{16#0A#}).
16626 @end itemize
16627 @end quotation
16630 @itemize *
16632 @item 
16633 “The sequence of characters of the value returned by
16634 Exceptions.Exception_Name (respectively, Exceptions.Wide_Exception_Name)
16635 when some of the graphic characters of Exceptions.Wide_Wide_Exception_Name
16636 are not defined in Character (respectively, Wide_Character).
16637 See 11.4.1(12.1).”
16638 @end itemize
16640 This is handled in the same way as the implementation-defined behavior
16641 referenced in A.4.12(34).
16644 @itemize *
16646 @item 
16647 “The information returned by Exception_Information.  See 11.4.1(13).”
16648 @end itemize
16650 The exception name and the source location at which the exception was
16651 raised are included.
16654 @itemize *
16656 @item 
16657 “Implementation-defined policy_identifiers and assertion_aspect_marks
16658 allowed in a pragma Assertion_Policy.  See 11.4.2(9).”
16659 @end itemize
16661 Implementation-defined assertion_aspect_marks include Assert_And_Cut,
16662 Assume, Contract_Cases, Debug, Ghost, Initial_Condition, Loop_Invariant,
16663 Loop_Variant, Postcondition, Precondition, Predicate, Refined_Post,
16664 Statement_Assertions, and Subprogram_Variant. Implementation-defined
16665 policy_identifiers include Ignore and Suppressible.
16668 @itemize *
16670 @item 
16671 “The default assertion policy.  See 11.4.2(10).”
16672 @end itemize
16674 The default assertion policy is Ignore, although this can be overridden
16675 via compiler switches such as “-gnata”.
16678 @itemize *
16680 @item 
16681 “Implementation-defined check names.  See 11.5(27).”
16682 @end itemize
16684 The implementation defined check names include Alignment_Check,
16685 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
16686 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
16687 program can add implementation-defined check names by means of the pragma
16688 Check_Name. See the description of pragma @code{Suppress} for full details.
16691 @itemize *
16693 @item 
16694 “Existence and meaning of second parameter of pragma Unsuppress.
16695 See 11.5(27.1).”
16696 @end itemize
16698 The legality rules for and semantics of the second parameter of pragma
16699 Unsuppress match those for the second argument of pragma Suppress.
16702 @itemize *
16704 @item 
16705 “The cases that cause conflicts between the representation of the
16706 ancestors of a type_declaration.  See 13.1(13.1).”
16707 @end itemize
16709 No such cases exist.
16712 @itemize *
16714 @item 
16715 “The interpretation of each representation aspect.  See 13.1(20).”
16716 @end itemize
16718 See separate section on data representations.
16721 @itemize *
16723 @item 
16724 “Any restrictions placed upon the specification of representation aspects.
16725 See 13.1(20).”
16726 @end itemize
16728 See separate section on data representations.
16731 @itemize *
16733 @item 
16734 “Implementation-defined aspects, including the syntax for specifying
16735 such aspects and the legality rules for such aspects.  See 13.1.1(38).”
16736 @end itemize
16738 See @ref{12b,,Implementation Defined Aspects}.
16741 @itemize *
16743 @item 
16744 “The set of machine scalars.  See 13.3(8.1).”
16745 @end itemize
16747 See separate section on data representations.
16750 @itemize *
16752 @item 
16753 “The meaning of @code{Size} for indefinite subtypes.  See 13.3(48).”
16754 @end itemize
16756 The Size attribute of an indefinite subtype is not less than the Size
16757 attribute of any object of that type.
16760 @itemize *
16762 @item 
16763 “The meaning of Object_Size for indefinite subtypes.  See 13.3(58).”
16764 @end itemize
16766 The Object_Size attribute of an indefinite subtype is not less than the
16767 Object_Size attribute of any object of that type.
16770 @itemize *
16772 @item 
16773 “The default external representation for a type tag.  See 13.3(75).”
16774 @end itemize
16776 The default external representation for a type tag is the fully expanded
16777 name of the type in upper case letters.
16780 @itemize *
16782 @item 
16783 “What determines whether a compilation unit is the same in
16784 two different partitions.  See 13.3(76).”
16785 @end itemize
16787 A compilation unit is the same in two different partitions if and only
16788 if it derives from the same source file.
16791 @itemize *
16793 @item 
16794 “Implementation-defined components.  See 13.5.1(15).”
16795 @end itemize
16797 The only implementation defined component is the tag for a tagged type,
16798 which contains a pointer to the dispatching table.
16801 @itemize *
16803 @item 
16804 “If @code{Word_Size} = @code{Storage_Unit}, the default bit
16805 ordering.  See 13.5.3(5).”
16806 @end itemize
16808 @code{Word_Size} does not equal @code{Storage_Unit} in this implementation.
16811 @itemize *
16813 @item 
16814 “The contents of the visible part of package @code{System}.  See 13.7(2).”
16815 @end itemize
16817 See the definition of package System in @code{system.ads}.
16818 Note that two declarations are added to package System.
16820 @example
16821 Max_Priority           : constant Positive := Priority'Last;
16822 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
16823 @end example
16826 @itemize *
16828 @item 
16829 “The range of Storage_Elements.Storage_Offset, the modulus of
16830 Storage_Elements.Storage_Element, and the declaration of
16831 Storage_Elements.Integer_Address.  See 13.7.1(11).”
16832 @end itemize
16834 See the definition of package System.Storage_Elements in @code{s-stoele.ads}.
16837 @itemize *
16839 @item 
16840 “The contents of the visible part of package @code{System.Machine_Code},
16841 and the meaning of `code_statements'.  See 13.8(7).”
16842 @end itemize
16844 See the definition and documentation in file @code{s-maccod.ads}.
16847 @itemize *
16849 @item 
16850 “The result of unchecked conversion for instances with scalar result
16851 types whose result is not defined by the language.  See 13.9(11).”
16852 @end itemize
16854 Unchecked conversion between types of the same size
16855 results in an uninterpreted transmission of the bits from one type
16856 to the other.  If the types are of unequal sizes, then in the case of
16857 discrete types, a shorter source is first zero or sign extended as
16858 necessary, and a shorter target is simply truncated on the left.
16859 For all non-discrete types, the source is first copied if necessary
16860 to ensure that the alignment requirements of the target are met, then
16861 a pointer is constructed to the source value, and the result is obtained
16862 by dereferencing this pointer after converting it to be a pointer to the
16863 target type. Unchecked conversions where the target subtype is an
16864 unconstrained array are not permitted. If the target alignment is
16865 greater than the source alignment, then a copy of the result is
16866 made with appropriate alignment
16869 @itemize *
16871 @item 
16872 “The result of unchecked conversion for instances with nonscalar result
16873 types whose result is not defined by the language.  See 13.9(11).”
16874 @end itemize
16876 See preceding definition for the scalar result case.
16879 @itemize *
16881 @item 
16882 “Whether or not the implementation provides user-accessible
16883 names for the standard pool type(s).  See 13.11(17).”
16884 @end itemize
16886 There are 3 different standard pools used by the compiler when
16887 @code{Storage_Pool} is not specified depending whether the type is local
16888 to a subprogram or defined at the library level and whether
16889 @code{Storage_Size`@w{`}is specified or not. See documentation in the runtime
16890 library units `@w{`}System.Pool_Global}, @code{System.Pool_Size} and
16891 @code{System.Pool_Local} in files @code{s-poosiz.ads},
16892 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
16893 default pools used.  All these pools are accessible by means of @cite{with}ing
16894 these units.
16897 @itemize *
16899 @item 
16900 “The meaning of @code{Storage_Size} when neither the Storage_Size nor the
16901 Storage_Pool is specified for an access type.  See 13.11(18).”
16902 @end itemize
16904 @code{Storage_Size} is measured in storage units, and refers to the
16905 total space available for an access type collection, or to the primary
16906 stack space for a task.
16909 @itemize *
16911 @item 
16912 “The effect of specifying aspect Default_Storage_Pool on an instance
16913 of a language-defined generic unit.  See 13.11.3(5).”
16914 @end itemize
16916 Instances of language-defined generic units are treated the same as other
16917 instances with respect to the Default_Storage_Pool aspect.
16920 @itemize *
16922 @item 
16923 “Implementation-defined restrictions allowed in a pragma
16924 @code{Restrictions}.  See 13.12(8.7).”
16925 @end itemize
16927 See @ref{9,,Standard and Implementation Defined Restrictions}.
16930 @itemize *
16932 @item 
16933 “The consequences of violating limitations on
16934 @code{Restrictions} pragmas.  See 13.12(9).”
16935 @end itemize
16937 Restrictions that can be checked at compile time are enforced at
16938 compile time; violations are illegal. For other restrictions, any
16939 violation during program execution results in erroneous execution.
16942 @itemize *
16944 @item 
16945 “Implementation-defined usage profiles allowed in a pragma Profile.
16946 See 13.12(15).”
16947 @end itemize
16949 See @ref{7,,Implementation Defined Pragmas}.
16952 @itemize *
16954 @item 
16955 “The contents of the stream elements read and written by the Read and
16956 Write attributes of elementary types.  See 13.13.2(9).”
16957 @end itemize
16959 The representation is the in-memory representation of the base type of
16960 the type, using the number of bits corresponding to the
16961 @code{type'Size} value, and the natural ordering of the machine.
16964 @itemize *
16966 @item 
16967 “The names and characteristics of the numeric subtypes
16968 declared in the visible part of package @code{Standard}.  See A.1(3).”
16969 @end itemize
16971 See items describing the integer and floating-point types supported.
16974 @itemize *
16976 @item 
16977 “The values returned by Strings.Hash.  See A.4.9(3).”
16978 @end itemize
16980 This hash function has predictable collisions and is subject to
16981 equivalent substring attacks. It is not suitable for construction of a
16982 hash table keyed on possibly malicious user input.
16985 @itemize *
16987 @item 
16988 “The value returned by a call to a Text_Buffer Get procedure if any
16989 character in the returned sequence is not defined in Character.
16990 See A.4.12(34).”
16991 @end itemize
16993 The contents of a buffer is represented internally as a UTF_8 string.
16994 The value return by Text_Buffer.Get is the result of passing that
16995 UTF_8 string to UTF_Encoding.Strings.Decode.
16998 @itemize *
17000 @item 
17001 “The value returned by a call to a Text_Buffer Wide_Get procedure if
17002 any character in the returned sequence is not defined in Wide_Character.
17003 See A.4.12(34).”
17004 @end itemize
17006 The contents of a buffer is represented internally as a UTF_8 string.
17007 The value return by Text_Buffer.Wide_Get is the result of passing that
17008 UTF_8 string to UTF_Encoding.Wide_Strings.Decode.
17011 @itemize *
17013 @item 
17014 “The accuracy actually achieved by the elementary
17015 functions.  See A.5.1(1).”
17016 @end itemize
17018 The elementary functions correspond to the functions available in the C
17019 library.  Only fast math mode is implemented.
17022 @itemize *
17024 @item 
17025 “The sign of a zero result from some of the operators or
17026 functions in @code{Numerics.Generic_Elementary_Functions}, when
17027 @code{Float_Type'Signed_Zeros} is @code{True}.  See A.5.1(46).”
17028 @end itemize
17030 The sign of zeroes follows the requirements of the IEEE 754 standard on
17031 floating-point.
17034 @itemize *
17036 @item 
17037 “The value of
17038 @code{Numerics.Float_Random.Max_Image_Width}.  See A.5.2(27).”
17039 @end itemize
17041 Maximum image width is 6864, see library file @code{s-rannum.ads}.
17044 @itemize *
17046 @item 
17047 “The value of
17048 @code{Numerics.Discrete_Random.Max_Image_Width}.  See A.5.2(27).”
17049 @end itemize
17051 Maximum image width is 6864, see library file @code{s-rannum.ads}.
17054 @itemize *
17056 @item 
17057 “The string representation of a random number generator’s
17058 state.  See A.5.2(38).”
17059 @end itemize
17061 The value returned by the Image function is the concatenation of
17062 the fixed-width decimal representations of the 624 32-bit integers
17063 of the state vector.
17066 @itemize *
17068 @item 
17069 “The values of the @code{Model_Mantissa},
17070 @code{Model_Emin}, @code{Model_Epsilon}, @code{Model},
17071 @code{Safe_First}, and @code{Safe_Last} attributes, if the Numerics
17072 Annex is not supported.  See A.5.3(72).”
17073 @end itemize
17075 Running the compiler with `-gnatS' to produce a listing of package
17076 @code{Standard} displays the values of these attributes.
17079 @itemize *
17081 @item 
17082 “The value of @code{Buffer_Size} in @code{Storage_IO}.  See A.9(10).”
17083 @end itemize
17085 All type representations are contiguous, and the @code{Buffer_Size} is
17086 the value of @code{type'Size} rounded up to the next storage unit
17087 boundary.
17090 @itemize *
17092 @item 
17093 “External files for standard input, standard output, and
17094 standard error See A.10(5).”
17095 @end itemize
17097 These files are mapped onto the files provided by the C streams
17098 libraries. See source file @code{i-cstrea.ads} for further details.
17101 @itemize *
17103 @item 
17104 “The accuracy of the value produced by @code{Put}.  See A.10.9(36).”
17105 @end itemize
17107 If more digits are requested in the output than are represented by the
17108 precision of the value, zeroes are output in the corresponding least
17109 significant digit positions.
17112 @itemize *
17114 @item 
17115 “Current size for a stream file for which positioning is not supported.
17116 See A.12.1(1.1).”
17117 @end itemize
17119 Positioning is supported.
17122 @itemize *
17124 @item 
17125 “The meaning of @code{Argument_Count}, @code{Argument}, and
17126 @code{Command_Name}.  See A.15(1).”
17127 @end itemize
17129 These are mapped onto the @code{argv} and @code{argc} parameters of the
17130 main program in the natural manner.
17133 @itemize *
17135 @item 
17136 “The interpretation of file names and directory names.  See A.16(46).”
17137 @end itemize
17139 These names are interpreted consistently with the underlying file system.
17142 @itemize *
17144 @item 
17145 “The maxium value for a file size in Directories.  See A.16(87).”
17146 @end itemize
17148 Directories.File_Size’Last is equal to Long_Long_Integer’Last .
17151 @itemize *
17153 @item 
17154 “The result for Directories.Size for a directory or special file.
17155 See A.16(93).”
17156 @end itemize
17158 Name_Error is raised.
17161 @itemize *
17163 @item 
17164 “The result for Directories.Modification_Time for a directory or special file.
17165 See A.16(93).”
17166 @end itemize
17168 Name_Error is raised.
17171 @itemize *
17173 @item 
17174 “The interpretation of a nonnull search pattern in Directories.
17175 See A.16(104).”
17176 @end itemize
17178 When the @code{Pattern} parameter is not the null string, it is interpreted
17179 according to the syntax of regular expressions as defined in the
17180 @code{GNAT.Regexp} package.
17182 See @ref{270,,GNAT.Regexp (g-regexp.ads)}.
17185 @itemize *
17187 @item 
17188 “The results of a Directories search if the contents of the directory are
17189 altered while a search is in progress.  See A.16(110).”
17190 @end itemize
17192 The effect of a call to Get_Next_Entry is determined by the current
17193 state of the directory.
17196 @itemize *
17198 @item 
17199 “The definition and meaning of an environment variable.  See A.17(1).”
17200 @end itemize
17202 This definition is determined by the underlying operating system.
17205 @itemize *
17207 @item 
17208 “The circumstances where an environment variable cannot be defined.
17209 See A.17(16).”
17210 @end itemize
17212 There are no such implementation-defined circumstances.
17215 @itemize *
17217 @item 
17218 “Environment names for which Set has the effect of Clear.  See A.17(17).”
17219 @end itemize
17221 There are no such names.
17224 @itemize *
17226 @item 
17227 “The value of Containers.Hash_Type’Modulus. The value of
17228 Containers.Count_Type’Last.  See A.18.1(7).”
17229 @end itemize
17231 Containers.Hash_Type’Modulus is 2**32.
17232 Containers.Count_Type’Last is 2**31 - 1.
17235 @itemize *
17237 @item 
17238 “Implementation-defined convention names.  See B.1(11).”
17239 @end itemize
17241 The following convention names are supported
17244 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
17245 @headitem
17247 Convention Name
17249 @tab
17251 Interpretation
17253 @item
17255 `Ada'
17257 @tab
17261 @item
17263 `Ada_Pass_By_Copy'
17265 @tab
17267 Allowed for any types except by-reference types such as limited
17268 records. Compatible with convention Ada, but causes any parameters
17269 with this convention to be passed by copy.
17271 @item
17273 `Ada_Pass_By_Reference'
17275 @tab
17277 Allowed for any types except by-copy types such as scalars.
17278 Compatible with convention Ada, but causes any parameters
17279 with this convention to be passed by reference.
17281 @item
17283 `Assembler'
17285 @tab
17287 Assembly language
17289 @item
17291 `Asm'
17293 @tab
17295 Synonym for Assembler
17297 @item
17299 `Assembly'
17301 @tab
17303 Synonym for Assembler
17305 @item
17309 @tab
17313 @item
17315 `C_Pass_By_Copy'
17317 @tab
17319 Allowed only for record types, like C, but also notes that record
17320 is to be passed by copy rather than reference.
17322 @item
17324 `COBOL'
17326 @tab
17328 COBOL
17330 @item
17332 `C_Plus_Plus (or CPP)'
17334 @tab
17338 @item
17340 `Default'
17342 @tab
17344 Treated the same as C
17346 @item
17348 `External'
17350 @tab
17352 Treated the same as C
17354 @item
17356 `Fortran'
17358 @tab
17360 Fortran
17362 @item
17364 `Intrinsic'
17366 @tab
17368 For support of pragma @code{Import} with convention Intrinsic, see
17369 separate section on Intrinsic Subprograms.
17371 @item
17373 `Stdcall'
17375 @tab
17377 Stdcall (used for Windows implementations only).  This convention correspond
17378 to the WINAPI (previously called Pascal convention) C/C++ convention under
17379 Windows.  A routine with this convention cleans the stack before
17380 exit. This pragma cannot be applied to a dispatching call.
17382 @item
17384 `DLL'
17386 @tab
17388 Synonym for Stdcall
17390 @item
17392 `Win32'
17394 @tab
17396 Synonym for Stdcall
17398 @item
17400 `Stubbed'
17402 @tab
17404 Stubbed is a special convention used to indicate that the body of the
17405 subprogram will be entirely ignored.  Any call to the subprogram
17406 is converted into a raise of the @code{Program_Error} exception.  If a
17407 pragma @code{Import} specifies convention @code{stubbed} then no body need
17408 be present at all.  This convention is useful during development for the
17409 inclusion of subprograms whose body has not yet been written.
17410 In addition, all otherwise unrecognized convention names are also
17411 treated as being synonymous with convention C.  In all implementations,
17412 use of such other names results in a warning.
17414 @end multitable
17418 @itemize *
17420 @item 
17421 “The meaning of link names.  See B.1(36).”
17422 @end itemize
17424 Link names are the actual names used by the linker.
17427 @itemize *
17429 @item 
17430 “The manner of choosing link names when neither the link name nor the
17431 address of an imported or exported entity is specified.  See B.1(36).”
17432 @end itemize
17434 The default linker name is that which would be assigned by the relevant
17435 external language, interpreting the Ada name as being in all lower case
17436 letters.
17439 @itemize *
17441 @item 
17442 “The effect of pragma @code{Linker_Options}.  See B.1(37).”
17443 @end itemize
17445 The string passed to @code{Linker_Options} is presented uninterpreted as
17446 an argument to the link command, unless it contains ASCII.NUL characters.
17447 NUL characters if they appear act as argument separators, so for example
17449 @example
17450 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
17451 @end example
17453 causes two separate arguments @code{-labc} and @code{-ldef} to be passed to the
17454 linker. The order of linker options is preserved for a given unit. The final
17455 list of options passed to the linker is in reverse order of the elaboration
17456 order. For example, linker options for a body always appear before the options
17457 from the corresponding package spec.
17460 @itemize *
17462 @item 
17463 “The contents of the visible part of package
17464 @code{Interfaces} and its language-defined descendants.  See B.2(1).”
17465 @end itemize
17467 See files with prefix @code{i-} in the distributed library.
17470 @itemize *
17472 @item 
17473 “Implementation-defined children of package
17474 @code{Interfaces}.  The contents of the visible part of package
17475 @code{Interfaces}.  See B.2(11).”
17476 @end itemize
17478 See files with prefix @code{i-} in the distributed library.
17481 @itemize *
17483 @item 
17484 “The definitions of certain types and constants in Interfaces.C.
17485 See B.3(41).”
17486 @end itemize
17488 See source file @code{i-c.ads}.
17491 @itemize *
17493 @item 
17494 “The types @code{Floating}, @code{Long_Floating},
17495 @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and
17496 @code{COBOL_Character}; and the initialization of the variables
17497 @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in
17498 @code{Interfaces.COBOL}.  See B.4(50).”
17499 @end itemize
17502 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
17503 @headitem
17505 COBOL
17507 @tab
17511 @item
17513 `Floating'
17515 @tab
17517 Float
17519 @item
17521 `Long_Floating'
17523 @tab
17525 (Floating) Long_Float
17527 @item
17529 `Binary'
17531 @tab
17533 Integer
17535 @item
17537 `Long_Binary'
17539 @tab
17541 Long_Long_Integer
17543 @item
17545 `Decimal_Element'
17547 @tab
17549 Character
17551 @item
17553 `COBOL_Character'
17555 @tab
17557 Character
17559 @end multitable
17562 For initialization, see the file @code{i-cobol.ads} in the distributed library.
17565 @itemize *
17567 @item 
17568 “The types Fortran_Integer, Real, Double_Precision, and Character_Set
17569 in Interfaces.Fortran.  See B.5(17).”
17570 @end itemize
17572 See source file @code{i-fortra.ads}. These types are derived, respectively,
17573 from Integer, Float, Long_Float, and Character.
17576 @itemize *
17578 @item 
17579 “Implementation-defined intrinsic subprograms.  See C.1(1).”
17580 @end itemize
17582 See separate section on Intrinsic Subprograms.
17585 @itemize *
17587 @item 
17588 “Any restrictions on a protected procedure or its containing type when an
17589 aspect Attach_handler or Interrupt_Handler is specified.  See C.3.1(17).”
17590 @end itemize
17592 There are no such restrictions.
17595 @itemize *
17597 @item 
17598 “Any other forms of interrupt handler supported by the Attach_Handler and
17599 Interrupt_Handler aspects.  See C.3.1(19).”
17600 @end itemize
17602 There are no such forms.
17605 @itemize *
17607 @item 
17608 “The semantics of some attributes and functions of an entity for which
17609 aspect Discard_Names is True.  See C.5(7).”
17610 @end itemize
17612 If Discard_Names is True for an enumeration type, the Image attribute
17613 provides the image of the Pos of the literal, and Value accepts
17614 Pos values.
17616 If both of the aspects`@w{`}Discard_Names`@w{`} and @code{No_Tagged_Streams} are true
17617 for a tagged type, its Expanded_Name and External_Tag values are
17618 empty strings. This is useful to avoid exposing entity names at binary
17619 level.
17622 @itemize *
17624 @item 
17625 “The modulus and size of Test_and_Set_Flag.  See C.6.3(8).”
17626 @end itemize
17628 The modulus is 2**8. The size is 8.
17631 @itemize *
17633 @item 
17634 “The value used to represent the set value for Atomic_Test_and_Set.
17635 See C.6.3(10).”
17636 @end itemize
17638 The value is 1.
17641 @itemize *
17643 @item 
17644 “The result of the @code{Task_Identification.Image}
17645 attribute.  See C.7.1(7).”
17646 @end itemize
17648 The result of this attribute is a string that identifies
17649 the object or component that denotes a given task. If a variable @code{Var}
17650 has a task type, the image for this task will have the form @code{Var_@var{XXXXXXXX}},
17651 where the suffix `XXXXXXXX'
17652 is the hexadecimal representation of the virtual address of the corresponding
17653 task control block. If the variable is an array of tasks, the image of each
17654 task will have the form of an indexed component indicating the position of a
17655 given task in the array, e.g., @code{Group(5)_@var{XXXXXXX}}. If the task is a
17656 component of a record, the image of the task will have the form of a selected
17657 component. These rules are fully recursive, so that the image of a task that
17658 is a subcomponent of a composite object corresponds to the expression that
17659 designates this task.
17661 If a task is created by an allocator, its image depends on the context. If the
17662 allocator is part of an object declaration, the rules described above are used
17663 to construct its image, and this image is not affected by subsequent
17664 assignments. If the allocator appears within an expression, the image
17665 includes only the name of the task type.
17667 If the configuration pragma Discard_Names is present, or if the restriction
17668 No_Implicit_Heap_Allocation is in effect,  the image reduces to
17669 the numeric suffix, that is to say the hexadecimal representation of the
17670 virtual address of the control block of the task.
17673 @itemize *
17675 @item 
17676 “The value of @code{Current_Task} when in a protected entry
17677 or interrupt handler.  See C.7.1(17).”
17678 @end itemize
17680 Protected entries or interrupt handlers can be executed by any
17681 convenient thread, so the value of @code{Current_Task} is undefined.
17684 @itemize *
17686 @item 
17687 “Granularity of locking for Task_Attributes.  See C.7.2(16).”
17688 @end itemize
17690 No locking is needed if the formal type Attribute has the size and
17691 alignment of either Integer or System.Address and the bit representation
17692 of Initial_Value is all zeroes. Otherwise, locking is performed.
17695 @itemize *
17697 @item 
17698 “The declarations of @code{Any_Priority} and
17699 @code{Priority}.  See D.1(11).”
17700 @end itemize
17702 See declarations in file @code{system.ads}.
17705 @itemize *
17707 @item 
17708 “Implementation-defined execution resources.  See D.1(15).”
17709 @end itemize
17711 There are no implementation-defined execution resources.
17714 @itemize *
17716 @item 
17717 “Whether, on a multiprocessor, a task that is waiting for
17718 access to a protected object keeps its processor busy.  See D.2.1(3).”
17719 @end itemize
17721 On a multi-processor, a task that is waiting for access to a protected
17722 object does not keep its processor busy.
17725 @itemize *
17727 @item 
17728 “The affect of implementation defined execution resources
17729 on task dispatching.  See D.2.1(9).”
17730 @end itemize
17732 Tasks map to threads in the threads package used by GNAT.  Where possible
17733 and appropriate, these threads correspond to native threads of the
17734 underlying operating system.
17737 @itemize *
17739 @item 
17740 “Implementation-defined task dispatching policies.  See D.2.2(3).”
17741 @end itemize
17743 There are no implementation-defined task dispatching policies.
17746 @itemize *
17748 @item 
17749 “The value of Default_Quantum in Dispatching.Round_Robin.  See D.2.5(4).”
17750 @end itemize
17752 The value is 10 milliseconds.
17755 @itemize *
17757 @item 
17758 “Implementation-defined `policy_identifiers' allowed
17759 in a pragma @code{Locking_Policy}.  See D.3(4).”
17760 @end itemize
17762 The two implementation defined policies permitted in GNAT are
17763 @code{Inheritance_Locking} and  @code{Concurrent_Readers_Locking}. On
17764 targets that support the @code{Inheritance_Locking} policy, locking is
17765 implemented by inheritance, i.e., the task owning the lock operates
17766 at a priority equal to the highest priority of any task currently
17767 requesting the lock. On targets that support the
17768 @code{Concurrent_Readers_Locking} policy, locking is implemented with a
17769 read/write lock allowing multiple protected object functions to enter
17770 concurrently.
17773 @itemize *
17775 @item 
17776 “Default ceiling priorities.  See D.3(10).”
17777 @end itemize
17779 The ceiling priority of protected objects of the type
17780 @code{System.Interrupt_Priority'Last} as described in the Ada
17781 Reference Manual D.3(10),
17784 @itemize *
17786 @item 
17787 “The ceiling of any protected object used internally by
17788 the implementation.  See D.3(16).”
17789 @end itemize
17791 The ceiling priority of internal protected objects is
17792 @code{System.Priority'Last}.
17795 @itemize *
17797 @item 
17798 “Implementation-defined queuing policies.  See D.4(1).”
17799 @end itemize
17801 There are no implementation-defined queuing policies.
17804 @itemize *
17806 @item 
17807 “Implementation-defined admission policies.  See D.4.1(1).”
17808 @end itemize
17810 There are no implementation-defined admission policies.
17813 @itemize *
17815 @item 
17816 “Any operations that implicitly require heap storage
17817 allocation.  See D.7(8).”
17818 @end itemize
17820 The only operation that implicitly requires heap storage allocation is
17821 task creation.
17824 @itemize *
17826 @item 
17827 “When restriction No_Dynamic_CPU_Assignment applies to a partition, the
17828 processor on which a task with a CPU value of a Not_A_Specific_CPU will
17829 execute.  See D.7(10).”
17830 @end itemize
17832 Unknown.
17835 @itemize *
17837 @item 
17838 “When restriction No_Task_Termination applies to a partition, what happens
17839 when a task terminates.  See D.7(15.1).”
17840 @end itemize
17842 Execution is erroneous in that case.
17845 @itemize *
17847 @item 
17848 “The behavior when restriction Max_Storage_At_Blocking is violated.
17849 See D.7(17).”
17850 @end itemize
17852 Execution is erroneous in that case.
17855 @itemize *
17857 @item 
17858 “The behavior when restriction Max_Asynchronous_Select_Nesting is violated.
17859 See D.7(18).”
17860 @end itemize
17862 Execution is erroneous in that case.
17865 @itemize *
17867 @item 
17868 “The behavior when restriction Max_Tasks is violated.  See D.7(19).”
17869 @end itemize
17871 Execution is erroneous in that case.
17874 @itemize *
17876 @item 
17877 “Whether the use of pragma Restrictions results in a reduction in program
17878 code or data size or execution time.  See D.7(20).”
17879 @end itemize
17881 Yes it can, but the precise circumstances and properties of such reductions
17882 are difficult to characterize.
17885 @itemize *
17887 @item 
17888 “The value of Barrier_Limit’Last in Synchronous_Barriers.  See D.10.1(4).”
17889 @end itemize
17891 Synchronous_Barriers.Barrier_Limit’Last is Integer’Last .
17894 @itemize *
17896 @item 
17897 “When an aborted task that is waiting on a Synchronous_Barrier is aborted.
17898 See D.10.1(13).”
17899 @end itemize
17901 Difficult to characterize.
17904 @itemize *
17906 @item 
17907 “The value of Min_Handler_Ceiling in Execution_Time.Group_Budgets.
17908 See D.14.2(7).”
17909 @end itemize
17911 See source file @code{a-etgrbu.ads}.
17914 @itemize *
17916 @item 
17917 “The value of CPU_Range’Last in System.Multiprocessors.  See D.16(4).”
17918 @end itemize
17920 See source file @code{s-multip.ads}.
17923 @itemize *
17925 @item 
17926 “The processor on which the environment task executes in the absence
17927 of a value for the aspect CPU.  See D.16(13).”
17928 @end itemize
17930 Unknown.
17933 @itemize *
17935 @item 
17936 “The means for creating and executing distributed
17937 programs.  See E(5).”
17938 @end itemize
17940 The GLADE package provides a utility GNATDIST for creating and executing
17941 distributed programs. See the GLADE reference manual for further details.
17944 @itemize *
17946 @item 
17947 “Any events that can result in a partition becoming
17948 inaccessible.  See E.1(7).”
17949 @end itemize
17951 See the GLADE reference manual for full details on such events.
17954 @itemize *
17956 @item 
17957 “The scheduling policies, treatment of priorities, and management of
17958 shared resources between partitions in certain cases.  See E.1(11).”
17959 @end itemize
17961 See the GLADE reference manual for full details on these aspects of
17962 multi-partition execution.
17965 @itemize *
17967 @item 
17968 “Whether the execution of the remote subprogram is
17969 immediately aborted as a result of cancellation.  See E.4(13).”
17970 @end itemize
17972 See the GLADE reference manual for details on the effect of abort in
17973 a distributed application.
17976 @itemize *
17978 @item 
17979 “The range of type System.RPC.Partition_Id.  See E.5(14).”
17980 @end itemize
17982 System.RPC.Partition_ID’Last is Integer’Last. See source file @code{s-rpc.ads}.
17985 @itemize *
17987 @item 
17988 “Implementation-defined interfaces in the PCS.  See E.5(26).”
17989 @end itemize
17991 See the GLADE reference manual for a full description of all
17992 implementation defined interfaces.
17995 @itemize *
17997 @item 
17998 “The values of named numbers in the package
17999 @code{Decimal}.  See F.2(7).”
18000 @end itemize
18003 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx} 
18004 @headitem
18006 Named Number
18008 @tab
18010 Value
18012 @item
18014 `Max_Scale'
18016 @tab
18020 @item
18022 `Min_Scale'
18024 @tab
18028 @item
18030 `Min_Delta'
18032 @tab
18034 1.0E-18
18036 @item
18038 `Max_Delta'
18040 @tab
18042 1.0E+18
18044 @item
18046 `Max_Decimal_Digits'
18048 @tab
18052 @end multitable
18056 @itemize *
18058 @item 
18059 “The value of @code{Max_Picture_Length} in the package
18060 @code{Text_IO.Editing}.  See F.3.3(16).”
18064 @item 
18065 “The value of @code{Max_Picture_Length} in the package
18066 @code{Wide_Text_IO.Editing}.  See F.3.4(5).”
18070 @item 
18071 “The accuracy actually achieved by the complex elementary
18072 functions and by other complex arithmetic operations.  See G.1(1).”
18073 @end itemize
18075 Standard library functions are used for the complex arithmetic
18076 operations.  Only fast math mode is currently supported.
18079 @itemize *
18081 @item 
18082 “The sign of a zero result (or a component thereof) from
18083 any operator or function in @code{Numerics.Generic_Complex_Types}, when
18084 @code{Real'Signed_Zeros} is True.  See G.1.1(53).”
18085 @end itemize
18087 The signs of zero values are as recommended by the relevant
18088 implementation advice.
18091 @itemize *
18093 @item 
18094 “The sign of a zero result (or a component thereof) from
18095 any operator or function in
18096 @code{Numerics.Generic_Complex_Elementary_Functions}, when
18097 @code{Real'Signed_Zeros} is @code{True}.  See G.1.2(45).”
18098 @end itemize
18100 The signs of zero values are as recommended by the relevant
18101 implementation advice.
18104 @itemize *
18106 @item 
18107 “Whether the strict mode or the relaxed mode is the
18108 default.  See G.2(2).”
18109 @end itemize
18111 The strict mode is the default.  There is no separate relaxed mode.  GNAT
18112 provides a highly efficient implementation of strict mode.
18115 @itemize *
18117 @item 
18118 “The result interval in certain cases of fixed-to-float
18119 conversion.  See G.2.1(10).”
18120 @end itemize
18122 For cases where the result interval is implementation dependent, the
18123 accuracy is that provided by performing all operations in 64-bit IEEE
18124 floating-point format.
18127 @itemize *
18129 @item 
18130 “The result of a floating point arithmetic operation in
18131 overflow situations, when the @code{Machine_Overflows} attribute of the
18132 result type is @code{False}.  See G.2.1(13).”
18133 @end itemize
18135 Infinite and NaN values are produced as dictated by the IEEE
18136 floating-point standard.
18137 Note that on machines that are not fully compliant with the IEEE
18138 floating-point standard, such as Alpha, the `-mieee' compiler flag
18139 must be used for achieving IEEE conforming behavior (although at the cost
18140 of a significant performance penalty), so infinite and NaN values are
18141 properly generated.
18144 @itemize *
18146 @item 
18147 “The result interval for division (or exponentiation by a
18148 negative exponent), when the floating point hardware implements division
18149 as multiplication by a reciprocal.  See G.2.1(16).”
18150 @end itemize
18152 Not relevant, division is IEEE exact.
18155 @itemize *
18157 @item 
18158 “The definition of close result set, which determines the accuracy of
18159 certain fixed point multiplications and divisions.  See G.2.3(5).”
18160 @end itemize
18162 Operations in the close result set are performed using IEEE long format
18163 floating-point arithmetic.  The input operands are converted to
18164 floating-point, the operation is done in floating-point, and the result
18165 is converted to the target type.
18168 @itemize *
18170 @item 
18171 “Conditions on a `universal_real' operand of a fixed
18172 point multiplication or division for which the result shall be in the
18173 perfect result set.  See G.2.3(22).”
18174 @end itemize
18176 The result is only defined to be in the perfect result set if the result
18177 can be computed by a single scaling operation involving a scale factor
18178 representable in 64 bits.
18181 @itemize *
18183 @item 
18184 “The result of a fixed point arithmetic operation in
18185 overflow situations, when the @code{Machine_Overflows} attribute of the
18186 result type is @code{False}.  See G.2.3(27).”
18187 @end itemize
18189 Not relevant, @code{Machine_Overflows} is @code{True} for fixed-point
18190 types.
18193 @itemize *
18195 @item 
18196 “The result of an elementary function reference in
18197 overflow situations, when the @code{Machine_Overflows} attribute of the
18198 result type is @code{False}.  See G.2.4(4).”
18199 @end itemize
18201 IEEE infinite and Nan values are produced as appropriate.
18204 @itemize *
18206 @item 
18207 “The value of the angle threshold, within which certain
18208 elementary functions, complex arithmetic operations, and complex
18209 elementary functions yield results conforming to a maximum relative
18210 error bound.  See G.2.4(10).”
18211 @end itemize
18213 Information on this subject is not yet available.
18216 @itemize *
18218 @item 
18219 “The accuracy of certain elementary functions for
18220 parameters beyond the angle threshold.  See G.2.4(10).”
18221 @end itemize
18223 Information on this subject is not yet available.
18226 @itemize *
18228 @item 
18229 “The result of a complex arithmetic operation or complex
18230 elementary function reference in overflow situations, when the
18231 @code{Machine_Overflows} attribute of the corresponding real type is
18232 @code{False}.  See G.2.6(5).”
18233 @end itemize
18235 IEEE infinite and Nan values are produced as appropriate.
18238 @itemize *
18240 @item 
18241 “The accuracy of certain complex arithmetic operations and
18242 certain complex elementary functions for parameters (or components
18243 thereof) beyond the angle threshold.  See G.2.6(8).”
18244 @end itemize
18246 Information on those subjects is not yet available.
18249 @itemize *
18251 @item 
18252 “The accuracy requirements for the subprograms Solve, Inverse,
18253 Determinant, Eigenvalues and Eigensystem for type Real_Matrix.
18254 See G.3.1(81).”
18255 @end itemize
18257 Information on those subjects is not yet available.
18260 @itemize *
18262 @item 
18263 “The accuracy requirements for the subprograms Solve, Inverse,
18264 Determinant, Eigenvalues and Eigensystem for type Complex_Matrix.
18265 See G.3.2(149).”
18266 @end itemize
18268 Information on those subjects is not yet available.
18271 @itemize *
18273 @item 
18274 “The consequences of violating No_Hidden_Indirect_Globals.  See H.4(23.9).”
18275 @end itemize
18277 Execution is erroneous in that case.
18279 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
18280 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{271}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{272}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}
18281 @chapter Intrinsic Subprograms
18284 @geindex Intrinsic Subprograms
18286 GNAT allows a user application program to write the declaration:
18288 @example
18289 pragma Import (Intrinsic, name);
18290 @end example
18292 providing that the name corresponds to one of the implemented intrinsic
18293 subprograms in GNAT, and that the parameter profile of the referenced
18294 subprogram meets the requirements.  This chapter describes the set of
18295 implemented intrinsic subprograms, and the requirements on parameter profiles.
18296 Note that no body is supplied; as with other uses of pragma Import, the
18297 body is supplied elsewhere (in this case by the compiler itself).  Note
18298 that any use of this feature is potentially non-portable, since the
18299 Ada standard does not require Ada compilers to implement this feature.
18301 @menu
18302 * Intrinsic Operators:: 
18303 * Compilation_ISO_Date:: 
18304 * Compilation_Date:: 
18305 * Compilation_Time:: 
18306 * Enclosing_Entity:: 
18307 * Exception_Information:: 
18308 * Exception_Message:: 
18309 * Exception_Name:: 
18310 * File:: 
18311 * Line:: 
18312 * Shifts and Rotates:: 
18313 * Source_Location:: 
18315 @end menu
18317 @node Intrinsic Operators,Compilation_ISO_Date,,Intrinsic Subprograms
18318 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{273}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{274}
18319 @section Intrinsic Operators
18322 @geindex Intrinsic operator
18324 All the predefined numeric operators in package Standard
18325 in @code{pragma Import (Intrinsic,..)}
18326 declarations.  In the binary operator case, the operands must have the same
18327 size.  The operand or operands must also be appropriate for
18328 the operator.  For example, for addition, the operands must
18329 both be floating-point or both be fixed-point, and the
18330 right operand for @code{"**"} must have a root type of
18331 @code{Standard.Integer'Base}.
18332 You can use an intrinsic operator declaration as in the following example:
18334 @example
18335 type Int1 is new Integer;
18336 type Int2 is new Integer;
18338 function "+" (X1 : Int1; X2 : Int2) return Int1;
18339 function "+" (X1 : Int1; X2 : Int2) return Int2;
18340 pragma Import (Intrinsic, "+");
18341 @end example
18343 This declaration would permit ‘mixed mode’ arithmetic on items
18344 of the differing types @code{Int1} and @code{Int2}.
18345 It is also possible to specify such operators for private types, if the
18346 full views are appropriate arithmetic types.
18348 @node Compilation_ISO_Date,Compilation_Date,Intrinsic Operators,Intrinsic Subprograms
18349 @anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{275}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{276}
18350 @section Compilation_ISO_Date
18353 @geindex Compilation_ISO_Date
18355 This intrinsic subprogram is used in the implementation of the
18356 library package @code{GNAT.Source_Info}.  The only useful use of the
18357 intrinsic import in this case is the one in this unit, so an
18358 application program should simply call the function
18359 @code{GNAT.Source_Info.Compilation_ISO_Date} to obtain the date of
18360 the current compilation (in local time format YYYY-MM-DD).
18362 @node Compilation_Date,Compilation_Time,Compilation_ISO_Date,Intrinsic Subprograms
18363 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{277}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{278}
18364 @section Compilation_Date
18367 @geindex Compilation_Date
18369 Same as Compilation_ISO_Date, except the string is in the form
18370 MMM DD YYYY.
18372 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
18373 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{279}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{27a}
18374 @section Compilation_Time
18377 @geindex Compilation_Time
18379 This intrinsic subprogram is used in the implementation of the
18380 library package @code{GNAT.Source_Info}.  The only useful use of the
18381 intrinsic import in this case is the one in this unit, so an
18382 application program should simply call the function
18383 @code{GNAT.Source_Info.Compilation_Time} to obtain the time of
18384 the current compilation (in local time format HH:MM:SS).
18386 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
18387 @anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{27b}@anchor{gnat_rm/intrinsic_subprograms id6}@anchor{27c}
18388 @section Enclosing_Entity
18391 @geindex Enclosing_Entity
18393 This intrinsic subprogram is used in the implementation of the
18394 library package @code{GNAT.Source_Info}.  The only useful use of the
18395 intrinsic import in this case is the one in this unit, so an
18396 application program should simply call the function
18397 @code{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
18398 the current subprogram, package, task, entry, or protected subprogram.
18400 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
18401 @anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{27d}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{27e}
18402 @section Exception_Information
18405 @geindex Exception_Information'
18407 This intrinsic subprogram is used in the implementation of the
18408 library package @code{GNAT.Current_Exception}.  The only useful
18409 use of the intrinsic import in this case is the one in this unit,
18410 so an application program should simply call the function
18411 @code{GNAT.Current_Exception.Exception_Information} to obtain
18412 the exception information associated with the current exception.
18414 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
18415 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{27f}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{280}
18416 @section Exception_Message
18419 @geindex Exception_Message
18421 This intrinsic subprogram is used in the implementation of the
18422 library package @code{GNAT.Current_Exception}.  The only useful
18423 use of the intrinsic import in this case is the one in this unit,
18424 so an application program should simply call the function
18425 @code{GNAT.Current_Exception.Exception_Message} to obtain
18426 the message associated with the current exception.
18428 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
18429 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{281}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{282}
18430 @section Exception_Name
18433 @geindex Exception_Name
18435 This intrinsic subprogram is used in the implementation of the
18436 library package @code{GNAT.Current_Exception}.  The only useful
18437 use of the intrinsic import in this case is the one in this unit,
18438 so an application program should simply call the function
18439 @code{GNAT.Current_Exception.Exception_Name} to obtain
18440 the name of the current exception.
18442 @node File,Line,Exception_Name,Intrinsic Subprograms
18443 @anchor{gnat_rm/intrinsic_subprograms file}@anchor{283}@anchor{gnat_rm/intrinsic_subprograms id10}@anchor{284}
18444 @section File
18447 @geindex File
18449 This intrinsic subprogram is used in the implementation of the
18450 library package @code{GNAT.Source_Info}.  The only useful use of the
18451 intrinsic import in this case is the one in this unit, so an
18452 application program should simply call the function
18453 @code{GNAT.Source_Info.File} to obtain the name of the current
18454 file.
18456 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
18457 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{285}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{286}
18458 @section Line
18461 @geindex Line
18463 This intrinsic subprogram is used in the implementation of the
18464 library package @code{GNAT.Source_Info}.  The only useful use of the
18465 intrinsic import in this case is the one in this unit, so an
18466 application program should simply call the function
18467 @code{GNAT.Source_Info.Line} to obtain the number of the current
18468 source line.
18470 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
18471 @anchor{gnat_rm/intrinsic_subprograms id12}@anchor{287}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{288}
18472 @section Shifts and Rotates
18475 @geindex Shift_Left
18477 @geindex Shift_Right
18479 @geindex Shift_Right_Arithmetic
18481 @geindex Rotate_Left
18483 @geindex Rotate_Right
18485 In standard Ada, the shift and rotate functions are available only
18486 for the predefined modular types in package @code{Interfaces}.  However, in
18487 GNAT it is possible to define these functions for any integer
18488 type (signed or modular), as in this example:
18490 @example
18491 function Shift_Left
18492   (Value  : T;
18493    Amount : Natural) return T
18494 with Import, Convention => Intrinsic;
18495 @end example
18497 The function name must be one of
18498 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
18499 Rotate_Right. T must be an integer type. T’Size must be
18500 8, 16, 32 or 64 bits; if T is modular, the modulus
18501 must be 2**8, 2**16, 2**32 or 2**64.
18502 The result type must be the same as the type of @code{Value}.
18503 The shift amount must be Natural.
18504 The formal parameter names can be anything.
18506 A more convenient way of providing these shift operators is to use the
18507 Provide_Shift_Operators pragma, which provides the function declarations and
18508 corresponding pragma Import’s for all five shift functions. For signed types
18509 the semantics of these operators is to interpret the bitwise result of the
18510 corresponding operator for modular type. In particular, shifting a negative
18511 number may change its sign bit to positive.
18513 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
18514 @anchor{gnat_rm/intrinsic_subprograms id13}@anchor{289}@anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{28a}
18515 @section Source_Location
18518 @geindex Source_Location
18520 This intrinsic subprogram is used in the implementation of the
18521 library routine @code{GNAT.Source_Info}.  The only useful use of the
18522 intrinsic import in this case is the one in this unit, so an
18523 application program should simply call the function
18524 @code{GNAT.Source_Info.Source_Location} to obtain the current
18525 source file location.
18527 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
18528 @anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{28b}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{28c}@anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}
18529 @chapter Representation Clauses and Pragmas
18532 @geindex Representation Clauses
18534 @geindex Representation Clause
18536 @geindex Representation Pragma
18538 @geindex Pragma
18539 @geindex representation
18541 This section describes the representation clauses accepted by GNAT, and
18542 their effect on the representation of corresponding data objects.
18544 GNAT fully implements Annex C (Systems Programming).  This means that all
18545 the implementation advice sections in chapter 13 are fully implemented.
18546 However, these sections only require a minimal level of support for
18547 representation clauses.  GNAT provides much more extensive capabilities,
18548 and this section describes the additional capabilities provided.
18550 @menu
18551 * Alignment Clauses:: 
18552 * Size Clauses:: 
18553 * Storage_Size Clauses:: 
18554 * Size of Variant Record Objects:: 
18555 * Biased Representation:: 
18556 * Value_Size and Object_Size Clauses:: 
18557 * Component_Size Clauses:: 
18558 * Bit_Order Clauses:: 
18559 * Effect of Bit_Order on Byte Ordering:: 
18560 * Pragma Pack for Arrays:: 
18561 * Pragma Pack for Records:: 
18562 * Record Representation Clauses:: 
18563 * Handling of Records with Holes:: 
18564 * Enumeration Clauses:: 
18565 * Address Clauses:: 
18566 * Use of Address Clauses for Memory-Mapped I/O:: 
18567 * Effect of Convention on Representation:: 
18568 * Conventions and Anonymous Access Types:: 
18569 * Determining the Representations chosen by GNAT:: 
18571 @end menu
18573 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
18574 @anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{28d}@anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{28e}
18575 @section Alignment Clauses
18578 @geindex Alignment Clause
18580 GNAT requires that all alignment clauses specify 0 or a power of 2, and
18581 all default alignments are always a power of 2. Specifying 0 is the
18582 same as specifying 1.
18584 The default alignment values are as follows:
18587 @itemize *
18589 @item 
18590 `Elementary Types'.
18592 For elementary types, the alignment is the minimum of the actual size of
18593 objects of the type divided by @code{Storage_Unit},
18594 and the maximum alignment supported by the target.
18595 (This maximum alignment is given by the GNAT-specific attribute
18596 @code{Standard'Maximum_Alignment}; see @ref{19d,,Attribute Maximum_Alignment}.)
18598 @geindex Maximum_Alignment attribute
18600 For example, for type @code{Long_Float}, the object size is 8 bytes, and the
18601 default alignment will be 8 on any target that supports alignments
18602 this large, but on some targets, the maximum alignment may be smaller
18603 than 8, in which case objects of type @code{Long_Float} will be maximally
18604 aligned.
18606 @item 
18607 `Arrays'.
18609 For arrays, the alignment is equal to the alignment of the component type
18610 for the normal case where no packing or component size is given.  If the
18611 array is packed, and the packing is effective (see separate section on
18612 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
18613 arrays or arrays whose length is not known at compile time, depending on
18614 whether the component size is divisible by 4, 2, or is odd.  For short packed
18615 arrays, which are handled internally as modular types, the alignment
18616 will be as described for elementary types, e.g. a packed array of length
18617 31 bits will have an object size of four bytes, and an alignment of 4.
18619 @item 
18620 `Records'.
18622 For the normal unpacked case, the alignment of a record is equal to
18623 the maximum alignment of any of its components.  For tagged records, this
18624 includes the implicit access type used for the tag.  If a pragma @code{Pack}
18625 is used and all components are packable (see separate section on pragma
18626 @code{Pack}), then the resulting alignment is 1, unless the layout of the
18627 record makes it profitable to increase it.
18629 A special case is when:
18632 @itemize *
18634 @item 
18635 the size of the record is given explicitly, or a
18636 full record representation clause is given, and
18638 @item 
18639 the size of the record is 2, 4, or 8 bytes.
18640 @end itemize
18642 In this case, an alignment is chosen to match the
18643 size of the record. For example, if we have:
18645 @example
18646 type Small is record
18647    A, B : Character;
18648 end record;
18649 for Small'Size use 16;
18650 @end example
18652 then the default alignment of the record type @code{Small} is 2, not 1. This
18653 leads to more efficient code when the record is treated as a unit, and also
18654 allows the type to specified as @code{Atomic} on architectures requiring
18655 strict alignment.
18656 @end itemize
18658 An alignment clause may specify a larger alignment than the default value
18659 up to some maximum value dependent on the target (obtainable by using the
18660 attribute reference @code{Standard'Maximum_Alignment}). It may also specify
18661 a smaller alignment than the default value for enumeration, integer and
18662 fixed point types, as well as for record types, for example
18664 @example
18665 type V is record
18666    A : Integer;
18667 end record;
18669 for V'alignment use 1;
18670 @end example
18672 @geindex Alignment
18673 @geindex default
18675 The default alignment for the type @code{V} is 4, as a result of the
18676 Integer field in the record, but it is permissible, as shown, to
18677 override the default alignment of the record with a smaller value.
18679 @geindex Alignment
18680 @geindex subtypes
18682 Note that according to the Ada standard, an alignment clause applies only
18683 to the first named subtype. If additional subtypes are declared, then the
18684 compiler is allowed to choose any alignment it likes, and there is no way
18685 to control this choice. Consider:
18687 @example
18688 type R is range 1 .. 10_000;
18689 for R'Alignment use 1;
18690 subtype RS is R range 1 .. 1000;
18691 @end example
18693 The alignment clause specifies an alignment of 1 for the first named subtype
18694 @code{R} but this does not necessarily apply to @code{RS}. When writing
18695 portable Ada code, you should avoid writing code that explicitly or
18696 implicitly relies on the alignment of such subtypes.
18698 For the GNAT compiler, if an explicit alignment clause is given, this
18699 value is also used for any subsequent subtypes. So for GNAT, in the
18700 above example, you can count on the alignment of @code{RS} being 1. But this
18701 assumption is non-portable, and other compilers may choose different
18702 alignments for the subtype @code{RS}.
18704 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
18705 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{28f}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{290}
18706 @section Size Clauses
18709 @geindex Size Clause
18711 The default size for a type @code{T} is obtainable through the
18712 language-defined attribute @code{T'Size} and also through the
18713 equivalent GNAT-defined attribute @code{T'Value_Size}.
18714 For objects of type @code{T}, GNAT will generally increase the type size
18715 so that the object size (obtainable through the GNAT-defined attribute
18716 @code{T'Object_Size})
18717 is a multiple of @code{T'Alignment * Storage_Unit}.
18719 For example:
18721 @example
18722 type Smallint is range 1 .. 6;
18724 type Rec is record
18725    Y1 : integer;
18726    Y2 : boolean;
18727 end record;
18728 @end example
18730 In this example, @code{Smallint'Size} = @code{Smallint'Value_Size} = 3,
18731 as specified by the RM rules,
18732 but objects of this type will have a size of 8
18733 (@code{Smallint'Object_Size} = 8),
18734 since objects by default occupy an integral number
18735 of storage units.  On some targets, notably older
18736 versions of the Digital Alpha, the size of stand
18737 alone objects of this type may be 32, reflecting
18738 the inability of the hardware to do byte load/stores.
18740 Similarly, the size of type @code{Rec} is 40 bits
18741 (@code{Rec'Size} = @code{Rec'Value_Size} = 40), but
18742 the alignment is 4, so objects of this type will have
18743 their size increased to 64 bits so that it is a multiple
18744 of the alignment (in bits).  This decision is
18745 in accordance with the specific Implementation Advice in RM 13.3(43):
18747 @quotation
18749 “A @code{Size} clause should be supported for an object if the specified
18750 @code{Size} is at least as large as its subtype’s @code{Size}, and corresponds
18751 to a size in storage elements that is a multiple of the object’s
18752 @code{Alignment} (if the @code{Alignment} is nonzero).”
18753 @end quotation
18755 An explicit size clause may be used to override the default size by
18756 increasing it.  For example, if we have:
18758 @example
18759 type My_Boolean is new Boolean;
18760 for My_Boolean'Size use 32;
18761 @end example
18763 then values of this type will always be 32-bit long.  In the case of discrete
18764 types, the size can be increased up to 64 bits on 32-bit targets and 128 bits
18765 on 64-bit targets, with the effect that the entire specified field is used to
18766 hold the value, sign- or zero-extended as appropriate.  If more than 64 bits
18767 or 128 bits resp. is specified, then padding space is allocated after the
18768 value, and a warning is issued that there are unused bits.
18770 Similarly the size of records and arrays may be increased, and the effect
18771 is to add padding bits after the value.  This also causes a warning message
18772 to be generated.
18774 The largest Size value permitted in GNAT is 2**31-1.  Since this is a
18775 Size in bits, this corresponds to an object of size 256 megabytes (minus
18776 one).  This limitation is true on all targets.  The reason for this
18777 limitation is that it improves the quality of the code in many cases
18778 if it is known that a Size value can be accommodated in an object of
18779 type Integer.
18781 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
18782 @anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{291}@anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{292}
18783 @section Storage_Size Clauses
18786 @geindex Storage_Size Clause
18788 For tasks, the @code{Storage_Size} clause specifies the amount of space
18789 to be allocated for the task stack.  This cannot be extended, and if the
18790 stack is exhausted, then @code{Storage_Error} will be raised (if stack
18791 checking is enabled).  Use a @code{Storage_Size} attribute definition clause,
18792 or a @code{Storage_Size} pragma in the task definition to set the
18793 appropriate required size.  A useful technique is to include in every
18794 task definition a pragma of the form:
18796 @example
18797 pragma Storage_Size (Default_Stack_Size);
18798 @end example
18800 Then @code{Default_Stack_Size} can be defined in a global package, and
18801 modified as required. Any tasks requiring stack sizes different from the
18802 default can have an appropriate alternative reference in the pragma.
18804 You can also use the `-d' binder switch to modify the default stack
18805 size.
18807 For access types, the @code{Storage_Size} clause specifies the maximum
18808 space available for allocation of objects of the type.  If this space is
18809 exceeded then @code{Storage_Error} will be raised by an allocation attempt.
18810 In the case where the access type is declared local to a subprogram, the
18811 use of a @code{Storage_Size} clause triggers automatic use of a special
18812 predefined storage pool (@code{System.Pool_Size}) that ensures that all
18813 space for the pool is automatically reclaimed on exit from the scope in
18814 which the type is declared.
18816 A special case recognized by the compiler is the specification of a
18817 @code{Storage_Size} of zero for an access type.  This means that no
18818 items can be allocated from the pool, and this is recognized at compile
18819 time, and all the overhead normally associated with maintaining a fixed
18820 size storage pool is eliminated.  Consider the following example:
18822 @example
18823 procedure p is
18824    type R is array (Natural) of Character;
18825    type P is access all R;
18826    for P'Storage_Size use 0;
18827    --  Above access type intended only for interfacing purposes
18829    y : P;
18831    procedure g (m : P);
18832    pragma Import (C, g);
18834    --  ...
18836 begin
18837    --  ...
18838    y := new R;
18839 end;
18840 @end example
18842 As indicated in this example, these dummy storage pools are often useful in
18843 connection with interfacing where no object will ever be allocated.  If you
18844 compile the above example, you get the warning:
18846 @example
18847 p.adb:16:09: warning: allocation from empty storage pool
18848 p.adb:16:09: warning: Storage_Error will be raised at run time
18849 @end example
18851 Of course in practice, there will not be any explicit allocators in the
18852 case of such an access declaration.
18854 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
18855 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{293}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{294}
18856 @section Size of Variant Record Objects
18859 @geindex Size
18860 @geindex variant record objects
18862 @geindex Variant record objects
18863 @geindex size
18865 In the case of variant record objects, there is a question whether Size gives
18866 information about a particular variant, or the maximum size required
18867 for any variant.  Consider the following program
18869 @example
18870 with Text_IO; use Text_IO;
18871 procedure q is
18872    type R1 (A : Boolean := False) is record
18873      case A is
18874        when True  => X : Character;
18875        when False => null;
18876      end case;
18877    end record;
18879    V1 : R1 (False);
18880    V2 : R1;
18882 begin
18883    Put_Line (Integer'Image (V1'Size));
18884    Put_Line (Integer'Image (V2'Size));
18885 end q;
18886 @end example
18888 Here we are dealing with a variant record, where the True variant
18889 requires 16 bits, and the False variant requires 8 bits.
18890 In the above example, both V1 and V2 contain the False variant,
18891 which is only 8 bits long.  However, the result of running the
18892 program is:
18894 @example
18897 @end example
18899 The reason for the difference here is that the discriminant value of
18900 V1 is fixed, and will always be False.  It is not possible to assign
18901 a True variant value to V1, therefore 8 bits is sufficient.  On the
18902 other hand, in the case of V2, the initial discriminant value is
18903 False (from the default), but it is possible to assign a True
18904 variant value to V2, therefore 16 bits must be allocated for V2
18905 in the general case, even fewer bits may be needed at any particular
18906 point during the program execution.
18908 As can be seen from the output of this program, the @code{'Size}
18909 attribute applied to such an object in GNAT gives the actual allocated
18910 size of the variable, which is the largest size of any of the variants.
18911 The Ada Reference Manual is not completely clear on what choice should
18912 be made here, but the GNAT behavior seems most consistent with the
18913 language in the RM.
18915 In some cases, it may be desirable to obtain the size of the current
18916 variant, rather than the size of the largest variant.  This can be
18917 achieved in GNAT by making use of the fact that in the case of a
18918 subprogram parameter, GNAT does indeed return the size of the current
18919 variant (because a subprogram has no way of knowing how much space
18920 is actually allocated for the actual).
18922 Consider the following modified version of the above program:
18924 @example
18925 with Text_IO; use Text_IO;
18926 procedure q is
18927    type R1 (A : Boolean := False) is record
18928      case A is
18929        when True  => X : Character;
18930        when False => null;
18931      end case;
18932    end record;
18934    V2 : R1;
18936    function Size (V : R1) return Integer is
18937    begin
18938       return V'Size;
18939    end Size;
18941 begin
18942    Put_Line (Integer'Image (V2'Size));
18943    Put_Line (Integer'Image (Size (V2)));
18944    V2 := (True, 'x');
18945    Put_Line (Integer'Image (V2'Size));
18946    Put_Line (Integer'Image (Size (V2)));
18947 end q;
18948 @end example
18950 The output from this program is
18952 @example
18957 @end example
18959 Here we see that while the @code{'Size} attribute always returns
18960 the maximum size, regardless of the current variant value, the
18961 @code{Size} function does indeed return the size of the current
18962 variant value.
18964 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18965 @anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{295}@anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{296}
18966 @section Biased Representation
18969 @geindex Size for biased representation
18971 @geindex Biased representation
18973 In the case of scalars with a range starting at other than zero, it is
18974 possible in some cases to specify a size smaller than the default minimum
18975 value, and in such cases, GNAT uses an unsigned biased representation,
18976 in which zero is used to represent the lower bound, and successive values
18977 represent successive values of the type.
18979 For example, suppose we have the declaration:
18981 @example
18982 type Small is range -7 .. -4;
18983 for Small'Size use 2;
18984 @end example
18986 Although the default size of type @code{Small} is 4, the @code{Size}
18987 clause is accepted by GNAT and results in the following representation
18988 scheme:
18990 @example
18991 -7 is represented as 2#00#
18992 -6 is represented as 2#01#
18993 -5 is represented as 2#10#
18994 -4 is represented as 2#11#
18995 @end example
18997 Biased representation is only used if the specified @code{Size} clause
18998 cannot be accepted in any other manner.  These reduced sizes that force
18999 biased representation can be used for all discrete types except for
19000 enumeration types for which a representation clause is given.
19002 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
19003 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{297}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{298}
19004 @section Value_Size and Object_Size Clauses
19007 @geindex Value_Size
19009 @geindex Object_Size
19011 @geindex Size
19012 @geindex of objects
19014 In Ada 95 and Ada 2005, @code{T'Size} for a type @code{T} is the minimum
19015 number of bits required to hold values of type @code{T}.
19016 Although this interpretation was allowed in Ada 83, it was not required,
19017 and this requirement in practice can cause some significant difficulties.
19018 For example, in most Ada 83 compilers, @code{Natural'Size} was 32.
19019 However, in Ada 95 and Ada 2005,
19020 @code{Natural'Size} is
19021 typically 31.  This means that code may change in behavior when moving
19022 from Ada 83 to Ada 95 or Ada 2005.  For example, consider:
19024 @example
19025 type Rec is record
19026    A : Natural;
19027    B : Natural;
19028 end record;
19030 for Rec use record
19031    A at 0 range 0 .. Natural'Size - 1;
19032    B at 0 range Natural'Size .. 2 * Natural'Size - 1;
19033 end record;
19034 @end example
19036 In the above code, since the typical size of @code{Natural} objects
19037 is 32 bits and @code{Natural'Size} is 31, the above code can cause
19038 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
19039 there are cases where the fact that the object size can exceed the
19040 size of the type causes surprises.
19042 To help get around this problem GNAT provides two implementation
19043 defined attributes, @code{Value_Size} and @code{Object_Size}.  When
19044 applied to a type, these attributes yield the size of the type
19045 (corresponding to the RM defined size attribute), and the size of
19046 objects of the type respectively.
19048 The @code{Object_Size} is used for determining the default size of
19049 objects and components.  This size value can be referred to using the
19050 @code{Object_Size} attribute.  The phrase ‘is used’ here means that it is
19051 the basis of the determination of the size.  The backend is free to
19052 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
19053 character might be stored in 32 bits on a machine with no efficient
19054 byte access instructions such as the Alpha.
19056 The default rules for the value of @code{Object_Size} for
19057 discrete types are as follows:
19060 @itemize *
19062 @item 
19063 The @code{Object_Size} for base subtypes reflect the natural hardware
19064 size in bits (run the compiler with `-gnatS' to find those values
19065 for numeric types). Enumeration types and fixed-point base subtypes have
19066 8, 16, 32, or 64 bits for this size, depending on the range of values
19067 to be stored.
19069 @item 
19070 The @code{Object_Size} of a subtype is the same as the
19071 @code{Object_Size} of
19072 the type from which it is obtained.
19074 @item 
19075 The @code{Object_Size} of a derived base type is copied from the parent
19076 base type, and the @code{Object_Size} of a derived first subtype is copied
19077 from the parent first subtype.
19078 @end itemize
19080 The @code{Value_Size} attribute
19081 is the (minimum) number of bits required to store a value
19082 of the type.
19083 This value is used to determine how tightly to pack
19084 records or arrays with components of this type, and also affects
19085 the semantics of unchecked conversion (unchecked conversions where
19086 the @code{Value_Size} values differ generate a warning, and are potentially
19087 target dependent).
19089 The default rules for the value of @code{Value_Size} are as follows:
19092 @itemize *
19094 @item 
19095 The @code{Value_Size} for a base subtype is the minimum number of bits
19096 required to store all values of the type (including the sign bit
19097 only if negative values are possible).
19099 @item 
19100 If a subtype statically matches the first subtype of a given type, then it has
19101 by default the same @code{Value_Size} as the first subtype.  (This is a
19102 consequence of RM 13.1(14): “if two subtypes statically match,
19103 then their subtype-specific aspects are the same”.)
19105 @item 
19106 All other subtypes have a @code{Value_Size} corresponding to the minimum
19107 number of bits required to store all values of the subtype.  For
19108 dynamic bounds, it is assumed that the value can range down or up
19109 to the corresponding bound of the ancestor
19110 @end itemize
19112 The RM defined attribute @code{Size} corresponds to the
19113 @code{Value_Size} attribute.
19115 The @code{Size} attribute may be defined for a first-named subtype.  This sets
19116 the @code{Value_Size} of
19117 the first-named subtype to the given value, and the
19118 @code{Object_Size} of this first-named subtype to the given value padded up
19119 to an appropriate boundary.  It is a consequence of the default rules
19120 above that this @code{Object_Size} will apply to all further subtypes.  On the
19121 other hand, @code{Value_Size} is affected only for the first subtype, any
19122 dynamic subtypes obtained from it directly, and any statically matching
19123 subtypes.  The @code{Value_Size} of any other static subtypes is not affected.
19125 @code{Value_Size} and
19126 @code{Object_Size} may be explicitly set for any subtype using
19127 an attribute definition clause.  Note that the use of these attributes
19128 can cause the RM 13.1(14) rule to be violated.  If two access types
19129 reference aliased objects whose subtypes have differing @code{Object_Size}
19130 values as a result of explicit attribute definition clauses, then it
19131 is illegal to convert from one access subtype to the other. For a more
19132 complete description of this additional legality rule, see the
19133 description of the @code{Object_Size} attribute.
19135 To get a feel for the difference, consider the following examples (note
19136 that in each case the base is @code{Short_Short_Integer} with a size of 8):
19139 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} 
19140 @headitem
19142 Type or subtype declaration
19144 @tab
19146 Object_Size
19148 @tab
19150 Value_Size
19152 @item
19154 @code{type x1 is range 0 .. 5;}
19156 @tab
19160 @tab
19164 @item
19166 @code{type x2 is range 0 .. 5;}
19167 @code{for x2'size use 12;}
19169 @tab
19173 @tab
19177 @item
19179 @code{subtype x3 is x2 range 0 .. 3;}
19181 @tab
19185 @tab
19189 @item
19191 @code{subtype x4 is x2'base range 0 .. 10;}
19193 @tab
19197 @tab
19201 @item
19203 @code{dynamic : x2'Base range -64 .. +63;}
19205 @tab
19207 @tab
19209 @item
19211 @code{subtype x5 is x2 range 0 .. dynamic;}
19213 @tab
19217 @tab
19221 @item
19223 @code{subtype x6 is x2'base range 0 .. dynamic;}
19225 @tab
19229 @tab
19233 @end multitable
19236 Note: the entries marked ‘*’ are not actually specified by the Ada
19237 Reference Manual, which has nothing to say about size in the dynamic
19238 case. What GNAT does is to allocate sufficient bits to accommodate any
19239 possible dynamic values for the bounds at run-time.
19241 So far, so good, but GNAT has to obey the RM rules, so the question is
19242 under what conditions must the RM @code{Size} be used.
19243 The following is a list
19244 of the occasions on which the RM @code{Size} must be used:
19247 @itemize *
19249 @item 
19250 Component size for packed arrays or records
19252 @item 
19253 Value of the attribute @code{Size} for a type
19255 @item 
19256 Warning about sizes not matching for unchecked conversion
19257 @end itemize
19259 For record types, the @code{Object_Size} is always a multiple of the
19260 alignment of the type (this is true for all types). In some cases the
19261 @code{Value_Size} can be smaller. Consider:
19263 @example
19264 type R is record
19265   X : Integer;
19266   Y : Character;
19267 end record;
19268 @end example
19270 On a typical 32-bit architecture, the X component will occupy four bytes
19271 and the Y component will occupy one byte, for a total of 5 bytes. As a
19272 result @code{R'Value_Size} will be 40 (bits) since this is the minimum size
19273 required to store a value of this type. For example, it is permissible
19274 to have a component of type R in an array whose component size is
19275 specified to be 40 bits.
19277 However, @code{R'Object_Size} will be 64 (bits). The difference is due to
19278 the alignment requirement for objects of the record type. The X
19279 component will require four-byte alignment because that is what type
19280 Integer requires, whereas the Y component, a Character, will only
19281 require 1-byte alignment. Since the alignment required for X is the
19282 greatest of all the components’ alignments, that is the alignment
19283 required for the enclosing record type, i.e., 4 bytes or 32 bits. As
19284 indicated above, the actual object size must be rounded up so that it is
19285 a multiple of the alignment value. Therefore, 40 bits rounded up to the
19286 next multiple of 32 yields 64 bits.
19288 For all other types, the @code{Object_Size}
19289 and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}).
19290 Only @code{Size} may be specified for such types.
19292 Note that @code{Value_Size} can be used to force biased representation
19293 for a particular subtype. Consider this example:
19295 @example
19296 type R is (A, B, C, D, E, F);
19297 subtype RAB is R range A .. B;
19298 subtype REF is R range E .. F;
19299 @end example
19301 By default, @code{RAB}
19302 has a size of 1 (sufficient to accommodate the representation
19303 of @code{A} and @code{B}, 0 and 1), and @code{REF}
19304 has a size of 3 (sufficient to accommodate the representation
19305 of @code{E} and @code{F}, 4 and 5). But if we add the
19306 following @code{Value_Size} attribute definition clause:
19308 @example
19309 for REF'Value_Size use 1;
19310 @end example
19312 then biased representation is forced for @code{REF},
19313 and 0 will represent @code{E} and 1 will represent @code{F}.
19314 A warning is issued when a @code{Value_Size} attribute
19315 definition clause forces biased representation. This
19316 warning can be turned off using @code{-gnatw.B}.
19318 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
19319 @anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{299}@anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{29a}
19320 @section Component_Size Clauses
19323 @geindex Component_Size Clause
19325 Normally, the value specified in a component size clause must be consistent
19326 with the subtype of the array component with regard to size and alignment.
19327 In other words, the value specified must be at least equal to the size
19328 of this subtype, and must be a multiple of the alignment value.
19330 In addition, component size clauses are allowed which cause the array
19331 to be packed, by specifying a smaller value.  A first case is for
19332 component size values in the range 1 through 63 on 32-bit targets,
19333 and 1 through 127 on 64-bit targets.  The value specified may not
19334 be smaller than the Size of the subtype.  GNAT will accurately
19335 honor all packing requests in this range.  For example, if we have:
19337 @example
19338 type r is array (1 .. 8) of Natural;
19339 for r'Component_Size use 31;
19340 @end example
19342 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
19343 Of course access to the components of such an array is considerably
19344 less efficient than if the natural component size of 32 is used.
19345 A second case is when the subtype of the component is a record type
19346 padded because of its default alignment.  For example, if we have:
19348 @example
19349 type r is record
19350   i : Integer;
19351   j : Integer;
19352   b : Boolean;
19353 end record;
19355 type a is array (1 .. 8) of r;
19356 for a'Component_Size use 72;
19357 @end example
19359 then the resulting array has a length of 72 bytes, instead of 96 bytes
19360 if the alignment of the record (4) was obeyed.
19362 Note that there is no point in giving both a component size clause
19363 and a pragma Pack for the same array type. if such duplicate
19364 clauses are given, the pragma Pack will be ignored.
19366 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
19367 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{29b}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{29c}
19368 @section Bit_Order Clauses
19371 @geindex Bit_Order Clause
19373 @geindex bit ordering
19375 @geindex ordering
19376 @geindex of bits
19378 For record subtypes, GNAT permits the specification of the @code{Bit_Order}
19379 attribute.  The specification may either correspond to the default bit
19380 order for the target, in which case the specification has no effect and
19381 places no additional restrictions, or it may be for the non-standard
19382 setting (that is the opposite of the default).
19384 In the case where the non-standard value is specified, the effect is
19385 to renumber bits within each byte, but the ordering of bytes is not
19386 affected.  There are certain
19387 restrictions placed on component clauses as follows:
19390 @itemize *
19392 @item 
19393 Components fitting within a single storage unit.
19395 These are unrestricted, and the effect is merely to renumber bits.  For
19396 example if we are on a little-endian machine with @code{Low_Order_First}
19397 being the default, then the following two declarations have exactly
19398 the same effect:
19400 @example
19401 type R1 is record
19402    A : Boolean;
19403    B : Integer range 1 .. 120;
19404 end record;
19406 for R1 use record
19407    A at 0 range 0 .. 0;
19408    B at 0 range 1 .. 7;
19409 end record;
19411 type R2 is record
19412    A : Boolean;
19413    B : Integer range 1 .. 120;
19414 end record;
19416 for R2'Bit_Order use High_Order_First;
19418 for R2 use record
19419    A at 0 range 7 .. 7;
19420    B at 0 range 0 .. 6;
19421 end record;
19422 @end example
19424 The useful application here is to write the second declaration with the
19425 @code{Bit_Order} attribute definition clause, and know that it will be treated
19426 the same, regardless of whether the target is little-endian or big-endian.
19428 @item 
19429 Components occupying an integral number of bytes.
19431 These are components that exactly fit in two or more bytes.  Such component
19432 declarations are allowed, but have no effect, since it is important to realize
19433 that the @code{Bit_Order} specification does not affect the ordering of bytes.
19434 In particular, the following attempt at getting an endian-independent integer
19435 does not work:
19437 @example
19438 type R2 is record
19439    A : Integer;
19440 end record;
19442 for R2'Bit_Order use High_Order_First;
19444 for R2 use record
19445    A at 0 range 0 .. 31;
19446 end record;
19447 @end example
19449 This declaration will result in a little-endian integer on a
19450 little-endian machine, and a big-endian integer on a big-endian machine.
19451 If byte flipping is required for interoperability between big- and
19452 little-endian machines, this must be explicitly programmed.  This capability
19453 is not provided by @code{Bit_Order}.
19455 @item 
19456 Components that are positioned across byte boundaries.
19458 but do not occupy an integral number of bytes.  Given that bytes are not
19459 reordered, such fields would occupy a non-contiguous sequence of bits
19460 in memory, requiring non-trivial code to reassemble.  They are for this
19461 reason not permitted, and any component clause specifying such a layout
19462 will be flagged as illegal by GNAT.
19463 @end itemize
19465 Since the misconception that Bit_Order automatically deals with all
19466 endian-related incompatibilities is a common one, the specification of
19467 a component field that is an integral number of bytes will always
19468 generate a warning.  This warning may be suppressed using @code{pragma Warnings (Off)}
19469 if desired.  The following section contains additional
19470 details regarding the issue of byte ordering.
19472 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
19473 @anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{29d}@anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{29e}
19474 @section Effect of Bit_Order on Byte Ordering
19477 @geindex byte ordering
19479 @geindex ordering
19480 @geindex of bytes
19482 In this section we will review the effect of the @code{Bit_Order} attribute
19483 definition clause on byte ordering.  Briefly, it has no effect at all, but
19484 a detailed example will be helpful.  Before giving this
19485 example, let us review the precise
19486 definition of the effect of defining @code{Bit_Order}.  The effect of a
19487 non-standard bit order is described in section 13.5.3 of the Ada
19488 Reference Manual:
19490 @quotation
19492 “2   A bit ordering is a method of interpreting the meaning of
19493 the storage place attributes.”
19494 @end quotation
19496 To understand the precise definition of storage place attributes in
19497 this context, we visit section 13.5.1 of the manual:
19499 @quotation
19501 “13   A record_representation_clause (without the mod_clause)
19502 specifies the layout.  The storage place attributes (see 13.5.2)
19503 are taken from the values of the position, first_bit, and last_bit
19504 expressions after normalizing those values so that first_bit is
19505 less than Storage_Unit.”
19506 @end quotation
19508 The critical point here is that storage places are taken from
19509 the values after normalization, not before.  So the @code{Bit_Order}
19510 interpretation applies to normalized values.  The interpretation
19511 is described in the later part of the 13.5.3 paragraph:
19513 @quotation
19515 “2   A bit ordering is a method of interpreting the meaning of
19516 the storage place attributes.  High_Order_First (known in the
19517 vernacular as ‘big endian’) means that the first bit of a
19518 storage element (bit 0) is the most significant bit (interpreting
19519 the sequence of bits that represent a component as an unsigned
19520 integer value).  Low_Order_First (known in the vernacular as
19521 ‘little endian’) means the opposite: the first bit is the
19522 least significant.”
19523 @end quotation
19525 Note that the numbering is with respect to the bits of a storage
19526 unit.  In other words, the specification affects only the numbering
19527 of bits within a single storage unit.
19529 We can make the effect clearer by giving an example.
19531 Suppose that we have an external device which presents two bytes, the first
19532 byte presented, which is the first (low addressed byte) of the two byte
19533 record is called Master, and the second byte is called Slave.
19535 The left most (most significant) bit is called Control for each byte, and
19536 the remaining 7 bits are called V1, V2, … V7, where V7 is the rightmost
19537 (least significant) bit.
19539 On a big-endian machine, we can write the following representation clause
19541 @example
19542 type Data is record
19543    Master_Control : Bit;
19544    Master_V1      : Bit;
19545    Master_V2      : Bit;
19546    Master_V3      : Bit;
19547    Master_V4      : Bit;
19548    Master_V5      : Bit;
19549    Master_V6      : Bit;
19550    Master_V7      : Bit;
19551    Slave_Control  : Bit;
19552    Slave_V1       : Bit;
19553    Slave_V2       : Bit;
19554    Slave_V3       : Bit;
19555    Slave_V4       : Bit;
19556    Slave_V5       : Bit;
19557    Slave_V6       : Bit;
19558    Slave_V7       : Bit;
19559 end record;
19561 for Data use record
19562    Master_Control at 0 range 0 .. 0;
19563    Master_V1      at 0 range 1 .. 1;
19564    Master_V2      at 0 range 2 .. 2;
19565    Master_V3      at 0 range 3 .. 3;
19566    Master_V4      at 0 range 4 .. 4;
19567    Master_V5      at 0 range 5 .. 5;
19568    Master_V6      at 0 range 6 .. 6;
19569    Master_V7      at 0 range 7 .. 7;
19570    Slave_Control  at 1 range 0 .. 0;
19571    Slave_V1       at 1 range 1 .. 1;
19572    Slave_V2       at 1 range 2 .. 2;
19573    Slave_V3       at 1 range 3 .. 3;
19574    Slave_V4       at 1 range 4 .. 4;
19575    Slave_V5       at 1 range 5 .. 5;
19576    Slave_V6       at 1 range 6 .. 6;
19577    Slave_V7       at 1 range 7 .. 7;
19578 end record;
19579 @end example
19581 Now if we move this to a little endian machine, then the bit ordering within
19582 the byte is backwards, so we have to rewrite the record rep clause as:
19584 @example
19585 for Data use record
19586    Master_Control at 0 range 7 .. 7;
19587    Master_V1      at 0 range 6 .. 6;
19588    Master_V2      at 0 range 5 .. 5;
19589    Master_V3      at 0 range 4 .. 4;
19590    Master_V4      at 0 range 3 .. 3;
19591    Master_V5      at 0 range 2 .. 2;
19592    Master_V6      at 0 range 1 .. 1;
19593    Master_V7      at 0 range 0 .. 0;
19594    Slave_Control  at 1 range 7 .. 7;
19595    Slave_V1       at 1 range 6 .. 6;
19596    Slave_V2       at 1 range 5 .. 5;
19597    Slave_V3       at 1 range 4 .. 4;
19598    Slave_V4       at 1 range 3 .. 3;
19599    Slave_V5       at 1 range 2 .. 2;
19600    Slave_V6       at 1 range 1 .. 1;
19601    Slave_V7       at 1 range 0 .. 0;
19602 end record;
19603 @end example
19605 It is a nuisance to have to rewrite the clause, especially if
19606 the code has to be maintained on both machines.  However,
19607 this is a case that we can handle with the
19608 @code{Bit_Order} attribute if it is implemented.
19609 Note that the implementation is not required on byte addressed
19610 machines, but it is indeed implemented in GNAT.
19611 This means that we can simply use the
19612 first record clause, together with the declaration
19614 @example
19615 for Data'Bit_Order use High_Order_First;
19616 @end example
19618 and the effect is what is desired, namely the layout is exactly the same,
19619 independent of whether the code is compiled on a big-endian or little-endian
19620 machine.
19622 The important point to understand is that byte ordering is not affected.
19623 A @code{Bit_Order} attribute definition never affects which byte a field
19624 ends up in, only where it ends up in that byte.
19625 To make this clear, let us rewrite the record rep clause of the previous
19626 example as:
19628 @example
19629 for Data'Bit_Order use High_Order_First;
19630 for Data use record
19631    Master_Control at 0 range  0 .. 0;
19632    Master_V1      at 0 range  1 .. 1;
19633    Master_V2      at 0 range  2 .. 2;
19634    Master_V3      at 0 range  3 .. 3;
19635    Master_V4      at 0 range  4 .. 4;
19636    Master_V5      at 0 range  5 .. 5;
19637    Master_V6      at 0 range  6 .. 6;
19638    Master_V7      at 0 range  7 .. 7;
19639    Slave_Control  at 0 range  8 .. 8;
19640    Slave_V1       at 0 range  9 .. 9;
19641    Slave_V2       at 0 range 10 .. 10;
19642    Slave_V3       at 0 range 11 .. 11;
19643    Slave_V4       at 0 range 12 .. 12;
19644    Slave_V5       at 0 range 13 .. 13;
19645    Slave_V6       at 0 range 14 .. 14;
19646    Slave_V7       at 0 range 15 .. 15;
19647 end record;
19648 @end example
19650 This is exactly equivalent to saying (a repeat of the first example):
19652 @example
19653 for Data'Bit_Order use High_Order_First;
19654 for Data use record
19655    Master_Control at 0 range 0 .. 0;
19656    Master_V1      at 0 range 1 .. 1;
19657    Master_V2      at 0 range 2 .. 2;
19658    Master_V3      at 0 range 3 .. 3;
19659    Master_V4      at 0 range 4 .. 4;
19660    Master_V5      at 0 range 5 .. 5;
19661    Master_V6      at 0 range 6 .. 6;
19662    Master_V7      at 0 range 7 .. 7;
19663    Slave_Control  at 1 range 0 .. 0;
19664    Slave_V1       at 1 range 1 .. 1;
19665    Slave_V2       at 1 range 2 .. 2;
19666    Slave_V3       at 1 range 3 .. 3;
19667    Slave_V4       at 1 range 4 .. 4;
19668    Slave_V5       at 1 range 5 .. 5;
19669    Slave_V6       at 1 range 6 .. 6;
19670    Slave_V7       at 1 range 7 .. 7;
19671 end record;
19672 @end example
19674 Why are they equivalent? Well take a specific field, the @code{Slave_V2}
19675 field.  The storage place attributes are obtained by normalizing the
19676 values given so that the @code{First_Bit} value is less than 8.  After
19677 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
19678 we specified in the other case.
19680 Now one might expect that the @code{Bit_Order} attribute might affect
19681 bit numbering within the entire record component (two bytes in this
19682 case, thus affecting which byte fields end up in), but that is not
19683 the way this feature is defined, it only affects numbering of bits,
19684 not which byte they end up in.
19686 Consequently it never makes sense to specify a starting bit number
19687 greater than 7 (for a byte addressable field) if an attribute
19688 definition for @code{Bit_Order} has been given, and indeed it
19689 may be actively confusing to specify such a value, so the compiler
19690 generates a warning for such usage.
19692 If you do need to control byte ordering then appropriate conditional
19693 values must be used.  If in our example, the slave byte came first on
19694 some machines we might write:
19696 @example
19697 Master_Byte_First constant Boolean := ...;
19699 Master_Byte : constant Natural :=
19700                 1 - Boolean'Pos (Master_Byte_First);
19701 Slave_Byte  : constant Natural :=
19702                 Boolean'Pos (Master_Byte_First);
19704 for Data'Bit_Order use High_Order_First;
19705 for Data use record
19706    Master_Control at Master_Byte range 0 .. 0;
19707    Master_V1      at Master_Byte range 1 .. 1;
19708    Master_V2      at Master_Byte range 2 .. 2;
19709    Master_V3      at Master_Byte range 3 .. 3;
19710    Master_V4      at Master_Byte range 4 .. 4;
19711    Master_V5      at Master_Byte range 5 .. 5;
19712    Master_V6      at Master_Byte range 6 .. 6;
19713    Master_V7      at Master_Byte range 7 .. 7;
19714    Slave_Control  at Slave_Byte  range 0 .. 0;
19715    Slave_V1       at Slave_Byte  range 1 .. 1;
19716    Slave_V2       at Slave_Byte  range 2 .. 2;
19717    Slave_V3       at Slave_Byte  range 3 .. 3;
19718    Slave_V4       at Slave_Byte  range 4 .. 4;
19719    Slave_V5       at Slave_Byte  range 5 .. 5;
19720    Slave_V6       at Slave_Byte  range 6 .. 6;
19721    Slave_V7       at Slave_Byte  range 7 .. 7;
19722 end record;
19723 @end example
19725 Now to switch between machines, all that is necessary is
19726 to set the boolean constant @code{Master_Byte_First} in
19727 an appropriate manner.
19729 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
19730 @anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{29f}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{2a0}
19731 @section Pragma Pack for Arrays
19734 @geindex Pragma Pack (for arrays)
19736 Pragma @code{Pack} applied to an array has an effect that depends upon whether the
19737 component type is `packable'.  For a component type to be `packable', it must
19738 be one of the following cases:
19741 @itemize *
19743 @item 
19744 Any elementary type.
19746 @item 
19747 Any small packed array type with a static size.
19749 @item 
19750 Any small simple record type with a static size.
19751 @end itemize
19753 For all these cases, if the component subtype size is in the range
19754 1 through 63 on 32-bit targets, and 1 through 127 on 64-bit targets,
19755 then the effect of the pragma @code{Pack} is exactly as though a
19756 component size were specified giving the component subtype size.
19758 All other types are non-packable, they occupy an integral number of storage
19759 units and the only effect of pragma Pack is to remove alignment gaps.
19761 For example if we have:
19763 @example
19764 type r is range 0 .. 17;
19766 type ar is array (1 .. 8) of r;
19767 pragma Pack (ar);
19768 @end example
19770 Then the component size of @code{ar} will be set to 5 (i.e., to @code{r'size},
19771 and the size of the array @code{ar} will be exactly 40 bits).
19773 Note that in some cases this rather fierce approach to packing can produce
19774 unexpected effects.  For example, in Ada 95 and Ada 2005,
19775 subtype @code{Natural} typically has a size of 31, meaning that if you
19776 pack an array of @code{Natural}, you get 31-bit
19777 close packing, which saves a few bits, but results in far less efficient
19778 access.  Since many other Ada compilers will ignore such a packing request,
19779 GNAT will generate a warning on some uses of pragma @code{Pack} that it guesses
19780 might not be what is intended.  You can easily remove this warning by
19781 using an explicit @code{Component_Size} setting instead, which never generates
19782 a warning, since the intention of the programmer is clear in this case.
19784 GNAT treats packed arrays in one of two ways.  If the size of the array is
19785 known at compile time and is at most 64 bits on 32-bit targets, and at most
19786 128 bits on 64-bit targets, then internally the array is represented as a
19787 single modular type, of exactly the appropriate number of bits.  If the
19788 length is greater than 64 bits on 32-bit targets, and greater than 128
19789 bits on 64-bit targets, or is not known at compile time, then the packed
19790 array is represented as an array of bytes, and its length is always a
19791 multiple of 8 bits.
19793 Note that to represent a packed array as a modular type, the alignment must
19794 be suitable for the modular type involved. For example, on typical machines
19795 a 32-bit packed array will be represented by a 32-bit modular integer with
19796 an alignment of four bytes. If you explicitly override the default alignment
19797 with an alignment clause that is too small, the modular representation
19798 cannot be used. For example, consider the following set of declarations:
19800 @example
19801 type R is range 1 .. 3;
19802 type S is array (1 .. 31) of R;
19803 for S'Component_Size use 2;
19804 for S'Size use 62;
19805 for S'Alignment use 1;
19806 @end example
19808 If the alignment clause were not present, then a 62-bit modular
19809 representation would be chosen (typically with an alignment of 4 or 8
19810 bytes depending on the target). But the default alignment is overridden
19811 with the explicit alignment clause. This means that the modular
19812 representation cannot be used, and instead the array of bytes
19813 representation must be used, meaning that the length must be a multiple
19814 of 8. Thus the above set of declarations will result in a diagnostic
19815 rejecting the size clause and noting that the minimum size allowed is 64.
19817 @geindex Pragma Pack (for type Natural)
19819 @geindex Pragma Pack warning
19821 One special case that is worth noting occurs when the base type of the
19822 component size is 8/16/32 and the subtype is one bit less. Notably this
19823 occurs with subtype @code{Natural}. Consider:
19825 @example
19826 type Arr is array (1 .. 32) of Natural;
19827 pragma Pack (Arr);
19828 @end example
19830 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
19831 since typically @code{Natural'Size} is 32 in Ada 83, and in any case most
19832 Ada 83 compilers did not attempt 31 bit packing.
19834 In Ada 95 and Ada 2005, @code{Natural'Size} is required to be 31. Furthermore,
19835 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
19836 substantial unintended performance penalty when porting legacy Ada 83 code.
19837 To help prevent this, GNAT generates a warning in such cases. If you really
19838 want 31 bit packing in a case like this, you can set the component size
19839 explicitly:
19841 @example
19842 type Arr is array (1 .. 32) of Natural;
19843 for Arr'Component_Size use 31;
19844 @end example
19846 Here 31-bit packing is achieved as required, and no warning is generated,
19847 since in this case the programmer intention is clear.
19849 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
19850 @anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{2a1}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{2a2}
19851 @section Pragma Pack for Records
19854 @geindex Pragma Pack (for records)
19856 Pragma @code{Pack} applied to a record will pack the components to reduce
19857 wasted space from alignment gaps and by reducing the amount of space
19858 taken by components.  We distinguish between `packable' components and
19859 `non-packable' components.
19860 Components of the following types are considered packable:
19863 @itemize *
19865 @item 
19866 Components of an elementary type are packable unless they are aliased,
19867 independent or atomic.
19869 @item 
19870 Small packed arrays, where the size is statically known, are represented
19871 internally as modular integers, and so they are also packable.
19873 @item 
19874 Small simple records, where the size is statically known, are also packable.
19875 @end itemize
19877 For all these cases, if the @code{'Size} value is in the range 1 through 64 on
19878 32-bit targets, and 1 through 128 on 64-bit targets, the components occupy
19879 the exact number of bits corresponding to this value and are packed with no
19880 padding bits, i.e. they can start on an arbitrary bit boundary.
19882 All other types are non-packable, they occupy an integral number of storage
19883 units and the only effect of pragma @code{Pack} is to remove alignment gaps.
19885 For example, consider the record
19887 @example
19888 type Rb1 is array (1 .. 13) of Boolean;
19889 pragma Pack (Rb1);
19891 type Rb2 is array (1 .. 65) of Boolean;
19892 pragma Pack (Rb2);
19894 type AF is new Float with Atomic;
19896 type X2 is record
19897    L1 : Boolean;
19898    L2 : Duration;
19899    L3 : AF;
19900    L4 : Boolean;
19901    L5 : Rb1;
19902    L6 : Rb2;
19903 end record;
19904 pragma Pack (X2);
19905 @end example
19907 The representation for the record @code{X2} is as follows on 32-bit targets:
19909 @example
19910 for X2'Size use 224;
19911 for X2 use record
19912    L1 at  0 range  0 .. 0;
19913    L2 at  0 range  1 .. 64;
19914    L3 at 12 range  0 .. 31;
19915    L4 at 16 range  0 .. 0;
19916    L5 at 16 range  1 .. 13;
19917    L6 at 18 range  0 .. 71;
19918 end record;
19919 @end example
19921 Studying this example, we see that the packable fields @code{L1}
19922 and @code{L2} are of length equal to their sizes, and placed at
19923 specific bit boundaries (and not byte boundaries) to eliminate
19924 padding.  But @code{L3} is of a non-packable float type (because
19925 it is aliased), so it is on the next appropriate alignment boundary.
19927 The next two fields are fully packable, so @code{L4} and @code{L5} are
19928 minimally packed with no gaps.  However, type @code{Rb2} is a packed
19929 array that is longer than 64 bits, so it is itself non-packable on
19930 32-bit targets.  Thus the @code{L6} field is aligned to the next byte
19931 boundary, and takes an integral number of bytes, i.e., 72 bits.
19933 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19934 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{2a3}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{2a4}
19935 @section Record Representation Clauses
19938 @geindex Record Representation Clause
19940 Record representation clauses may be given for all record types, including
19941 types obtained by record extension.  Component clauses are allowed for any
19942 static component.  The restrictions on component clauses depend on the type
19943 of the component.
19945 @geindex Component Clause
19947 For all components of an elementary type, the only restriction on component
19948 clauses is that the size must be at least the @code{'Size} value of the type
19949 (actually the Value_Size).  There are no restrictions due to alignment,
19950 and such components may freely cross storage boundaries.
19952 Packed arrays with a size up to and including 64 bits on 32-bit targets,
19953 and up to and including 128 bits on 64-bit targets, are represented
19954 internally using a modular type with the appropriate number of bits, and
19955 thus the same lack of restriction applies.  For example, if you declare:
19957 @example
19958 type R is array (1 .. 49) of Boolean;
19959 pragma Pack (R);
19960 for R'Size use 49;
19961 @end example
19963 then a component clause for a component of type @code{R} may start on any
19964 specified bit boundary, and may specify a value of 49 bits or greater.
19966 For packed bit arrays that are longer than 64 bits on 32-bit targets,
19967 and longer than 128 bits on 64-bit targets, there are two cases. If the
19968 component size is a power of 2 (1,2,4,8,16,32,64 bits), including the
19969 important case of single bits or boolean values, then there are no
19970 limitations on placement of such components, and they may start and
19971 end at arbitrary bit boundaries.
19973 If the component size is not a power of 2 (e.g., 3 or 5), then an array
19974 of this type must always be placed on on a storage unit (byte) boundary
19975 and occupy an integral number of storage units (bytes). Any component
19976 clause that does not meet this requirement will be rejected.
19978 Any aliased component, or component of an aliased type, must have its
19979 normal alignment and size. A component clause that does not meet this
19980 requirement will be rejected.
19982 The tag field of a tagged type always occupies an address sized field at
19983 the start of the record.  No component clause may attempt to overlay this
19984 tag. When a tagged type appears as a component, the tag field must have
19985 proper alignment
19987 In the case of a record extension @code{T1}, of a type @code{T}, no component
19988 clause applied to the type @code{T1} can specify a storage location that
19989 would overlap the first @code{T'Object_Size} bits of the record.
19991 For all other component types, including non-bit-packed arrays,
19992 the component can be placed at an arbitrary bit boundary,
19993 so for example, the following is permitted:
19995 @example
19996 type R is array (1 .. 10) of Boolean;
19997 for R'Size use 80;
19999 type Q is record
20000    G, H : Boolean;
20001    L, M : R;
20002 end record;
20004 for Q use record
20005    G at 0 range  0 ..   0;
20006    H at 0 range  1 ..   1;
20007    L at 0 range  2 ..  81;
20008    R at 0 range 82 .. 161;
20009 end record;
20010 @end example
20012 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
20013 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{2a5}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{2a6}
20014 @section Handling of Records with Holes
20017 @geindex Handling of Records with Holes
20019 As a result of alignment considerations, records may contain “holes”
20020 or gaps which do not correspond to the data bits of any of the components.
20021 Record representation clauses can also result in holes in records.
20023 GNAT does not attempt to clear these holes, so in record objects,
20024 they should be considered to hold undefined rubbish. The generated
20025 equality routine just tests components so does not access these
20026 undefined bits, and assignment and copy operations may or may not
20027 preserve the contents of these holes (for assignments, the holes
20028 in the target will in practice contain either the bits that are
20029 present in the holes in the source, or the bits that were present
20030 in the target before the assignment).
20032 If it is necessary to ensure that holes in records have all zero
20033 bits, then record objects for which this initialization is desired
20034 should be explicitly set to all zero values using Unchecked_Conversion
20035 or address overlays. For example
20037 @example
20038 type HRec is record
20039    C : Character;
20040    I : Integer;
20041 end record;
20042 @end example
20044 On typical machines, integers need to be aligned on a four-byte
20045 boundary, resulting in three bytes of undefined rubbish following
20046 the 8-bit field for C. To ensure that the hole in a variable of
20047 type HRec is set to all zero bits,
20048 you could for example do:
20050 @example
20051 type Base is record
20052    Dummy1, Dummy2 : Integer := 0;
20053 end record;
20055 BaseVar : Base;
20056 RealVar : Hrec;
20057 for RealVar'Address use BaseVar'Address;
20058 @end example
20060 Now the 8-bytes of the value of RealVar start out containing all zero
20061 bits. A safer approach is to just define dummy fields, avoiding the
20062 holes, as in:
20064 @example
20065 type HRec is record
20066    C      : Character;
20067    Dummy1 : Short_Short_Integer := 0;
20068    Dummy2 : Short_Short_Integer := 0;
20069    Dummy3 : Short_Short_Integer := 0;
20070    I      : Integer;
20071 end record;
20072 @end example
20074 And to make absolutely sure that the intent of this is followed, you
20075 can use representation clauses:
20077 @example
20078 for Hrec use record
20079    C      at 0 range 0 .. 7;
20080    Dummy1 at 1 range 0 .. 7;
20081    Dummy2 at 2 range 0 .. 7;
20082    Dummy3 at 3 range 0 .. 7;
20083    I      at 4 range 0 .. 31;
20084 end record;
20085 for Hrec'Size use 64;
20086 @end example
20088 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
20089 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{2a7}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{2a8}
20090 @section Enumeration Clauses
20093 The only restriction on enumeration clauses is that the range of values
20094 must be representable.  For the signed case, if one or more of the
20095 representation values are negative, all values must be in the range:
20097 @example
20098 System.Min_Int .. System.Max_Int
20099 @end example
20101 For the unsigned case, where all values are nonnegative, the values must
20102 be in the range:
20104 @example
20105 0 .. System.Max_Binary_Modulus;
20106 @end example
20108 A `confirming' representation clause is one in which the values range
20109 from 0 in sequence, i.e., a clause that confirms the default representation
20110 for an enumeration type.
20111 Such a confirming representation
20112 is permitted by these rules, and is specially recognized by the compiler so
20113 that no extra overhead results from the use of such a clause.
20115 If an array has an index type which is an enumeration type to which an
20116 enumeration clause has been applied, then the array is stored in a compact
20117 manner.  Consider the declarations:
20119 @example
20120 type r is (A, B, C);
20121 for r use (A => 1, B => 5, C => 10);
20122 type t is array (r) of Character;
20123 @end example
20125 The array type t corresponds to a vector with exactly three elements and
20126 has a default size equal to @code{3*Character'Size}.  This ensures efficient
20127 use of space, but means that accesses to elements of the array will incur
20128 the overhead of converting representation values to the corresponding
20129 positional values, (i.e., the value delivered by the @code{Pos} attribute).
20131 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
20132 @anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{2a9}@anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{2aa}
20133 @section Address Clauses
20136 @geindex Address Clause
20138 The reference manual allows a general restriction on representation clauses,
20139 as found in RM 13.1(22):
20141 @quotation
20143 “An implementation need not support representation
20144 items containing nonstatic expressions, except that
20145 an implementation should support a representation item
20146 for a given entity if each nonstatic expression in the
20147 representation item is a name that statically denotes
20148 a constant declared before the entity.”
20149 @end quotation
20151 In practice this is applicable only to address clauses, since this is the
20152 only case in which a nonstatic expression is permitted by the syntax.  As
20153 the AARM notes in sections 13.1 (22.a-22.h):
20155 @quotation
20157 22.a   Reason: This is to avoid the following sort of thing:
20159 22.b        X : Integer := F(…);
20160 Y : Address := G(…);
20161 for X’Address use Y;
20163 22.c   In the above, we have to evaluate the
20164 initialization expression for X before we
20165 know where to put the result.  This seems
20166 like an unreasonable implementation burden.
20168 22.d   The above code should instead be written
20169 like this:
20171 22.e        Y : constant Address := G(…);
20172 X : Integer := F(…);
20173 for X’Address use Y;
20175 22.f   This allows the expression ‘Y’ to be safely
20176 evaluated before X is created.
20178 22.g   The constant could be a formal parameter of mode in.
20180 22.h   An implementation can support other nonstatic
20181 expressions if it wants to.  Expressions of type
20182 Address are hardly ever static, but their value
20183 might be known at compile time anyway in many
20184 cases.
20185 @end quotation
20187 GNAT does indeed permit many additional cases of nonstatic expressions.  In
20188 particular, if the type involved is elementary there are no restrictions
20189 (since in this case, holding a temporary copy of the initialization value,
20190 if one is present, is inexpensive).  In addition, if there is no implicit or
20191 explicit initialization, then there are no restrictions.  GNAT will reject
20192 only the case where all three of these conditions hold:
20195 @itemize *
20197 @item 
20198 The type of the item is non-elementary (e.g., a record or array).
20200 @item 
20201 There is explicit or implicit initialization required for the object.
20202 Note that access values are always implicitly initialized.
20204 @item 
20205 The address value is nonstatic.  Here GNAT is more permissive than the
20206 RM, and allows the address value to be the address of a previously declared
20207 stand-alone variable, as long as it does not itself have an address clause.
20209 @example
20210 Anchor  : Some_Initialized_Type;
20211 Overlay : Some_Initialized_Type;
20212 for Overlay'Address use Anchor'Address;
20213 @end example
20215 However, the prefix of the address clause cannot be an array component, or
20216 a component of a discriminated record.
20217 @end itemize
20219 As noted above in section 22.h, address values are typically nonstatic.  In
20220 particular the To_Address function, even if applied to a literal value, is
20221 a nonstatic function call.  To avoid this minor annoyance, GNAT provides
20222 the implementation defined attribute ‘To_Address.  The following two
20223 expressions have identical values:
20225 @geindex Attribute
20227 @geindex To_Address
20229 @example
20230 To_Address (16#1234_0000#)
20231 System'To_Address (16#1234_0000#);
20232 @end example
20234 except that the second form is considered to be a static expression, and
20235 thus when used as an address clause value is always permitted.
20237 Additionally, GNAT treats as static an address clause that is an
20238 unchecked_conversion of a static integer value.  This simplifies the porting
20239 of legacy code, and provides a portable equivalent to the GNAT attribute
20240 @code{To_Address}.
20242 Another issue with address clauses is the interaction with alignment
20243 requirements.  When an address clause is given for an object, the address
20244 value must be consistent with the alignment of the object (which is usually
20245 the same as the alignment of the type of the object).  If an address clause
20246 is given that specifies an inappropriately aligned address value, then the
20247 program execution is erroneous.
20249 Since this source of erroneous behavior can have unfortunate effects on
20250 machines with strict alignment requirements, GNAT
20251 checks (at compile time if possible, generating a warning, or at execution
20252 time with a run-time check) that the alignment is appropriate.  If the
20253 run-time check fails, then @code{Program_Error} is raised.  This run-time
20254 check is suppressed if range checks are suppressed, or if the special GNAT
20255 check Alignment_Check is suppressed, or if
20256 @code{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
20257 suppressed by default on non-strict alignment machines (such as the x86).
20259 In some cases, GNAT does not support an address specification (using either
20260 form of aspect specification syntax) for the declaration of an object that has
20261 an indefinite nominal subtype. An object declaration has an indefinite
20262 nominal subtype if it takes its bounds (for an array type), discriminant
20263 values (for a discriminated type whose discriminants lack defaults), or tag
20264 (for a class-wide type) from its initial value, as in
20266 @example
20267 X : String := Some_Function_Call;
20268 -- String has no constraint, so bounds for X come from function call
20269 @end example
20271 This restriction does not apply if the size of the object’s initial value is
20272 known at compile time and the type of the object is not class-wide.
20274 @geindex Export
20276 An address clause cannot be given for an exported object.  More
20277 understandably the real restriction is that objects with an address
20278 clause cannot be exported.  This is because such variables are not
20279 defined by the Ada program, so there is no external object to export.
20281 @geindex Import
20283 It is permissible to give an address clause and a pragma Import for the
20284 same object.  In this case, the variable is not really defined by the
20285 Ada program, so there is no external symbol to be linked.  The link name
20286 and the external name are ignored in this case.  The reason that we allow this
20287 combination is that it provides a useful idiom to avoid unwanted
20288 initializations on objects with address clauses.
20290 When an address clause is given for an object that has implicit or
20291 explicit initialization, then by default initialization takes place.  This
20292 means that the effect of the object declaration is to overwrite the
20293 memory at the specified address.  This is almost always not what the
20294 programmer wants, so GNAT will output a warning:
20296 @example
20297 with System;
20298 package G is
20299    type R is record
20300       M : Integer := 0;
20301    end record;
20303    Ext : R;
20304    for Ext'Address use System'To_Address (16#1234_1234#);
20305        |
20306 >>> warning: implicit initialization of "Ext" may
20307     modify overlaid storage
20308 >>> warning: use pragma Import for "Ext" to suppress
20309     initialization (RM B(24))
20311 end G;
20312 @end example
20314 As indicated by the warning message, the solution is to use a (dummy) pragma
20315 Import to suppress this initialization.  The pragma tell the compiler that the
20316 object is declared and initialized elsewhere.  The following package compiles
20317 without warnings (and the initialization is suppressed):
20319 @example
20320 with System;
20321 package G is
20322    type R is record
20323       M : Integer := 0;
20324    end record;
20326    Ext : R;
20327    for Ext'Address use System'To_Address (16#1234_1234#);
20328    pragma Import (Ada, Ext);
20329 end G;
20330 @end example
20332 A final issue with address clauses involves their use for overlaying
20333 variables, as in the following example:
20335 @geindex Overlaying of objects
20337 @example
20338 A : Integer;
20339 B : Integer;
20340 for B'Address use A'Address;
20341 @end example
20343 or alternatively, using the form recommended by the RM:
20345 @example
20346 A    : Integer;
20347 Addr : constant Address := A'Address;
20348 B    : Integer;
20349 for B'Address use Addr;
20350 @end example
20352 In both of these cases, @code{A} and @code{B} become aliased to one another
20353 via the address clause. This use of address clauses to overlay
20354 variables, achieving an effect similar to unchecked conversion
20355 was erroneous in Ada 83, but in Ada 95 and Ada 2005
20356 the effect is implementation defined. Furthermore, the
20357 Ada RM specifically recommends that in a situation
20358 like this, @code{B} should be subject to the following
20359 implementation advice (RM 13.3(19)):
20361 @quotation
20363 “19  If the Address of an object is specified, or it is imported
20364 or exported, then the implementation should not perform
20365 optimizations based on assumptions of no aliases.”
20366 @end quotation
20368 GNAT follows this recommendation, and goes further by also applying
20369 this recommendation to the overlaid variable (@code{A} in the above example)
20370 in this case. This means that the overlay works “as expected”, in that
20371 a modification to one of the variables will affect the value of the other.
20373 More generally, GNAT interprets this recommendation conservatively for
20374 address clauses: in the cases other than overlays, it considers that the
20375 object is effectively subject to pragma @code{Volatile} and implements the
20376 associated semantics.
20378 Note that when address clause overlays are used in this way, there is an
20379 issue of unintentional initialization, as shown by this example:
20381 @example
20382 package Overwrite_Record is
20383    type R is record
20384       A : Character := 'C';
20385       B : Character := 'A';
20386    end record;
20387    X : Short_Integer := 3;
20388    Y : R;
20389    for Y'Address use X'Address;
20390        |
20391 >>> warning: default initialization of "Y" may
20392     modify "X", use pragma Import for "Y" to
20393     suppress initialization (RM B.1(24))
20395 end Overwrite_Record;
20396 @end example
20398 Here the default initialization of @code{Y} will clobber the value
20399 of @code{X}, which justifies the warning. The warning notes that
20400 this effect can be eliminated by adding a @code{pragma Import}
20401 which suppresses the initialization:
20403 @example
20404 package Overwrite_Record is
20405    type R is record
20406       A : Character := 'C';
20407       B : Character := 'A';
20408    end record;
20409    X : Short_Integer := 3;
20410    Y : R;
20411    for Y'Address use X'Address;
20412    pragma Import (Ada, Y);
20413 end Overwrite_Record;
20414 @end example
20416 Note that the use of @code{pragma Initialize_Scalars} may cause variables to
20417 be initialized when they would not otherwise have been in the absence
20418 of the use of this pragma. This may cause an overlay to have this
20419 unintended clobbering effect. The compiler avoids this for scalar
20420 types, but not for composite objects (where in general the effect
20421 of @code{Initialize_Scalars} is part of the initialization routine
20422 for the composite object):
20424 @example
20425 pragma Initialize_Scalars;
20426 with Ada.Text_IO;  use Ada.Text_IO;
20427 procedure Overwrite_Array is
20428    type Arr is array (1 .. 5) of Integer;
20429    X : Arr := (others => 1);
20430    A : Arr;
20431    for A'Address use X'Address;
20432        |
20433 >>> warning: default initialization of "A" may
20434     modify "X", use pragma Import for "A" to
20435     suppress initialization (RM B.1(24))
20437 begin
20438    if X /= Arr'(others => 1) then
20439       Put_Line ("X was clobbered");
20440    else
20441       Put_Line ("X was not clobbered");
20442    end if;
20443 end Overwrite_Array;
20444 @end example
20446 The above program generates the warning as shown, and at execution
20447 time, prints @code{X was clobbered}. If the @code{pragma Import} is
20448 added as suggested:
20450 @example
20451 pragma Initialize_Scalars;
20452 with Ada.Text_IO;  use Ada.Text_IO;
20453 procedure Overwrite_Array is
20454    type Arr is array (1 .. 5) of Integer;
20455    X : Arr := (others => 1);
20456    A : Arr;
20457    for A'Address use X'Address;
20458    pragma Import (Ada, A);
20459 begin
20460    if X /= Arr'(others => 1) then
20461       Put_Line ("X was clobbered");
20462    else
20463       Put_Line ("X was not clobbered");
20464    end if;
20465 end Overwrite_Array;
20466 @end example
20468 then the program compiles without the warning and when run will generate
20469 the output @code{X was not clobbered}.
20471 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
20472 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{2ab}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{2ac}
20473 @section Use of Address Clauses for Memory-Mapped I/O
20476 @geindex Memory-mapped I/O
20478 A common pattern is to use an address clause to map an atomic variable to
20479 a location in memory that corresponds to a memory-mapped I/O operation or
20480 operations, for example:
20482 @example
20483 type Mem_Word is record
20484    A,B,C,D : Byte;
20485 end record;
20486 pragma Atomic (Mem_Word);
20487 for Mem_Word_Size use 32;
20489 Mem : Mem_Word;
20490 for Mem'Address use some-address;
20492 Temp := Mem;
20493 Temp.A := 32;
20494 Mem := Temp;
20495 @end example
20497 For a full access (reference or modification) of the variable (Mem) in this
20498 case, as in the above examples, GNAT guarantees that the entire atomic word
20499 will be accessed, in accordance with the RM C.6(15) clause.
20501 A problem arises with a component access such as:
20503 @example
20504 Mem.A := 32;
20505 @end example
20507 Note that the component A is not declared as atomic. This means that it is
20508 not clear what this assignment means. It could correspond to full word read
20509 and write as given in the first example, or on architectures that supported
20510 such an operation it might be a single byte store instruction. The RM does
20511 not have anything to say in this situation, and GNAT does not make any
20512 guarantee. The code generated may vary from target to target. GNAT will issue
20513 a warning in such a case:
20515 @example
20516 Mem.A := 32;
20518 >>> warning: access to non-atomic component of atomic array,
20519     may cause unexpected accesses to atomic object
20520 @end example
20522 It is best to be explicit in this situation, by either declaring the
20523 components to be atomic if you want the byte store, or explicitly writing
20524 the full word access sequence if that is what the hardware requires.
20525 Alternatively, if the full word access sequence is required, GNAT also
20526 provides the pragma @code{Volatile_Full_Access} which can be used in lieu of
20527 pragma @code{Atomic} and will give the additional guarantee.
20529 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
20530 @anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{2ad}@anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{2ae}
20531 @section Effect of Convention on Representation
20534 @geindex Convention
20535 @geindex effect on representation
20537 Normally the specification of a foreign language convention for a type or
20538 an object has no effect on the chosen representation.  In particular, the
20539 representation chosen for data in GNAT generally meets the standard system
20540 conventions, and for example records are laid out in a manner that is
20541 consistent with C.  This means that specifying convention C (for example)
20542 has no effect.
20544 There are four exceptions to this general rule:
20547 @itemize *
20549 @item 
20550 `Convention Fortran and array subtypes'.
20552 If pragma Convention Fortran is specified for an array subtype, then in
20553 accordance with the implementation advice in section 3.6.2(11) of the
20554 Ada Reference Manual, the array will be stored in a Fortran-compatible
20555 column-major manner, instead of the normal default row-major order.
20557 @item 
20558 `Convention C and enumeration types'
20560 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
20561 to accommodate all values of the type.  For example, for the enumeration
20562 type declared by:
20564 @example
20565 type Color is (Red, Green, Blue);
20566 @end example
20568 8 bits is sufficient to store all values of the type, so by default, objects
20569 of type @code{Color} will be represented using 8 bits.  However, normal C
20570 convention is to use 32 bits for all enum values in C, since enum values
20571 are essentially of type int.  If pragma @code{Convention C} is specified for an
20572 Ada enumeration type, then the size is modified as necessary (usually to
20573 32 bits) to be consistent with the C convention for enum values.
20575 Note that this treatment applies only to types. If Convention C is given for
20576 an enumeration object, where the enumeration type is not Convention C, then
20577 Object_Size bits are allocated. For example, for a normal enumeration type,
20578 with less than 256 elements, only 8 bits will be allocated for the object.
20579 Since this may be a surprise in terms of what C expects, GNAT will issue a
20580 warning in this situation. The warning can be suppressed by giving an explicit
20581 size clause specifying the desired size.
20583 @item 
20584 `Convention C/Fortran and Boolean types'
20586 In C, the usual convention for boolean values, that is values used for
20587 conditions, is that zero represents false, and nonzero values represent
20588 true.  In Ada, the normal convention is that two specific values, typically
20589 0/1, are used to represent false/true respectively.
20591 Fortran has a similar convention for @code{LOGICAL} values (any nonzero
20592 value represents true).
20594 To accommodate the Fortran and C conventions, if a pragma Convention specifies
20595 C or Fortran convention for a derived Boolean, as in the following example:
20597 @example
20598 type C_Switch is new Boolean;
20599 pragma Convention (C, C_Switch);
20600 @end example
20602 then the GNAT generated code will treat any nonzero value as true.  For truth
20603 values generated by GNAT, the conventional value 1 will be used for True, but
20604 when one of these values is read, any nonzero value is treated as True.
20605 @end itemize
20607 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
20608 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{2af}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{2b0}
20609 @section Conventions and Anonymous Access Types
20612 @geindex Anonymous access types
20614 @geindex Convention for anonymous access types
20616 The RM is not entirely clear on convention handling in a number of cases,
20617 and in particular, it is not clear on the convention to be given to
20618 anonymous access types in general, and in particular what is to be
20619 done for the case of anonymous access-to-subprogram.
20621 In GNAT, we decide that if an explicit Convention is applied
20622 to an object or component, and its type is such an anonymous type,
20623 then the convention will apply to this anonymous type as well. This
20624 seems to make sense since it is anomolous in any case to have a
20625 different convention for an object and its type, and there is clearly
20626 no way to explicitly specify a convention for an anonymous type, since
20627 it doesn’t have a name to specify!
20629 Furthermore, we decide that if a convention is applied to a record type,
20630 then this convention is inherited by any of its components that are of an
20631 anonymous access type which do not have an explicitly specified convention.
20633 The following program shows these conventions in action:
20635 @example
20636 package ConvComp is
20637    type Foo is range 1 .. 10;
20638    type T1 is record
20639       A : access function (X : Foo) return Integer;
20640       B : Integer;
20641    end record;
20642    pragma Convention (C, T1);
20644    type T2 is record
20645       A : access function (X : Foo) return Integer;
20646       pragma Convention  (C, A);
20647       B : Integer;
20648    end record;
20649    pragma Convention (COBOL, T2);
20651    type T3 is record
20652       A : access function (X : Foo) return Integer;
20653       pragma Convention  (COBOL, A);
20654       B : Integer;
20655    end record;
20656    pragma Convention (C, T3);
20658    type T4 is record
20659       A : access function (X : Foo) return Integer;
20660       B : Integer;
20661    end record;
20662    pragma Convention (COBOL, T4);
20664    function F (X : Foo) return Integer;
20665    pragma Convention (C, F);
20667    function F (X : Foo) return Integer is (13);
20669    TV1 : T1 := (F'Access, 12);  -- OK
20670    TV2 : T2 := (F'Access, 13);  -- OK
20672    TV3 : T3 := (F'Access, 13);  -- ERROR
20673                 |
20674 >>> subprogram "F" has wrong convention
20675 >>> does not match access to subprogram declared at line 17
20676      38.    TV4 : T4 := (F'Access, 13);  -- ERROR
20677                 |
20678 >>> subprogram "F" has wrong convention
20679 >>> does not match access to subprogram declared at line 24
20680      39. end ConvComp;
20681 @end example
20683 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
20684 @anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{2b1}@anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{2b2}
20685 @section Determining the Representations chosen by GNAT
20688 @geindex Representation
20689 @geindex determination of
20691 @geindex -gnatR (gcc)
20693 Although the descriptions in this section are intended to be complete, it is
20694 often easier to simply experiment to see what GNAT accepts and what the
20695 effect is on the layout of types and objects.
20697 As required by the Ada RM, if a representation clause is not accepted, then
20698 it must be rejected as illegal by the compiler.  However, when a
20699 representation clause or pragma is accepted, there can still be questions
20700 of what the compiler actually does.  For example, if a partial record
20701 representation clause specifies the location of some components and not
20702 others, then where are the non-specified components placed? Or if pragma
20703 @code{Pack} is used on a record, then exactly where are the resulting
20704 fields placed? The section on pragma @code{Pack} in this chapter can be
20705 used to answer the second question, but it is often easier to just see
20706 what the compiler does.
20708 For this purpose, GNAT provides the option `-gnatR'.  If you compile
20709 with this option, then the compiler will output information on the actual
20710 representations chosen, in a format similar to source representation
20711 clauses.  For example, if we compile the package:
20713 @example
20714 package q is
20715    type r (x : boolean) is tagged record
20716       case x is
20717          when True => S : String (1 .. 100);
20718          when False => null;
20719       end case;
20720    end record;
20722    type r2 is new r (false) with record
20723       y2 : integer;
20724    end record;
20726    for r2 use record
20727       y2 at 16 range 0 .. 31;
20728    end record;
20730    type x is record
20731       y : character;
20732    end record;
20734    type x1 is array (1 .. 10) of x;
20735    for x1'component_size use 11;
20737    type ia is access integer;
20739    type Rb1 is array (1 .. 13) of Boolean;
20740    pragma Pack (rb1);
20742    type Rb2 is array (1 .. 65) of Boolean;
20743    pragma Pack (rb2);
20745    type x2 is record
20746       l1 : Boolean;
20747       l2 : Duration;
20748       l3 : Float;
20749       l4 : Boolean;
20750       l5 : Rb1;
20751       l6 : Rb2;
20752    end record;
20753    pragma Pack (x2);
20754 end q;
20755 @end example
20757 using the switch `-gnatR' we obtain the following output:
20759 @example
20760 Representation information for unit q
20761 -------------------------------------
20763 for r'Size use ??;
20764 for r'Alignment use 4;
20765 for r use record
20766    x    at 4 range  0 .. 7;
20767    _tag at 0 range  0 .. 31;
20768    s    at 5 range  0 .. 799;
20769 end record;
20771 for r2'Size use 160;
20772 for r2'Alignment use 4;
20773 for r2 use record
20774    x       at  4 range  0 .. 7;
20775    _tag    at  0 range  0 .. 31;
20776    _parent at  0 range  0 .. 63;
20777    y2      at 16 range  0 .. 31;
20778 end record;
20780 for x'Size use 8;
20781 for x'Alignment use 1;
20782 for x use record
20783    y at 0 range  0 .. 7;
20784 end record;
20786 for x1'Size use 112;
20787 for x1'Alignment use 1;
20788 for x1'Component_Size use 11;
20790 for rb1'Size use 13;
20791 for rb1'Alignment use 2;
20792 for rb1'Component_Size use 1;
20794 for rb2'Size use 72;
20795 for rb2'Alignment use 1;
20796 for rb2'Component_Size use 1;
20798 for x2'Size use 224;
20799 for x2'Alignment use 4;
20800 for x2 use record
20801    l1 at  0 range  0 .. 0;
20802    l2 at  0 range  1 .. 64;
20803    l3 at 12 range  0 .. 31;
20804    l4 at 16 range  0 .. 0;
20805    l5 at 16 range  1 .. 13;
20806    l6 at 18 range  0 .. 71;
20807 end record;
20808 @end example
20810 The Size values are actually the Object_Size, i.e., the default size that
20811 will be allocated for objects of the type.
20812 The @code{??} size for type r indicates that we have a variant record, and the
20813 actual size of objects will depend on the discriminant value.
20815 The Alignment values show the actual alignment chosen by the compiler
20816 for each record or array type.
20818 The record representation clause for type r shows where all fields
20819 are placed, including the compiler generated tag field (whose location
20820 cannot be controlled by the programmer).
20822 The record representation clause for the type extension r2 shows all the
20823 fields present, including the parent field, which is a copy of the fields
20824 of the parent type of r2, i.e., r1.
20826 The component size and size clauses for types rb1 and rb2 show
20827 the exact effect of pragma @code{Pack} on these arrays, and the record
20828 representation clause for type x2 shows how pragma @cite{Pack} affects
20829 this record type.
20831 In some cases, it may be useful to cut and paste the representation clauses
20832 generated by the compiler into the original source to fix and guarantee
20833 the actual representation to be used.
20835 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
20836 @anchor{gnat_rm/standard_library_routines doc}@anchor{2b3}@anchor{gnat_rm/standard_library_routines id1}@anchor{2b4}@anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}
20837 @chapter Standard Library Routines
20840 The Ada Reference Manual contains in Annex A a full description of an
20841 extensive set of standard library routines that can be used in any Ada
20842 program, and which must be provided by all Ada compilers.  They are
20843 analogous to the standard C library used by C programs.
20845 GNAT implements all of the facilities described in annex A, and for most
20846 purposes the description in the Ada Reference Manual, or appropriate Ada
20847 text book, will be sufficient for making use of these facilities.
20849 In the case of the input-output facilities,
20850 @ref{f,,The Implementation of Standard I/O},
20851 gives details on exactly how GNAT interfaces to the
20852 file system.  For the remaining packages, the Ada Reference Manual
20853 should be sufficient.  The following is a list of the packages included,
20854 together with a brief description of the functionality that is provided.
20856 For completeness, references are included to other predefined library
20857 routines defined in other sections of the Ada Reference Manual (these are
20858 cross-indexed from Annex A). For further details see the relevant
20859 package declarations in the run-time library. In particular, a few units
20860 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
20861 and in this case the package declaration contains comments explaining why
20862 the unit is not implemented.
20865 @table @asis
20867 @item @code{Ada} `(A.2)'
20869 This is a parent package for all the standard library packages.  It is
20870 usually included implicitly in your program, and itself contains no
20871 useful data or routines.
20873 @item @code{Ada.Assertions} `(11.4.2)'
20875 @code{Assertions} provides the @code{Assert} subprograms, and also
20876 the declaration of the @code{Assertion_Error} exception.
20878 @item @code{Ada.Asynchronous_Task_Control} `(D.11)'
20880 @code{Asynchronous_Task_Control} provides low level facilities for task
20881 synchronization. It is typically not implemented. See package spec for details.
20883 @item @code{Ada.Calendar} `(9.6)'
20885 @code{Calendar} provides time of day access, and routines for
20886 manipulating times and durations.
20888 @item @code{Ada.Calendar.Arithmetic} `(9.6.1)'
20890 This package provides additional arithmetic
20891 operations for @code{Calendar}.
20893 @item @code{Ada.Calendar.Formatting} `(9.6.1)'
20895 This package provides formatting operations for @code{Calendar}.
20897 @item @code{Ada.Calendar.Time_Zones} `(9.6.1)'
20899 This package provides additional @code{Calendar} facilities
20900 for handling time zones.
20902 @item @code{Ada.Characters} `(A.3.1)'
20904 This is a dummy parent package that contains no useful entities
20906 @item @code{Ada.Characters.Conversions} `(A.3.2)'
20908 This package provides character conversion functions.
20910 @item @code{Ada.Characters.Handling} `(A.3.2)'
20912 This package provides some basic character handling capabilities,
20913 including classification functions for classes of characters (e.g., test
20914 for letters, or digits).
20916 @item @code{Ada.Characters.Latin_1} `(A.3.3)'
20918 This package includes a complete set of definitions of the characters
20919 that appear in type CHARACTER.  It is useful for writing programs that
20920 will run in international environments.  For example, if you want an
20921 upper case E with an acute accent in a string, it is often better to use
20922 the definition of @code{UC_E_Acute} in this package.  Then your program
20923 will print in an understandable manner even if your environment does not
20924 support these extended characters.
20926 @item @code{Ada.Command_Line} `(A.15)'
20928 This package provides access to the command line parameters and the name
20929 of the current program (analogous to the use of @code{argc} and @code{argv}
20930 in C), and also allows the exit status for the program to be set in a
20931 system-independent manner.
20933 @item @code{Ada.Complex_Text_IO} `(G.1.3)'
20935 This package provides text input and output of complex numbers.
20937 @item @code{Ada.Containers} `(A.18.1)'
20939 A top level package providing a few basic definitions used by all the
20940 following specific child packages that provide specific kinds of
20941 containers.
20942 @end table
20944 @code{Ada.Containers.Bounded_Priority_Queues} `(A.18.31)'
20946 @code{Ada.Containers.Bounded_Synchronized_Queues} `(A.18.29)'
20948 @code{Ada.Containers.Doubly_Linked_Lists} `(A.18.3)'
20950 @code{Ada.Containers.Generic_Array_Sort} `(A.18.26)'
20952 @code{Ada.Containers.Generic_Constrained_Array_Sort} `(A.18.26)'
20954 @code{Ada.Containers.Generic_Sort} `(A.18.26)'
20956 @code{Ada.Containers.Hashed_Maps} `(A.18.5)'
20958 @code{Ada.Containers.Hashed_Sets} `(A.18.8)'
20960 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} `(A.18.12)'
20962 @code{Ada.Containers.Indefinite_Hashed_Maps} `(A.18.13)'
20964 @code{Ada.Containers.Indefinite_Hashed_Sets} `(A.18.15)'
20966 @code{Ada.Containers.Indefinite_Holders} `(A.18.18)'
20968 @code{Ada.Containers.Indefinite_Multiway_Trees} `(A.18.17)'
20970 @code{Ada.Containers.Indefinite_Ordered_Maps} `(A.18.14)'
20972 @code{Ada.Containers.Indefinite_Ordered_Sets} `(A.18.16)'
20974 @code{Ada.Containers.Indefinite_Vectors} `(A.18.11)'
20976 @code{Ada.Containers.Multiway_Trees} `(A.18.10)'
20978 @code{Ada.Containers.Ordered_Maps} `(A.18.6)'
20980 @code{Ada.Containers.Ordered_Sets} `(A.18.9)'
20982 @code{Ada.Containers.Synchronized_Queue_Interfaces} `(A.18.27)'
20984 @code{Ada.Containers.Unbounded_Priority_Queues} `(A.18.30)'
20986 @code{Ada.Containers.Unbounded_Synchronized_Queues} `(A.18.28)'
20988 @code{Ada.Containers.Vectors} `(A.18.2)'
20991 @table @asis
20993 @item @code{Ada.Directories} `(A.16)'
20995 This package provides operations on directories.
20997 @item @code{Ada.Directories.Hierarchical_File_Names} `(A.16.1)'
20999 This package provides additional directory operations handling
21000 hierarchical file names.
21002 @item @code{Ada.Directories.Information} `(A.16)'
21004 This is an implementation defined package for additional directory
21005 operations, which is not implemented in GNAT.
21007 @item @code{Ada.Decimal} `(F.2)'
21009 This package provides constants describing the range of decimal numbers
21010 implemented, and also a decimal divide routine (analogous to the COBOL
21011 verb DIVIDE … GIVING … REMAINDER …)
21013 @item @code{Ada.Direct_IO} `(A.8.4)'
21015 This package provides input-output using a model of a set of records of
21016 fixed-length, containing an arbitrary definite Ada type, indexed by an
21017 integer record number.
21019 @item @code{Ada.Dispatching} `(D.2.1)'
21021 A parent package containing definitions for task dispatching operations.
21023 @item @code{Ada.Dispatching.EDF} `(D.2.6)'
21025 Not implemented in GNAT.
21027 @item @code{Ada.Dispatching.Non_Preemptive} `(D.2.4)'
21029 Not implemented in GNAT.
21031 @item @code{Ada.Dispatching.Round_Robin} `(D.2.5)'
21033 Not implemented in GNAT.
21035 @item @code{Ada.Dynamic_Priorities} `(D.5)'
21037 This package allows the priorities of a task to be adjusted dynamically
21038 as the task is running.
21040 @item @code{Ada.Environment_Variables} `(A.17)'
21042 This package provides facilities for accessing environment variables.
21044 @item @code{Ada.Exceptions} `(11.4.1)'
21046 This package provides additional information on exceptions, and also
21047 contains facilities for treating exceptions as data objects, and raising
21048 exceptions with associated messages.
21050 @item @code{Ada.Execution_Time} `(D.14)'
21052 This package provides CPU clock functionalities. It is not implemented on
21053 all targets (see package spec for details).
21055 @item @code{Ada.Execution_Time.Group_Budgets} `(D.14.2)'
21057 Not implemented in GNAT.
21059 @item @code{Ada.Execution_Time.Timers} `(D.14.1)’'
21061 Not implemented in GNAT.
21063 @item @code{Ada.Finalization} `(7.6)'
21065 This package contains the declarations and subprograms to support the
21066 use of controlled types, providing for automatic initialization and
21067 finalization (analogous to the constructors and destructors of C++).
21069 @item @code{Ada.Float_Text_IO} `(A.10.9)'
21071 A library level instantiation of Text_IO.Float_IO for type Float.
21073 @item @code{Ada.Float_Wide_Text_IO} `(A.10.9)'
21075 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
21077 @item @code{Ada.Float_Wide_Wide_Text_IO} `(A.10.9)'
21079 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
21081 @item @code{Ada.Integer_Text_IO} `(A.10.9)'
21083 A library level instantiation of Text_IO.Integer_IO for type Integer.
21085 @item @code{Ada.Integer_Wide_Text_IO} `(A.10.9)'
21087 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
21089 @item @code{Ada.Integer_Wide_Wide_Text_IO} `(A.10.9)'
21091 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
21093 @item @code{Ada.Interrupts} `(C.3.2)'
21095 This package provides facilities for interfacing to interrupts, which
21096 includes the set of signals or conditions that can be raised and
21097 recognized as interrupts.
21099 @item @code{Ada.Interrupts.Names} `(C.3.2)'
21101 This package provides the set of interrupt names (actually signal
21102 or condition names) that can be handled by GNAT.
21104 @item @code{Ada.IO_Exceptions} `(A.13)'
21106 This package defines the set of exceptions that can be raised by use of
21107 the standard IO packages.
21109 @item @code{Ada.Iterator_Interfaces} `(5.5.1)'
21111 This package provides a generic interface to generalized iterators.
21113 @item @code{Ada.Locales} `(A.19)'
21115 This package provides declarations providing information (Language
21116 and Country) about the current locale.
21118 @item @code{Ada.Numerics}
21120 This package contains some standard constants and exceptions used
21121 throughout the numerics packages.  Note that the constants pi and e are
21122 defined here, and it is better to use these definitions than rolling
21123 your own.
21125 @item @code{Ada.Numerics.Complex_Arrays} `(G.3.2)'
21127 Provides operations on arrays of complex numbers.
21129 @item @code{Ada.Numerics.Complex_Elementary_Functions}
21131 Provides the implementation of standard elementary functions (such as
21132 log and trigonometric functions) operating on complex numbers using the
21133 standard @code{Float} and the @code{Complex} and @code{Imaginary} types
21134 created by the package @code{Numerics.Complex_Types}.
21136 @item @code{Ada.Numerics.Complex_Types}
21138 This is a predefined instantiation of
21139 @code{Numerics.Generic_Complex_Types} using @code{Standard.Float} to
21140 build the type @code{Complex} and @code{Imaginary}.
21142 @item @code{Ada.Numerics.Discrete_Random}
21144 This generic package provides a random number generator suitable for generating
21145 uniformly distributed values of a specified discrete subtype.
21147 @item @code{Ada.Numerics.Float_Random}
21149 This package provides a random number generator suitable for generating
21150 uniformly distributed floating point values in the unit interval.
21152 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
21154 This is a generic version of the package that provides the
21155 implementation of standard elementary functions (such as log and
21156 trigonometric functions) for an arbitrary complex type.
21158 The following predefined instantiations of this package are provided:
21161 @itemize *
21163 @item 
21164 @code{Short_Float}
21166 @code{Ada.Numerics.Short_Complex_Elementary_Functions}
21168 @item 
21169 @code{Float}
21171 @code{Ada.Numerics.Complex_Elementary_Functions}
21173 @item 
21174 @code{Long_Float}
21176 @code{Ada.Numerics.Long_Complex_Elementary_Functions}
21177 @end itemize
21179 @item @code{Ada.Numerics.Generic_Complex_Types}
21181 This is a generic package that allows the creation of complex types,
21182 with associated complex arithmetic operations.
21184 The following predefined instantiations of this package exist
21187 @itemize *
21189 @item 
21190 @code{Short_Float}
21192 @code{Ada.Numerics.Short_Complex_Complex_Types}
21194 @item 
21195 @code{Float}
21197 @code{Ada.Numerics.Complex_Complex_Types}
21199 @item 
21200 @code{Long_Float}
21202 @code{Ada.Numerics.Long_Complex_Complex_Types}
21203 @end itemize
21205 @item @code{Ada.Numerics.Generic_Elementary_Functions}
21207 This is a generic package that provides the implementation of standard
21208 elementary functions (such as log an trigonometric functions) for an
21209 arbitrary float type.
21211 The following predefined instantiations of this package exist
21214 @itemize *
21216 @item 
21217 @code{Short_Float}
21219 @code{Ada.Numerics.Short_Elementary_Functions}
21221 @item 
21222 @code{Float}
21224 @code{Ada.Numerics.Elementary_Functions}
21226 @item 
21227 @code{Long_Float}
21229 @code{Ada.Numerics.Long_Elementary_Functions}
21230 @end itemize
21232 @item @code{Ada.Numerics.Generic_Real_Arrays} `(G.3.1)'
21234 Generic operations on arrays of reals
21236 @item @code{Ada.Numerics.Real_Arrays} `(G.3.1)'
21238 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
21240 @item @code{Ada.Real_Time} `(D.8)'
21242 This package provides facilities similar to those of @code{Calendar}, but
21243 operating with a finer clock suitable for real time control. Note that
21244 annex D requires that there be no backward clock jumps, and GNAT generally
21245 guarantees this behavior, but of course if the external clock on which
21246 the GNAT runtime depends is deliberately reset by some external event,
21247 then such a backward jump may occur.
21249 @item @code{Ada.Real_Time.Timing_Events} `(D.15)'
21251 Not implemented in GNAT.
21253 @item @code{Ada.Sequential_IO} `(A.8.1)'
21255 This package provides input-output facilities for sequential files,
21256 which can contain a sequence of values of a single type, which can be
21257 any Ada type, including indefinite (unconstrained) types.
21259 @item @code{Ada.Storage_IO} `(A.9)'
21261 This package provides a facility for mapping arbitrary Ada types to and
21262 from a storage buffer.  It is primarily intended for the creation of new
21263 IO packages.
21265 @item @code{Ada.Streams} `(13.13.1)'
21267 This is a generic package that provides the basic support for the
21268 concept of streams as used by the stream attributes (@code{Input},
21269 @code{Output}, @code{Read} and @code{Write}).
21271 @item @code{Ada.Streams.Stream_IO} `(A.12.1)'
21273 This package is a specialization of the type @code{Streams} defined in
21274 package @code{Streams} together with a set of operations providing
21275 Stream_IO capability.  The Stream_IO model permits both random and
21276 sequential access to a file which can contain an arbitrary set of values
21277 of one or more Ada types.
21279 @item @code{Ada.Strings} `(A.4.1)'
21281 This package provides some basic constants used by the string handling
21282 packages.
21284 @item @code{Ada.Strings.Bounded} `(A.4.4)'
21286 This package provides facilities for handling variable length
21287 strings.  The bounded model requires a maximum length.  It is thus
21288 somewhat more limited than the unbounded model, but avoids the use of
21289 dynamic allocation or finalization.
21291 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} `(A.4.10)'
21293 Provides case-insensitive comparisons of bounded strings
21295 @item @code{Ada.Strings.Bounded.Hash} `(A.4.9)'
21297 This package provides a generic hash function for bounded strings
21299 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} `(A.4.9)'
21301 This package provides a generic hash function for bounded strings that
21302 converts the string to be hashed to lower case.
21304 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} `(A.4.10)'
21306 This package provides a comparison function for bounded strings that works
21307 in a case insensitive manner by converting to lower case before the comparison.
21309 @item @code{Ada.Strings.Fixed} `(A.4.3)'
21311 This package provides facilities for handling fixed length strings.
21313 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} `(A.4.10)'
21315 This package provides an equality function for fixed strings that compares
21316 the strings after converting both to lower case.
21318 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} `(A.4.9)'
21320 This package provides a case insensitive hash function for fixed strings that
21321 converts the string to lower case before computing the hash.
21323 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} `(A.4.10)'
21325 This package provides a comparison function for fixed strings that works
21326 in a case insensitive manner by converting to lower case before the comparison.
21328 @item @code{Ada.Strings.Hash} `(A.4.9)'
21330 This package provides a hash function for strings.
21332 @item @code{Ada.Strings.Hash_Case_Insensitive} `(A.4.9)'
21334 This package provides a hash function for strings that is case insensitive.
21335 The string is converted to lower case before computing the hash.
21337 @item @code{Ada.Strings.Less_Case_Insensitive} `(A.4.10)'
21339 This package provides a comparison function for\strings that works
21340 in a case insensitive manner by converting to lower case before the comparison.
21342 @item @code{Ada.Strings.Maps} `(A.4.2)'
21344 This package provides facilities for handling character mappings and
21345 arbitrarily defined subsets of characters.  For instance it is useful in
21346 defining specialized translation tables.
21348 @item @code{Ada.Strings.Maps.Constants} `(A.4.6)'
21350 This package provides a standard set of predefined mappings and
21351 predefined character sets.  For example, the standard upper to lower case
21352 conversion table is found in this package.  Note that upper to lower case
21353 conversion is non-trivial if you want to take the entire set of
21354 characters, including extended characters like E with an acute accent,
21355 into account.  You should use the mappings in this package (rather than
21356 adding 32 yourself) to do case mappings.
21358 @item @code{Ada.Strings.Unbounded} `(A.4.5)'
21360 This package provides facilities for handling variable length
21361 strings.  The unbounded model allows arbitrary length strings, but
21362 requires the use of dynamic allocation and finalization.
21364 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} `(A.4.10)'
21366 Provides case-insensitive comparisons of unbounded strings
21368 @item @code{Ada.Strings.Unbounded.Hash} `(A.4.9)'
21370 This package provides a generic hash function for unbounded strings
21372 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} `(A.4.9)'
21374 This package provides a generic hash function for unbounded strings that
21375 converts the string to be hashed to lower case.
21377 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} `(A.4.10)'
21379 This package provides a comparison function for unbounded strings that works
21380 in a case insensitive manner by converting to lower case before the comparison.
21382 @item @code{Ada.Strings.UTF_Encoding} `(A.4.11)'
21384 This package provides basic definitions for dealing with UTF-encoded strings.
21386 @item @code{Ada.Strings.UTF_Encoding.Conversions} `(A.4.11)'
21388 This package provides conversion functions for UTF-encoded strings.
21389 @end table
21391 @code{Ada.Strings.UTF_Encoding.Strings} `(A.4.11)'
21393 @code{Ada.Strings.UTF_Encoding.Wide_Strings} `(A.4.11)'
21396 @table @asis
21398 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} `(A.4.11)'
21400 These packages provide facilities for handling UTF encodings for
21401 Strings, Wide_Strings and Wide_Wide_Strings.
21402 @end table
21404 @code{Ada.Strings.Wide_Bounded} `(A.4.7)'
21406 @code{Ada.Strings.Wide_Fixed} `(A.4.7)'
21408 @code{Ada.Strings.Wide_Maps} `(A.4.7)'
21411 @table @asis
21413 @item @code{Ada.Strings.Wide_Unbounded} `(A.4.7)'
21415 These packages provide analogous capabilities to the corresponding
21416 packages without @code{Wide_} in the name, but operate with the types
21417 @code{Wide_String} and @code{Wide_Character} instead of @code{String}
21418 and @code{Character}. Versions of all the child packages are available.
21419 @end table
21421 @code{Ada.Strings.Wide_Wide_Bounded} `(A.4.7)'
21423 @code{Ada.Strings.Wide_Wide_Fixed} `(A.4.7)'
21425 @code{Ada.Strings.Wide_Wide_Maps} `(A.4.7)'
21428 @table @asis
21430 @item @code{Ada.Strings.Wide_Wide_Unbounded} `(A.4.7)'
21432 These packages provide analogous capabilities to the corresponding
21433 packages without @code{Wide_} in the name, but operate with the types
21434 @code{Wide_Wide_String} and @code{Wide_Wide_Character} instead
21435 of @code{String} and @code{Character}.
21437 @item @code{Ada.Synchronous_Barriers} `(D.10.1)'
21439 This package provides facilities for synchronizing tasks at a low level
21440 with barriers.
21442 @item @code{Ada.Synchronous_Task_Control} `(D.10)'
21444 This package provides some standard facilities for controlling task
21445 communication in a synchronous manner.
21447 @item @code{Ada.Synchronous_Task_Control.EDF} `(D.10)'
21449 Not implemented in GNAT.
21451 @item @code{Ada.Tags}
21453 This package contains definitions for manipulation of the tags of tagged
21454 values.
21456 @item @code{Ada.Tags.Generic_Dispatching_Constructor} `(3.9)'
21458 This package provides a way of constructing tagged class-wide values given
21459 only the tag value.
21461 @item @code{Ada.Task_Attributes} `(C.7.2)'
21463 This package provides the capability of associating arbitrary
21464 task-specific data with separate tasks.
21466 @item @code{Ada.Task_Identification} `(C.7.1)'
21468 This package provides capabilities for task identification.
21470 @item @code{Ada.Task_Termination} `(C.7.3)'
21472 This package provides control over task termination.
21474 @item @code{Ada.Text_IO}
21476 This package provides basic text input-output capabilities for
21477 character, string and numeric data.  The subpackages of this
21478 package are listed next. Note that although these are defined
21479 as subpackages in the RM, they are actually transparently
21480 implemented as child packages in GNAT, meaning that they
21481 are only loaded if needed.
21483 @item @code{Ada.Text_IO.Decimal_IO}
21485 Provides input-output facilities for decimal fixed-point types
21487 @item @code{Ada.Text_IO.Enumeration_IO}
21489 Provides input-output facilities for enumeration types.
21491 @item @code{Ada.Text_IO.Fixed_IO}
21493 Provides input-output facilities for ordinary fixed-point types.
21495 @item @code{Ada.Text_IO.Float_IO}
21497 Provides input-output facilities for float types.  The following
21498 predefined instantiations of this generic package are available:
21501 @itemize *
21503 @item 
21504 @code{Short_Float}
21506 @code{Short_Float_Text_IO}
21508 @item 
21509 @code{Float}
21511 @code{Float_Text_IO}
21513 @item 
21514 @code{Long_Float}
21516 @code{Long_Float_Text_IO}
21517 @end itemize
21519 @item @code{Ada.Text_IO.Integer_IO}
21521 Provides input-output facilities for integer types.  The following
21522 predefined instantiations of this generic package are available:
21525 @itemize *
21527 @item 
21528 @code{Short_Short_Integer}
21530 @code{Ada.Short_Short_Integer_Text_IO}
21532 @item 
21533 @code{Short_Integer}
21535 @code{Ada.Short_Integer_Text_IO}
21537 @item 
21538 @code{Integer}
21540 @code{Ada.Integer_Text_IO}
21542 @item 
21543 @code{Long_Integer}
21545 @code{Ada.Long_Integer_Text_IO}
21547 @item 
21548 @code{Long_Long_Integer}
21550 @code{Ada.Long_Long_Integer_Text_IO}
21551 @end itemize
21553 @item @code{Ada.Text_IO.Modular_IO}
21555 Provides input-output facilities for modular (unsigned) types.
21557 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
21559 Provides input-output facilities for bounded strings.
21561 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
21563 This package provides basic text input-output capabilities for complex
21564 data.
21566 @item @code{Ada.Text_IO.Editing (F.3.3)}
21568 This package contains routines for edited output, analogous to the use
21569 of pictures in COBOL.  The picture formats used by this package are a
21570 close copy of the facility in COBOL.
21572 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
21574 This package provides a facility that allows Text_IO files to be treated
21575 as streams, so that the stream attributes can be used for writing
21576 arbitrary data, including binary data, to Text_IO files.
21578 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
21580 This package provides input-output facilities for unbounded strings.
21582 @item @code{Ada.Unchecked_Conversion (13.9)}
21584 This generic package allows arbitrary conversion from one type to
21585 another of the same size, providing for breaking the type safety in
21586 special circumstances.
21588 If the types have the same Size (more accurately the same Value_Size),
21589 then the effect is simply to transfer the bits from the source to the
21590 target type without any modification.  This usage is well defined, and
21591 for simple types whose representation is typically the same across
21592 all implementations, gives a portable method of performing such
21593 conversions.
21595 If the types do not have the same size, then the result is implementation
21596 defined, and thus may be non-portable.  The following describes how GNAT
21597 handles such unchecked conversion cases.
21599 If the types are of different sizes, and are both discrete types, then
21600 the effect is of a normal type conversion without any constraint checking.
21601 In particular if the result type has a larger size, the result will be
21602 zero or sign extended.  If the result type has a smaller size, the result
21603 will be truncated by ignoring high order bits.
21605 If the types are of different sizes, and are not both discrete types,
21606 then the conversion works as though pointers were created to the source
21607 and target, and the pointer value is converted.  The effect is that bits
21608 are copied from successive low order storage units and bits of the source
21609 up to the length of the target type.
21611 A warning is issued if the lengths differ, since the effect in this
21612 case is implementation dependent, and the above behavior may not match
21613 that of some other compiler.
21615 A pointer to one type may be converted to a pointer to another type using
21616 unchecked conversion.  The only case in which the effect is undefined is
21617 when one or both pointers are pointers to unconstrained array types.  In
21618 this case, the bounds information may get incorrectly transferred, and in
21619 particular, GNAT uses double size pointers for such types, and it is
21620 meaningless to convert between such pointer types.  GNAT will issue a
21621 warning if the alignment of the target designated type is more strict
21622 than the alignment of the source designated type (since the result may
21623 be unaligned in this case).
21625 A pointer other than a pointer to an unconstrained array type may be
21626 converted to and from System.Address.  Such usage is common in Ada 83
21627 programs, but note that Ada.Address_To_Access_Conversions is the
21628 preferred method of performing such conversions in Ada 95 and Ada 2005.
21629 Neither
21630 unchecked conversion nor Ada.Address_To_Access_Conversions should be
21631 used in conjunction with pointers to unconstrained objects, since
21632 the bounds information cannot be handled correctly in this case.
21634 @item @code{Ada.Unchecked_Deallocation} `(13.11.2)'
21636 This generic package allows explicit freeing of storage previously
21637 allocated by use of an allocator.
21639 @item @code{Ada.Wide_Text_IO} `(A.11)'
21641 This package is similar to @code{Ada.Text_IO}, except that the external
21642 file supports wide character representations, and the internal types are
21643 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21644 and @code{String}. The corresponding set of nested packages and child
21645 packages are defined.
21647 @item @code{Ada.Wide_Wide_Text_IO} `(A.11)'
21649 This package is similar to @code{Ada.Text_IO}, except that the external
21650 file supports wide character representations, and the internal types are
21651 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21652 and @code{String}. The corresponding set of nested packages and child
21653 packages are defined.
21654 @end table
21656 For packages in Interfaces and System, all the RM defined packages are
21657 available in GNAT, see the Ada 2012 RM for full details.
21659 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
21660 @anchor{gnat_rm/the_implementation_of_standard_i_o doc}@anchor{2b5}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{2b6}@anchor{gnat_rm/the_implementation_of_standard_i_o the-implementation-of-standard-i-o}@anchor{f}
21661 @chapter The Implementation of Standard I/O
21664 GNAT implements all the required input-output facilities described in
21665 A.6 through A.14.  These sections of the Ada Reference Manual describe the
21666 required behavior of these packages from the Ada point of view, and if
21667 you are writing a portable Ada program that does not need to know the
21668 exact manner in which Ada maps to the outside world when it comes to
21669 reading or writing external files, then you do not need to read this
21670 chapter.  As long as your files are all regular files (not pipes or
21671 devices), and as long as you write and read the files only from Ada, the
21672 description in the Ada Reference Manual is sufficient.
21674 However, if you want to do input-output to pipes or other devices, such
21675 as the keyboard or screen, or if the files you are dealing with are
21676 either generated by some other language, or to be read by some other
21677 language, then you need to know more about the details of how the GNAT
21678 implementation of these input-output facilities behaves.
21680 In this chapter we give a detailed description of exactly how GNAT
21681 interfaces to the file system.  As always, the sources of the system are
21682 available to you for answering questions at an even more detailed level,
21683 but for most purposes the information in this chapter will suffice.
21685 Another reason that you may need to know more about how input-output is
21686 implemented arises when you have a program written in mixed languages
21687 where, for example, files are shared between the C and Ada sections of
21688 the same program.  GNAT provides some additional facilities, in the form
21689 of additional child library packages, that facilitate this sharing, and
21690 these additional facilities are also described in this chapter.
21692 @menu
21693 * Standard I/O Packages:: 
21694 * FORM Strings:: 
21695 * Direct_IO:: 
21696 * Sequential_IO:: 
21697 * Text_IO:: 
21698 * Wide_Text_IO:: 
21699 * Wide_Wide_Text_IO:: 
21700 * Stream_IO:: 
21701 * Text Translation:: 
21702 * Shared Files:: 
21703 * Filenames encoding:: 
21704 * File content encoding:: 
21705 * Open Modes:: 
21706 * Operations on C Streams:: 
21707 * Interfacing to C Streams:: 
21709 @end menu
21711 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
21712 @anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{2b7}@anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{2b8}
21713 @section Standard I/O Packages
21716 The Standard I/O packages described in Annex A for
21719 @itemize *
21721 @item 
21722 Ada.Text_IO
21724 @item 
21725 Ada.Text_IO.Complex_IO
21727 @item 
21728 Ada.Text_IO.Text_Streams
21730 @item 
21731 Ada.Wide_Text_IO
21733 @item 
21734 Ada.Wide_Text_IO.Complex_IO
21736 @item 
21737 Ada.Wide_Text_IO.Text_Streams
21739 @item 
21740 Ada.Wide_Wide_Text_IO
21742 @item 
21743 Ada.Wide_Wide_Text_IO.Complex_IO
21745 @item 
21746 Ada.Wide_Wide_Text_IO.Text_Streams
21748 @item 
21749 Ada.Stream_IO
21751 @item 
21752 Ada.Sequential_IO
21754 @item 
21755 Ada.Direct_IO
21756 @end itemize
21758 are implemented using the C
21759 library streams facility; where
21762 @itemize *
21764 @item 
21765 All files are opened using @code{fopen}.
21767 @item 
21768 All input/output operations use @code{fread}/@code{fwrite}.
21769 @end itemize
21771 There is no internal buffering of any kind at the Ada library level. The only
21772 buffering is that provided at the system level in the implementation of the
21773 library routines that support streams. This facilitates shared use of these
21774 streams by mixed language programs. Note though that system level buffering is
21775 explicitly enabled at elaboration of the standard I/O packages and that can
21776 have an impact on mixed language programs, in particular those using I/O before
21777 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
21778 the Ada elaboration routine before performing any I/O or when impractical,
21779 flush the common I/O streams and in particular Standard_Output before
21780 elaborating the Ada code.
21782 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
21783 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{2b9}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{2ba}
21784 @section FORM Strings
21787 The format of a FORM string in GNAT is:
21789 @example
21790 "keyword=value,keyword=value,...,keyword=value"
21791 @end example
21793 where letters may be in upper or lower case, and there are no spaces
21794 between values.  The order of the entries is not important.  Currently
21795 the following keywords defined.
21797 @example
21798 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
21799 SHARED=[YES|NO]
21800 WCEM=[n|h|u|s|e|8|b]
21801 ENCODING=[UTF8|8BITS]
21802 @end example
21804 The use of these parameters is described later in this section. If an
21805 unrecognized keyword appears in a form string, it is silently ignored
21806 and not considered invalid.
21808 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
21809 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{2bb}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{2bc}
21810 @section Direct_IO
21813 Direct_IO can only be instantiated for definite types.  This is a
21814 restriction of the Ada language, which means that the records are fixed
21815 length (the length being determined by @code{type'Size}, rounded
21816 up to the next storage unit boundary if necessary).
21818 The records of a Direct_IO file are simply written to the file in index
21819 sequence, with the first record starting at offset zero, and subsequent
21820 records following.  There is no control information of any kind.  For
21821 example, if 32-bit integers are being written, each record takes
21822 4-bytes, so the record at index @code{K} starts at offset @code{(K-1)*4}.
21824 There is no limit on the size of Direct_IO files, they are expanded as
21825 necessary to accommodate whatever records are written to the file.
21827 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
21828 @anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{2bd}@anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{2be}
21829 @section Sequential_IO
21832 Sequential_IO may be instantiated with either a definite (constrained)
21833 or indefinite (unconstrained) type.
21835 For the definite type case, the elements written to the file are simply
21836 the memory images of the data values with no control information of any
21837 kind.  The resulting file should be read using the same type, no validity
21838 checking is performed on input.
21840 For the indefinite type case, the elements written consist of two
21841 parts.  First is the size of the data item, written as the memory image
21842 of a @code{Interfaces.C.size_t} value, followed by the memory image of
21843 the data value.  The resulting file can only be read using the same
21844 (unconstrained) type.  Normal assignment checks are performed on these
21845 read operations, and if these checks fail, @code{Data_Error} is
21846 raised.  In particular, in the array case, the lengths must match, and in
21847 the variant record case, if the variable for a particular read operation
21848 is constrained, the discriminants must match.
21850 Note that it is not possible to use Sequential_IO to write variable
21851 length array items, and then read the data back into different length
21852 arrays.  For example, the following will raise @code{Data_Error}:
21854 @example
21855 package IO is new Sequential_IO (String);
21856 F : IO.File_Type;
21857 S : String (1..4);
21859 IO.Create (F)
21860 IO.Write (F, "hello!")
21861 IO.Reset (F, Mode=>In_File);
21862 IO.Read (F, S);
21863 Put_Line (S);
21864 @end example
21866 On some Ada implementations, this will print @code{hell}, but the program is
21867 clearly incorrect, since there is only one element in the file, and that
21868 element is the string @code{hello!}.
21870 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
21871 using Stream_IO, and this is the preferred mechanism.  In particular, the
21872 above program fragment rewritten to use Stream_IO will work correctly.
21874 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
21875 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{2bf}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{2c0}
21876 @section Text_IO
21879 Text_IO files consist of a stream of characters containing the following
21880 special control characters:
21882 @example
21883 LF (line feed, 16#0A#) Line Mark
21884 FF (form feed, 16#0C#) Page Mark
21885 @end example
21887 A canonical Text_IO file is defined as one in which the following
21888 conditions are met:
21891 @itemize *
21893 @item 
21894 The character @code{LF} is used only as a line mark, i.e., to mark the end
21895 of the line.
21897 @item 
21898 The character @code{FF} is used only as a page mark, i.e., to mark the
21899 end of a page and consequently can appear only immediately following a
21900 @code{LF} (line mark) character.
21902 @item 
21903 The file ends with either @code{LF} (line mark) or @code{LF}-@cite{FF}
21904 (line mark, page mark).  In the former case, the page mark is implicitly
21905 assumed to be present.
21906 @end itemize
21908 A file written using Text_IO will be in canonical form provided that no
21909 explicit @code{LF} or @code{FF} characters are written using @code{Put}
21910 or @code{Put_Line}.  There will be no @code{FF} character at the end of
21911 the file unless an explicit @code{New_Page} operation was performed
21912 before closing the file.
21914 A canonical Text_IO file that is a regular file (i.e., not a device or a
21915 pipe) can be read using any of the routines in Text_IO.  The
21916 semantics in this case will be exactly as defined in the Ada Reference
21917 Manual, and all the routines in Text_IO are fully implemented.
21919 A text file that does not meet the requirements for a canonical Text_IO
21920 file has one of the following:
21923 @itemize *
21925 @item 
21926 The file contains @code{FF} characters not immediately following a
21927 @code{LF} character.
21929 @item 
21930 The file contains @code{LF} or @code{FF} characters written by
21931 @code{Put} or @code{Put_Line}, which are not logically considered to be
21932 line marks or page marks.
21934 @item 
21935 The file ends in a character other than @code{LF} or @code{FF},
21936 i.e., there is no explicit line mark or page mark at the end of the file.
21937 @end itemize
21939 Text_IO can be used to read such non-standard text files but subprograms
21940 to do with line or page numbers do not have defined meanings.  In
21941 particular, a @code{FF} character that does not follow a @code{LF}
21942 character may or may not be treated as a page mark from the point of
21943 view of page and line numbering.  Every @code{LF} character is considered
21944 to end a line, and there is an implied @code{LF} character at the end of
21945 the file.
21947 @menu
21948 * Stream Pointer Positioning:: 
21949 * Reading and Writing Non-Regular Files:: 
21950 * Get_Immediate:: 
21951 * Treating Text_IO Files as Streams:: 
21952 * Text_IO Extensions:: 
21953 * Text_IO Facilities for Unbounded Strings:: 
21955 @end menu
21957 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21958 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{2c1}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{2c2}
21959 @subsection Stream Pointer Positioning
21962 @code{Ada.Text_IO} has a definition of current position for a file that
21963 is being read.  No internal buffering occurs in Text_IO, and usually the
21964 physical position in the stream used to implement the file corresponds
21965 to this logical position defined by Text_IO.  There are two exceptions:
21968 @itemize *
21970 @item 
21971 After a call to @code{End_Of_Page} that returns @code{True}, the stream
21972 is positioned past the @code{LF} (line mark) that precedes the page
21973 mark.  Text_IO maintains an internal flag so that subsequent read
21974 operations properly handle the logical position which is unchanged by
21975 the @code{End_Of_Page} call.
21977 @item 
21978 After a call to @code{End_Of_File} that returns @code{True}, if the
21979 Text_IO file was positioned before the line mark at the end of file
21980 before the call, then the logical position is unchanged, but the stream
21981 is physically positioned right at the end of file (past the line mark,
21982 and past a possible page mark following the line mark.  Again Text_IO
21983 maintains internal flags so that subsequent read operations properly
21984 handle the logical position.
21985 @end itemize
21987 These discrepancies have no effect on the observable behavior of
21988 Text_IO, but if a single Ada stream is shared between a C program and
21989 Ada program, or shared (using @code{shared=yes} in the form string)
21990 between two Ada files, then the difference may be observable in some
21991 situations.
21993 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21994 @anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{2c3}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{2c4}
21995 @subsection Reading and Writing Non-Regular Files
21998 A non-regular file is a device (such as a keyboard), or a pipe.  Text_IO
21999 can be used for reading and writing.  Writing is not affected and the
22000 sequence of characters output is identical to the normal file case, but
22001 for reading, the behavior of Text_IO is modified to avoid undesirable
22002 look-ahead as follows:
22004 An input file that is not a regular file is considered to have no page
22005 marks.  Any @code{Ascii.FF} characters (the character normally used for a
22006 page mark) appearing in the file are considered to be data
22007 characters.  In particular:
22010 @itemize *
22012 @item 
22013 @code{Get_Line} and @code{Skip_Line} do not test for a page mark
22014 following a line mark.  If a page mark appears, it will be treated as a
22015 data character.
22017 @item 
22018 This avoids the need to wait for an extra character to be typed or
22019 entered from the pipe to complete one of these operations.
22021 @item 
22022 @code{End_Of_Page} always returns @code{False}
22024 @item 
22025 @code{End_Of_File} will return @code{False} if there is a page mark at
22026 the end of the file.
22027 @end itemize
22029 Output to non-regular files is the same as for regular files.  Page marks
22030 may be written to non-regular files using @code{New_Page}, but as noted
22031 above they will not be treated as page marks on input if the output is
22032 piped to another Ada program.
22034 Another important discrepancy when reading non-regular files is that the end
22035 of file indication is not ‘sticky’.  If an end of file is entered, e.g., by
22036 pressing the @code{EOT} key,
22037 then end of file
22038 is signaled once (i.e., the test @code{End_Of_File}
22039 will yield @code{True}, or a read will
22040 raise @code{End_Error}), but then reading can resume
22041 to read data past that end of
22042 file indication, until another end of file indication is entered.
22044 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
22045 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{2c5}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2c6}
22046 @subsection Get_Immediate
22049 @geindex Get_Immediate
22051 Get_Immediate returns the next character (including control characters)
22052 from the input file.  In particular, Get_Immediate will return LF or FF
22053 characters used as line marks or page marks.  Such operations leave the
22054 file positioned past the control character, and it is thus not treated
22055 as having its normal function.  This means that page, line and column
22056 counts after this kind of Get_Immediate call are set as though the mark
22057 did not occur.  In the case where a Get_Immediate leaves the file
22058 positioned between the line mark and page mark (which is not normally
22059 possible), it is undefined whether the FF character will be treated as a
22060 page mark.
22062 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
22063 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2c7}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2c8}
22064 @subsection Treating Text_IO Files as Streams
22067 @geindex Stream files
22069 The package @code{Text_IO.Streams} allows a @code{Text_IO} file to be treated
22070 as a stream.  Data written to a @code{Text_IO} file in this stream mode is
22071 binary data.  If this binary data contains bytes 16#0A# (@code{LF}) or
22072 16#0C# (@code{FF}), the resulting file may have non-standard
22073 format.  Similarly if read operations are used to read from a Text_IO
22074 file treated as a stream, then @code{LF} and @code{FF} characters may be
22075 skipped and the effect is similar to that described above for
22076 @code{Get_Immediate}.
22078 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
22079 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2c9}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2ca}
22080 @subsection Text_IO Extensions
22083 @geindex Text_IO extensions
22085 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
22086 to the standard @code{Text_IO} package:
22089 @itemize *
22091 @item 
22092 function File_Exists (Name : String) return Boolean;
22093 Determines if a file of the given name exists.
22095 @item 
22096 function Get_Line return String;
22097 Reads a string from the standard input file.  The value returned is exactly
22098 the length of the line that was read.
22100 @item 
22101 function Get_Line (File : Ada.Text_IO.File_Type) return String;
22102 Similar, except that the parameter File specifies the file from which
22103 the string is to be read.
22104 @end itemize
22106 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
22107 @anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2cb}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2cc}
22108 @subsection Text_IO Facilities for Unbounded Strings
22111 @geindex Text_IO for unbounded strings
22113 @geindex Unbounded_String
22114 @geindex Text_IO operations
22116 The package @code{Ada.Strings.Unbounded.Text_IO}
22117 in library files @code{a-suteio.ads/adb} contains some GNAT-specific
22118 subprograms useful for Text_IO operations on unbounded strings:
22121 @itemize *
22123 @item 
22124 function Get_Line (File : File_Type) return Unbounded_String;
22125 Reads a line from the specified file
22126 and returns the result as an unbounded string.
22128 @item 
22129 procedure Put (File : File_Type; U : Unbounded_String);
22130 Writes the value of the given unbounded string to the specified file
22131 Similar to the effect of
22132 @code{Put (To_String (U))} except that an extra copy is avoided.
22134 @item 
22135 procedure Put_Line (File : File_Type; U : Unbounded_String);
22136 Writes the value of the given unbounded string to the specified file,
22137 followed by a @code{New_Line}.
22138 Similar to the effect of @code{Put_Line (To_String (U))} except
22139 that an extra copy is avoided.
22140 @end itemize
22142 In the above procedures, @code{File} is of type @code{Ada.Text_IO.File_Type}
22143 and is optional.  If the parameter is omitted, then the standard input or
22144 output file is referenced as appropriate.
22146 The package @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
22147 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
22148 @code{Wide_Text_IO} functionality for unbounded wide strings.
22150 The package @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
22151 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
22152 @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
22154 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
22155 @anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2cd}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2ce}
22156 @section Wide_Text_IO
22159 @code{Wide_Text_IO} is similar in most respects to Text_IO, except that
22160 both input and output files may contain special sequences that represent
22161 wide character values.  The encoding scheme for a given file may be
22162 specified using a FORM parameter:
22164 @example
22165 WCEM=`x`
22166 @end example
22168 as part of the FORM string (WCEM = wide character encoding method),
22169 where @code{x} is one of the following characters
22172 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
22173 @headitem
22175 Character
22177 @tab
22179 Encoding
22181 @item
22185 @tab
22187 Hex ESC encoding
22189 @item
22193 @tab
22195 Upper half encoding
22197 @item
22201 @tab
22203 Shift-JIS encoding
22205 @item
22209 @tab
22211 EUC Encoding
22213 @item
22217 @tab
22219 UTF-8 encoding
22221 @item
22225 @tab
22227 Brackets encoding
22229 @end multitable
22232 The encoding methods match those that
22233 can be used in a source
22234 program, but there is no requirement that the encoding method used for
22235 the source program be the same as the encoding method used for files,
22236 and different files may use different encoding methods.
22238 The default encoding method for the standard files, and for opened files
22239 for which no WCEM parameter is given in the FORM string matches the
22240 wide character encoding specified for the main program (the default
22241 being brackets encoding if no coding method was specified with -gnatW).
22244 @table @asis
22246 @item `Hex Coding'
22248 In this encoding, a wide character is represented by a five character
22249 sequence:
22250 @end table
22252 @example
22253 ESC a b c d
22254 @end example
22257 @quotation
22259 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22260 characters (using upper case letters) of the wide character code.  For
22261 example, ESC A345 is used to represent the wide character with code
22262 16#A345#.  This scheme is compatible with use of the full
22263 @code{Wide_Character} set.
22264 @end quotation
22267 @table @asis
22269 @item `Upper Half Coding'
22271 The wide character with encoding 16#abcd#, where the upper bit is on
22272 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
22273 16#cd#.  The second byte may never be a format control character, but is
22274 not required to be in the upper half.  This method can be also used for
22275 shift-JIS or EUC where the internal coding matches the external coding.
22277 @item `Shift JIS Coding'
22279 A wide character is represented by a two character sequence 16#ab# and
22280 16#cd#, with the restrictions described for upper half encoding as
22281 described above.  The internal character code is the corresponding JIS
22282 character according to the standard algorithm for Shift-JIS
22283 conversion.  Only characters defined in the JIS code set table can be
22284 used with this encoding method.
22286 @item `EUC Coding'
22288 A wide character is represented by a two character sequence 16#ab# and
22289 16#cd#, with both characters being in the upper half.  The internal
22290 character code is the corresponding JIS character according to the EUC
22291 encoding algorithm.  Only characters defined in the JIS code set table
22292 can be used with this encoding method.
22294 @item `UTF-8 Coding'
22296 A wide character is represented using
22297 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22298 10646-1/Am.2.  Depending on the character value, the representation
22299 is a one, two, or three byte sequence:
22300 @end table
22302 @example
22303 16#0000#-16#007f#: 2#0xxxxxxx#
22304 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
22305 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22306 @end example
22309 @quotation
22311 where the @code{xxx} bits correspond to the left-padded bits of the
22312 16-bit character value.  Note that all lower half ASCII characters
22313 are represented as ASCII bytes and all upper half characters and
22314 other wide characters are represented as sequences of upper-half
22315 (The full UTF-8 scheme allows for encoding 31-bit characters as
22316 6-byte sequences, but in this implementation, all UTF-8 sequences
22317 of four or more bytes length will raise a Constraint_Error, as
22318 will all invalid UTF-8 sequences.)
22319 @end quotation
22322 @table @asis
22324 @item `Brackets Coding'
22326 In this encoding, a wide character is represented by the following eight
22327 character sequence:
22328 @end table
22330 @example
22331 [ " a b c d " ]
22332 @end example
22335 @quotation
22337 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22338 characters (using uppercase letters) of the wide character code.  For
22339 example, @code{["A345"]} is used to represent the wide character with code
22340 @code{16#A345#}.
22341 This scheme is compatible with use of the full Wide_Character set.
22342 On input, brackets coding can also be used for upper half characters,
22343 e.g., @code{["C1"]} for lower case a.  However, on output, brackets notation
22344 is only used for wide characters with a code greater than @code{16#FF#}.
22346 Note that brackets coding is not normally used in the context of
22347 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
22348 a portable way of encoding source files. In the context of Wide_Text_IO
22349 or Wide_Wide_Text_IO, it can only be used if the file does not contain
22350 any instance of the left bracket character other than to encode wide
22351 character values using the brackets encoding method. In practice it is
22352 expected that some standard wide character encoding method such
22353 as UTF-8 will be used for text input output.
22355 If brackets notation is used, then any occurrence of a left bracket
22356 in the input file which is not the start of a valid wide character
22357 sequence will cause Constraint_Error to be raised. It is possible to
22358 encode a left bracket as [“5B”] and Wide_Text_IO and Wide_Wide_Text_IO
22359 input will interpret this as a left bracket.
22361 However, when a left bracket is output, it will be output as a left bracket
22362 and not as [“5B”]. We make this decision because for normal use of
22363 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
22364 brackets. For example, if we write:
22366 @example
22367 Put_Line ("Start of output [first run]");
22368 @end example
22370 we really do not want to have the left bracket in this message clobbered so
22371 that the output reads:
22372 @end quotation
22374 @example
22375 Start of output ["5B"]first run]
22376 @end example
22379 @quotation
22381 In practice brackets encoding is reasonably useful for normal Put_Line use
22382 since we won’t get confused between left brackets and wide character
22383 sequences in the output. But for input, or when files are written out
22384 and read back in, it really makes better sense to use one of the standard
22385 encoding methods such as UTF-8.
22386 @end quotation
22388 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
22389 not all wide character
22390 values can be represented.  An attempt to output a character that cannot
22391 be represented using the encoding scheme for the file causes
22392 Constraint_Error to be raised.  An invalid wide character sequence on
22393 input also causes Constraint_Error to be raised.
22395 @menu
22396 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
22397 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
22399 @end menu
22401 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
22402 @anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2cf}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2d0}
22403 @subsection Stream Pointer Positioning
22406 @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22407 of stream pointer positioning (@ref{2c0,,Text_IO}).  There is one additional
22408 case:
22410 If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
22411 normal lower ASCII set, i.e. a character in the range:
22413 @example
22414 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
22415 @end example
22417 then although the logical position of the file pointer is unchanged by
22418 the @code{Look_Ahead} call, the stream is physically positioned past the
22419 wide character sequence.  Again this is to avoid the need for buffering
22420 or backup, and all @code{Wide_Text_IO} routines check the internal
22421 indication that this situation has occurred so that this is not visible
22422 to a normal program using @code{Wide_Text_IO}.  However, this discrepancy
22423 can be observed if the wide text file shares a stream with another file.
22425 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
22426 @anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2d1}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2d2}
22427 @subsection Reading and Writing Non-Regular Files
22430 As in the case of Text_IO, when a non-regular file is read, it is
22431 assumed that the file contains no page marks (any form characters are
22432 treated as data characters), and @code{End_Of_Page} always returns
22433 @code{False}.  Similarly, the end of file indication is not sticky, so
22434 it is possible to read beyond an end of file.
22436 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
22437 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2d3}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2d4}
22438 @section Wide_Wide_Text_IO
22441 @code{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
22442 both input and output files may contain special sequences that represent
22443 wide wide character values.  The encoding scheme for a given file may be
22444 specified using a FORM parameter:
22446 @example
22447 WCEM=`x`
22448 @end example
22450 as part of the FORM string (WCEM = wide character encoding method),
22451 where @code{x} is one of the following characters
22454 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
22455 @headitem
22457 Character
22459 @tab
22461 Encoding
22463 @item
22467 @tab
22469 Hex ESC encoding
22471 @item
22475 @tab
22477 Upper half encoding
22479 @item
22483 @tab
22485 Shift-JIS encoding
22487 @item
22491 @tab
22493 EUC Encoding
22495 @item
22499 @tab
22501 UTF-8 encoding
22503 @item
22507 @tab
22509 Brackets encoding
22511 @end multitable
22514 The encoding methods match those that
22515 can be used in a source
22516 program, but there is no requirement that the encoding method used for
22517 the source program be the same as the encoding method used for files,
22518 and different files may use different encoding methods.
22520 The default encoding method for the standard files, and for opened files
22521 for which no WCEM parameter is given in the FORM string matches the
22522 wide character encoding specified for the main program (the default
22523 being brackets encoding if no coding method was specified with -gnatW).
22526 @table @asis
22528 @item `UTF-8 Coding'
22530 A wide character is represented using
22531 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22532 10646-1/Am.2.  Depending on the character value, the representation
22533 is a one, two, three, or four byte sequence:
22534 @end table
22536 @example
22537 16#000000#-16#00007f#: 2#0xxxxxxx#
22538 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
22539 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22540 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
22541 @end example
22544 @quotation
22546 where the @code{xxx} bits correspond to the left-padded bits of the
22547 21-bit character value.  Note that all lower half ASCII characters
22548 are represented as ASCII bytes and all upper half characters and
22549 other wide characters are represented as sequences of upper-half
22550 characters.
22551 @end quotation
22554 @table @asis
22556 @item `Brackets Coding'
22558 In this encoding, a wide wide character is represented by the following eight
22559 character sequence if is in wide character range
22560 @end table
22562 @example
22563 [ " a b c d " ]
22564 @end example
22567 @quotation
22569 and by the following ten character sequence if not
22570 @end quotation
22572 @example
22573 [ " a b c d e f " ]
22574 @end example
22577 @quotation
22579 where @code{a}, @code{b}, @code{c}, @code{d}, @code{e}, and @code{f}
22580 are the four or six hexadecimal
22581 characters (using uppercase letters) of the wide wide character code.  For
22582 example, @code{["01A345"]} is used to represent the wide wide character
22583 with code @code{16#01A345#}.
22585 This scheme is compatible with use of the full Wide_Wide_Character set.
22586 On input, brackets coding can also be used for upper half characters,
22587 e.g., @code{["C1"]} for lower case a.  However, on output, brackets notation
22588 is only used for wide characters with a code greater than @code{16#FF#}.
22589 @end quotation
22591 If is also possible to use the other Wide_Character encoding methods,
22592 such as Shift-JIS, but the other schemes cannot support the full range
22593 of wide wide characters.
22594 An attempt to output a character that cannot
22595 be represented using the encoding scheme for the file causes
22596 Constraint_Error to be raised.  An invalid wide character sequence on
22597 input also causes Constraint_Error to be raised.
22599 @menu
22600 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
22601 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
22603 @end menu
22605 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
22606 @anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2d5}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2d6}
22607 @subsection Stream Pointer Positioning
22610 @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22611 of stream pointer positioning (@ref{2c0,,Text_IO}).  There is one additional
22612 case:
22614 If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
22615 normal lower ASCII set, i.e. a character in the range:
22617 @example
22618 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
22619 @end example
22621 then although the logical position of the file pointer is unchanged by
22622 the @code{Look_Ahead} call, the stream is physically positioned past the
22623 wide character sequence.  Again this is to avoid the need for buffering
22624 or backup, and all @code{Wide_Wide_Text_IO} routines check the internal
22625 indication that this situation has occurred so that this is not visible
22626 to a normal program using @code{Wide_Wide_Text_IO}.  However, this discrepancy
22627 can be observed if the wide text file shares a stream with another file.
22629 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
22630 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2d7}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2d8}
22631 @subsection Reading and Writing Non-Regular Files
22634 As in the case of Text_IO, when a non-regular file is read, it is
22635 assumed that the file contains no page marks (any form characters are
22636 treated as data characters), and @code{End_Of_Page} always returns
22637 @code{False}.  Similarly, the end of file indication is not sticky, so
22638 it is possible to read beyond an end of file.
22640 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
22641 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2d9}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2da}
22642 @section Stream_IO
22645 A stream file is a sequence of bytes, where individual elements are
22646 written to the file as described in the Ada Reference Manual.  The type
22647 @code{Stream_Element} is simply a byte.  There are two ways to read or
22648 write a stream file.
22651 @itemize *
22653 @item 
22654 The operations @code{Read} and @code{Write} directly read or write a
22655 sequence of stream elements with no control information.
22657 @item 
22658 The stream attributes applied to a stream file transfer data in the
22659 manner described for stream attributes.
22660 @end itemize
22662 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
22663 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2db}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2dc}
22664 @section Text Translation
22667 @code{Text_Translation=xxx} may be used as the Form parameter
22668 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
22669 has no effect on Unix systems. Possible values are:
22672 @itemize *
22674 @item 
22675 @code{Yes} or @code{Text} is the default, which means to
22676 translate LF to/from CR/LF on Windows systems.
22678 @code{No} disables this translation; i.e. it
22679 uses binary mode. For output files, @code{Text_Translation=No}
22680 may be used to create Unix-style files on
22681 Windows.
22683 @item 
22684 @code{wtext} translation enabled in Unicode mode.
22685 (corresponds to _O_WTEXT).
22687 @item 
22688 @code{u8text} translation enabled in Unicode UTF-8 mode.
22689 (corresponds to O_U8TEXT).
22691 @item 
22692 @code{u16text} translation enabled in Unicode UTF-16
22693 mode. (corresponds to_O_U16TEXT).
22694 @end itemize
22696 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
22697 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2dd}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2de}
22698 @section Shared Files
22701 Section A.14 of the Ada Reference Manual allows implementations to
22702 provide a wide variety of behavior if an attempt is made to access the
22703 same external file with two or more internal files.
22705 To provide a full range of functionality, while at the same time
22706 minimizing the problems of portability caused by this implementation
22707 dependence, GNAT handles file sharing as follows:
22710 @itemize *
22712 @item 
22713 In the absence of a @code{shared=xxx} form parameter, an attempt
22714 to open two or more files with the same full name is considered an error
22715 and is not supported.  The exception @code{Use_Error} will be
22716 raised.  Note that a file that is not explicitly closed by the program
22717 remains open until the program terminates.
22719 @item 
22720 If the form parameter @code{shared=no} appears in the form string, the
22721 file can be opened or created with its own separate stream identifier,
22722 regardless of whether other files sharing the same external file are
22723 opened.  The exact effect depends on how the C stream routines handle
22724 multiple accesses to the same external files using separate streams.
22726 @item 
22727 If the form parameter @code{shared=yes} appears in the form string for
22728 each of two or more files opened using the same full name, the same
22729 stream is shared between these files, and the semantics are as described
22730 in Ada Reference Manual, Section A.14.
22731 @end itemize
22733 When a program that opens multiple files with the same name is ported
22734 from another Ada compiler to GNAT, the effect will be that
22735 @code{Use_Error} is raised.
22737 The documentation of the original compiler and the documentation of the
22738 program should then be examined to determine if file sharing was
22739 expected, and @code{shared=xxx} parameters added to @code{Open}
22740 and @code{Create} calls as required.
22742 When a program is ported from GNAT to some other Ada compiler, no
22743 special attention is required unless the @code{shared=xxx} form
22744 parameter is used in the program.  In this case, you must examine the
22745 documentation of the new compiler to see if it supports the required
22746 file sharing semantics, and form strings modified appropriately.  Of
22747 course it may be the case that the program cannot be ported if the
22748 target compiler does not support the required functionality.  The best
22749 approach in writing portable code is to avoid file sharing (and hence
22750 the use of the @code{shared=xxx} parameter in the form string)
22751 completely.
22753 One common use of file sharing in Ada 83 is the use of instantiations of
22754 Sequential_IO on the same file with different types, to achieve
22755 heterogeneous input-output.  Although this approach will work in GNAT if
22756 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
22757 for this purpose (using the stream attributes)
22759 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
22760 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2df}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2e0}
22761 @section Filenames encoding
22764 An encoding form parameter can be used to specify the filename
22765 encoding @code{encoding=xxx}.
22768 @itemize *
22770 @item 
22771 If the form parameter @code{encoding=utf8} appears in the form string, the
22772 filename must be encoded in UTF-8.
22774 @item 
22775 If the form parameter @code{encoding=8bits} appears in the form
22776 string, the filename must be a standard 8bits string.
22777 @end itemize
22779 In the absence of a @code{encoding=xxx} form parameter, the
22780 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
22781 variable. And if not set @code{utf8} is assumed.
22784 @table @asis
22786 @item `CP_ACP'
22788 The current system Windows ANSI code page.
22790 @item `CP_UTF8'
22792 UTF-8 encoding
22793 @end table
22795 This encoding form parameter is only supported on the Windows
22796 platform. On the other Operating Systems the run-time is supporting
22797 UTF-8 natively.
22799 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
22800 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2e1}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2e2}
22801 @section File content encoding
22804 For text files it is possible to specify the encoding to use. This is
22805 controlled by the by the @code{GNAT_CCS_ENCODING} environment
22806 variable. And if not set @code{TEXT} is assumed.
22808 The possible values are those supported on Windows:
22811 @table @asis
22813 @item `TEXT'
22815 Translated text mode
22817 @item `WTEXT'
22819 Translated unicode encoding
22821 @item `U16TEXT'
22823 Unicode 16-bit encoding
22825 @item `U8TEXT'
22827 Unicode 8-bit encoding
22828 @end table
22830 This encoding is only supported on the Windows platform.
22832 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
22833 @anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2e3}@anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2e4}
22834 @section Open Modes
22837 @code{Open} and @code{Create} calls result in a call to @code{fopen}
22838 using the mode shown in the following table:
22841 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx} 
22842 @headitem
22844 @code{Open} and @code{Create} Call Modes
22846 @tab
22848 @tab
22850 @item
22852 @tab
22854 `OPEN'
22856 @tab
22858 `CREATE'
22860 @item
22862 Append_File
22864 @tab
22866 “r+”
22868 @tab
22870 “w+”
22872 @item
22874 In_File
22876 @tab
22878 “r”
22880 @tab
22882 “w+”
22884 @item
22886 Out_File (Direct_IO)
22888 @tab
22890 “r+”
22892 @tab
22894 “w”
22896 @item
22898 Out_File (all other cases)
22900 @tab
22902 “w”
22904 @tab
22906 “w”
22908 @item
22910 Inout_File
22912 @tab
22914 “r+”
22916 @tab
22918 “w+”
22920 @end multitable
22923 If text file translation is required, then either @code{b} or @code{t}
22924 is added to the mode, depending on the setting of Text.  Text file
22925 translation refers to the mapping of CR/LF sequences in an external file
22926 to LF characters internally.  This mapping only occurs in DOS and
22927 DOS-like systems, and is not relevant to other systems.
22929 A special case occurs with Stream_IO.  As shown in the above table, the
22930 file is initially opened in @code{r} or @code{w} mode for the
22931 @code{In_File} and @code{Out_File} cases.  If a @code{Set_Mode} operation
22932 subsequently requires switching from reading to writing or vice-versa,
22933 then the file is reopened in @code{r+} mode to permit the required operation.
22935 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22936 @anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2e5}@anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2e6}
22937 @section Operations on C Streams
22940 The package @code{Interfaces.C_Streams} provides an Ada program with direct
22941 access to the C library functions for operations on C streams:
22943 @example
22944 package Interfaces.C_Streams is
22945   -- Note: the reason we do not use the types that are in
22946   -- Interfaces.C is that we want to avoid dragging in the
22947   -- code in this unit if possible.
22948   subtype chars is System.Address;
22949   -- Pointer to null-terminated array of characters
22950   subtype FILEs is System.Address;
22951   -- Corresponds to the C type FILE*
22952   subtype voids is System.Address;
22953   -- Corresponds to the C type void*
22954   subtype int is Integer;
22955   subtype long is Long_Integer;
22956   -- Note: the above types are subtypes deliberately, and it
22957   -- is part of this spec that the above correspondences are
22958   -- guaranteed.  This means that it is legitimate to, for
22959   -- example, use Integer instead of int.  We provide these
22960   -- synonyms for clarity, but in some cases it may be
22961   -- convenient to use the underlying types (for example to
22962   -- avoid an unnecessary dependency of a spec on the spec
22963   -- of this unit).
22964   type size_t is mod 2 ** Standard'Address_Size;
22965   NULL_Stream : constant FILEs;
22966   -- Value returned (NULL in C) to indicate an
22967   -- fdopen/fopen/tmpfile error
22968   ----------------------------------
22969   -- Constants Defined in stdio.h --
22970   ----------------------------------
22971   EOF : constant int;
22972   -- Used by a number of routines to indicate error or
22973   -- end of file
22974   IOFBF : constant int;
22975   IOLBF : constant int;
22976   IONBF : constant int;
22977   -- Used to indicate buffering mode for setvbuf call
22978   SEEK_CUR : constant int;
22979   SEEK_END : constant int;
22980   SEEK_SET : constant int;
22981   -- Used to indicate origin for fseek call
22982   function stdin return FILEs;
22983   function stdout return FILEs;
22984   function stderr return FILEs;
22985   -- Streams associated with standard files
22986   --------------------------
22987   -- Standard C functions --
22988   --------------------------
22989   -- The functions selected below are ones that are
22990   -- available in UNIX (but not necessarily in ANSI C).
22991   -- These are very thin interfaces
22992   -- which copy exactly the C headers.  For more
22993   -- documentation on these functions, see the Microsoft C
22994   -- "Run-Time Library Reference" (Microsoft Press, 1990,
22995   -- ISBN 1-55615-225-6), which includes useful information
22996   -- on system compatibility.
22997   procedure clearerr (stream : FILEs);
22998   function fclose (stream : FILEs) return int;
22999   function fdopen (handle : int; mode : chars) return FILEs;
23000   function feof (stream : FILEs) return int;
23001   function ferror (stream : FILEs) return int;
23002   function fflush (stream : FILEs) return int;
23003   function fgetc (stream : FILEs) return int;
23004   function fgets (strng : chars; n : int; stream : FILEs)
23005       return chars;
23006   function fileno (stream : FILEs) return int;
23007   function fopen (filename : chars; Mode : chars)
23008       return FILEs;
23009   -- Note: to maintain target independence, use
23010   -- text_translation_required, a boolean variable defined in
23011   -- a-sysdep.c to deal with the target dependent text
23012   -- translation requirement.  If this variable is set,
23013   -- then  b/t should be appended to the standard mode
23014   -- argument to set the text translation mode off or on
23015   -- as required.
23016   function fputc (C : int; stream : FILEs) return int;
23017   function fputs (Strng : chars; Stream : FILEs) return int;
23018   function fread
23019      (buffer : voids;
23020       size : size_t;
23021       count : size_t;
23022       stream : FILEs)
23023       return size_t;
23024   function freopen
23025      (filename : chars;
23026       mode : chars;
23027       stream : FILEs)
23028       return FILEs;
23029   function fseek
23030      (stream : FILEs;
23031       offset : long;
23032       origin : int)
23033       return int;
23034   function ftell (stream : FILEs) return long;
23035   function fwrite
23036      (buffer : voids;
23037       size : size_t;
23038       count : size_t;
23039       stream : FILEs)
23040       return size_t;
23041   function isatty (handle : int) return int;
23042   procedure mktemp (template : chars);
23043   -- The return value (which is just a pointer to template)
23044   -- is discarded
23045   procedure rewind (stream : FILEs);
23046   function rmtmp return int;
23047   function setvbuf
23048      (stream : FILEs;
23049       buffer : chars;
23050       mode : int;
23051       size : size_t)
23052       return int;
23054   function tmpfile return FILEs;
23055   function ungetc (c : int; stream : FILEs) return int;
23056   function unlink (filename : chars) return int;
23057   ---------------------
23058   -- Extra functions --
23059   ---------------------
23060   -- These functions supply slightly thicker bindings than
23061   -- those above.  They are derived from functions in the
23062   -- C Run-Time Library, but may do a bit more work than
23063   -- just directly calling one of the Library functions.
23064   function is_regular_file (handle : int) return int;
23065   -- Tests if given handle is for a regular file (result 1)
23066   -- or for a non-regular file (pipe or device, result 0).
23067   ---------------------------------
23068   -- Control of Text/Binary Mode --
23069   ---------------------------------
23070   -- If text_translation_required is true, then the following
23071   -- functions may be used to dynamically switch a file from
23072   -- binary to text mode or vice versa.  These functions have
23073   -- no effect if text_translation_required is false (i.e., in
23074   -- normal UNIX mode).  Use fileno to get a stream handle.
23075   procedure set_binary_mode (handle : int);
23076   procedure set_text_mode (handle : int);
23077   ----------------------------
23078   -- Full Path Name support --
23079   ----------------------------
23080   procedure full_name (nam : chars; buffer : chars);
23081   -- Given a NUL terminated string representing a file
23082   -- name, returns in buffer a NUL terminated string
23083   -- representing the full path name for the file name.
23084   -- On systems where it is relevant the   drive is also
23085   -- part of the full path name.  It is the responsibility
23086   -- of the caller to pass an actual parameter for buffer
23087   -- that is big enough for any full path name.  Use
23088   -- max_path_len given below as the size of buffer.
23089   max_path_len : integer;
23090   -- Maximum length of an allowable full path name on the
23091   -- system, including a terminating NUL character.
23092 end Interfaces.C_Streams;
23093 @end example
23095 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
23096 @anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2e7}@anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2e8}
23097 @section Interfacing to C Streams
23100 The packages in this section permit interfacing Ada files to C Stream
23101 operations.
23103 @example
23104 with Interfaces.C_Streams;
23105 package Ada.Sequential_IO.C_Streams is
23106    function C_Stream (F : File_Type)
23107       return Interfaces.C_Streams.FILEs;
23108    procedure Open
23109      (File : in out File_Type;
23110       Mode : in File_Mode;
23111       C_Stream : in Interfaces.C_Streams.FILEs;
23112       Form : in String := "");
23113 end Ada.Sequential_IO.C_Streams;
23115  with Interfaces.C_Streams;
23116  package Ada.Direct_IO.C_Streams is
23117     function C_Stream (F : File_Type)
23118        return Interfaces.C_Streams.FILEs;
23119     procedure Open
23120       (File : in out File_Type;
23121        Mode : in File_Mode;
23122        C_Stream : in Interfaces.C_Streams.FILEs;
23123        Form : in String := "");
23124  end Ada.Direct_IO.C_Streams;
23126  with Interfaces.C_Streams;
23127  package Ada.Text_IO.C_Streams is
23128     function C_Stream (F : File_Type)
23129        return Interfaces.C_Streams.FILEs;
23130     procedure Open
23131       (File : in out File_Type;
23132        Mode : in File_Mode;
23133        C_Stream : in Interfaces.C_Streams.FILEs;
23134        Form : in String := "");
23135  end Ada.Text_IO.C_Streams;
23137  with Interfaces.C_Streams;
23138  package Ada.Wide_Text_IO.C_Streams is
23139     function C_Stream (F : File_Type)
23140        return Interfaces.C_Streams.FILEs;
23141     procedure Open
23142       (File : in out File_Type;
23143        Mode : in File_Mode;
23144        C_Stream : in Interfaces.C_Streams.FILEs;
23145        Form : in String := "");
23146 end Ada.Wide_Text_IO.C_Streams;
23148  with Interfaces.C_Streams;
23149  package Ada.Wide_Wide_Text_IO.C_Streams is
23150     function C_Stream (F : File_Type)
23151        return Interfaces.C_Streams.FILEs;
23152     procedure Open
23153       (File : in out File_Type;
23154        Mode : in File_Mode;
23155        C_Stream : in Interfaces.C_Streams.FILEs;
23156        Form : in String := "");
23157 end Ada.Wide_Wide_Text_IO.C_Streams;
23159 with Interfaces.C_Streams;
23160 package Ada.Stream_IO.C_Streams is
23161    function C_Stream (F : File_Type)
23162       return Interfaces.C_Streams.FILEs;
23163    procedure Open
23164      (File : in out File_Type;
23165       Mode : in File_Mode;
23166       C_Stream : in Interfaces.C_Streams.FILEs;
23167       Form : in String := "");
23168 end Ada.Stream_IO.C_Streams;
23169 @end example
23171 In each of these six packages, the @code{C_Stream} function obtains the
23172 @code{FILE} pointer from a currently opened Ada file.  It is then
23173 possible to use the @code{Interfaces.C_Streams} package to operate on
23174 this stream, or the stream can be passed to a C program which can
23175 operate on it directly.  Of course the program is responsible for
23176 ensuring that only appropriate sequences of operations are executed.
23178 One particular use of relevance to an Ada program is that the
23179 @code{setvbuf} function can be used to control the buffering of the
23180 stream used by an Ada file.  In the absence of such a call the standard
23181 default buffering is used.
23183 The @code{Open} procedures in these packages open a file giving an
23184 existing C Stream instead of a file name.  Typically this stream is
23185 imported from a C program, allowing an Ada file to operate on an
23186 existing C file.
23188 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
23189 @anchor{gnat_rm/the_gnat_library doc}@anchor{2e9}@anchor{gnat_rm/the_gnat_library id1}@anchor{2ea}@anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}
23190 @chapter The GNAT Library
23193 The GNAT library contains a number of general and special purpose packages.
23194 It represents functionality that the GNAT developers have found useful, and
23195 which is made available to GNAT users.  The packages described here are fully
23196 supported, and upwards compatibility will be maintained in future releases,
23197 so you can use these facilities with the confidence that the same functionality
23198 will be available in future releases.
23200 The chapter here simply gives a brief summary of the facilities available.
23201 The full documentation is found in the spec file for the package.  The full
23202 sources of these library packages, including both spec and body, are provided
23203 with all GNAT releases.  For example, to find out the full specifications of
23204 the SPITBOL pattern matching capability, including a full tutorial and
23205 extensive examples, look in the @code{g-spipat.ads} file in the library.
23207 For each entry here, the package name (as it would appear in a @code{with}
23208 clause) is given, followed by the name of the corresponding spec file in
23209 parentheses.  The packages are children in four hierarchies, @code{Ada},
23210 @code{Interfaces}, @code{System}, and @code{GNAT}, the latter being a
23211 GNAT-specific hierarchy.
23213 Note that an application program should only use packages in one of these
23214 four hierarchies if the package is defined in the Ada Reference Manual,
23215 or is listed in this section of the GNAT Programmers Reference Manual.
23216 All other units should be considered internal implementation units and
23217 should not be directly @code{with}ed by application code.  The use of
23218 a @code{with} clause that references one of these internal implementation
23219 units makes an application potentially dependent on changes in versions
23220 of GNAT, and will generate a warning message.
23222 @menu
23223 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
23224 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
23225 * Ada.Characters.Wide_Latin_9 (a-cwila9.ads): Ada Characters Wide_Latin_9 a-cwila9 ads. 
23226 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
23227 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
23228 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
23229 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
23230 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
23231 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
23232 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
23233 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
23234 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
23235 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
23236 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
23237 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
23238 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
23239 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
23240 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
23241 * Ada.Task_Initialization (a-tasini.ads): Ada Task_Initialization a-tasini ads. 
23242 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
23243 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
23244 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
23245 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
23246 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
23247 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
23248 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
23249 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
23250 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
23251 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
23252 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
23253 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
23254 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
23255 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
23256 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
23257 * GNAT.Binary_Search (g-binsea.ads): GNAT Binary_Search g-binsea ads. 
23258 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
23259 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads. 
23260 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
23261 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
23262 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
23263 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
23264 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
23265 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
23266 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
23267 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
23268 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
23269 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
23270 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
23271 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
23272 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
23273 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
23274 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
23275 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
23276 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
23277 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
23278 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
23279 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
23280 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
23281 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
23282 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
23283 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
23284 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
23285 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
23286 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
23287 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
23288 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
23289 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
23290 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads. 
23291 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
23292 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
23293 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
23294 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
23295 * GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads): GNAT Generic_Fast_Math_Functions g-gfmafu ads. 
23296 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
23297 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
23298 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
23299 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
23300 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
23301 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
23302 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
23303 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
23304 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
23305 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
23306 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
23307 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
23308 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
23309 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
23310 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
23311 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
23312 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
23313 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
23314 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
23315 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
23316 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
23317 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
23318 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
23319 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
23320 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
23321 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
23322 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
23323 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
23324 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
23325 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
23326 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
23327 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
23328 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
23329 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
23330 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
23331 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
23332 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
23333 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
23334 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
23335 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
23336 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
23337 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
23338 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
23339 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
23340 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
23341 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
23342 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
23343 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
23344 * GNAT.UTF_32 (g-utf_32.ads): GNAT UTF_32 g-utf_32 ads. 
23345 * GNAT.UTF_32_Spelling_Checker (g-u3spch.ads): GNAT UTF_32_Spelling_Checker g-u3spch ads. 
23346 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
23347 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
23348 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
23349 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
23350 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
23351 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
23352 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
23353 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
23354 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
23355 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
23356 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
23357 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
23358 * System.Memory (s-memory.ads): System Memory s-memory ads. 
23359 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
23360 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
23361 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
23362 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
23363 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
23364 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
23365 * System.Rident (s-rident.ads): System Rident s-rident ads. 
23366 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
23367 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
23368 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
23369 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
23371 @end menu
23373 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
23374 @anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2eb}@anchor{gnat_rm/the_gnat_library id2}@anchor{2ec}
23375 @section @code{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
23378 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
23380 @geindex Latin_9 constants for Character
23382 This child of @code{Ada.Characters}
23383 provides a set of definitions corresponding to those in the
23384 RM-defined package @code{Ada.Characters.Latin_1} but with the
23385 few modifications required for @code{Latin-9}.
23386 The provision of such a package
23387 is specifically authorized by the Ada Reference Manual
23388 (RM A.3.3(27)).
23390 @node Ada Characters Wide_Latin_1 a-cwila1 ads,Ada Characters Wide_Latin_9 a-cwila9 ads,Ada Characters Latin_9 a-chlat9 ads,The GNAT Library
23391 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2ed}@anchor{gnat_rm/the_gnat_library id3}@anchor{2ee}
23392 @section @code{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
23395 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
23397 @geindex Latin_1 constants for Wide_Character
23399 This child of @code{Ada.Characters}
23400 provides a set of definitions corresponding to those in the
23401 RM-defined package @code{Ada.Characters.Latin_1} but with the
23402 types of the constants being @code{Wide_Character}
23403 instead of @code{Character}.  The provision of such a package
23404 is specifically authorized by the Ada Reference Manual
23405 (RM A.3.3(27)).
23407 @node Ada Characters Wide_Latin_9 a-cwila9 ads,Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,The GNAT Library
23408 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila9-ads}@anchor{2ef}@anchor{gnat_rm/the_gnat_library id4}@anchor{2f0}
23409 @section @code{Ada.Characters.Wide_Latin_9} (@code{a-cwila9.ads})
23412 @geindex Ada.Characters.Wide_Latin_9 (a-cwila9.ads)
23414 @geindex Latin_9 constants for Wide_Character
23416 This child of @code{Ada.Characters}
23417 provides a set of definitions corresponding to those in the
23418 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23419 types of the constants being @code{Wide_Character}
23420 instead of @code{Character}.  The provision of such a package
23421 is specifically authorized by the Ada Reference Manual
23422 (RM A.3.3(27)).
23424 @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-cwila9 ads,The GNAT Library
23425 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2f1}@anchor{gnat_rm/the_gnat_library id5}@anchor{2f2}
23426 @section @code{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
23429 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
23431 @geindex Latin_1 constants for Wide_Wide_Character
23433 This child of @code{Ada.Characters}
23434 provides a set of definitions corresponding to those in the
23435 RM-defined package @code{Ada.Characters.Latin_1} but with the
23436 types of the constants being @code{Wide_Wide_Character}
23437 instead of @code{Character}.  The provision of such a package
23438 is specifically authorized by the Ada Reference Manual
23439 (RM A.3.3(27)).
23441 @node Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,Ada Containers Bounded_Holders a-coboho ads,Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,The GNAT Library
23442 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2f3}@anchor{gnat_rm/the_gnat_library id6}@anchor{2f4}
23443 @section @code{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
23446 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
23448 @geindex Latin_9 constants for Wide_Wide_Character
23450 This child of @code{Ada.Characters}
23451 provides a set of definitions corresponding to those in the
23452 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23453 types of the constants being @code{Wide_Wide_Character}
23454 instead of @code{Character}.  The provision of such a package
23455 is specifically authorized by the Ada Reference Manual
23456 (RM A.3.3(27)).
23458 @node Ada Containers Bounded_Holders a-coboho ads,Ada Command_Line Environment a-colien ads,Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,The GNAT Library
23459 @anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2f5}@anchor{gnat_rm/the_gnat_library id7}@anchor{2f6}
23460 @section @code{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
23463 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
23465 @geindex Formal container for vectors
23467 This child of @code{Ada.Containers} defines a modified version of
23468 Indefinite_Holders that avoids heap allocation.
23470 @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
23471 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2f7}@anchor{gnat_rm/the_gnat_library id8}@anchor{2f8}
23472 @section @code{Ada.Command_Line.Environment} (@code{a-colien.ads})
23475 @geindex Ada.Command_Line.Environment (a-colien.ads)
23477 @geindex Environment entries
23479 This child of @code{Ada.Command_Line}
23480 provides a mechanism for obtaining environment values on systems
23481 where this concept makes sense.
23483 @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
23484 @anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2f9}@anchor{gnat_rm/the_gnat_library id9}@anchor{2fa}
23485 @section @code{Ada.Command_Line.Remove} (@code{a-colire.ads})
23488 @geindex Ada.Command_Line.Remove (a-colire.ads)
23490 @geindex Removing command line arguments
23492 @geindex Command line
23493 @geindex argument removal
23495 This child of @code{Ada.Command_Line}
23496 provides a mechanism for logically removing
23497 arguments from the argument list.  Once removed, an argument is not visible
23498 to further calls to the subprograms in @code{Ada.Command_Line}. These calls
23499 will not see the removed argument.
23501 @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
23502 @anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2fb}@anchor{gnat_rm/the_gnat_library id10}@anchor{2fc}
23503 @section @code{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
23506 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
23508 @geindex Response file for command line
23510 @geindex Command line
23511 @geindex response file
23513 @geindex Command line
23514 @geindex handling long command lines
23516 This child of @code{Ada.Command_Line} provides a mechanism facilities for
23517 getting command line arguments from a text file, called a “response file”.
23518 Using a response file allow passing a set of arguments to an executable longer
23519 than the maximum allowed by the system on the command line.
23521 @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
23522 @anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2fd}@anchor{gnat_rm/the_gnat_library id11}@anchor{2fe}
23523 @section @code{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
23526 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
23528 @geindex C Streams
23529 @geindex Interfacing with Direct_IO
23531 This package provides subprograms that allow interfacing between
23532 C streams and @code{Direct_IO}.  The stream identifier can be
23533 extracted from a file opened on the Ada side, and an Ada file
23534 can be constructed from a stream opened on the C side.
23536 @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
23537 @anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2ff}@anchor{gnat_rm/the_gnat_library id12}@anchor{300}
23538 @section @code{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
23541 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
23543 @geindex Null_Occurrence
23544 @geindex testing for
23546 This child subprogram provides a way of testing for the null
23547 exception occurrence (@code{Null_Occurrence}) without raising
23548 an exception.
23550 @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
23551 @anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{301}@anchor{gnat_rm/the_gnat_library id13}@anchor{302}
23552 @section @code{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
23555 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
23557 @geindex Null_Occurrence
23558 @geindex testing for
23560 This child subprogram is used for handling otherwise unhandled
23561 exceptions (hence the name last chance), and perform clean ups before
23562 terminating the program. Note that this subprogram never returns.
23564 @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
23565 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{303}@anchor{gnat_rm/the_gnat_library id14}@anchor{304}
23566 @section @code{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
23569 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
23571 @geindex Traceback for Exception Occurrence
23573 This child package provides the subprogram (@code{Tracebacks}) to
23574 give a traceback array of addresses based on an exception
23575 occurrence.
23577 @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
23578 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{305}@anchor{gnat_rm/the_gnat_library id15}@anchor{306}
23579 @section @code{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
23582 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
23584 @geindex C Streams
23585 @geindex Interfacing with Sequential_IO
23587 This package provides subprograms that allow interfacing between
23588 C streams and @code{Sequential_IO}.  The stream identifier can be
23589 extracted from a file opened on the Ada side, and an Ada file
23590 can be constructed from a stream opened on the C side.
23592 @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
23593 @anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{307}@anchor{gnat_rm/the_gnat_library id16}@anchor{308}
23594 @section @code{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
23597 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
23599 @geindex C Streams
23600 @geindex Interfacing with Stream_IO
23602 This package provides subprograms that allow interfacing between
23603 C streams and @code{Stream_IO}.  The stream identifier can be
23604 extracted from a file opened on the Ada side, and an Ada file
23605 can be constructed from a stream opened on the C side.
23607 @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
23608 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{309}@anchor{gnat_rm/the_gnat_library id17}@anchor{30a}
23609 @section @code{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
23612 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
23614 @geindex Unbounded_String
23615 @geindex IO support
23617 @geindex Text_IO
23618 @geindex extensions for unbounded strings
23620 This package provides subprograms for Text_IO for unbounded
23621 strings, avoiding the necessity for an intermediate operation
23622 with ordinary strings.
23624 @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
23625 @anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{30b}@anchor{gnat_rm/the_gnat_library id18}@anchor{30c}
23626 @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
23629 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
23631 @geindex Unbounded_Wide_String
23632 @geindex IO support
23634 @geindex Text_IO
23635 @geindex extensions for unbounded wide strings
23637 This package provides subprograms for Text_IO for unbounded
23638 wide strings, avoiding the necessity for an intermediate operation
23639 with ordinary wide strings.
23641 @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
23642 @anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{30d}@anchor{gnat_rm/the_gnat_library id19}@anchor{30e}
23643 @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
23646 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
23648 @geindex Unbounded_Wide_Wide_String
23649 @geindex IO support
23651 @geindex Text_IO
23652 @geindex extensions for unbounded wide wide strings
23654 This package provides subprograms for Text_IO for unbounded
23655 wide wide strings, avoiding the necessity for an intermediate operation
23656 with ordinary wide wide strings.
23658 @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
23659 @anchor{gnat_rm/the_gnat_library ada-task-initialization-a-tasini-ads}@anchor{30f}@anchor{gnat_rm/the_gnat_library id20}@anchor{310}
23660 @section @code{Ada.Task_Initialization} (@code{a-tasini.ads})
23663 @geindex Ada.Task_Initialization (a-tasini.ads)
23665 This package provides a way to set a global initialization handler that
23666 is automatically invoked whenever a task is activated. Handlers are
23667 parameterless procedures. Note that such a handler is only invoked for
23668 those tasks activated after the handler is set.
23670 @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
23671 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{311}@anchor{gnat_rm/the_gnat_library id21}@anchor{312}
23672 @section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
23675 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
23677 @geindex C Streams
23678 @geindex Interfacing with `@w{`}Text_IO`@w{`}
23680 This package provides subprograms that allow interfacing between
23681 C streams and @code{Text_IO}.  The stream identifier can be
23682 extracted from a file opened on the Ada side, and an Ada file
23683 can be constructed from a stream opened on the C side.
23685 @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
23686 @anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{313}@anchor{gnat_rm/the_gnat_library id22}@anchor{314}
23687 @section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
23690 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
23692 @geindex Text_IO resetting standard files
23694 This procedure is used to reset the status of the standard files used
23695 by Ada.Text_IO.  This is useful in a situation (such as a restart in an
23696 embedded application) where the status of the files may change during
23697 execution (for example a standard input file may be redefined to be
23698 interactive).
23700 @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
23701 @anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{315}@anchor{gnat_rm/the_gnat_library id23}@anchor{316}
23702 @section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
23705 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
23707 @geindex Unicode categorization
23708 @geindex Wide_Character
23710 This package provides subprograms that allow categorization of
23711 Wide_Character values according to Unicode categories.
23713 @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
23714 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{317}@anchor{gnat_rm/the_gnat_library id24}@anchor{318}
23715 @section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
23718 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
23720 @geindex C Streams
23721 @geindex Interfacing with `@w{`}Wide_Text_IO`@w{`}
23723 This package provides subprograms that allow interfacing between
23724 C streams and @code{Wide_Text_IO}.  The stream identifier can be
23725 extracted from a file opened on the Ada side, and an Ada file
23726 can be constructed from a stream opened on the C side.
23728 @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
23729 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{319}@anchor{gnat_rm/the_gnat_library id25}@anchor{31a}
23730 @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
23733 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
23735 @geindex Wide_Text_IO resetting standard files
23737 This procedure is used to reset the status of the standard files used
23738 by Ada.Wide_Text_IO.  This is useful in a situation (such as a restart in an
23739 embedded application) where the status of the files may change during
23740 execution (for example a standard input file may be redefined to be
23741 interactive).
23743 @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
23744 @anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{31b}@anchor{gnat_rm/the_gnat_library id26}@anchor{31c}
23745 @section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
23748 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
23750 @geindex Unicode categorization
23751 @geindex Wide_Wide_Character
23753 This package provides subprograms that allow categorization of
23754 Wide_Wide_Character values according to Unicode categories.
23756 @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
23757 @anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{31d}@anchor{gnat_rm/the_gnat_library id27}@anchor{31e}
23758 @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
23761 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
23763 @geindex C Streams
23764 @geindex Interfacing with `@w{`}Wide_Wide_Text_IO`@w{`}
23766 This package provides subprograms that allow interfacing between
23767 C streams and @code{Wide_Wide_Text_IO}.  The stream identifier can be
23768 extracted from a file opened on the Ada side, and an Ada file
23769 can be constructed from a stream opened on the C side.
23771 @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
23772 @anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{31f}@anchor{gnat_rm/the_gnat_library id28}@anchor{320}
23773 @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23776 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23778 @geindex Wide_Wide_Text_IO resetting standard files
23780 This procedure is used to reset the status of the standard files used
23781 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23782 restart in an embedded application) where the status of the files may
23783 change during execution (for example a standard input file may be
23784 redefined to be interactive).
23786 @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
23787 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{321}@anchor{gnat_rm/the_gnat_library id29}@anchor{322}
23788 @section @code{GNAT.Altivec} (@code{g-altive.ads})
23791 @geindex GNAT.Altivec (g-altive.ads)
23793 @geindex AltiVec
23795 This is the root package of the GNAT AltiVec binding. It provides
23796 definitions of constants and types common to all the versions of the
23797 binding.
23799 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23800 @anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{323}@anchor{gnat_rm/the_gnat_library id30}@anchor{324}
23801 @section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23804 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23806 @geindex AltiVec
23808 This package provides the Vector/View conversion routines.
23810 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23811 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{325}@anchor{gnat_rm/the_gnat_library id31}@anchor{326}
23812 @section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23815 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23817 @geindex AltiVec
23819 This package exposes the Ada interface to the AltiVec operations on
23820 vector objects. A soft emulation is included by default in the GNAT
23821 library. The hard binding is provided as a separate package. This unit
23822 is common to both bindings.
23824 @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
23825 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{327}@anchor{gnat_rm/the_gnat_library id32}@anchor{328}
23826 @section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23829 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23831 @geindex AltiVec
23833 This package exposes the various vector types part of the Ada binding
23834 to AltiVec facilities.
23836 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23837 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{329}@anchor{gnat_rm/the_gnat_library id33}@anchor{32a}
23838 @section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23841 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23843 @geindex AltiVec
23845 This package provides public ‘View’ data types from/to which private
23846 vector representations can be converted via
23847 GNAT.Altivec.Conversions. This allows convenient access to individual
23848 vector elements and provides a simple way to initialize vector
23849 objects.
23851 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23852 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{32b}@anchor{gnat_rm/the_gnat_library id34}@anchor{32c}
23853 @section @code{GNAT.Array_Split} (@code{g-arrspl.ads})
23856 @geindex GNAT.Array_Split (g-arrspl.ads)
23858 @geindex Array splitter
23860 Useful array-manipulation routines: given a set of separators, split
23861 an array wherever the separators appear, and provide direct access
23862 to the resulting slices.
23864 @node GNAT AWK g-awk ads,GNAT Binary_Search g-binsea ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23865 @anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{32d}@anchor{gnat_rm/the_gnat_library id35}@anchor{32e}
23866 @section @code{GNAT.AWK} (@code{g-awk.ads})
23869 @geindex GNAT.AWK (g-awk.ads)
23871 @geindex Parsing
23873 @geindex AWK
23875 Provides AWK-like parsing functions, with an easy interface for parsing one
23876 or more files containing formatted data.  The file is viewed as a database
23877 where each record is a line and a field is a data element in this line.
23879 @node GNAT Binary_Search g-binsea ads,GNAT Bind_Environment g-binenv ads,GNAT AWK g-awk ads,The GNAT Library
23880 @anchor{gnat_rm/the_gnat_library gnat-binary-search-g-binsea-ads}@anchor{32f}@anchor{gnat_rm/the_gnat_library id36}@anchor{330}
23881 @section @code{GNAT.Binary_Search} (@code{g-binsea.ads})
23884 @geindex GNAT.Binary_Search (g-binsea.ads)
23886 @geindex Binary search
23888 Allow binary search of a sorted array (or of an array-like container;
23889 the generic does not reference the array directly).
23891 @node GNAT Bind_Environment g-binenv ads,GNAT Branch_Prediction g-brapre ads,GNAT Binary_Search g-binsea ads,The GNAT Library
23892 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{331}@anchor{gnat_rm/the_gnat_library id37}@anchor{332}
23893 @section @code{GNAT.Bind_Environment} (@code{g-binenv.ads})
23896 @geindex GNAT.Bind_Environment (g-binenv.ads)
23898 @geindex Bind environment
23900 Provides access to key=value associations captured at bind time.
23901 These associations can be specified using the @code{-V} binder command
23902 line switch.
23904 @node GNAT Branch_Prediction g-brapre ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
23905 @anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{333}@anchor{gnat_rm/the_gnat_library id38}@anchor{334}
23906 @section @code{GNAT.Branch_Prediction} (@code{g-brapre.ads})
23909 @geindex GNAT.Branch_Prediction (g-brapre.ads)
23911 @geindex Branch Prediction
23913 Provides routines giving hints to the branch predictor of the code generator.
23915 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Branch_Prediction g-brapre ads,The GNAT Library
23916 @anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{335}@anchor{gnat_rm/the_gnat_library id39}@anchor{336}
23917 @section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
23920 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
23922 @geindex Parsing
23924 @geindex Bounded Buffers
23926 Provides a concurrent generic bounded buffer abstraction.  Instances are
23927 useful directly or as parts of the implementations of other abstractions,
23928 such as mailboxes.
23930 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
23931 @anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{337}@anchor{gnat_rm/the_gnat_library id40}@anchor{338}
23932 @section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
23935 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
23937 @geindex Parsing
23939 @geindex Mailboxes
23941 Provides a thread-safe asynchronous intertask mailbox communication facility.
23943 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
23944 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{339}@anchor{gnat_rm/the_gnat_library id41}@anchor{33a}
23945 @section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
23948 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
23950 @geindex Sorting
23952 @geindex Bubble sort
23954 Provides a general implementation of bubble sort usable for sorting arbitrary
23955 data items.  Exchange and comparison procedures are provided by passing
23956 access-to-procedure values.
23958 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
23959 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{33b}@anchor{gnat_rm/the_gnat_library id42}@anchor{33c}
23960 @section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
23963 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
23965 @geindex Sorting
23967 @geindex Bubble sort
23969 Provides a general implementation of bubble sort usable for sorting arbitrary
23970 data items.  Move and comparison procedures are provided by passing
23971 access-to-procedure values. This is an older version, retained for
23972 compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
23974 @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
23975 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{33d}@anchor{gnat_rm/the_gnat_library id43}@anchor{33e}
23976 @section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
23979 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
23981 @geindex Sorting
23983 @geindex Bubble sort
23985 Similar to @code{Bubble_Sort_A} except that the move and sorting procedures
23986 are provided as generic parameters, this improves efficiency, especially
23987 if the procedures can be inlined, at the expense of duplicating code for
23988 multiple instantiations.
23990 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
23991 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{33f}@anchor{gnat_rm/the_gnat_library id44}@anchor{340}
23992 @section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
23995 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
23997 @geindex UTF-8 representation
23999 @geindex Wide characte representations
24001 Provides a routine which given a string, reads the start of the string to
24002 see whether it is one of the standard byte order marks (BOM’s) which signal
24003 the encoding of the string. The routine includes detection of special XML
24004 sequences for various UCS input formats.
24006 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
24007 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{341}@anchor{gnat_rm/the_gnat_library id45}@anchor{342}
24008 @section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
24011 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
24013 @geindex Byte swapping
24015 @geindex Endianness
24017 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
24018 Machine-specific implementations are available in some cases.
24020 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
24021 @anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{343}@anchor{gnat_rm/the_gnat_library id46}@anchor{344}
24022 @section @code{GNAT.Calendar} (@code{g-calend.ads})
24025 @geindex GNAT.Calendar (g-calend.ads)
24027 @geindex Calendar
24029 Extends the facilities provided by @code{Ada.Calendar} to include handling
24030 of days of the week, an extended @code{Split} and @code{Time_Of} capability.
24031 Also provides conversion of @code{Ada.Calendar.Time} values to and from the
24032 C @code{timeval} format.
24034 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
24035 @anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{345}@anchor{gnat_rm/the_gnat_library id47}@anchor{346}
24036 @section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
24039 @geindex Calendar
24041 @geindex Time
24043 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
24045 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
24046 @anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{347}@anchor{gnat_rm/the_gnat_library id48}@anchor{348}
24047 @section @code{GNAT.CRC32} (@code{g-crc32.ads})
24050 @geindex GNAT.CRC32 (g-crc32.ads)
24052 @geindex CRC32
24054 @geindex Cyclic Redundancy Check
24056 This package implements the CRC-32 algorithm.  For a full description
24057 of this algorithm see
24058 `Computation of Cyclic Redundancy Checks via Table Look-Up',
24059 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
24060 Aug. 1988.  Sarwate, D.V.
24062 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
24063 @anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{349}@anchor{gnat_rm/the_gnat_library id49}@anchor{34a}
24064 @section @code{GNAT.Case_Util} (@code{g-casuti.ads})
24067 @geindex GNAT.Case_Util (g-casuti.ads)
24069 @geindex Casing utilities
24071 @geindex Character handling (`@w{`}GNAT.Case_Util`@w{`})
24073 A set of simple routines for handling upper and lower casing of strings
24074 without the overhead of the full casing tables
24075 in @code{Ada.Characters.Handling}.
24077 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
24078 @anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{34b}@anchor{gnat_rm/the_gnat_library id50}@anchor{34c}
24079 @section @code{GNAT.CGI} (@code{g-cgi.ads})
24082 @geindex GNAT.CGI (g-cgi.ads)
24084 @geindex CGI (Common Gateway Interface)
24086 This is a package for interfacing a GNAT program with a Web server via the
24087 Common Gateway Interface (CGI).  Basically this package parses the CGI
24088 parameters, which are a set of key/value pairs sent by the Web server.  It
24089 builds a table whose index is the key and provides some services to deal
24090 with this table.
24092 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
24093 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{34d}@anchor{gnat_rm/the_gnat_library id51}@anchor{34e}
24094 @section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
24097 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
24099 @geindex CGI (Common Gateway Interface) cookie support
24101 @geindex Cookie support in CGI
24103 This is a package to interface a GNAT program with a Web server via the
24104 Common Gateway Interface (CGI).  It exports services to deal with Web
24105 cookies (piece of information kept in the Web client software).
24107 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
24108 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{34f}@anchor{gnat_rm/the_gnat_library id52}@anchor{350}
24109 @section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads})
24112 @geindex GNAT.CGI.Debug (g-cgideb.ads)
24114 @geindex CGI (Common Gateway Interface) debugging
24116 This is a package to help debugging CGI (Common Gateway Interface)
24117 programs written in Ada.
24119 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
24120 @anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{351}@anchor{gnat_rm/the_gnat_library id53}@anchor{352}
24121 @section @code{GNAT.Command_Line} (@code{g-comlin.ads})
24124 @geindex GNAT.Command_Line (g-comlin.ads)
24126 @geindex Command line
24128 Provides a high level interface to @code{Ada.Command_Line} facilities,
24129 including the ability to scan for named switches with optional parameters
24130 and expand file names using wildcard notations.
24132 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
24133 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{353}@anchor{gnat_rm/the_gnat_library id54}@anchor{354}
24134 @section @code{GNAT.Compiler_Version} (@code{g-comver.ads})
24137 @geindex GNAT.Compiler_Version (g-comver.ads)
24139 @geindex Compiler Version
24141 @geindex Version
24142 @geindex of compiler
24144 Provides a routine for obtaining the version of the compiler used to
24145 compile the program. More accurately this is the version of the binder
24146 used to bind the program (this will normally be the same as the version
24147 of the compiler if a consistent tool set is used to compile all units
24148 of a partition).
24150 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
24151 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{355}@anchor{gnat_rm/the_gnat_library id55}@anchor{356}
24152 @section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
24155 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
24157 @geindex Interrupt
24159 Provides a simple interface to handle Ctrl-C keyboard events.
24161 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
24162 @anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{357}@anchor{gnat_rm/the_gnat_library id56}@anchor{358}
24163 @section @code{GNAT.Current_Exception} (@code{g-curexc.ads})
24166 @geindex GNAT.Current_Exception (g-curexc.ads)
24168 @geindex Current exception
24170 @geindex Exception retrieval
24172 Provides access to information on the current exception that has been raised
24173 without the need for using the Ada 95 / Ada 2005 exception choice parameter
24174 specification syntax.
24175 This is particularly useful in simulating typical facilities for
24176 obtaining information about exceptions provided by Ada 83 compilers.
24178 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
24179 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{359}@anchor{gnat_rm/the_gnat_library id57}@anchor{35a}
24180 @section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads})
24183 @geindex GNAT.Debug_Pools (g-debpoo.ads)
24185 @geindex Debugging
24187 @geindex Debug pools
24189 @geindex Memory corruption debugging
24191 Provides a debugging storage pools that helps tracking memory corruption
24192 problems.
24193 See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User’s Guide}.
24195 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
24196 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{35b}@anchor{gnat_rm/the_gnat_library id58}@anchor{35c}
24197 @section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads})
24200 @geindex GNAT.Debug_Utilities (g-debuti.ads)
24202 @geindex Debugging
24204 Provides a few useful utilities for debugging purposes, including conversion
24205 to and from string images of address values. Supports both C and Ada formats
24206 for hexadecimal literals.
24208 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
24209 @anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{35d}@anchor{gnat_rm/the_gnat_library id59}@anchor{35e}
24210 @section @code{GNAT.Decode_String} (@code{g-decstr.ads})
24213 @geindex GNAT.Decode_String (g-decstr.ads)
24215 @geindex Decoding strings
24217 @geindex String decoding
24219 @geindex Wide character encoding
24221 @geindex UTF-8
24223 @geindex Unicode
24225 A generic package providing routines for decoding wide character and wide wide
24226 character strings encoded as sequences of 8-bit characters using a specified
24227 encoding method. Includes validation routines, and also routines for stepping
24228 to next or previous encoded character in an encoded string.
24229 Useful in conjunction with Unicode character coding. Note there is a
24230 preinstantiation for UTF-8. See next entry.
24232 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
24233 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{35f}@anchor{gnat_rm/the_gnat_library id60}@anchor{360}
24234 @section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
24237 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
24239 @geindex Decoding strings
24241 @geindex Decoding UTF-8 strings
24243 @geindex UTF-8 string decoding
24245 @geindex Wide character decoding
24247 @geindex UTF-8
24249 @geindex Unicode
24251 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
24253 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
24254 @anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{361}@anchor{gnat_rm/the_gnat_library id61}@anchor{362}
24255 @section @code{GNAT.Directory_Operations} (@code{g-dirope.ads})
24258 @geindex GNAT.Directory_Operations (g-dirope.ads)
24260 @geindex Directory operations
24262 Provides a set of routines for manipulating directories, including changing
24263 the current directory, making new directories, and scanning the files in a
24264 directory.
24266 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
24267 @anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{363}@anchor{gnat_rm/the_gnat_library id62}@anchor{364}
24268 @section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
24271 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
24273 @geindex Directory operations iteration
24275 A child unit of GNAT.Directory_Operations providing additional operations
24276 for iterating through directories.
24278 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
24279 @anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{365}@anchor{gnat_rm/the_gnat_library id63}@anchor{366}
24280 @section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
24283 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
24285 @geindex Hash tables
24287 A generic implementation of hash tables that can be used to hash arbitrary
24288 data.  Provided in two forms, a simple form with built in hash functions,
24289 and a more complex form in which the hash function is supplied.
24291 This package provides a facility similar to that of @code{GNAT.HTable},
24292 except that this package declares a type that can be used to define
24293 dynamic instances of the hash table, while an instantiation of
24294 @code{GNAT.HTable} creates a single instance of the hash table.
24296 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
24297 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{367}@anchor{gnat_rm/the_gnat_library id64}@anchor{368}
24298 @section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
24301 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
24303 @geindex Table implementation
24305 @geindex Arrays
24306 @geindex extendable
24308 A generic package providing a single dimension array abstraction where the
24309 length of the array can be dynamically modified.
24311 This package provides a facility similar to that of @code{GNAT.Table},
24312 except that this package declares a type that can be used to define
24313 dynamic instances of the table, while an instantiation of
24314 @code{GNAT.Table} creates a single instance of the table type.
24316 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
24317 @anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{369}@anchor{gnat_rm/the_gnat_library id65}@anchor{36a}
24318 @section @code{GNAT.Encode_String} (@code{g-encstr.ads})
24321 @geindex GNAT.Encode_String (g-encstr.ads)
24323 @geindex Encoding strings
24325 @geindex String encoding
24327 @geindex Wide character encoding
24329 @geindex UTF-8
24331 @geindex Unicode
24333 A generic package providing routines for encoding wide character and wide
24334 wide character strings as sequences of 8-bit characters using a specified
24335 encoding method. Useful in conjunction with Unicode character coding.
24336 Note there is a preinstantiation for UTF-8. See next entry.
24338 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
24339 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{36b}@anchor{gnat_rm/the_gnat_library id66}@anchor{36c}
24340 @section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
24343 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
24345 @geindex Encoding strings
24347 @geindex Encoding UTF-8 strings
24349 @geindex UTF-8 string encoding
24351 @geindex Wide character encoding
24353 @geindex UTF-8
24355 @geindex Unicode
24357 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
24359 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
24360 @anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{36d}@anchor{gnat_rm/the_gnat_library id67}@anchor{36e}
24361 @section @code{GNAT.Exception_Actions} (@code{g-excact.ads})
24364 @geindex GNAT.Exception_Actions (g-excact.ads)
24366 @geindex Exception actions
24368 Provides callbacks when an exception is raised. Callbacks can be registered
24369 for specific exceptions, or when any exception is raised. This
24370 can be used for instance to force a core dump to ease debugging.
24372 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library
24373 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{36f}@anchor{gnat_rm/the_gnat_library id68}@anchor{370}
24374 @section @code{GNAT.Exception_Traces} (@code{g-exctra.ads})
24377 @geindex GNAT.Exception_Traces (g-exctra.ads)
24379 @geindex Exception traces
24381 @geindex Debugging
24383 Provides an interface allowing to control automatic output upon exception
24384 occurrences.
24386 @node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
24387 @anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{371}@anchor{gnat_rm/the_gnat_library id69}@anchor{372}
24388 @section @code{GNAT.Exceptions} (@code{g-except.ads})
24391 @geindex GNAT.Exceptions (g-except.ads)
24393 @geindex Exceptions
24394 @geindex Pure
24396 @geindex Pure packages
24397 @geindex exceptions
24399 Normally it is not possible to raise an exception with
24400 a message from a subprogram in a pure package, since the
24401 necessary types and subprograms are in @code{Ada.Exceptions}
24402 which is not a pure unit. @code{GNAT.Exceptions} provides a
24403 facility for getting around this limitation for a few
24404 predefined exceptions, and for example allows raising
24405 @code{Constraint_Error} with a message from a pure subprogram.
24407 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library
24408 @anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{373}@anchor{gnat_rm/the_gnat_library id70}@anchor{374}
24409 @section @code{GNAT.Expect} (@code{g-expect.ads})
24412 @geindex GNAT.Expect (g-expect.ads)
24414 Provides a set of subprograms similar to what is available
24415 with the standard Tcl Expect tool.
24416 It allows you to easily spawn and communicate with an external process.
24417 You can send commands or inputs to the process, and compare the output
24418 with some expected regular expression. Currently @code{GNAT.Expect}
24419 is implemented on all native GNAT ports.
24420 It is not implemented for cross ports, and in particular is not
24421 implemented for VxWorks or LynxOS.
24423 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
24424 @anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{375}@anchor{gnat_rm/the_gnat_library id71}@anchor{376}
24425 @section @code{GNAT.Expect.TTY} (@code{g-exptty.ads})
24428 @geindex GNAT.Expect.TTY (g-exptty.ads)
24430 As GNAT.Expect but using pseudo-terminal.
24431 Currently @code{GNAT.Expect.TTY} is implemented on all native GNAT
24432 ports. It is not implemented for cross ports, and
24433 in particular is not implemented for VxWorks or LynxOS.
24435 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
24436 @anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{377}@anchor{gnat_rm/the_gnat_library id72}@anchor{378}
24437 @section @code{GNAT.Float_Control} (@code{g-flocon.ads})
24440 @geindex GNAT.Float_Control (g-flocon.ads)
24442 @geindex Floating-Point Processor
24444 Provides an interface for resetting the floating-point processor into the
24445 mode required for correct semantic operation in Ada.  Some third party
24446 library calls may cause this mode to be modified, and the Reset procedure
24447 in this package can be used to reestablish the required mode.
24449 @node GNAT Formatted_String g-forstr ads,GNAT Generic_Fast_Math_Functions g-gfmafu ads,GNAT Float_Control g-flocon ads,The GNAT Library
24450 @anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{379}@anchor{gnat_rm/the_gnat_library id73}@anchor{37a}
24451 @section @code{GNAT.Formatted_String} (@code{g-forstr.ads})
24454 @geindex GNAT.Formatted_String (g-forstr.ads)
24456 @geindex Formatted String
24458 Provides support for C/C++ printf() formatted strings. The format is
24459 copied from the printf() routine and should therefore give identical
24460 output. Some generic routines are provided to be able to use types
24461 derived from Integer, Float or enumerations as values for the
24462 formatted string.
24464 @node GNAT Generic_Fast_Math_Functions g-gfmafu ads,GNAT Heap_Sort g-heasor ads,GNAT Formatted_String g-forstr ads,The GNAT Library
24465 @anchor{gnat_rm/the_gnat_library gnat-generic-fast-math-functions-g-gfmafu-ads}@anchor{37b}@anchor{gnat_rm/the_gnat_library id74}@anchor{37c}
24466 @section @code{GNAT.Generic_Fast_Math_Functions} (@code{g-gfmafu.ads})
24469 @geindex GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads)
24471 @geindex Mathematical functions
24473 Provides direct access to the underlying implementation of the common
24474 mathematical functions, generally from the system mathematical library.
24475 This differs from @code{Ada.Numerics.Generic_Elementary_Functions} in that
24476 the implementation may deviate from the semantics specified for these
24477 functions in the Reference Manual, for example @code{Numerics.Argument_Error}
24478 is not raised. On selected platforms, some of these functions may also
24479 have a vector implementation that can be automatically used by the
24480 compiler when auto-vectorization is enabled.
24482 @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
24483 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{37d}@anchor{gnat_rm/the_gnat_library id75}@anchor{37e}
24484 @section @code{GNAT.Heap_Sort} (@code{g-heasor.ads})
24487 @geindex GNAT.Heap_Sort (g-heasor.ads)
24489 @geindex Sorting
24491 Provides a general implementation of heap sort usable for sorting arbitrary
24492 data items. Exchange and comparison procedures are provided by passing
24493 access-to-procedure values.  The algorithm used is a modified heap sort
24494 that performs approximately N*log(N) comparisons in the worst case.
24496 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
24497 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{37f}@anchor{gnat_rm/the_gnat_library id76}@anchor{380}
24498 @section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
24501 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
24503 @geindex Sorting
24505 Provides a general implementation of heap sort usable for sorting arbitrary
24506 data items. Move and comparison procedures are provided by passing
24507 access-to-procedure values.  The algorithm used is a modified heap sort
24508 that performs approximately N*log(N) comparisons in the worst case.
24509 This differs from @code{GNAT.Heap_Sort} in having a less convenient
24510 interface, but may be slightly more efficient.
24512 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
24513 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{381}@anchor{gnat_rm/the_gnat_library id77}@anchor{382}
24514 @section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
24517 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
24519 @geindex Sorting
24521 Similar to @code{Heap_Sort_A} except that the move and sorting procedures
24522 are provided as generic parameters, this improves efficiency, especially
24523 if the procedures can be inlined, at the expense of duplicating code for
24524 multiple instantiations.
24526 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
24527 @anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{383}@anchor{gnat_rm/the_gnat_library id78}@anchor{384}
24528 @section @code{GNAT.HTable} (@code{g-htable.ads})
24531 @geindex GNAT.HTable (g-htable.ads)
24533 @geindex Hash tables
24535 A generic implementation of hash tables that can be used to hash arbitrary
24536 data.  Provides two approaches, one a simple static approach, and the other
24537 allowing arbitrary dynamic hash tables.
24539 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
24540 @anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{385}@anchor{gnat_rm/the_gnat_library id79}@anchor{386}
24541 @section @code{GNAT.IO} (@code{g-io.ads})
24544 @geindex GNAT.IO (g-io.ads)
24546 @geindex Simple I/O
24548 @geindex Input/Output facilities
24550 A simple preelaborable input-output package that provides a subset of
24551 simple Text_IO functions for reading characters and strings from
24552 Standard_Input, and writing characters, strings and integers to either
24553 Standard_Output or Standard_Error.
24555 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
24556 @anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{387}@anchor{gnat_rm/the_gnat_library id80}@anchor{388}
24557 @section @code{GNAT.IO_Aux} (@code{g-io_aux.ads})
24560 @geindex GNAT.IO_Aux (g-io_aux.ads)
24562 @geindex Text_IO
24564 @geindex Input/Output facilities
24566 Provides some auxiliary functions for use with Text_IO, including a test
24567 for whether a file exists, and functions for reading a line of text.
24569 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
24570 @anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{389}@anchor{gnat_rm/the_gnat_library id81}@anchor{38a}
24571 @section @code{GNAT.Lock_Files} (@code{g-locfil.ads})
24574 @geindex GNAT.Lock_Files (g-locfil.ads)
24576 @geindex File locking
24578 @geindex Locking using files
24580 Provides a general interface for using files as locks.  Can be used for
24581 providing program level synchronization.
24583 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
24584 @anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{38b}@anchor{gnat_rm/the_gnat_library id82}@anchor{38c}
24585 @section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
24588 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
24590 @geindex Random number generation
24592 The original implementation of @code{Ada.Numerics.Discrete_Random}.  Uses
24593 a modified version of the Blum-Blum-Shub generator.
24595 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
24596 @anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{38d}@anchor{gnat_rm/the_gnat_library id83}@anchor{38e}
24597 @section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
24600 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
24602 @geindex Random number generation
24604 The original implementation of @code{Ada.Numerics.Float_Random}.  Uses
24605 a modified version of the Blum-Blum-Shub generator.
24607 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
24608 @anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{38f}@anchor{gnat_rm/the_gnat_library id84}@anchor{390}
24609 @section @code{GNAT.MD5} (@code{g-md5.ads})
24612 @geindex GNAT.MD5 (g-md5.ads)
24614 @geindex Message Digest MD5
24616 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
24617 the HMAC-MD5 message authentication function as described in RFC 2104 and
24618 FIPS PUB 198.
24620 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
24621 @anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{391}@anchor{gnat_rm/the_gnat_library id85}@anchor{392}
24622 @section @code{GNAT.Memory_Dump} (@code{g-memdum.ads})
24625 @geindex GNAT.Memory_Dump (g-memdum.ads)
24627 @geindex Dump Memory
24629 Provides a convenient routine for dumping raw memory to either the
24630 standard output or standard error files. Uses GNAT.IO for actual
24631 output.
24633 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
24634 @anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{393}@anchor{gnat_rm/the_gnat_library id86}@anchor{394}
24635 @section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
24638 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
24640 @geindex Exception
24641 @geindex obtaining most recent
24643 Provides access to the most recently raised exception.  Can be used for
24644 various logging purposes, including duplicating functionality of some
24645 Ada 83 implementation dependent extensions.
24647 @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
24648 @anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{395}@anchor{gnat_rm/the_gnat_library id87}@anchor{396}
24649 @section @code{GNAT.OS_Lib} (@code{g-os_lib.ads})
24652 @geindex GNAT.OS_Lib (g-os_lib.ads)
24654 @geindex Operating System interface
24656 @geindex Spawn capability
24658 Provides a range of target independent operating system interface functions,
24659 including time/date management, file operations, subprocess management,
24660 including a portable spawn procedure, and access to environment variables
24661 and error return codes.
24663 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
24664 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{397}@anchor{gnat_rm/the_gnat_library id88}@anchor{398}
24665 @section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
24668 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
24670 @geindex Hash functions
24672 Provides a generator of static minimal perfect hash functions. No
24673 collisions occur and each item can be retrieved from the table in one
24674 probe (perfect property). The hash table size corresponds to the exact
24675 size of the key set and no larger (minimal property). The key set has to
24676 be known in advance (static property). The hash functions are also order
24677 preserving. If w2 is inserted after w1 in the generator, their
24678 hashcode are in the same order. These hashing functions are very
24679 convenient for use with realtime applications.
24681 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
24682 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{399}@anchor{gnat_rm/the_gnat_library id89}@anchor{39a}
24683 @section @code{GNAT.Random_Numbers} (@code{g-rannum.ads})
24686 @geindex GNAT.Random_Numbers (g-rannum.ads)
24688 @geindex Random number generation
24690 Provides random number capabilities which extend those available in the
24691 standard Ada library and are more convenient to use.
24693 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
24694 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{270}@anchor{gnat_rm/the_gnat_library id90}@anchor{39b}
24695 @section @code{GNAT.Regexp} (@code{g-regexp.ads})
24698 @geindex GNAT.Regexp (g-regexp.ads)
24700 @geindex Regular expressions
24702 @geindex Pattern matching
24704 A simple implementation of regular expressions, using a subset of regular
24705 expression syntax copied from familiar Unix style utilities.  This is the
24706 simplest of the three pattern matching packages provided, and is particularly
24707 suitable for ‘file globbing’ applications.
24709 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
24710 @anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{39c}@anchor{gnat_rm/the_gnat_library id91}@anchor{39d}
24711 @section @code{GNAT.Registry} (@code{g-regist.ads})
24714 @geindex GNAT.Registry (g-regist.ads)
24716 @geindex Windows Registry
24718 This is a high level binding to the Windows registry.  It is possible to
24719 do simple things like reading a key value, creating a new key.  For full
24720 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
24721 package provided with the Win32Ada binding
24723 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
24724 @anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{39e}@anchor{gnat_rm/the_gnat_library id92}@anchor{39f}
24725 @section @code{GNAT.Regpat} (@code{g-regpat.ads})
24728 @geindex GNAT.Regpat (g-regpat.ads)
24730 @geindex Regular expressions
24732 @geindex Pattern matching
24734 A complete implementation of Unix-style regular expression matching, copied
24735 from the original V7 style regular expression library written in C by
24736 Henry Spencer (and binary compatible with this C library).
24738 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
24739 @anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{3a0}@anchor{gnat_rm/the_gnat_library id93}@anchor{3a1}
24740 @section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
24743 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
24745 @geindex Rewrite data
24747 A unit to rewrite on-the-fly string occurrences in a stream of
24748 data. The implementation has a very minimal memory footprint as the
24749 full content to be processed is not loaded into memory all at once. This makes
24750 this interface usable for large files or socket streams.
24752 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
24753 @anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{3a2}@anchor{gnat_rm/the_gnat_library id94}@anchor{3a3}
24754 @section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
24757 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
24759 @geindex Secondary Stack Info
24761 Provides the capability to query the high water mark of the current task’s
24762 secondary stack.
24764 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
24765 @anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{3a4}@anchor{gnat_rm/the_gnat_library id95}@anchor{3a5}
24766 @section @code{GNAT.Semaphores} (@code{g-semaph.ads})
24769 @geindex GNAT.Semaphores (g-semaph.ads)
24771 @geindex Semaphores
24773 Provides classic counting and binary semaphores using protected types.
24775 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
24776 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{3a6}@anchor{gnat_rm/the_gnat_library id96}@anchor{3a7}
24777 @section @code{GNAT.Serial_Communications} (@code{g-sercom.ads})
24780 @geindex GNAT.Serial_Communications (g-sercom.ads)
24782 @geindex Serial_Communications
24784 Provides a simple interface to send and receive data over a serial
24785 port. This is only supported on GNU/Linux and Windows.
24787 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
24788 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{3a8}@anchor{gnat_rm/the_gnat_library id97}@anchor{3a9}
24789 @section @code{GNAT.SHA1} (@code{g-sha1.ads})
24792 @geindex GNAT.SHA1 (g-sha1.ads)
24794 @geindex Secure Hash Algorithm SHA-1
24796 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
24797 and RFC 3174, and the HMAC-SHA1 message authentication function as described
24798 in RFC 2104 and FIPS PUB 198.
24800 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
24801 @anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{3aa}@anchor{gnat_rm/the_gnat_library id98}@anchor{3ab}
24802 @section @code{GNAT.SHA224} (@code{g-sha224.ads})
24805 @geindex GNAT.SHA224 (g-sha224.ads)
24807 @geindex Secure Hash Algorithm SHA-224
24809 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24810 and the HMAC-SHA224 message authentication function as described
24811 in RFC 2104 and FIPS PUB 198.
24813 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24814 @anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{3ac}@anchor{gnat_rm/the_gnat_library id99}@anchor{3ad}
24815 @section @code{GNAT.SHA256} (@code{g-sha256.ads})
24818 @geindex GNAT.SHA256 (g-sha256.ads)
24820 @geindex Secure Hash Algorithm SHA-256
24822 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24823 and the HMAC-SHA256 message authentication function as described
24824 in RFC 2104 and FIPS PUB 198.
24826 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24827 @anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{3ae}@anchor{gnat_rm/the_gnat_library id100}@anchor{3af}
24828 @section @code{GNAT.SHA384} (@code{g-sha384.ads})
24831 @geindex GNAT.SHA384 (g-sha384.ads)
24833 @geindex Secure Hash Algorithm SHA-384
24835 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24836 and the HMAC-SHA384 message authentication function as described
24837 in RFC 2104 and FIPS PUB 198.
24839 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24840 @anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3b0}@anchor{gnat_rm/the_gnat_library id101}@anchor{3b1}
24841 @section @code{GNAT.SHA512} (@code{g-sha512.ads})
24844 @geindex GNAT.SHA512 (g-sha512.ads)
24846 @geindex Secure Hash Algorithm SHA-512
24848 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24849 and the HMAC-SHA512 message authentication function as described
24850 in RFC 2104 and FIPS PUB 198.
24852 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24853 @anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3b2}@anchor{gnat_rm/the_gnat_library id102}@anchor{3b3}
24854 @section @code{GNAT.Signals} (@code{g-signal.ads})
24857 @geindex GNAT.Signals (g-signal.ads)
24859 @geindex Signals
24861 Provides the ability to manipulate the blocked status of signals on supported
24862 targets.
24864 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24865 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3b4}@anchor{gnat_rm/the_gnat_library id103}@anchor{3b5}
24866 @section @code{GNAT.Sockets} (@code{g-socket.ads})
24869 @geindex GNAT.Sockets (g-socket.ads)
24871 @geindex Sockets
24873 A high level and portable interface to develop sockets based applications.
24874 This package is based on the sockets thin binding found in
24875 @code{GNAT.Sockets.Thin}. Currently @code{GNAT.Sockets} is implemented
24876 on all native GNAT ports and on VxWorks cross ports.  It is not implemented for
24877 the LynxOS cross port.
24879 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
24880 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3b6}@anchor{gnat_rm/the_gnat_library id104}@anchor{3b7}
24881 @section @code{GNAT.Source_Info} (@code{g-souinf.ads})
24884 @geindex GNAT.Source_Info (g-souinf.ads)
24886 @geindex Source Information
24888 Provides subprograms that give access to source code information known at
24889 compile time, such as the current file name and line number. Also provides
24890 subprograms yielding the date and time of the current compilation (like the
24891 C macros @code{__DATE__} and @code{__TIME__})
24893 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
24894 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3b8}@anchor{gnat_rm/the_gnat_library id105}@anchor{3b9}
24895 @section @code{GNAT.Spelling_Checker} (@code{g-speche.ads})
24898 @geindex GNAT.Spelling_Checker (g-speche.ads)
24900 @geindex Spell checking
24902 Provides a function for determining whether one string is a plausible
24903 near misspelling of another string.
24905 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
24906 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3ba}@anchor{gnat_rm/the_gnat_library id106}@anchor{3bb}
24907 @section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
24910 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
24912 @geindex Spell checking
24914 Provides a generic function that can be instantiated with a string type for
24915 determining whether one string is a plausible near misspelling of another
24916 string.
24918 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
24919 @anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3bc}@anchor{gnat_rm/the_gnat_library id107}@anchor{3bd}
24920 @section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
24923 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
24925 @geindex SPITBOL pattern matching
24927 @geindex Pattern matching
24929 A complete implementation of SNOBOL4 style pattern matching.  This is the
24930 most elaborate of the pattern matching packages provided.  It fully duplicates
24931 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
24932 efficient algorithm developed by Robert Dewar for the SPITBOL system.
24934 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
24935 @anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3be}@anchor{gnat_rm/the_gnat_library id108}@anchor{3bf}
24936 @section @code{GNAT.Spitbol} (@code{g-spitbo.ads})
24939 @geindex GNAT.Spitbol (g-spitbo.ads)
24941 @geindex SPITBOL interface
24943 The top level package of the collection of SPITBOL-style functionality, this
24944 package provides basic SNOBOL4 string manipulation functions, such as
24945 Pad, Reverse, Trim, Substr capability, as well as a generic table function
24946 useful for constructing arbitrary mappings from strings in the style of
24947 the SNOBOL4 TABLE function.
24949 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
24950 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3c0}@anchor{gnat_rm/the_gnat_library id109}@anchor{3c1}
24951 @section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
24954 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
24956 @geindex Sets of strings
24958 @geindex SPITBOL Tables
24960 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24961 for type @code{Standard.Boolean}, giving an implementation of sets of
24962 string values.
24964 @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
24965 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3c2}@anchor{gnat_rm/the_gnat_library id110}@anchor{3c3}
24966 @section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
24969 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
24971 @geindex Integer maps
24973 @geindex Maps
24975 @geindex SPITBOL Tables
24977 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24978 for type @code{Standard.Integer}, giving an implementation of maps
24979 from string to integer values.
24981 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
24982 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3c4}@anchor{gnat_rm/the_gnat_library id111}@anchor{3c5}
24983 @section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
24986 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
24988 @geindex String maps
24990 @geindex Maps
24992 @geindex SPITBOL Tables
24994 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table} for
24995 a variable length string type, giving an implementation of general
24996 maps from strings to strings.
24998 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
24999 @anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3c6}@anchor{gnat_rm/the_gnat_library id112}@anchor{3c7}
25000 @section @code{GNAT.SSE} (@code{g-sse.ads})
25003 @geindex GNAT.SSE (g-sse.ads)
25005 Root of a set of units aimed at offering Ada bindings to a subset of
25006 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
25007 targets.  It exposes vector component types together with a general
25008 introduction to the binding contents and use.
25010 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
25011 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3c8}@anchor{gnat_rm/the_gnat_library id113}@anchor{3c9}
25012 @section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
25015 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
25017 SSE vector types for use with SSE related intrinsics.
25019 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
25020 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3ca}@anchor{gnat_rm/the_gnat_library id114}@anchor{3cb}
25021 @section @code{GNAT.String_Hash} (@code{g-strhas.ads})
25024 @geindex GNAT.String_Hash (g-strhas.ads)
25026 @geindex Hash functions
25028 Provides a generic hash function working on arrays of scalars. Both the scalar
25029 type and the hash result type are parameters.
25031 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
25032 @anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3cc}@anchor{gnat_rm/the_gnat_library id115}@anchor{3cd}
25033 @section @code{GNAT.Strings} (@code{g-string.ads})
25036 @geindex GNAT.Strings (g-string.ads)
25038 Common String access types and related subprograms. Basically it
25039 defines a string access and an array of string access types.
25041 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
25042 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3ce}@anchor{gnat_rm/the_gnat_library id116}@anchor{3cf}
25043 @section @code{GNAT.String_Split} (@code{g-strspl.ads})
25046 @geindex GNAT.String_Split (g-strspl.ads)
25048 @geindex String splitter
25050 Useful string manipulation routines: given a set of separators, split
25051 a string wherever the separators appear, and provide direct access
25052 to the resulting slices. This package is instantiated from
25053 @code{GNAT.Array_Split}.
25055 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
25056 @anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3d0}@anchor{gnat_rm/the_gnat_library id117}@anchor{3d1}
25057 @section @code{GNAT.Table} (@code{g-table.ads})
25060 @geindex GNAT.Table (g-table.ads)
25062 @geindex Table implementation
25064 @geindex Arrays
25065 @geindex extendable
25067 A generic package providing a single dimension array abstraction where the
25068 length of the array can be dynamically modified.
25070 This package provides a facility similar to that of @code{GNAT.Dynamic_Tables},
25071 except that this package declares a single instance of the table type,
25072 while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
25073 used to define dynamic instances of the table.
25075 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
25076 @anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3d2}@anchor{gnat_rm/the_gnat_library id118}@anchor{3d3}
25077 @section @code{GNAT.Task_Lock} (@code{g-tasloc.ads})
25080 @geindex GNAT.Task_Lock (g-tasloc.ads)
25082 @geindex Task synchronization
25084 @geindex Task locking
25086 @geindex Locking
25088 A very simple facility for locking and unlocking sections of code using a
25089 single global task lock.  Appropriate for use in situations where contention
25090 between tasks is very rarely expected.
25092 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
25093 @anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3d4}@anchor{gnat_rm/the_gnat_library id119}@anchor{3d5}
25094 @section @code{GNAT.Time_Stamp} (@code{g-timsta.ads})
25097 @geindex GNAT.Time_Stamp (g-timsta.ads)
25099 @geindex Time stamp
25101 @geindex Current time
25103 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
25104 represents the current date and time in ISO 8601 format. This is a very simple
25105 routine with minimal code and there are no dependencies on any other unit.
25107 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
25108 @anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3d6}@anchor{gnat_rm/the_gnat_library id120}@anchor{3d7}
25109 @section @code{GNAT.Threads} (@code{g-thread.ads})
25112 @geindex GNAT.Threads (g-thread.ads)
25114 @geindex Foreign threads
25116 @geindex Threads
25117 @geindex foreign
25119 Provides facilities for dealing with foreign threads which need to be known
25120 by the GNAT run-time system. Consult the documentation of this package for
25121 further details if your program has threads that are created by a non-Ada
25122 environment which then accesses Ada code.
25124 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
25125 @anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3d8}@anchor{gnat_rm/the_gnat_library id121}@anchor{3d9}
25126 @section @code{GNAT.Traceback} (@code{g-traceb.ads})
25129 @geindex GNAT.Traceback (g-traceb.ads)
25131 @geindex Trace back facilities
25133 Provides a facility for obtaining non-symbolic traceback information, useful
25134 in various debugging situations.
25136 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-utf_32 ads,GNAT Traceback g-traceb ads,The GNAT Library
25137 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3da}@anchor{gnat_rm/the_gnat_library id122}@anchor{3db}
25138 @section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
25141 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
25143 @geindex Trace back facilities
25145 @node GNAT UTF_32 g-utf_32 ads,GNAT UTF_32_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
25146 @anchor{gnat_rm/the_gnat_library gnat-utf-32-g-utf-32-ads}@anchor{3dc}@anchor{gnat_rm/the_gnat_library id123}@anchor{3dd}
25147 @section @code{GNAT.UTF_32} (@code{g-utf_32.ads})
25150 @geindex GNAT.UTF_32 (g-utf_32.ads)
25152 @geindex Wide character codes
25154 This is a package intended to be used in conjunction with the
25155 @code{Wide_Character} type in Ada 95 and the
25156 @code{Wide_Wide_Character} type in Ada 2005 (available
25157 in @code{GNAT} in Ada 2005 mode). This package contains
25158 Unicode categorization routines, as well as lexical
25159 categorization routines corresponding to the Ada 2005
25160 lexical rules for identifiers and strings, and also a
25161 lower case to upper case fold routine corresponding to
25162 the Ada 2005 rules for identifier equivalence.
25164 @node GNAT UTF_32_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-utf_32 ads,The GNAT Library
25165 @anchor{gnat_rm/the_gnat_library gnat-utf-32-spelling-checker-g-u3spch-ads}@anchor{3de}@anchor{gnat_rm/the_gnat_library id124}@anchor{3df}
25166 @section @code{GNAT.UTF_32_Spelling_Checker} (@code{g-u3spch.ads})
25169 @geindex GNAT.UTF_32_Spelling_Checker (g-u3spch.ads)
25171 @geindex Spell checking
25173 Provides a function for determining whether one wide wide string is a plausible
25174 near misspelling of another wide wide string, where the strings are represented
25175 using the UTF_32_String type defined in System.Wch_Cnv.
25177 @node GNAT Wide_Spelling_Checker g-wispch ads,GNAT Wide_String_Split g-wistsp ads,GNAT UTF_32_Spelling_Checker g-u3spch ads,The GNAT Library
25178 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3e0}@anchor{gnat_rm/the_gnat_library id125}@anchor{3e1}
25179 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
25182 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
25184 @geindex Spell checking
25186 Provides a function for determining whether one wide string is a plausible
25187 near misspelling of another wide string.
25189 @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
25190 @anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3e2}@anchor{gnat_rm/the_gnat_library id126}@anchor{3e3}
25191 @section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
25194 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
25196 @geindex Wide_String splitter
25198 Useful wide string manipulation routines: given a set of separators, split
25199 a wide string wherever the separators appear, and provide direct access
25200 to the resulting slices. This package is instantiated from
25201 @code{GNAT.Array_Split}.
25203 @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
25204 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3e4}@anchor{gnat_rm/the_gnat_library id127}@anchor{3e5}
25205 @section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
25208 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
25210 @geindex Spell checking
25212 Provides a function for determining whether one wide wide string is a plausible
25213 near misspelling of another wide wide string.
25215 @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
25216 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3e6}@anchor{gnat_rm/the_gnat_library id128}@anchor{3e7}
25217 @section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
25220 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
25222 @geindex Wide_Wide_String splitter
25224 Useful wide wide string manipulation routines: given a set of separators, split
25225 a wide wide string wherever the separators appear, and provide direct access
25226 to the resulting slices. This package is instantiated from
25227 @code{GNAT.Array_Split}.
25229 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
25230 @anchor{gnat_rm/the_gnat_library id129}@anchor{3e8}@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3e9}
25231 @section @code{Interfaces.C.Extensions} (@code{i-cexten.ads})
25234 @geindex Interfaces.C.Extensions (i-cexten.ads)
25236 This package contains additional C-related definitions, intended
25237 for use with either manually or automatically generated bindings
25238 to C libraries.
25240 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
25241 @anchor{gnat_rm/the_gnat_library id130}@anchor{3ea}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3eb}
25242 @section @code{Interfaces.C.Streams} (@code{i-cstrea.ads})
25245 @geindex Interfaces.C.Streams (i-cstrea.ads)
25247 @geindex C streams
25248 @geindex interfacing
25250 This package is a binding for the most commonly used operations
25251 on C streams.
25253 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
25254 @anchor{gnat_rm/the_gnat_library id131}@anchor{3ec}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3ed}
25255 @section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
25258 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
25260 @geindex IBM Packed Format
25262 @geindex Packed Decimal
25264 This package provides a set of routines for conversions to and
25265 from a packed decimal format compatible with that used on IBM
25266 mainframes.
25268 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
25269 @anchor{gnat_rm/the_gnat_library id132}@anchor{3ee}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3ef}
25270 @section @code{Interfaces.VxWorks} (@code{i-vxwork.ads})
25273 @geindex Interfaces.VxWorks (i-vxwork.ads)
25275 @geindex Interfacing to VxWorks
25277 @geindex VxWorks
25278 @geindex interfacing
25280 This package provides a limited binding to the VxWorks API.
25282 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
25283 @anchor{gnat_rm/the_gnat_library id133}@anchor{3f0}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3f1}
25284 @section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
25287 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
25289 @geindex Interfacing to VxWorks' I/O
25291 @geindex VxWorks
25292 @geindex I/O interfacing
25294 @geindex VxWorks
25295 @geindex Get_Immediate
25297 @geindex Get_Immediate
25298 @geindex VxWorks
25300 This package provides a binding to the ioctl (IO/Control)
25301 function of VxWorks, defining a set of option values and
25302 function codes. A particular use of this package is
25303 to enable the use of Get_Immediate under VxWorks.
25305 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
25306 @anchor{gnat_rm/the_gnat_library id134}@anchor{3f2}@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3f3}
25307 @section @code{System.Address_Image} (@code{s-addima.ads})
25310 @geindex System.Address_Image (s-addima.ads)
25312 @geindex Address image
25314 @geindex Image
25315 @geindex of an address
25317 This function provides a useful debugging
25318 function that gives an (implementation dependent)
25319 string which identifies an address.
25321 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
25322 @anchor{gnat_rm/the_gnat_library id135}@anchor{3f4}@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3f5}
25323 @section @code{System.Assertions} (@code{s-assert.ads})
25326 @geindex System.Assertions (s-assert.ads)
25328 @geindex Assertions
25330 @geindex Assert_Failure
25331 @geindex exception
25333 This package provides the declaration of the exception raised
25334 by an run-time assertion failure, as well as the routine that
25335 is used internally to raise this assertion.
25337 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
25338 @anchor{gnat_rm/the_gnat_library id136}@anchor{3f6}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3f7}
25339 @section @code{System.Atomic_Counters} (@code{s-atocou.ads})
25342 @geindex System.Atomic_Counters (s-atocou.ads)
25344 This package provides the declaration of an atomic counter type,
25345 together with efficient routines (using hardware
25346 synchronization primitives) for incrementing, decrementing,
25347 and testing of these counters. This package is implemented
25348 on most targets, including all Alpha, AARCH64, ARM, ia64, PowerPC, SPARC V9,
25349 x86, and x86_64 platforms.
25351 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
25352 @anchor{gnat_rm/the_gnat_library id137}@anchor{3f8}@anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3f9}
25353 @section @code{System.Memory} (@code{s-memory.ads})
25356 @geindex System.Memory (s-memory.ads)
25358 @geindex Memory allocation
25360 This package provides the interface to the low level routines used
25361 by the generated code for allocation and freeing storage for the
25362 default storage pool (analogous to the C routines malloc and free).
25363 It also provides a reallocation interface analogous to the C routine
25364 realloc. The body of this unit may be modified to provide alternative
25365 allocation mechanisms for the default pool, and in addition, direct
25366 calls to this unit may be made for low level allocation uses (for
25367 example see the body of @code{GNAT.Tables}).
25369 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
25370 @anchor{gnat_rm/the_gnat_library id138}@anchor{3fa}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3fb}
25371 @section @code{System.Multiprocessors} (@code{s-multip.ads})
25374 @geindex System.Multiprocessors (s-multip.ads)
25376 @geindex Multiprocessor interface
25378 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25379 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25380 technically an implementation-defined addition).
25382 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
25383 @anchor{gnat_rm/the_gnat_library id139}@anchor{3fc}@anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3fd}
25384 @section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
25387 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
25389 @geindex Multiprocessor interface
25391 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25392 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25393 technically an implementation-defined addition).
25395 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
25396 @anchor{gnat_rm/the_gnat_library id140}@anchor{3fe}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3ff}
25397 @section @code{System.Partition_Interface} (@code{s-parint.ads})
25400 @geindex System.Partition_Interface (s-parint.ads)
25402 @geindex Partition interfacing functions
25404 This package provides facilities for partition interfacing.  It
25405 is used primarily in a distribution context when using Annex E
25406 with @code{GLADE}.
25408 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
25409 @anchor{gnat_rm/the_gnat_library id141}@anchor{400}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{401}
25410 @section @code{System.Pool_Global} (@code{s-pooglo.ads})
25413 @geindex System.Pool_Global (s-pooglo.ads)
25415 @geindex Storage pool
25416 @geindex global
25418 @geindex Global storage pool
25420 This package provides a storage pool that is equivalent to the default
25421 storage pool used for access types for which no pool is specifically
25422 declared. It uses malloc/free to allocate/free and does not attempt to
25423 do any automatic reclamation.
25425 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
25426 @anchor{gnat_rm/the_gnat_library id142}@anchor{402}@anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{403}
25427 @section @code{System.Pool_Local} (@code{s-pooloc.ads})
25430 @geindex System.Pool_Local (s-pooloc.ads)
25432 @geindex Storage pool
25433 @geindex local
25435 @geindex Local storage pool
25437 This package provides a storage pool that is intended for use with locally
25438 defined access types. It uses malloc/free for allocate/free, and maintains
25439 a list of allocated blocks, so that all storage allocated for the pool can
25440 be freed automatically when the pool is finalized.
25442 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
25443 @anchor{gnat_rm/the_gnat_library id143}@anchor{404}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{405}
25444 @section @code{System.Restrictions} (@code{s-restri.ads})
25447 @geindex System.Restrictions (s-restri.ads)
25449 @geindex Run-time restrictions access
25451 This package provides facilities for accessing at run time
25452 the status of restrictions specified at compile time for
25453 the partition. Information is available both with regard
25454 to actual restrictions specified, and with regard to
25455 compiler determined information on which restrictions
25456 are violated by one or more packages in the partition.
25458 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
25459 @anchor{gnat_rm/the_gnat_library id144}@anchor{406}@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{407}
25460 @section @code{System.Rident} (@code{s-rident.ads})
25463 @geindex System.Rident (s-rident.ads)
25465 @geindex Restrictions definitions
25467 This package provides definitions of the restrictions
25468 identifiers supported by GNAT, and also the format of
25469 the restrictions provided in package System.Restrictions.
25470 It is not normally necessary to @code{with} this generic package
25471 since the necessary instantiation is included in
25472 package System.Restrictions.
25474 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
25475 @anchor{gnat_rm/the_gnat_library id145}@anchor{408}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{409}
25476 @section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads})
25479 @geindex System.Strings.Stream_Ops (s-ststop.ads)
25481 @geindex Stream operations
25483 @geindex String stream operations
25485 This package provides a set of stream subprograms for standard string types.
25486 It is intended primarily to support implicit use of such subprograms when
25487 stream attributes are applied to string types, but the subprograms in this
25488 package can be used directly by application programs.
25490 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
25491 @anchor{gnat_rm/the_gnat_library id146}@anchor{40a}@anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{40b}
25492 @section @code{System.Unsigned_Types} (@code{s-unstyp.ads})
25495 @geindex System.Unsigned_Types (s-unstyp.ads)
25497 This package contains definitions of standard unsigned types that
25498 correspond in size to the standard signed types declared in Standard,
25499 and (unlike the types in Interfaces) have corresponding names. It
25500 also contains some related definitions for other specialized types
25501 used by the compiler in connection with packed array types.
25503 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
25504 @anchor{gnat_rm/the_gnat_library id147}@anchor{40c}@anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{40d}
25505 @section @code{System.Wch_Cnv} (@code{s-wchcnv.ads})
25508 @geindex System.Wch_Cnv (s-wchcnv.ads)
25510 @geindex Wide Character
25511 @geindex Representation
25513 @geindex Wide String
25514 @geindex Conversion
25516 @geindex Representation of wide characters
25518 This package provides routines for converting between
25519 wide and wide wide characters and a representation as a value of type
25520 @code{Standard.String}, using a specified wide character
25521 encoding method.  It uses definitions in
25522 package @code{System.Wch_Con}.
25524 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
25525 @anchor{gnat_rm/the_gnat_library id148}@anchor{40e}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{40f}
25526 @section @code{System.Wch_Con} (@code{s-wchcon.ads})
25529 @geindex System.Wch_Con (s-wchcon.ads)
25531 This package provides definitions and descriptions of
25532 the various methods used for encoding wide characters
25533 in ordinary strings.  These definitions are used by
25534 the package @code{System.Wch_Cnv}.
25536 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
25537 @anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{410}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{411}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}
25538 @chapter Interfacing to Other Languages
25541 The facilities in Annex B of the Ada Reference Manual are fully
25542 implemented in GNAT, and in addition, a full interface to C++ is
25543 provided.
25545 @menu
25546 * Interfacing to C:: 
25547 * Interfacing to C++:: 
25548 * Interfacing to COBOL:: 
25549 * Interfacing to Fortran:: 
25550 * Interfacing to non-GNAT Ada code:: 
25552 @end menu
25554 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
25555 @anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{412}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{413}
25556 @section Interfacing to C
25559 Interfacing to C with GNAT can use one of two approaches:
25562 @itemize *
25564 @item 
25565 The types in the package @code{Interfaces.C} may be used.
25567 @item 
25568 Standard Ada types may be used directly.  This may be less portable to
25569 other compilers, but will work on all GNAT compilers, which guarantee
25570 correspondence between the C and Ada types.
25571 @end itemize
25573 Pragma @code{Convention C} may be applied to Ada types, but mostly has no
25574 effect, since this is the default.  The following table shows the
25575 correspondence between Ada scalar types and the corresponding C types.
25578 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
25579 @headitem
25581 Ada Type
25583 @tab
25585 C Type
25587 @item
25589 @code{Integer}
25591 @tab
25593 @code{int}
25595 @item
25597 @code{Short_Integer}
25599 @tab
25601 @code{short}
25603 @item
25605 @code{Short_Short_Integer}
25607 @tab
25609 @code{signed char}
25611 @item
25613 @code{Long_Integer}
25615 @tab
25617 @code{long}
25619 @item
25621 @code{Long_Long_Integer}
25623 @tab
25625 @code{long long}
25627 @item
25629 @code{Short_Float}
25631 @tab
25633 @code{float}
25635 @item
25637 @code{Float}
25639 @tab
25641 @code{float}
25643 @item
25645 @code{Long_Float}
25647 @tab
25649 @code{double}
25651 @item
25653 @code{Long_Long_Float}
25655 @tab
25657 This is the longest floating-point type supported by the hardware.
25659 @end multitable
25662 Additionally, there are the following general correspondences between Ada
25663 and C types:
25666 @itemize *
25668 @item 
25669 Ada enumeration types map to C enumeration types directly if pragma
25670 @code{Convention C} is specified, which causes them to have a length of
25671 32 bits, except for boolean types which map to C99 @code{bool} and for
25672 which the length is 8 bits.
25673 Without pragma @code{Convention C}, Ada enumeration types map to
25674 8, 16, or 32 bits (i.e., C types @code{signed char}, @code{short},
25675 @code{int}, respectively) depending on the number of values passed.
25676 This is the only case in which pragma @code{Convention C} affects the
25677 representation of an Ada type.
25679 @item 
25680 Ada access types map to C pointers, except for the case of pointers to
25681 unconstrained types in Ada, which have no direct C equivalent.
25683 @item 
25684 Ada arrays map directly to C arrays.
25686 @item 
25687 Ada records map directly to C structures.
25689 @item 
25690 Packed Ada records map to C structures where all members are bit fields
25691 of the length corresponding to the @code{type'Size} value in Ada.
25692 @end itemize
25694 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
25695 @anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{49}@anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{414}
25696 @section Interfacing to C++
25699 The interface to C++ makes use of the following pragmas, which are
25700 primarily intended to be constructed automatically using a binding generator
25701 tool, although it is possible to construct them by hand.
25703 Using these pragmas it is possible to achieve complete
25704 inter-operability between Ada tagged types and C++ class definitions.
25705 See @ref{7,,Implementation Defined Pragmas}, for more details.
25708 @table @asis
25710 @item @code{pragma CPP_Class ([Entity =>] @var{LOCAL_NAME})}
25712 The argument denotes an entity in the current declarative region that is
25713 declared as a tagged or untagged record type. It indicates that the type
25714 corresponds to an externally declared C++ class type, and is to be laid
25715 out the same way that C++ would lay out the type.
25717 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
25718 for backward compatibility but its functionality is available
25719 using pragma @code{Import} with @code{Convention} = @code{CPP}.
25721 @item @code{pragma CPP_Constructor ([Entity =>] @var{LOCAL_NAME})}
25723 This pragma identifies an imported function (imported in the usual way
25724 with pragma @code{Import}) as corresponding to a C++ constructor.
25725 @end table
25727 A few restrictions are placed on the use of the @code{Access} attribute
25728 in conjunction with subprograms subject to convention @code{CPP}: the
25729 attribute may be used neither on primitive operations of a tagged
25730 record type with convention @code{CPP}, imported or not, nor on
25731 subprograms imported with pragma @code{CPP_Constructor}.
25733 In addition, C++ exceptions are propagated and can be handled in an
25734 @code{others} choice of an exception handler. The corresponding Ada
25735 occurrence has no message, and the simple name of the exception identity
25736 contains @code{Foreign_Exception}. Finalization and awaiting dependent
25737 tasks works properly when such foreign exceptions are propagated.
25739 It is also possible to import a C++ exception using the following syntax:
25741 @example
25742 LOCAL_NAME : exception;
25743 pragma Import (Cpp,
25744   [Entity =>] LOCAL_NAME,
25745   [External_Name =>] static_string_EXPRESSION);
25746 @end example
25748 The @code{External_Name} is the name of the C++ RTTI symbol. You can then
25749 cover a specific C++ exception in an exception handler.
25751 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
25752 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{415}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{416}
25753 @section Interfacing to COBOL
25756 Interfacing to COBOL is achieved as described in section B.4 of
25757 the Ada Reference Manual.
25759 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
25760 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{417}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{418}
25761 @section Interfacing to Fortran
25764 Interfacing to Fortran is achieved as described in section B.5 of the
25765 Ada Reference Manual.  The pragma @code{Convention Fortran}, applied to a
25766 multi-dimensional array causes the array to be stored in column-major
25767 order as required for convenient interface to Fortran.
25769 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
25770 @anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{419}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{41a}
25771 @section Interfacing to non-GNAT Ada code
25774 It is possible to specify the convention @code{Ada} in a pragma
25775 @code{Import} or pragma @code{Export}.  However this refers to
25776 the calling conventions used by GNAT, which may or may not be
25777 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
25778 compiler to allow interoperation.
25780 If arguments types are kept simple, and if the foreign compiler generally
25781 follows system calling conventions, then it may be possible to integrate
25782 files compiled by other Ada compilers, provided that the elaboration
25783 issues are adequately addressed (for example by eliminating the
25784 need for any load time elaboration).
25786 In particular, GNAT running on VMS is designed to
25787 be highly compatible with the DEC Ada 83 compiler, so this is one
25788 case in which it is possible to import foreign units of this type,
25789 provided that the data items passed are restricted to simple scalar
25790 values or simple record types without variants, or simple array
25791 types with fixed bounds.
25793 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
25794 @anchor{gnat_rm/specialized_needs_annexes doc}@anchor{41b}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{41c}@anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}
25795 @chapter Specialized Needs Annexes
25798 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
25799 required in all implementations.  However, as described in this chapter,
25800 GNAT implements all of these annexes:
25803 @table @asis
25805 @item `Systems Programming (Annex C)'
25807 The Systems Programming Annex is fully implemented.
25809 @item `Real-Time Systems (Annex D)'
25811 The Real-Time Systems Annex is fully implemented.
25813 @item `Distributed Systems (Annex E)'
25815 Stub generation is fully implemented in the GNAT compiler.  In addition,
25816 a complete compatible PCS is available as part of the GLADE system,
25817 a separate product.  When the two
25818 products are used in conjunction, this annex is fully implemented.
25820 @item `Information Systems (Annex F)'
25822 The Information Systems annex is fully implemented.
25824 @item `Numerics (Annex G)'
25826 The Numerics Annex is fully implemented.
25828 @item `Safety and Security / High-Integrity Systems (Annex H)'
25830 The Safety and Security Annex (termed the High-Integrity Systems Annex
25831 in Ada 2005) is fully implemented.
25832 @end table
25834 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25835 @anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{41d}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{41e}@anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13}
25836 @chapter Implementation of Specific Ada Features
25839 This chapter describes the GNAT implementation of several Ada language
25840 facilities.
25842 @menu
25843 * Machine Code Insertions:: 
25844 * GNAT Implementation of Tasking:: 
25845 * GNAT Implementation of Shared Passive Packages:: 
25846 * Code Generation for Array Aggregates:: 
25847 * The Size of Discriminated Records with Default Discriminants:: 
25848 * Image Values For Nonscalar Types:: 
25849 * Strict Conformance to the Ada Reference Manual:: 
25851 @end menu
25853 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25854 @anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{41f}@anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{178}
25855 @section Machine Code Insertions
25858 @geindex Machine Code insertions
25860 Package @code{Machine_Code} provides machine code support as described
25861 in the Ada Reference Manual in two separate forms:
25864 @itemize *
25866 @item 
25867 Machine code statements, consisting of qualified expressions that
25868 fit the requirements of RM section 13.8.
25870 @item 
25871 An intrinsic callable procedure, providing an alternative mechanism of
25872 including machine instructions in a subprogram.
25873 @end itemize
25875 The two features are similar, and both are closely related to the mechanism
25876 provided by the asm instruction in the GNU C compiler.  Full understanding
25877 and use of the facilities in this package requires understanding the asm
25878 instruction, see the section on Extended Asm in
25879 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
25881 Calls to the function @code{Asm} and the procedure @code{Asm} have identical
25882 semantic restrictions and effects as described below.  Both are provided so
25883 that the procedure call can be used as a statement, and the function call
25884 can be used to form a code_statement.
25886 Consider this C @code{asm} instruction:
25888 @example
25889 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
25890 @end example
25892 The equivalent can be written for GNAT as:
25894 @example
25895 Asm ("fsinx %1 %0",
25896      My_Float'Asm_Output ("=f", result),
25897      My_Float'Asm_Input  ("f",  angle));
25898 @end example
25900 The first argument to @code{Asm} is the assembler template, and is
25901 identical to what is used in GNU C.  This string must be a static
25902 expression.  The second argument is the output operand list.  It is
25903 either a single @code{Asm_Output} attribute reference, or a list of such
25904 references enclosed in parentheses (technically an array aggregate of
25905 such references).
25907 The @code{Asm_Output} attribute denotes a function that takes two
25908 parameters.  The first is a string, the second is the name of a variable
25909 of the type designated by the attribute prefix.  The first (string)
25910 argument is required to be a static expression and designates the
25911 constraint (see the section on Constraints in
25912 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
25913 for the parameter; e.g., what kind of register is required.  The second
25914 argument is the variable to be written or updated with the
25915 result.  The possible values for constraint are the same as those used in
25916 the RTL, and are dependent on the configuration file used to build the
25917 GCC back end.  If there are no output operands, then this argument may
25918 either be omitted, or explicitly given as @code{No_Output_Operands}.
25919 No support is provided for GNU C’s symbolic names for output parameters.
25921 The second argument of @code{my_float'Asm_Output} functions as
25922 though it were an @code{out} parameter, which is a little curious, but
25923 all names have the form of expressions, so there is no syntactic
25924 irregularity, even though normally functions would not be permitted
25925 @code{out} parameters.  The third argument is the list of input
25926 operands.  It is either a single @code{Asm_Input} attribute reference, or
25927 a list of such references enclosed in parentheses (technically an array
25928 aggregate of such references).
25930 The @code{Asm_Input} attribute denotes a function that takes two
25931 parameters.  The first is a string, the second is an expression of the
25932 type designated by the prefix.  The first (string) argument is required
25933 to be a static expression, and is the constraint for the parameter,
25934 (e.g., what kind of register is required).  The second argument is the
25935 value to be used as the input argument.  The possible values for the
25936 constraint are the same as those used in the RTL, and are dependent on
25937 the configuration file used to built the GCC back end.
25938 No support is provided for GNU C’s symbolic names for input parameters.
25940 If there are no input operands, this argument may either be omitted, or
25941 explicitly given as @code{No_Input_Operands}.  The fourth argument, not
25942 present in the above example, is a list of register names, called the
25943 `clobber' argument.  This argument, if given, must be a static string
25944 expression, and is a space or comma separated list of names of registers
25945 that must be considered destroyed as a result of the @code{Asm} call.  If
25946 this argument is the null string (the default value), then the code
25947 generator assumes that no additional registers are destroyed.
25948 In addition to registers, the special clobbers @code{memory} and
25949 @code{cc} as described in the GNU C docs are both supported.
25951 The fifth argument, not present in the above example, called the
25952 `volatile' argument, is by default @code{False}.  It can be set to
25953 the literal value @code{True} to indicate to the code generator that all
25954 optimizations with respect to the instruction specified should be
25955 suppressed, and in particular an instruction that has outputs
25956 will still be generated, even if none of the outputs are
25957 used.  See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
25958 for the full description.
25959 Generally it is strongly advisable to use Volatile for any ASM statement
25960 that is missing either input or output operands or to avoid unwanted
25961 optimizations. A warning is generated if this advice is not followed.
25963 No support is provided for GNU C’s @code{asm goto} feature.
25965 The @code{Asm} subprograms may be used in two ways.  First the procedure
25966 forms can be used anywhere a procedure call would be valid, and
25967 correspond to what the RM calls ‘intrinsic’ routines.  Such calls can
25968 be used to intersperse machine instructions with other Ada statements.
25969 Second, the function forms, which return a dummy value of the limited
25970 private type @code{Asm_Insn}, can be used in code statements, and indeed
25971 this is the only context where such calls are allowed.  Code statements
25972 appear as aggregates of the form:
25974 @example
25975 Asm_Insn'(Asm (...));
25976 Asm_Insn'(Asm_Volatile (...));
25977 @end example
25979 In accordance with RM rules, such code statements are allowed only
25980 within subprograms whose entire body consists of such statements.  It is
25981 not permissible to intermix such statements with other Ada statements.
25983 Typically the form using intrinsic procedure calls is more convenient
25984 and more flexible.  The code statement form is provided to meet the RM
25985 suggestion that such a facility should be made available.  The following
25986 is the exact syntax of the call to @code{Asm}. As usual, if named notation
25987 is used, the arguments may be given in arbitrary order, following the
25988 normal rules for use of positional and named arguments:
25990 @example
25991 ASM_CALL ::= Asm (
25992                  [Template =>] static_string_EXPRESSION
25993                [,[Outputs  =>] OUTPUT_OPERAND_LIST      ]
25994                [,[Inputs   =>] INPUT_OPERAND_LIST       ]
25995                [,[Clobber  =>] static_string_EXPRESSION ]
25996                [,[Volatile =>] static_boolean_EXPRESSION] )
25998 OUTPUT_OPERAND_LIST ::=
25999   [PREFIX.]No_Output_Operands
26000 | OUTPUT_OPERAND_ATTRIBUTE
26001 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
26003 OUTPUT_OPERAND_ATTRIBUTE ::=
26004   SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
26006 INPUT_OPERAND_LIST ::=
26007   [PREFIX.]No_Input_Operands
26008 | INPUT_OPERAND_ATTRIBUTE
26009 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
26011 INPUT_OPERAND_ATTRIBUTE ::=
26012   SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
26013 @end example
26015 The identifiers @code{No_Input_Operands} and @code{No_Output_Operands}
26016 are declared in the package @code{Machine_Code} and must be referenced
26017 according to normal visibility rules. In particular if there is no
26018 @code{use} clause for this package, then appropriate package name
26019 qualification is required.
26021 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
26022 @anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{420}@anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{421}
26023 @section GNAT Implementation of Tasking
26026 This chapter outlines the basic GNAT approach to tasking (in particular,
26027 a multi-layered library for portability) and discusses issues related
26028 to compliance with the Real-Time Systems Annex.
26030 @menu
26031 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
26032 * Ensuring Compliance with the Real-Time Annex:: 
26033 * Support for Locking Policies:: 
26035 @end menu
26037 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
26038 @anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{422}@anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{423}
26039 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
26042 GNAT’s run-time support comprises two layers:
26045 @itemize *
26047 @item 
26048 GNARL (GNAT Run-time Layer)
26050 @item 
26051 GNULL (GNAT Low-level Library)
26052 @end itemize
26054 In GNAT, Ada’s tasking services rely on a platform and OS independent
26055 layer known as GNARL.  This code is responsible for implementing the
26056 correct semantics of Ada’s task creation, rendezvous, protected
26057 operations etc.
26059 GNARL decomposes Ada’s tasking semantics into simpler lower level
26060 operations such as create a thread, set the priority of a thread,
26061 yield, create a lock, lock/unlock, etc.  The spec for these low-level
26062 operations constitutes GNULLI, the GNULL Interface.  This interface is
26063 directly inspired from the POSIX real-time API.
26065 If the underlying executive or OS implements the POSIX standard
26066 faithfully, the GNULL Interface maps as is to the services offered by
26067 the underlying kernel.  Otherwise, some target dependent glue code maps
26068 the services offered by the underlying kernel to the semantics expected
26069 by GNARL.
26071 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
26072 key point is that each Ada task is mapped on a thread in the underlying
26073 kernel.  For example, in the case of VxWorks, one Ada task = one VxWorks task.
26075 In addition Ada task priorities map onto the underlying thread priorities.
26076 Mapping Ada tasks onto the underlying kernel threads has several advantages:
26079 @itemize *
26081 @item 
26082 The underlying scheduler is used to schedule the Ada tasks.  This
26083 makes Ada tasks as efficient as kernel threads from a scheduling
26084 standpoint.
26086 @item 
26087 Interaction with code written in C containing threads is eased
26088 since at the lowest level Ada tasks and C threads map onto the same
26089 underlying kernel concept.
26091 @item 
26092 When an Ada task is blocked during I/O the remaining Ada tasks are
26093 able to proceed.
26095 @item 
26096 On multiprocessor systems Ada tasks can execute in parallel.
26097 @end itemize
26099 Some threads libraries offer a mechanism to fork a new process, with the
26100 child process duplicating the threads from the parent.
26101 GNAT does not
26102 support this functionality when the parent contains more than one task.
26104 @geindex Forking a new process
26106 @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
26107 @anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{424}@anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{425}
26108 @subsection Ensuring Compliance with the Real-Time Annex
26111 @geindex Real-Time Systems Annex compliance
26113 Although mapping Ada tasks onto
26114 the underlying threads has significant advantages, it does create some
26115 complications when it comes to respecting the scheduling semantics
26116 specified in the real-time annex (Annex D).
26118 For instance the Annex D requirement for the @code{FIFO_Within_Priorities}
26119 scheduling policy states:
26121 @quotation
26123 `When the active priority of a ready task that is not running
26124 changes, or the setting of its base priority takes effect, the
26125 task is removed from the ready queue for its old active priority
26126 and is added at the tail of the ready queue for its new active
26127 priority, except in the case where the active priority is lowered
26128 due to the loss of inherited priority, in which case the task is
26129 added at the head of the ready queue for its new active priority.'
26130 @end quotation
26132 While most kernels do put tasks at the end of the priority queue when
26133 a task changes its priority, (which respects the main
26134 FIFO_Within_Priorities requirement), almost none keep a thread at the
26135 beginning of its priority queue when its priority drops from the loss
26136 of inherited priority.
26138 As a result most vendors have provided incomplete Annex D implementations.
26140 The GNAT run-time, has a nice cooperative solution to this problem
26141 which ensures that accurate FIFO_Within_Priorities semantics are
26142 respected.
26144 The principle is as follows.  When an Ada task T is about to start
26145 running, it checks whether some other Ada task R with the same
26146 priority as T has been suspended due to the loss of priority
26147 inheritance.  If this is the case, T yields and is placed at the end of
26148 its priority queue.  When R arrives at the front of the queue it
26149 executes.
26151 Note that this simple scheme preserves the relative order of the tasks
26152 that were ready to execute in the priority queue where R has been
26153 placed at the end.
26155 @c Support_for_Locking_Policies
26157 @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
26158 @anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{426}
26159 @subsection Support for Locking Policies
26162 This section specifies which policies specified by pragma Locking_Policy
26163 are supported on which platforms.
26165 GNAT supports the standard @code{Ceiling_Locking} policy, and the
26166 implementation defined @code{Inheritance_Locking} and
26167 @code{Concurrent_Readers_Locking} policies.
26169 @code{Ceiling_Locking} is supported on all platforms if the operating system
26170 supports it. In particular, @code{Ceiling_Locking} is not supported on
26171 VxWorks.
26172 @code{Inheritance_Locking} is supported on
26173 Linux,
26174 Darwin (Mac OS X),
26175 LynxOS 178,
26176 and VxWorks.
26177 @code{Concurrent_Readers_Locking} is supported on Linux.
26179 Notes about @code{Ceiling_Locking} on Linux:
26180 If the process is running as ‘root’, ceiling locking is used.
26181 If the capabilities facility is installed
26182 (“sudo apt-get –assume-yes install libcap-dev” on Ubuntu,
26183 for example),
26184 and the program is linked against that library
26185 (“-largs -lcap”),
26186 and the executable file has the cap_sys_nice capability
26187 (“sudo /sbin/setcap cap_sys_nice=ep executable_file_name”),
26188 then ceiling locking is used.
26189 Otherwise, the @code{Ceiling_Locking} policy is ignored.
26191 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
26192 @anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{427}@anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{428}
26193 @section GNAT Implementation of Shared Passive Packages
26196 @geindex Shared passive packages
26198 GNAT fully implements the 
26199 @geindex pragma Shared_Passive
26200 pragma
26201 @code{Shared_Passive} for
26202 the purpose of designating shared passive packages.
26203 This allows the use of passive partitions in the
26204 context described in the Ada Reference Manual; i.e., for communication
26205 between separate partitions of a distributed application using the
26206 features in Annex E.
26208 @geindex Annex E
26210 @geindex Distribution Systems Annex
26212 However, the implementation approach used by GNAT provides for more
26213 extensive usage as follows:
26216 @table @asis
26218 @item `Communication between separate programs'
26220 This allows separate programs to access the data in passive
26221 partitions, using protected objects for synchronization where
26222 needed. The only requirement is that the two programs have a
26223 common shared file system. It is even possible for programs
26224 running on different machines with different architectures
26225 (e.g., different endianness) to communicate via the data in
26226 a passive partition.
26228 @item `Persistence between program runs'
26230 The data in a passive package can persist from one run of a
26231 program to another, so that a later program sees the final
26232 values stored by a previous run of the same program.
26233 @end table
26235 The implementation approach used is to store the data in files. A
26236 separate stream file is created for each object in the package, and
26237 an access to an object causes the corresponding file to be read or
26238 written.
26240 @geindex SHARED_MEMORY_DIRECTORY environment variable
26242 The environment variable @code{SHARED_MEMORY_DIRECTORY} should be
26243 set to the directory to be used for these files.
26244 The files in this directory
26245 have names that correspond to their fully qualified names. For
26246 example, if we have the package
26248 @example
26249 package X is
26250   pragma Shared_Passive (X);
26251   Y : Integer;
26252   Z : Float;
26253 end X;
26254 @end example
26256 and the environment variable is set to @code{/stemp/}, then the files created
26257 will have the names:
26259 @example
26260 /stemp/x.y
26261 /stemp/x.z
26262 @end example
26264 These files are created when a value is initially written to the object, and
26265 the files are retained until manually deleted. This provides the persistence
26266 semantics. If no file exists, it means that no partition has assigned a value
26267 to the variable; in this case the initial value declared in the package
26268 will be used. This model ensures that there are no issues in synchronizing
26269 the elaboration process, since elaboration of passive packages elaborates the
26270 initial values, but does not create the files.
26272 The files are written using normal @code{Stream_IO} access.
26273 If you want to be able
26274 to communicate between programs or partitions running on different
26275 architectures, then you should use the XDR versions of the stream attribute
26276 routines, since these are architecture independent.
26278 If active synchronization is required for access to the variables in the
26279 shared passive package, then as described in the Ada Reference Manual, the
26280 package may contain protected objects used for this purpose. In this case
26281 a lock file (whose name is @code{___lock}, with three underscores)
26282 is created in the shared memory directory.
26284 @geindex ___lock file (for shared passive packages)
26286 This is used to provide the required locking
26287 semantics for proper protected object synchronization.
26289 @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
26290 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{429}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{42a}
26291 @section Code Generation for Array Aggregates
26294 Aggregates have a rich syntax and allow the user to specify the values of
26295 complex data structures by means of a single construct.  As a result, the
26296 code generated for aggregates can be quite complex and involve loops, case
26297 statements and multiple assignments.  In the simplest cases, however, the
26298 compiler will recognize aggregates whose components and constraints are
26299 fully static, and in those cases the compiler will generate little or no
26300 executable code.  The following is an outline of the code that GNAT generates
26301 for various aggregate constructs.  For further details, you will find it
26302 useful to examine the output produced by the -gnatG flag to see the expanded
26303 source that is input to the code generator.  You may also want to examine
26304 the assembly code generated at various levels of optimization.
26306 The code generated for aggregates depends on the context, the component values,
26307 and the type.  In the context of an object declaration the code generated is
26308 generally simpler than in the case of an assignment.  As a general rule, static
26309 component values and static subtypes also lead to simpler code.
26311 @menu
26312 * Static constant aggregates with static bounds:: 
26313 * Constant aggregates with unconstrained nominal types:: 
26314 * Aggregates with static bounds:: 
26315 * Aggregates with nonstatic bounds:: 
26316 * Aggregates in assignment statements:: 
26318 @end menu
26320 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
26321 @anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{42b}@anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{42c}
26322 @subsection Static constant aggregates with static bounds
26325 For the declarations:
26327 @example
26328 type One_Dim is array (1..10) of integer;
26329 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
26330 @end example
26332 GNAT generates no executable code: the constant ar0 is placed in static memory.
26333 The same is true for constant aggregates with named associations:
26335 @example
26336 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
26337 Cr3 : constant One_Dim := (others => 7777);
26338 @end example
26340 The same is true for multidimensional constant arrays such as:
26342 @example
26343 type two_dim is array (1..3, 1..3) of integer;
26344 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
26345 @end example
26347 The same is true for arrays of one-dimensional arrays: the following are
26348 static:
26350 @example
26351 type ar1b  is array (1..3) of boolean;
26352 type ar_ar is array (1..3) of ar1b;
26353 None  : constant ar1b := (others => false);     --  fully static
26354 None2 : constant ar_ar := (1..3 => None);       --  fully static
26355 @end example
26357 However, for multidimensional aggregates with named associations, GNAT will
26358 generate assignments and loops, even if all associations are static.  The
26359 following two declarations generate a loop for the first dimension, and
26360 individual component assignments for the second dimension:
26362 @example
26363 Zero1: constant two_dim := (1..3 => (1..3 => 0));
26364 Zero2: constant two_dim := (others => (others => 0));
26365 @end example
26367 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
26368 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{42d}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{42e}
26369 @subsection Constant aggregates with unconstrained nominal types
26372 In such cases the aggregate itself establishes the subtype, so that
26373 associations with @code{others} cannot be used.  GNAT determines the
26374 bounds for the actual subtype of the aggregate, and allocates the
26375 aggregate statically as well.  No code is generated for the following:
26377 @example
26378 type One_Unc is array (natural range <>) of integer;
26379 Cr_Unc : constant One_Unc := (12,24,36);
26380 @end example
26382 @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
26383 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{42f}@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{430}
26384 @subsection Aggregates with static bounds
26387 In all previous examples the aggregate was the initial (and immutable) value
26388 of a constant.  If the aggregate initializes a variable, then code is generated
26389 for it as a combination of individual assignments and loops over the target
26390 object.  The declarations
26392 @example
26393 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
26394 Cr_Var2 : One_Dim := (others > -1);
26395 @end example
26397 generate the equivalent of
26399 @example
26400 Cr_Var1 (1) := 2;
26401 Cr_Var1 (2) := 3;
26402 Cr_Var1 (3) := 5;
26403 Cr_Var1 (4) := 11;
26405 for I in Cr_Var2'range loop
26406    Cr_Var2 (I) := -1;
26407 end loop;
26408 @end example
26410 @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
26411 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{431}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{432}
26412 @subsection Aggregates with nonstatic bounds
26415 If the bounds of the aggregate are not statically compatible with the bounds
26416 of the nominal subtype  of the target, then constraint checks have to be
26417 generated on the bounds.  For a multidimensional array, constraint checks may
26418 have to be applied to sub-arrays individually, if they do not have statically
26419 compatible subtypes.
26421 @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
26422 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{433}@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{434}
26423 @subsection Aggregates in assignment statements
26426 In general, aggregate assignment requires the construction of a temporary,
26427 and a copy from the temporary to the target of the assignment.  This is because
26428 it is not always possible to convert the assignment into a series of individual
26429 component assignments.  For example, consider the simple case:
26431 @example
26432 A := (A(2), A(1));
26433 @end example
26435 This cannot be converted into:
26437 @example
26438 A(1) := A(2);
26439 A(2) := A(1);
26440 @end example
26442 So the aggregate has to be built first in a separate location, and then
26443 copied into the target.  GNAT recognizes simple cases where this intermediate
26444 step is not required, and the assignments can be performed in place, directly
26445 into the target.  The following sufficient criteria are applied:
26448 @itemize *
26450 @item 
26451 The bounds of the aggregate are static, and the associations are static.
26453 @item 
26454 The components of the aggregate are static constants, names of
26455 simple variables that are not renamings, or expressions not involving
26456 indexed components whose operands obey these rules.
26457 @end itemize
26459 If any of these conditions are violated, the aggregate will be built in
26460 a temporary (created either by the front-end or the code generator) and then
26461 that temporary will be copied onto the target.
26463 @node The Size of Discriminated Records with Default Discriminants,Image Values For Nonscalar Types,Code Generation for Array Aggregates,Implementation of Specific Ada Features
26464 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{435}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{436}
26465 @section The Size of Discriminated Records with Default Discriminants
26468 If a discriminated type @code{T} has discriminants with default values, it is
26469 possible to declare an object of this type without providing an explicit
26470 constraint:
26472 @example
26473 type Size is range 1..100;
26475 type Rec (D : Size := 15) is record
26476    Name : String (1..D);
26477 end T;
26479 Word : Rec;
26480 @end example
26482 Such an object is said to be `unconstrained'.
26483 The discriminant of the object
26484 can be modified by a full assignment to the object, as long as it preserves the
26485 relation between the value of the discriminant, and the value of the components
26486 that depend on it:
26488 @example
26489 Word := (3, "yes");
26491 Word := (5, "maybe");
26493 Word := (5, "no"); -- raises Constraint_Error
26494 @end example
26496 In order to support this behavior efficiently, an unconstrained object is
26497 given the maximum size that any value of the type requires. In the case
26498 above, @code{Word} has storage for the discriminant and for
26499 a @code{String} of length 100.
26500 It is important to note that unconstrained objects do not require dynamic
26501 allocation. It would be an improper implementation to place on the heap those
26502 components whose size depends on discriminants. (This improper implementation
26503 was used by some Ada83 compilers, where the @code{Name} component above
26504 would have
26505 been stored as a pointer to a dynamic string). Following the principle that
26506 dynamic storage management should never be introduced implicitly,
26507 an Ada compiler should reserve the full size for an unconstrained declared
26508 object, and place it on the stack.
26510 This maximum size approach
26511 has been a source of surprise to some users, who expect the default
26512 values of the discriminants to determine the size reserved for an
26513 unconstrained object: “If the default is 15, why should the object occupy
26514 a larger size?”
26515 The answer, of course, is that the discriminant may be later modified,
26516 and its full range of values must be taken into account. This is why the
26517 declaration:
26519 @example
26520 type Rec (D : Positive := 15) is record
26521    Name : String (1..D);
26522 end record;
26524 Too_Large : Rec;
26525 @end example
26527 is flagged by the compiler with a warning:
26528 an attempt to create @code{Too_Large} will raise @code{Storage_Error},
26529 because the required size includes @code{Positive'Last}
26530 bytes. As the first example indicates, the proper approach is to declare an
26531 index type of ‘reasonable’ range so that unconstrained objects are not too
26532 large.
26534 One final wrinkle: if the object is declared to be @code{aliased}, or if it is
26535 created in the heap by means of an allocator, then it is `not'
26536 unconstrained:
26537 it is constrained by the default values of the discriminants, and those values
26538 cannot be modified by full assignment. This is because in the presence of
26539 aliasing all views of the object (which may be manipulated by different tasks,
26540 say) must be consistent, so it is imperative that the object, once created,
26541 remain invariant.
26543 @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
26544 @anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{437}@anchor{gnat_rm/implementation_of_specific_ada_features image-values-for-nonscalar-types}@anchor{438}
26545 @section Image Values For Nonscalar Types
26548 Ada 2022 defines the Image, Wide_Image, and Wide_Wide image attributes
26549 for nonscalar types; earlier Ada versions defined these attributes only
26550 for scalar types. Ada RM 4.10 provides some general guidance regarding
26551 the default implementation of these attributes and the GNAT compiler
26552 follows that guidance. However, beyond that the precise details of the
26553 image text generated in these cases are deliberately not documented and are
26554 subject to change. In particular, users should not rely on formatting details
26555 (such as spaces or line breaking), record field order, image values for access
26556 types, image values for types that have ancestor or subcomponent types
26557 declared in non-Ada2022 code, image values for predefined types, or the
26558 compiler’s choices regarding the implementation permissions described in
26559 Ada RM 4.10. This list is not intended to be exhaustive. If more precise
26560 control of image text is required for some type T, then T’Put_Image should be
26561 explicitly specified.
26563 @node Strict Conformance to the Ada Reference Manual,,Image Values For Nonscalar Types,Implementation of Specific Ada Features
26564 @anchor{gnat_rm/implementation_of_specific_ada_features id15}@anchor{439}@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{43a}
26565 @section Strict Conformance to the Ada Reference Manual
26568 The dynamic semantics defined by the Ada Reference Manual impose a set of
26569 run-time checks to be generated. By default, the GNAT compiler will insert many
26570 run-time checks into the compiled code, including most of those required by the
26571 Ada Reference Manual. However, there are two checks that are not enabled in
26572 the default mode for efficiency reasons: checks for access before elaboration
26573 on subprogram calls, and stack overflow checking (most operating systems do not
26574 perform this check by default).
26576 Strict conformance to the Ada Reference Manual can be achieved by adding two
26577 compiler options for dynamic checks for access-before-elaboration on subprogram
26578 calls and generic instantiations (`-gnatE'), and stack overflow checking
26579 (`-fstack-check').
26581 Note that the result of a floating point arithmetic operation in overflow and
26582 invalid situations, when the @code{Machine_Overflows} attribute of the result
26583 type is @code{False}, is to generate IEEE NaN and infinite values. This is the
26584 case for machines compliant with the IEEE floating-point standard, but on
26585 machines that are not fully compliant with this standard, such as Alpha, the
26586 `-mieee' compiler flag must be used for achieving IEEE confirming
26587 behavior (although at the cost of a significant performance penalty), so
26588 infinite and NaN values are properly generated.
26590 @node Implementation of Ada 2012 Features,GNAT language extensions,Implementation of Specific Ada Features,Top
26591 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{43b}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{43c}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14}
26592 @chapter Implementation of Ada 2012 Features
26595 @geindex Ada 2012 implementation status
26597 @geindex -gnat12 option (gcc)
26599 @geindex pragma Ada_2012
26601 @geindex configuration pragma Ada_2012
26603 @geindex Ada_2012 configuration pragma
26605 This chapter contains a complete list of Ada 2012 features that have been
26606 implemented.
26607 Generally, these features are only
26608 available if the `-gnat12' (Ada 2012 features enabled) option is set,
26609 which is the default behavior,
26610 or if the configuration pragma @code{Ada_2012} is used.
26612 However, new pragmas, attributes, and restrictions are
26613 unconditionally available, since the Ada 95 standard allows the addition of
26614 new pragmas, attributes, and restrictions (there are exceptions, which are
26615 documented in the individual descriptions), and also certain packages
26616 were made available in earlier versions of Ada.
26618 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
26619 This date shows the implementation date of the feature. Any wavefront
26620 subsequent to this date will contain the indicated feature, as will any
26621 subsequent releases. A date of 0000-00-00 means that GNAT has always
26622 implemented the feature, or implemented it as soon as it appeared as a
26623 binding interpretation.
26625 Each feature corresponds to an Ada Issue (‘AI’) approved by the Ada
26626 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
26627 The features are ordered based on the relevant sections of the Ada
26628 Reference Manual (“RM”).  When a given AI relates to multiple points
26629 in the RM, the earliest is used.
26631 A complete description of the AIs may be found in
26632 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
26634 @geindex AI-0002 (Ada 2012 feature)
26637 @itemize *
26639 @item 
26640 `AI-0002 Export C with unconstrained arrays (0000-00-00)'
26642 The compiler is not required to support exporting an Ada subprogram with
26643 convention C if there are parameters or a return type of an unconstrained
26644 array type (such as @code{String}). GNAT allows such declarations but
26645 generates warnings. It is possible, but complicated, to write the
26646 corresponding C code and certainly such code would be specific to GNAT and
26647 non-portable.
26649 RM References:  B.01 (17)   B.03 (62)   B.03 (71.1/2)
26650 @end itemize
26652 @geindex AI-0003 (Ada 2012 feature)
26655 @itemize *
26657 @item 
26658 `AI-0003 Qualified expressions as names (2010-07-11)'
26660 In Ada 2012, a qualified expression is considered to be syntactically a name,
26661 meaning that constructs such as @code{A'(F(X)).B} are now legal. This is
26662 useful in disambiguating some cases of overloading.
26664 RM References:  3.03 (11)   3.03 (21)   4.01 (2)   4.04 (7)   4.07 (3)
26665 5.04 (7)
26666 @end itemize
26668 @geindex AI-0007 (Ada 2012 feature)
26671 @itemize *
26673 @item 
26674 `AI-0007 Stream read and private scalar types (0000-00-00)'
26676 The RM as written appeared to limit the possibilities of declaring read
26677 attribute procedures for private scalar types. This limitation was not
26678 intended, and has never been enforced by GNAT.
26680 RM References:  13.13.02 (50/2)   13.13.02 (51/2)
26681 @end itemize
26683 @geindex AI-0008 (Ada 2012 feature)
26686 @itemize *
26688 @item 
26689 `AI-0008 General access to constrained objects (0000-00-00)'
26691 The wording in the RM implied that if you have a general access to a
26692 constrained object, it could be used to modify the discriminants. This was
26693 obviously not intended. @code{Constraint_Error} should be raised, and GNAT
26694 has always done so in this situation.
26696 RM References:  3.03 (23)   3.10.02 (26/2)   4.01 (9)   6.04.01 (17)   8.05.01 (5/2)
26697 @end itemize
26699 @geindex AI-0009 (Ada 2012 feature)
26702 @itemize *
26704 @item 
26705 `AI-0009 Pragma Independent[_Components] (2010-07-23)'
26707 This AI introduces the new pragmas @code{Independent} and
26708 @code{Independent_Components},
26709 which control guaranteeing independence of access to objects and components.
26710 The AI also requires independence not unaffected by confirming rep clauses.
26712 RM References:  9.10 (1)   13.01 (15/1)   13.02 (9)   13.03 (13)   C.06 (2)
26713 C.06 (4)   C.06 (6)   C.06 (9)   C.06 (13)   C.06 (14)
26714 @end itemize
26716 @geindex AI-0012 (Ada 2012 feature)
26719 @itemize *
26721 @item 
26722 `AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)'
26724 It is now illegal to give an inappropriate component size or a pragma
26725 @code{Pack} that attempts to change the component size in the case of atomic
26726 or aliased components. Previously GNAT ignored such an attempt with a
26727 warning.
26729 RM References:  13.02 (6.1/2)   13.02 (7)   C.06 (10)   C.06 (11)   C.06 (21)
26730 @end itemize
26732 @geindex AI-0015 (Ada 2012 feature)
26735 @itemize *
26737 @item 
26738 `AI-0015 Constant return objects (0000-00-00)'
26740 The return object declared in an `extended_return_statement' may be
26741 declared constant. This was always intended, and GNAT has always allowed it.
26743 RM References:  6.05 (2.1/2)   3.03 (10/2)   3.03 (21)   6.05 (5/2)
26744 6.05 (5.7/2)
26745 @end itemize
26747 @geindex AI-0017 (Ada 2012 feature)
26750 @itemize *
26752 @item 
26753 `AI-0017 Freezing and incomplete types (0000-00-00)'
26755 So-called ‘Taft-amendment types’ (i.e., types that are completed in package
26756 bodies) are not frozen by the occurrence of bodies in the
26757 enclosing declarative part. GNAT always implemented this properly.
26759 RM References:  13.14 (3/1)
26760 @end itemize
26762 @geindex AI-0019 (Ada 2012 feature)
26765 @itemize *
26767 @item 
26768 `AI-0019 Freezing of primitives for tagged types (0000-00-00)'
26770 The RM suggests that primitive subprograms of a specific tagged type are
26771 frozen when the tagged type is frozen. This would be an incompatible change
26772 and is not intended. GNAT has never attempted this kind of freezing and its
26773 behavior is consistent with the recommendation of this AI.
26775 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)
26776 @end itemize
26778 @geindex AI-0026 (Ada 2012 feature)
26781 @itemize *
26783 @item 
26784 `AI-0026 Missing rules for Unchecked_Union (2010-07-07)'
26786 Record representation clauses concerning Unchecked_Union types cannot mention
26787 the discriminant of the type. The type of a component declared in the variant
26788 part of an Unchecked_Union cannot be controlled, have controlled components,
26789 nor have protected or task parts. If an Unchecked_Union type is declared
26790 within the body of a generic unit or its descendants, then the type of a
26791 component declared in the variant part cannot be a formal private type or a
26792 formal private extension declared within the same generic unit.
26794 RM References:  7.06 (9.4/2)   B.03.03 (9/2)   B.03.03 (10/2)
26795 @end itemize
26797 @geindex AI-0030 (Ada 2012 feature)
26800 @itemize *
26802 @item 
26803 `AI-0030 Requeue on synchronized interfaces (2010-07-19)'
26805 Requeue is permitted to a protected, synchronized or task interface primitive
26806 providing it is known that the overriding operation is an entry. Otherwise
26807 the requeue statement has the same effect as a procedure call. Use of pragma
26808 @code{Implemented} provides a way to impose a static requirement on the
26809 overriding operation by adhering to one of the implementation kinds: entry,
26810 protected procedure or any of the above.
26812 RM References:  9.05 (9)   9.05.04 (2)   9.05.04 (3)   9.05.04 (5)
26813 9.05.04 (6)   9.05.04 (7)   9.05.04 (12)
26814 @end itemize
26816 @geindex AI-0031 (Ada 2012 feature)
26819 @itemize *
26821 @item 
26822 `AI-0031 Add From parameter to Find_Token (2010-07-25)'
26824 A new version of @code{Find_Token} is added to all relevant string packages,
26825 with an extra parameter @code{From}. Instead of starting at the first
26826 character of the string, the search for a matching Token starts at the
26827 character indexed by the value of @code{From}.
26828 These procedures are available in all versions of Ada
26829 but if used in versions earlier than Ada 2012 they will generate a warning
26830 that an Ada 2012 subprogram is being used.
26832 RM References:  A.04.03 (16)   A.04.03 (67)   A.04.03 (68/1)   A.04.04 (51)
26833 A.04.05 (46)
26834 @end itemize
26836 @geindex AI-0032 (Ada 2012 feature)
26839 @itemize *
26841 @item 
26842 `AI-0032 Extended return for class-wide functions (0000-00-00)'
26844 If a function returns a class-wide type, the object of an extended return
26845 statement can be declared with a specific type that is covered by the class-
26846 wide type. This has been implemented in GNAT since the introduction of
26847 extended returns. Note AI-0103 complements this AI by imposing matching
26848 rules for constrained return types.
26850 RM References:  6.05 (5.2/2)   6.05 (5.3/2)   6.05 (5.6/2)   6.05 (5.8/2)
26851 6.05 (8/2)
26852 @end itemize
26854 @geindex AI-0033 (Ada 2012 feature)
26857 @itemize *
26859 @item 
26860 `AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)'
26862 Neither of these two pragmas may appear within a generic template, because
26863 the generic might be instantiated at other than the library level.
26865 RM References:  13.11.02 (16)   C.03.01 (7/2)   C.03.01 (8/2)
26866 @end itemize
26868 @geindex AI-0034 (Ada 2012 feature)
26871 @itemize *
26873 @item 
26874 `AI-0034 Categorization of limited views (0000-00-00)'
26876 The RM makes certain limited with clauses illegal because of categorization
26877 considerations, when the corresponding normal with would be legal. This is
26878 not intended, and GNAT has always implemented the recommended behavior.
26880 RM References:  10.02.01 (11/1)   10.02.01 (17/2)
26881 @end itemize
26883 @geindex AI-0035 (Ada 2012 feature)
26886 @itemize *
26888 @item 
26889 `AI-0035 Inconsistencies with Pure units (0000-00-00)'
26891 This AI remedies some inconsistencies in the legality rules for Pure units.
26892 Derived access types are legal in a pure unit (on the assumption that the
26893 rule for a zero storage pool size has been enforced on the ancestor type).
26894 The rules are enforced in generic instances and in subunits. GNAT has always
26895 implemented the recommended behavior.
26897 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)
26898 @end itemize
26900 @geindex AI-0037 (Ada 2012 feature)
26903 @itemize *
26905 @item 
26906 `AI-0037 Out-of-range box associations in aggregate (0000-00-00)'
26908 This AI confirms that an association of the form @code{Indx => <>} in an
26909 array aggregate must raise @code{Constraint_Error} if @code{Indx}
26910 is out of range. The RM specified a range check on other associations, but
26911 not when the value of the association was defaulted. GNAT has always inserted
26912 a constraint check on the index value.
26914 RM References:  4.03.03 (29)
26915 @end itemize
26917 @geindex AI-0038 (Ada 2012 feature)
26920 @itemize *
26922 @item 
26923 `AI-0038 Minor errors in Text_IO (0000-00-00)'
26925 These are minor errors in the description on three points. The intent on
26926 all these points has always been clear, and GNAT has always implemented the
26927 correct intended semantics.
26929 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)
26930 @end itemize
26932 @geindex AI-0039 (Ada 2012 feature)
26935 @itemize *
26937 @item 
26938 `AI-0039 Stream attributes cannot be dynamic (0000-00-00)'
26940 The RM permitted the use of dynamic expressions (such as @code{ptr.all})
26941 for stream attributes, but these were never useful and are now illegal. GNAT
26942 has always regarded such expressions as illegal.
26944 RM References:  13.03 (4)   13.03 (6)   13.13.02 (38/2)
26945 @end itemize
26947 @geindex AI-0040 (Ada 2012 feature)
26950 @itemize *
26952 @item 
26953 `AI-0040 Limited with clauses on descendant (0000-00-00)'
26955 This AI confirms that a limited with clause in a child unit cannot name
26956 an ancestor of the unit. This has always been checked in GNAT.
26958 RM References:  10.01.02 (20/2)
26959 @end itemize
26961 @geindex AI-0042 (Ada 2012 feature)
26964 @itemize *
26966 @item 
26967 `AI-0042 Overriding versus implemented-by (0000-00-00)'
26969 This AI fixes a wording gap in the RM. An operation of a synchronized
26970 interface can be implemented by a protected or task entry, but the abstract
26971 operation is not being overridden in the usual sense, and it must be stated
26972 separately that this implementation is legal. This has always been the case
26973 in GNAT.
26975 RM References:  9.01 (9.2/2)   9.04 (11.1/2)
26976 @end itemize
26978 @geindex AI-0043 (Ada 2012 feature)
26981 @itemize *
26983 @item 
26984 `AI-0043 Rules about raising exceptions (0000-00-00)'
26986 This AI covers various omissions in the RM regarding the raising of
26987 exceptions. GNAT has always implemented the intended semantics.
26989 RM References:  11.04.01 (10.1/2)   11 (2)
26990 @end itemize
26992 @geindex AI-0044 (Ada 2012 feature)
26995 @itemize *
26997 @item 
26998 `AI-0044 Restrictions on container instantiations (0000-00-00)'
27000 This AI places restrictions on allowed instantiations of generic containers.
27001 These restrictions are not checked by the compiler, so there is nothing to
27002 change in the implementation. This affects only the RM documentation.
27004 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)
27005 @end itemize
27007 @geindex AI-0046 (Ada 2012 feature)
27010 @itemize *
27012 @item 
27013 `AI-0046 Null exclusion match for full conformance (2010-07-17)'
27015 For full conformance, in the case of access parameters, the null exclusion
27016 must match (either both or neither must have @code{not null}).
27018 RM References:  6.03.02 (18)
27019 @end itemize
27021 @geindex AI-0050 (Ada 2012 feature)
27024 @itemize *
27026 @item 
27027 `AI-0050 Raising Constraint_Error early for function call (0000-00-00)'
27029 The implementation permissions for raising @code{Constraint_Error} early on a function call
27030 when it was clear an exception would be raised were over-permissive and allowed
27031 mishandling of discriminants in some cases. GNAT did
27032 not take advantage of these incorrect permissions in any case.
27034 RM References:  6.05 (24/2)
27035 @end itemize
27037 @geindex AI-0056 (Ada 2012 feature)
27040 @itemize *
27042 @item 
27043 `AI-0056 Index on null string returns zero (0000-00-00)'
27045 The wording in the Ada 2005 RM implied an incompatible handling of the
27046 @code{Index} functions, resulting in raising an exception instead of
27047 returning zero in some situations.
27048 This was not intended and has been corrected.
27049 GNAT always returned zero, and is thus consistent with this AI.
27051 RM References:  A.04.03 (56.2/2)   A.04.03 (58.5/2)
27052 @end itemize
27054 @geindex AI-0058 (Ada 2012 feature)
27057 @itemize *
27059 @item 
27060 `AI-0058 Abnormal completion of an extended return (0000-00-00)'
27062 The RM had some incorrect wording implying wrong treatment of abnormal
27063 completion in an extended return. GNAT has always implemented the intended
27064 correct semantics as described by this AI.
27066 RM References:  6.05 (22/2)
27067 @end itemize
27069 @geindex AI-0060 (Ada 2012 feature)
27072 @itemize *
27074 @item 
27075 `AI-0060 Extended definition of remote access types (0000-00-00)'
27077 This AI extends the definition of remote access types to include access
27078 to limited, synchronized, protected or task class-wide interface types.
27079 GNAT already implemented this extension.
27081 RM References:  A (4)   E.02.02 (9/1)   E.02.02 (9.2/1)   E.02.02 (14/2)   E.02.02 (18)
27082 @end itemize
27084 @geindex AI-0062 (Ada 2012 feature)
27087 @itemize *
27089 @item 
27090 `AI-0062 Null exclusions and deferred constants (0000-00-00)'
27092 A full constant may have a null exclusion even if its associated deferred
27093 constant does not. GNAT has always allowed this.
27095 RM References:  7.04 (6/2)   7.04 (7.1/2)
27096 @end itemize
27098 @geindex AI-0064 (Ada 2012 feature)
27101 @itemize *
27103 @item 
27104 `AI-0064 Redundant finalization rule (0000-00-00)'
27106 This is an editorial change only. The intended behavior is already checked
27107 by an existing ACATS test, which GNAT has always executed correctly.
27109 RM References:  7.06.01 (17.1/1)
27110 @end itemize
27112 @geindex AI-0065 (Ada 2012 feature)
27115 @itemize *
27117 @item 
27118 `AI-0065 Remote access types and external streaming (0000-00-00)'
27120 This AI clarifies the fact that all remote access types support external
27121 streaming. This fixes an obvious oversight in the definition of the
27122 language, and GNAT always implemented the intended correct rules.
27124 RM References:  13.13.02 (52/2)
27125 @end itemize
27127 @geindex AI-0070 (Ada 2012 feature)
27130 @itemize *
27132 @item 
27133 `AI-0070 Elaboration of interface types (0000-00-00)'
27135 This is an editorial change only, there are no testable consequences short of
27136 checking for the absence of generated code for an interface declaration.
27138 RM References:  3.09.04 (18/2)
27139 @end itemize
27141 @geindex AI-0072 (Ada 2012 feature)
27144 @itemize *
27146 @item 
27147 `AI-0072 Task signalling using ‘Terminated (0000-00-00)'
27149 This AI clarifies that task signalling for reading @code{'Terminated} only
27150 occurs if the result is True. GNAT semantics has always been consistent with
27151 this notion of task signalling.
27153 RM References:  9.10 (6.1/1)
27154 @end itemize
27156 @geindex AI-0073 (Ada 2012 feature)
27159 @itemize *
27161 @item 
27162 `AI-0073 Functions returning abstract types (2010-07-10)'
27164 This AI covers a number of issues regarding returning abstract types. In
27165 particular generic functions cannot have abstract result types or access
27166 result types designated an abstract type. There are some other cases which
27167 are detailed in the AI. Note that this binding interpretation has not been
27168 retrofitted to operate before Ada 2012 mode, since it caused a significant
27169 number of regressions.
27171 RM References:  3.09.03 (8)   3.09.03 (10)   6.05 (8/2)
27172 @end itemize
27174 @geindex AI-0076 (Ada 2012 feature)
27177 @itemize *
27179 @item 
27180 `AI-0076 function with controlling result (0000-00-00)'
27182 This is an editorial change only. The RM defines calls with controlling
27183 results, but uses the term ‘function with controlling result’ without an
27184 explicit definition.
27186 RM References:  3.09.02 (2/2)
27187 @end itemize
27189 @geindex AI-0077 (Ada 2012 feature)
27192 @itemize *
27194 @item 
27195 `AI-0077 Limited withs and scope of declarations (0000-00-00)'
27197 This AI clarifies that a declaration does not include a context clause,
27198 and confirms that it is illegal to have a context in which both a limited
27199 and a nonlimited view of a package are accessible. Such double visibility
27200 was always rejected by GNAT.
27202 RM References:  10.01.02 (12/2)   10.01.02 (21/2)   10.01.02 (22/2)
27203 @end itemize
27205 @geindex AI-0078 (Ada 2012 feature)
27208 @itemize *
27210 @item 
27211 `AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)'
27213 In Ada 2012, compilers are required to support unchecked conversion where the
27214 target alignment is a multiple of the source alignment. GNAT always supported
27215 this case (and indeed all cases of differing alignments, doing copies where
27216 required if the alignment was reduced).
27218 RM References:  13.09 (7)
27219 @end itemize
27221 @geindex AI-0079 (Ada 2012 feature)
27224 @itemize *
27226 @item 
27227 `AI-0079 Allow other_format characters in source (2010-07-10)'
27229 Wide characters in the unicode category `other_format' are now allowed in
27230 source programs between tokens, but not within a token such as an identifier.
27232 RM References:  2.01 (4/2)   2.02 (7)
27233 @end itemize
27235 @geindex AI-0080 (Ada 2012 feature)
27238 @itemize *
27240 @item 
27241 `AI-0080 ‘View of’ not needed if clear from context (0000-00-00)'
27243 This is an editorial change only, described as non-testable in the AI.
27245 RM References:  3.01 (7)
27246 @end itemize
27248 @geindex AI-0087 (Ada 2012 feature)
27251 @itemize *
27253 @item 
27254 `AI-0087 Actual for formal nonlimited derived type (2010-07-15)'
27256 The actual for a formal nonlimited derived type cannot be limited. In
27257 particular, a formal derived type that extends a limited interface but which
27258 is not explicitly limited cannot be instantiated with a limited type.
27260 RM References:  7.05 (5/2)   12.05.01 (5.1/2)
27261 @end itemize
27263 @geindex AI-0088 (Ada 2012 feature)
27266 @itemize *
27268 @item 
27269 `AI-0088 The value of exponentiation (0000-00-00)'
27271 This AI clarifies the equivalence rule given for the dynamic semantics of
27272 exponentiation: the value of the operation can be obtained by repeated
27273 multiplication, but the operation can be implemented otherwise (for example
27274 using the familiar divide-by-two-and-square algorithm, even if this is less
27275 accurate), and does not imply repeated reads of a volatile base.
27277 RM References:  4.05.06 (11)
27278 @end itemize
27280 @geindex AI-0091 (Ada 2012 feature)
27283 @itemize *
27285 @item 
27286 `AI-0091 Do not allow other_format in identifiers (0000-00-00)'
27288 Wide characters in the unicode category `other_format' are not permitted
27289 within  an identifier, since this can be a security problem. The error
27290 message for this case has been improved to be more specific, but GNAT has
27291 never allowed such characters to appear in identifiers.
27293 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)
27294 @end itemize
27296 @geindex AI-0093 (Ada 2012 feature)
27299 @itemize *
27301 @item 
27302 `AI-0093 Additional rules use immutably limited (0000-00-00)'
27304 This is an editorial change only, to make more widespread use of the Ada 2012
27305 ‘immutably limited’.
27307 RM References:  3.03 (23.4/3)
27308 @end itemize
27310 @geindex AI-0095 (Ada 2012 feature)
27313 @itemize *
27315 @item 
27316 `AI-0095 Address of intrinsic subprograms (0000-00-00)'
27318 The prefix of @code{'Address} cannot statically denote a subprogram with
27319 convention @code{Intrinsic}. The use of the @code{Address} attribute raises
27320 @code{Program_Error} if the prefix denotes a subprogram with convention
27321 @code{Intrinsic}.
27323 RM References:  13.03 (11/1)
27324 @end itemize
27326 @geindex AI-0096 (Ada 2012 feature)
27329 @itemize *
27331 @item 
27332 `AI-0096 Deriving from formal private types (2010-07-20)'
27334 In general it is illegal for a type derived from a formal limited type to be
27335 nonlimited.  This AI makes an exception to this rule: derivation is legal
27336 if it appears in the private part of the generic, and the formal type is not
27337 tagged. If the type is tagged, the legality check must be applied to the
27338 private part of the package.
27340 RM References:  3.04 (5.1/2)   6.02 (7)
27341 @end itemize
27343 @geindex AI-0097 (Ada 2012 feature)
27346 @itemize *
27348 @item 
27349 `AI-0097 Treatment of abstract null extension (2010-07-19)'
27351 The RM as written implied that in some cases it was possible to create an
27352 object of an abstract type, by having an abstract extension inherit a non-
27353 abstract constructor from its parent type. This mistake has been corrected
27354 in GNAT and in the RM, and this construct is now illegal.
27356 RM References:  3.09.03 (4/2)
27357 @end itemize
27359 @geindex AI-0098 (Ada 2012 feature)
27362 @itemize *
27364 @item 
27365 `AI-0098 Anonymous subprogram access restrictions (0000-00-00)'
27367 An unintentional omission in the RM implied some inconsistent restrictions on
27368 the use of anonymous access to subprogram values. These restrictions were not
27369 intentional, and have never been enforced by GNAT.
27371 RM References:  3.10.01 (6)   3.10.01 (9.2/2)
27372 @end itemize
27374 @geindex AI-0099 (Ada 2012 feature)
27377 @itemize *
27379 @item 
27380 `AI-0099 Tag determines whether finalization needed (0000-00-00)'
27382 This AI clarifies that ‘needs finalization’ is part of dynamic semantics,
27383 and therefore depends on the run-time characteristics of an object (i.e. its
27384 tag) and not on its nominal type. As the AI indicates: “we do not expect
27385 this to affect any implementation”.
27387 RM References:  7.06.01 (6)   7.06.01 (7)   7.06.01 (8)   7.06.01 (9/2)
27388 @end itemize
27390 @geindex AI-0100 (Ada 2012 feature)
27393 @itemize *
27395 @item 
27396 `AI-0100 Placement of pragmas  (2010-07-01)'
27398 This AI is an earlier version of AI-163. It simplifies the rules
27399 for legal placement of pragmas. In the case of lists that allow pragmas, if
27400 the list may have no elements, then the list may consist solely of pragmas.
27402 RM References:  2.08 (7)
27403 @end itemize
27405 @geindex AI-0102 (Ada 2012 feature)
27408 @itemize *
27410 @item 
27411 `AI-0102 Some implicit conversions are illegal (0000-00-00)'
27413 It is illegal to assign an anonymous access constant to an anonymous access
27414 variable. The RM did not have a clear rule to prevent this, but GNAT has
27415 always generated an error for this usage.
27417 RM References:  3.07 (16)   3.07.01 (9)   6.04.01 (6)   8.06 (27/2)
27418 @end itemize
27420 @geindex AI-0103 (Ada 2012 feature)
27423 @itemize *
27425 @item 
27426 `AI-0103 Static matching for extended return (2010-07-23)'
27428 If the return subtype of a function is an elementary type or a constrained
27429 type, the subtype indication in an extended return statement must match
27430 statically this return subtype.
27432 RM References:  6.05 (5.2/2)
27433 @end itemize
27435 @geindex AI-0104 (Ada 2012 feature)
27438 @itemize *
27440 @item 
27441 `AI-0104 Null exclusion and uninitialized allocator (2010-07-15)'
27443 The assignment @code{Ptr := new not null Some_Ptr;} will raise
27444 @code{Constraint_Error} because the default value of the allocated object is
27445 `null'. This useless construct is illegal in Ada 2012.
27447 RM References:  4.08 (2)
27448 @end itemize
27450 @geindex AI-0106 (Ada 2012 feature)
27453 @itemize *
27455 @item 
27456 `AI-0106 No representation pragmas on generic formals (0000-00-00)'
27458 The RM appeared to allow representation pragmas on generic formal parameters,
27459 but this was not intended, and GNAT has never permitted this usage.
27461 RM References:  13.01 (9.1/1)
27462 @end itemize
27464 @geindex AI-0108 (Ada 2012 feature)
27467 @itemize *
27469 @item 
27470 `AI-0108 Limited incomplete view and discriminants (0000-00-00)'
27472 This AI confirms that an incomplete type from a limited view does not have
27473 discriminants. This has always been the case in GNAT.
27475 RM References:  10.01.01 (12.3/2)
27476 @end itemize
27478 @geindex AI-0109 (Ada 2012 feature)
27481 @itemize *
27483 @item 
27484 `AI-0109 Redundant check in S’Class’Input (0000-00-00)'
27486 This AI is an editorial change only. It removes the need for a tag check
27487 that can never fail.
27489 RM References:  13.13.02 (34/2)
27490 @end itemize
27492 @geindex AI-0112 (Ada 2012 feature)
27495 @itemize *
27497 @item 
27498 `AI-0112 Detection of duplicate pragmas (2010-07-24)'
27500 This AI concerns giving names to various representation aspects, but the
27501 practical effect is simply to make the use of duplicate
27502 @code{Atomic[_Components]},
27503 @code{Volatile[_Components]}, and
27504 @code{Independent[_Components]} pragmas illegal, and GNAT
27505 now performs this required check.
27507 RM References:  13.01 (8)
27508 @end itemize
27510 @geindex AI-0114 (Ada 2012 feature)
27513 @itemize *
27515 @item 
27516 `AI-0114 Classification of letters (0000-00-00)'
27518 The code points 170 (@code{FEMININE ORDINAL INDICATOR}),
27519 181 (@code{MICRO SIGN}), and
27520 186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered
27521 lower case letters by Unicode.
27522 However, they are not allowed in identifiers, and they
27523 return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}.
27524 This behavior is consistent with that defined in Ada 95.
27526 RM References:  A.03.02 (59)   A.04.06 (7)
27527 @end itemize
27529 @geindex AI-0116 (Ada 2012 feature)
27532 @itemize *
27534 @item 
27535 `AI-0116 Alignment of class-wide objects (0000-00-00)'
27537 This AI requires that the alignment of a class-wide object be no greater
27538 than the alignment of any type in the class. GNAT has always followed this
27539 recommendation.
27541 RM References:  13.03 (29)   13.11 (16)
27542 @end itemize
27544 @geindex AI-0118 (Ada 2012 feature)
27547 @itemize *
27549 @item 
27550 `AI-0118 The association of parameter associations (0000-00-00)'
27552 This AI clarifies the rules for named associations in subprogram calls and
27553 generic instantiations. The rules have been in place since Ada 83.
27555 RM References:  6.04.01 (2)   12.03 (9)
27556 @end itemize
27558 @geindex AI-0120 (Ada 2012 feature)
27561 @itemize *
27563 @item 
27564 `AI-0120 Constant instance of protected object (0000-00-00)'
27566 This is an RM editorial change only. The section that lists objects that are
27567 constant failed to include the current instance of a protected object
27568 within a protected function. This has always been treated as a constant
27569 in GNAT.
27571 RM References:  3.03 (21)
27572 @end itemize
27574 @geindex AI-0122 (Ada 2012 feature)
27577 @itemize *
27579 @item 
27580 `AI-0122 Private with and children of generics (0000-00-00)'
27582 This AI clarifies the visibility of private children of generic units within
27583 instantiations of a parent. GNAT has always handled this correctly.
27585 RM References:  10.01.02 (12/2)
27586 @end itemize
27588 @geindex AI-0123 (Ada 2012 feature)
27591 @itemize *
27593 @item 
27594 `AI-0123 Composability of equality (2010-04-13)'
27596 Equality of untagged record composes, so that the predefined equality for a
27597 composite type that includes a component of some untagged record type
27598 @code{R} uses the equality operation of @code{R} (which may be user-defined
27599 or predefined). This makes the behavior of untagged records identical to that
27600 of tagged types in this respect.
27602 This change is an incompatibility with previous versions of Ada, but it
27603 corrects a non-uniformity that was often a source of confusion. Analysis of
27604 a large number of industrial programs indicates that in those rare cases
27605 where a composite type had an untagged record component with a user-defined
27606 equality, either there was no use of the composite equality, or else the code
27607 expected the same composability as for tagged types, and thus had a bug that
27608 would be fixed by this change.
27610 RM References:  4.05.02 (9.7/2)   4.05.02 (14)   4.05.02 (15)   4.05.02 (24)
27611 8.05.04 (8)
27612 @end itemize
27614 @geindex AI-0125 (Ada 2012 feature)
27617 @itemize *
27619 @item 
27620 `AI-0125 Nonoverridable operations of an ancestor (2010-09-28)'
27622 In Ada 2012, the declaration of a primitive operation of a type extension
27623 or private extension can also override an inherited primitive that is not
27624 visible at the point of this declaration.
27626 RM References:  7.03.01 (6)   8.03 (23)   8.03.01 (5/2)   8.03.01 (6/2)
27627 @end itemize
27629 @geindex AI-0126 (Ada 2012 feature)
27632 @itemize *
27634 @item 
27635 `AI-0126 Dispatching with no declared operation (0000-00-00)'
27637 This AI clarifies dispatching rules, and simply confirms that dispatching
27638 executes the operation of the parent type when there is no explicitly or
27639 implicitly declared operation for the descendant type. This has always been
27640 the case in all versions of GNAT.
27642 RM References:  3.09.02 (20/2)   3.09.02 (20.1/2)   3.09.02 (20.2/2)
27643 @end itemize
27645 @geindex AI-0127 (Ada 2012 feature)
27648 @itemize *
27650 @item 
27651 `AI-0127 Adding Locale Capabilities (2010-09-29)'
27653 This package provides an interface for identifying the current locale.
27655 RM References:  A.19    A.19.01    A.19.02    A.19.03    A.19.05    A.19.06
27656 A.19.07    A.19.08    A.19.09    A.19.10    A.19.11    A.19.12    A.19.13
27657 @end itemize
27659 @geindex AI-0128 (Ada 2012 feature)
27662 @itemize *
27664 @item 
27665 `AI-0128 Inequality is a primitive operation (0000-00-00)'
27667 If an equality operator (“=”) is declared for a type, then the implicitly
27668 declared inequality operator (“/=”) is a primitive operation of the type.
27669 This is the only reasonable interpretation, and is the one always implemented
27670 by GNAT, but the RM was not entirely clear in making this point.
27672 RM References:  3.02.03 (6)   6.06 (6)
27673 @end itemize
27675 @geindex AI-0129 (Ada 2012 feature)
27678 @itemize *
27680 @item 
27681 `AI-0129 Limited views and incomplete types (0000-00-00)'
27683 This AI clarifies the description of limited views: a limited view of a
27684 package includes only one view of a type that has an incomplete declaration
27685 and a full declaration (there is no possible ambiguity in a client package).
27686 This AI also fixes an omission: a nested package in the private part has no
27687 limited view. GNAT always implemented this correctly.
27689 RM References:  10.01.01 (12.2/2)   10.01.01 (12.3/2)
27690 @end itemize
27692 @geindex AI-0132 (Ada 2012 feature)
27695 @itemize *
27697 @item 
27698 `AI-0132 Placement of library unit pragmas (0000-00-00)'
27700 This AI fills a gap in the description of library unit pragmas. The pragma
27701 clearly must apply to a library unit, even if it does not carry the name
27702 of the enclosing unit. GNAT has always enforced the required check.
27704 RM References:  10.01.05 (7)
27705 @end itemize
27707 @geindex AI-0134 (Ada 2012 feature)
27710 @itemize *
27712 @item 
27713 `AI-0134 Profiles must match for full conformance (0000-00-00)'
27715 For full conformance, the profiles of anonymous-access-to-subprogram
27716 parameters must match. GNAT has always enforced this rule.
27718 RM References:  6.03.01 (18)
27719 @end itemize
27721 @geindex AI-0137 (Ada 2012 feature)
27724 @itemize *
27726 @item 
27727 `AI-0137 String encoding package (2010-03-25)'
27729 The packages @code{Ada.Strings.UTF_Encoding}, together with its child
27730 packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings},
27731 and @code{Wide_Wide_Strings} have been
27732 implemented. These packages (whose documentation can be found in the spec
27733 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
27734 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
27735 @code{String}, @code{Wide_String}, and @code{Wide_Wide_String}
27736 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
27737 UTF-16), as well as conversions between the different UTF encodings. With
27738 the exception of @code{Wide_Wide_Strings}, these packages are available in
27739 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
27740 The @code{Wide_Wide_Strings} package
27741 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
27742 mode since it uses @code{Wide_Wide_Character}).
27744 RM References:  A.04.11
27745 @end itemize
27747 @geindex AI-0139-2 (Ada 2012 feature)
27750 @itemize *
27752 @item 
27753 `AI-0139-2 Syntactic sugar for iterators (2010-09-29)'
27755 The new syntax for iterating over arrays and containers is now implemented.
27756 Iteration over containers is for now limited to read-only iterators. Only
27757 default iterators are supported, with the syntax: @code{for Elem of C}.
27759 RM References:  5.05
27760 @end itemize
27762 @geindex AI-0146 (Ada 2012 feature)
27765 @itemize *
27767 @item 
27768 `AI-0146 Type invariants (2009-09-21)'
27770 Type invariants may be specified for private types using the aspect notation.
27771 Aspect @code{Type_Invariant} may be specified for any private type,
27772 @code{Type_Invariant'Class} can
27773 only be specified for tagged types, and is inherited by any descendent of the
27774 tagged types. The invariant is a boolean expression that is tested for being
27775 true in the following situations: conversions to the private type, object
27776 declarations for the private type that are default initialized, and
27777 [`in'] `out'
27778 parameters and returned result on return from any primitive operation for
27779 the type that is visible to a client.
27780 GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and
27781 @code{Invariant'Class} for @code{Type_Invariant'Class}.
27783 RM References:  13.03.03 (00)
27784 @end itemize
27786 @geindex AI-0147 (Ada 2012 feature)
27789 @itemize *
27791 @item 
27792 `AI-0147 Conditional expressions (2009-03-29)'
27794 Conditional expressions are permitted. The form of such an expression is:
27796 @example
27797 (if expr then expr @{elsif expr then expr@} [else expr])
27798 @end example
27800 The parentheses can be omitted in contexts where parentheses are present
27801 anyway, such as subprogram arguments and pragma arguments. If the `else'
27802 clause is omitted, `else' `True' is assumed;
27803 thus @code{(if A then B)} is a way to conveniently represent
27804 `(A implies B)' in standard logic.
27806 RM References:  4.03.03 (15)   4.04 (1)   4.04 (7)   4.05.07 (0)   4.07 (2)
27807 4.07 (3)   4.09 (12)   4.09 (33)   5.03 (3)   5.03 (4)   7.05 (2.1/2)
27808 @end itemize
27810 @geindex AI-0152 (Ada 2012 feature)
27813 @itemize *
27815 @item 
27816 `AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)'
27818 Restriction @code{No_Anonymous_Allocators} prevents the use of allocators
27819 where the type of the returned value is an anonymous access type.
27821 RM References:  H.04 (8/1)
27822 @end itemize
27824 @geindex AI-0157 (Ada 2012 feature)
27827 @itemize *
27829 @item 
27830 `AI-0157 Allocation/Deallocation from empty pool (2010-07-11)'
27832 Allocation and Deallocation from an empty storage pool (i.e. allocation or
27833 deallocation of a pointer for which a static storage size clause of zero
27834 has been given) is now illegal and is detected as such. GNAT
27835 previously gave a warning but not an error.
27837 RM References:  4.08 (5.3/2)   13.11.02 (4)   13.11.02 (17)
27838 @end itemize
27840 @geindex AI-0158 (Ada 2012 feature)
27843 @itemize *
27845 @item 
27846 `AI-0158 Generalizing membership tests (2010-09-16)'
27848 This AI extends the syntax of membership tests to simplify complex conditions
27849 that can be expressed as membership in a subset of values of any type. It
27850 introduces syntax for a list of expressions that may be used in loop contexts
27851 as well.
27853 RM References:  3.08.01 (5)   4.04 (3)   4.05.02 (3)   4.05.02 (5)   4.05.02 (27)
27854 @end itemize
27856 @geindex AI-0161 (Ada 2012 feature)
27859 @itemize *
27861 @item 
27862 `AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)'
27864 A new restriction @code{No_Default_Stream_Attributes} prevents the use of any
27865 of the default stream attributes for elementary types. If this restriction is
27866 in force, then it is necessary to provide explicit subprograms for any
27867 stream attributes used.
27869 RM References:  13.12.01 (4/2)   13.13.02 (40/2)   13.13.02 (52/2)
27870 @end itemize
27872 @geindex AI-0162 (Ada 2012 feature)
27875 @itemize *
27877 @item 
27878 `AI-0162 Incomplete type completed by partial view (2010-09-15)'
27880 Incomplete types are made more useful by allowing them to be completed by
27881 private types and private extensions.
27883 RM References:  3.10.01 (2.5/2)   3.10.01 (2.6/2)   3.10.01 (3)   3.10.01 (4/2)
27884 @end itemize
27886 @geindex AI-0163 (Ada 2012 feature)
27889 @itemize *
27891 @item 
27892 `AI-0163 Pragmas in place of null (2010-07-01)'
27894 A statement sequence may be composed entirely of pragmas. It is no longer
27895 necessary to add a dummy @code{null} statement to make the sequence legal.
27897 RM References:  2.08 (7)   2.08 (16)
27898 @end itemize
27900 @geindex AI-0171 (Ada 2012 feature)
27903 @itemize *
27905 @item 
27906 `AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)'
27908 A new package @code{System.Multiprocessors} is added, together with the
27909 definition of pragma @code{CPU} for controlling task affinity. A new no
27910 dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains},
27911 is added to the Ravenscar profile.
27913 RM References:  D.13.01 (4/2)   D.16
27914 @end itemize
27916 @geindex AI-0173 (Ada 2012 feature)
27919 @itemize *
27921 @item 
27922 `AI-0173 Testing if tags represent abstract types (2010-07-03)'
27924 The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked
27925 with the tag of an abstract type, and @code{False} otherwise.
27927 RM References:  3.09 (7.4/2)   3.09 (12.4/2)
27928 @end itemize
27930 @geindex AI-0176 (Ada 2012 feature)
27933 @itemize *
27935 @item 
27936 `AI-0176 Quantified expressions (2010-09-29)'
27938 Both universally and existentially quantified expressions are implemented.
27939 They use the new syntax for iterators proposed in AI05-139-2, as well as
27940 the standard Ada loop syntax.
27942 RM References:  1.01.04 (12)   2.09 (2/2)   4.04 (7)   4.05.09 (0)
27943 @end itemize
27945 @geindex AI-0177 (Ada 2012 feature)
27948 @itemize *
27950 @item 
27951 `AI-0177 Parameterized expressions (2010-07-10)'
27953 The new Ada 2012 notion of parameterized expressions is implemented. The form
27956 @example
27957 function-specification is (expression)
27958 @end example
27960 This is exactly equivalent to the
27961 corresponding function body that returns the expression, but it can appear
27962 in a package spec. Note that the expression must be parenthesized.
27964 RM References:  13.11.01 (3/2)
27965 @end itemize
27967 @geindex AI-0178 (Ada 2012 feature)
27970 @itemize *
27972 @item 
27973 `AI-0178 Incomplete views are limited (0000-00-00)'
27975 This AI clarifies the role of incomplete views and plugs an omission in the
27976 RM. GNAT always correctly restricted the use of incomplete views and types.
27978 RM References:  7.05 (3/2)   7.05 (6/2)
27979 @end itemize
27981 @geindex AI-0179 (Ada 2012 feature)
27984 @itemize *
27986 @item 
27987 `AI-0179 Statement not required after label (2010-04-10)'
27989 It is not necessary to have a statement following a label, so a label
27990 can appear at the end of a statement sequence without the need for putting a
27991 null statement afterwards, but it is not allowable to have only labels and
27992 no real statements in a statement sequence.
27994 RM References:  5.01 (2)
27995 @end itemize
27997 @geindex AI-0181 (Ada 2012 feature)
28000 @itemize *
28002 @item 
28003 `AI-0181 Soft hyphen is a non-graphic character (2010-07-23)'
28005 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
28006 means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the
28007 @code{Image} and @code{Value} attributes for the character types. Strictly
28008 speaking this is an inconsistency with Ada 95, but in practice the use of
28009 these attributes is so obscure that it will not cause problems.
28011 RM References:  3.05.02 (2/2)   A.01 (35/2)   A.03.03 (21)
28012 @end itemize
28014 @geindex AI-0182 (Ada 2012 feature)
28017 @itemize *
28019 @item 
28020 `AI-0182 Additional forms for' @code{Character'Value} `(0000-00-00)'
28022 This AI allows @code{Character'Value} to accept the string @code{'?'} where
28023 @code{?} is any character including non-graphic control characters. GNAT has
28024 always accepted such strings. It also allows strings such as
28025 @code{HEX_00000041} to be accepted, but GNAT does not take advantage of this
28026 permission and raises @code{Constraint_Error}, as is certainly still
28027 permitted.
28029 RM References:  3.05 (56/2)
28030 @end itemize
28032 @geindex AI-0183 (Ada 2012 feature)
28035 @itemize *
28037 @item 
28038 `AI-0183 Aspect specifications (2010-08-16)'
28040 Aspect specifications have been fully implemented except for pre and post-
28041 conditions, and type invariants, which have their own separate AI’s. All
28042 forms of declarations listed in the AI are supported. The following is a
28043 list of the aspects supported (with GNAT implementation aspects marked)
28044 @end itemize
28047 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} 
28048 @headitem
28050 Supported Aspect
28052 @tab
28054 Source
28056 @item
28058 @code{Ada_2005}
28060 @tab
28062 – GNAT
28064 @item
28066 @code{Ada_2012}
28068 @tab
28070 – GNAT
28072 @item
28074 @code{Address}
28076 @tab
28078 @item
28080 @code{Alignment}
28082 @tab
28084 @item
28086 @code{Atomic}
28088 @tab
28090 @item
28092 @code{Atomic_Components}
28094 @tab
28096 @item
28098 @code{Bit_Order}
28100 @tab
28102 @item
28104 @code{Component_Size}
28106 @tab
28108 @item
28110 @code{Contract_Cases}
28112 @tab
28114 – GNAT
28116 @item
28118 @code{Discard_Names}
28120 @tab
28122 @item
28124 @code{External_Tag}
28126 @tab
28128 @item
28130 @code{Favor_Top_Level}
28132 @tab
28134 – GNAT
28136 @item
28138 @code{Inline}
28140 @tab
28142 @item
28144 @code{Inline_Always}
28146 @tab
28148 – GNAT
28150 @item
28152 @code{Invariant}
28154 @tab
28156 – GNAT
28158 @item
28160 @code{Machine_Radix}
28162 @tab
28164 @item
28166 @code{No_Return}
28168 @tab
28170 @item
28172 @code{Object_Size}
28174 @tab
28176 – GNAT
28178 @item
28180 @code{Pack}
28182 @tab
28184 @item
28186 @code{Persistent_BSS}
28188 @tab
28190 – GNAT
28192 @item
28194 @code{Post}
28196 @tab
28198 @item
28200 @code{Pre}
28202 @tab
28204 @item
28206 @code{Predicate}
28208 @tab
28210 @item
28212 @code{Preelaborable_Initialization}
28214 @tab
28216 @item
28218 @code{Pure_Function}
28220 @tab
28222 – GNAT
28224 @item
28226 @code{Remote_Access_Type}
28228 @tab
28230 – GNAT
28232 @item
28234 @code{Shared}
28236 @tab
28238 – GNAT
28240 @item
28242 @code{Size}
28244 @tab
28246 @item
28248 @code{Storage_Pool}
28250 @tab
28252 @item
28254 @code{Storage_Size}
28256 @tab
28258 @item
28260 @code{Stream_Size}
28262 @tab
28264 @item
28266 @code{Suppress}
28268 @tab
28270 @item
28272 @code{Suppress_Debug_Info}
28274 @tab
28276 – GNAT
28278 @item
28280 @code{Test_Case}
28282 @tab
28284 – GNAT
28286 @item
28288 @code{Thread_Local_Storage}
28290 @tab
28292 – GNAT
28294 @item
28296 @code{Type_Invariant}
28298 @tab
28300 @item
28302 @code{Unchecked_Union}
28304 @tab
28306 @item
28308 @code{Universal_Aliasing}
28310 @tab
28312 – GNAT
28314 @item
28316 @code{Unmodified}
28318 @tab
28320 – GNAT
28322 @item
28324 @code{Unreferenced}
28326 @tab
28328 – GNAT
28330 @item
28332 @code{Unreferenced_Objects}
28334 @tab
28336 – GNAT
28338 @item
28340 @code{Unsuppress}
28342 @tab
28344 @item
28346 @code{Value_Size}
28348 @tab
28350 – GNAT
28352 @item
28354 @code{Volatile}
28356 @tab
28358 @item
28360 @code{Volatile_Components}
28362 @tab
28364 @item
28366 @code{Warnings}
28368 @tab
28370 – GNAT
28372 @end multitable
28375 @quotation
28377 Note that for aspects with an expression, e.g. @code{Size}, the expression is
28378 treated like a default expression (visibility is analyzed at the point of
28379 occurrence of the aspect, but evaluation of the expression occurs at the
28380 freeze point of the entity involved).
28382 RM References:  3.02.01 (3)   3.02.02 (2)   3.03.01 (2/2)   3.08 (6)
28383 3.09.03 (1.1/2)   6.01 (2/2)   6.07 (2/2)   9.05.02 (2/2)   7.01 (3)   7.03
28384 (2)   7.03 (3)   9.01 (2/2)   9.01 (3/2)   9.04 (2/2)   9.04 (3/2)
28385 9.05.02 (2/2)   11.01 (2)   12.01 (3)   12.03 (2/2)   12.04 (2/2)   12.05 (2)
28386 12.06 (2.1/2)   12.06 (2.2/2)   12.07 (2)   13.01 (0.1/2)   13.03 (5/1)
28387 13.03.01 (0)
28388 @end quotation
28390 @geindex AI-0185 (Ada 2012 feature)
28393 @itemize *
28395 @item 
28396 `AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)'
28398 Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide
28399 classification functions for @code{Wide_Character} and
28400 @code{Wide_Wide_Character}, as well as providing
28401 case folding routines for @code{Wide_[Wide_]Character} and
28402 @code{Wide_[Wide_]String}.
28404 RM References:  A.03.05 (0)   A.03.06 (0)
28405 @end itemize
28407 @geindex AI-0188 (Ada 2012 feature)
28410 @itemize *
28412 @item 
28413 `AI-0188 Case expressions (2010-01-09)'
28415 Case expressions are permitted. This allows use of constructs such as:
28417 @example
28418 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
28419 @end example
28421 RM References:  4.05.07 (0)   4.05.08 (0)   4.09 (12)   4.09 (33)
28422 @end itemize
28424 @geindex AI-0189 (Ada 2012 feature)
28427 @itemize *
28429 @item 
28430 `AI-0189 No_Allocators_After_Elaboration (2010-01-23)'
28432 This AI introduces a new restriction @code{No_Allocators_After_Elaboration},
28433 which says that no dynamic allocation will occur once elaboration is
28434 completed.
28435 In general this requires a run-time check, which is not required, and which
28436 GNAT does not attempt. But the static cases of allocators in a task body or
28437 in the body of the main program are detected and flagged at compile or bind
28438 time.
28440 RM References:  D.07 (19.1/2)   H.04 (23.3/2)
28441 @end itemize
28443 @geindex AI-0190 (Ada 2012 feature)
28446 @itemize *
28448 @item 
28449 `AI-0190 pragma Default_Storage_Pool (2010-09-15)'
28451 This AI introduces a new pragma @code{Default_Storage_Pool}, which can be
28452 used to control storage pools globally.
28453 In particular, you can force every access
28454 type that is used for allocation (`new') to have an explicit storage pool,
28455 or you can declare a pool globally to be used for all access types that lack
28456 an explicit one.
28458 RM References:  D.07 (8)
28459 @end itemize
28461 @geindex AI-0193 (Ada 2012 feature)
28464 @itemize *
28466 @item 
28467 `AI-0193 Alignment of allocators (2010-09-16)'
28469 This AI introduces a new attribute @code{Max_Alignment_For_Allocation},
28470 analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead
28471 of size.
28473 RM References:  13.11 (16)   13.11 (21)   13.11.01 (0)   13.11.01 (1)
28474 13.11.01 (2)   13.11.01 (3)
28475 @end itemize
28477 @geindex AI-0194 (Ada 2012 feature)
28480 @itemize *
28482 @item 
28483 `AI-0194 Value of Stream_Size attribute (0000-00-00)'
28485 The @code{Stream_Size} attribute returns the default number of bits in the
28486 stream representation of the given type.
28487 This value is not affected by the presence
28488 of stream subprogram attributes for the type. GNAT has always implemented
28489 this interpretation.
28491 RM References:  13.13.02 (1.2/2)
28492 @end itemize
28494 @geindex AI-0195 (Ada 2012 feature)
28497 @itemize *
28499 @item 
28500 `AI-0195 Invalid value handling is implementation defined (2010-07-03)'
28502 The handling of invalid values is now designated to be implementation
28503 defined. This is a documentation change only, requiring Annex M in the GNAT
28504 Reference Manual to document this handling.
28505 In GNAT, checks for invalid values are made
28506 only when necessary to avoid erroneous behavior. Operations like assignments
28507 which cannot cause erroneous behavior ignore the possibility of invalid
28508 values and do not do a check. The date given above applies only to the
28509 documentation change, this behavior has always been implemented by GNAT.
28511 RM References:  13.09.01 (10)
28512 @end itemize
28514 @geindex AI-0196 (Ada 2012 feature)
28517 @itemize *
28519 @item 
28520 `AI-0196 Null exclusion tests for out parameters (0000-00-00)'
28522 Null exclusion checks are not made for @code{out} parameters when
28523 evaluating the actual parameters. GNAT has never generated these checks.
28525 RM References:  6.04.01 (13)
28526 @end itemize
28528 @geindex AI-0198 (Ada 2012 feature)
28531 @itemize *
28533 @item 
28534 `AI-0198 Inheriting abstract operators  (0000-00-00)'
28536 This AI resolves a conflict between two rules involving inherited abstract
28537 operations and predefined operators. If a derived numeric type inherits
28538 an abstract operator, it overrides the predefined one. This interpretation
28539 was always the one implemented in GNAT.
28541 RM References:  3.09.03 (4/3)
28542 @end itemize
28544 @geindex AI-0199 (Ada 2012 feature)
28547 @itemize *
28549 @item 
28550 `AI-0199 Aggregate with anonymous access components (2010-07-14)'
28552 A choice list in a record aggregate can include several components of
28553 (distinct) anonymous access types as long as they have matching designated
28554 subtypes.
28556 RM References:  4.03.01 (16)
28557 @end itemize
28559 @geindex AI-0200 (Ada 2012 feature)
28562 @itemize *
28564 @item 
28565 `AI-0200 Mismatches in formal package declarations (0000-00-00)'
28567 This AI plugs a gap in the RM which appeared to allow some obviously intended
28568 illegal instantiations. GNAT has never allowed these instantiations.
28570 RM References:  12.07 (16)
28571 @end itemize
28573 @geindex AI-0201 (Ada 2012 feature)
28576 @itemize *
28578 @item 
28579 `AI-0201 Independence of atomic object components (2010-07-22)'
28581 If an Atomic object has a pragma @code{Pack} or a @code{Component_Size}
28582 attribute, then individual components may not be addressable by independent
28583 tasks. However, if the representation clause has no effect (is confirming),
28584 then independence is not compromised. Furthermore, in GNAT, specification of
28585 other appropriately addressable component sizes (e.g. 16 for 8-bit
28586 characters) also preserves independence. GNAT now gives very clear warnings
28587 both for the declaration of such a type, and for any assignment to its components.
28589 RM References:  9.10 (1/3)   C.06 (22/2)   C.06 (23/2)
28590 @end itemize
28592 @geindex AI-0203 (Ada 2012 feature)
28595 @itemize *
28597 @item 
28598 `AI-0203 Extended return cannot be abstract (0000-00-00)'
28600 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
28601 permitted such usage.
28603 RM References:  3.09.03 (8/3)
28604 @end itemize
28606 @geindex AI-0205 (Ada 2012 feature)
28609 @itemize *
28611 @item 
28612 `AI-0205 Extended return declares visible name (0000-00-00)'
28614 This AI corrects a simple omission in the RM. Return objects have always
28615 been visible within an extended return statement.
28617 RM References:  8.03 (17)
28618 @end itemize
28620 @geindex AI-0206 (Ada 2012 feature)
28623 @itemize *
28625 @item 
28626 `AI-0206 Remote types packages and preelaborate (2010-07-24)'
28628 Remote types packages are now allowed to depend on preelaborated packages.
28629 This was formerly considered illegal.
28631 RM References:  E.02.02 (6)
28632 @end itemize
28634 @geindex AI-0207 (Ada 2012 feature)
28637 @itemize *
28639 @item 
28640 `AI-0207 Mode conformance and access constant (0000-00-00)'
28642 This AI confirms that access_to_constant indication must match for mode
28643 conformance. This was implemented in GNAT when the qualifier was originally
28644 introduced in Ada 2005.
28646 RM References:  6.03.01 (16/2)
28647 @end itemize
28649 @geindex AI-0208 (Ada 2012 feature)
28652 @itemize *
28654 @item 
28655 `AI-0208 Characteristics of incomplete views (0000-00-00)'
28657 The wording in the Ada 2005 RM concerning characteristics of incomplete views
28658 was incorrect and implied that some programs intended to be legal were now
28659 illegal. GNAT had never considered such programs illegal, so it has always
28660 implemented the intent of this AI.
28662 RM References:  3.10.01 (2.4/2)   3.10.01 (2.6/2)
28663 @end itemize
28665 @geindex AI-0210 (Ada 2012 feature)
28668 @itemize *
28670 @item 
28671 `AI-0210 Correct Timing_Events metric (0000-00-00)'
28673 This is a documentation only issue regarding wording of metric requirements,
28674 that does not affect the implementation of the compiler.
28676 RM References:  D.15 (24/2)
28677 @end itemize
28679 @geindex AI-0211 (Ada 2012 feature)
28682 @itemize *
28684 @item 
28685 `AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)'
28687 The restriction @code{No_Relative_Delays} forbids any calls to the subprogram
28688 @code{Ada.Real_Time.Timing_Events.Set_Handler}.
28690 RM References:  D.07 (5)   D.07 (10/2)   D.07 (10.4/2)   D.07 (10.7/2)
28691 @end itemize
28693 @geindex AI-0214 (Ada 2012 feature)
28696 @itemize *
28698 @item 
28699 `AI-0214 Defaulted discriminants for limited tagged (2010-10-01)'
28701 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
28702 to have default expressions by allowing them when the type is limited. It
28703 is often useful to define a default value for a discriminant even though
28704 it can’t be changed by assignment.
28706 RM References:  3.07 (9.1/2)   3.07.02 (3)
28707 @end itemize
28709 @geindex AI-0216 (Ada 2012 feature)
28712 @itemize *
28714 @item 
28715 `AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)'
28717 It is clearly the intention that @code{No_Task_Hierarchy} is intended to
28718 forbid tasks declared locally within subprograms, or functions returning task
28719 objects, and that is the implementation that GNAT has always provided.
28720 However the language in the RM was not sufficiently clear on this point.
28721 Thus this is a documentation change in the RM only.
28723 RM References:  D.07 (3/3)
28724 @end itemize
28726 @geindex AI-0219 (Ada 2012 feature)
28729 @itemize *
28731 @item 
28732 `AI-0219 Pure permissions and limited parameters (2010-05-25)'
28734 This AI refines the rules for the cases with limited parameters which do not
28735 allow the implementations to omit ‘redundant’. GNAT now properly conforms
28736 to the requirements of this binding interpretation.
28738 RM References:  10.02.01 (18/2)
28739 @end itemize
28741 @geindex AI-0220 (Ada 2012 feature)
28744 @itemize *
28746 @item 
28747 `AI-0220 Needed components for aggregates (0000-00-00)'
28749 This AI addresses a wording problem in the RM that appears to permit some
28750 complex cases of aggregates with nonstatic discriminants. GNAT has always
28751 implemented the intended semantics.
28753 RM References:  4.03.01 (17)
28754 @end itemize
28756 @node GNAT language extensions,Security Hardening Features,Implementation of Ada 2012 Features,Top
28757 @anchor{gnat_rm/gnat_language_extensions doc}@anchor{43d}@anchor{gnat_rm/gnat_language_extensions gnat-language-extensions}@anchor{43e}@anchor{gnat_rm/gnat_language_extensions id1}@anchor{43f}
28758 @chapter GNAT language extensions
28761 The GNAT compiler implements a certain number of language extensions on top of
28762 the latest Ada standard, implementing its own extended superset of Ada.
28764 There are two sets of language extensions:
28767 @itemize *
28769 @item 
28770 The first is the curated set. The features in that set are features that we
28771 consider being worthy additions to the Ada language, and that we want to make
28772 available to users early on.
28774 @item 
28775 The second is the experimental set. It includes the first, but also
28776 experimental features, that are here because they’re still in an early
28777 prototyping phase.
28778 @end itemize
28780 @menu
28781 * How to activate the extended GNAT Ada superset:: 
28782 * Curated Extensions:: 
28783 * Experimental Language Extensions:: 
28785 @end menu
28787 @node How to activate the extended GNAT Ada superset,Curated Extensions,,GNAT language extensions
28788 @anchor{gnat_rm/gnat_language_extensions how-to-activate-the-extended-gnat-ada-superset}@anchor{440}
28789 @section How to activate the extended GNAT Ada superset
28792 There are two ways to activate the extended GNAT Ada superset:
28795 @itemize *
28797 @item 
28798 The @ref{68,,Pragma Extensions_Allowed}. To activate
28799 the curated set of extensions, you should use
28800 @end itemize
28802 @example
28803 pragma Extensions_Allowed (On)
28804 @end example
28806 As a configuration pragma, you can either put it at the beginning of a source
28807 file, or in a @code{.adc} file corresponding to your project.
28810 @itemize *
28812 @item 
28813 The @code{-gnatX} option, that you can pass to the compiler directly, will
28814 activate the curated subset of extensions.
28815 @end itemize
28817 @cartouche
28818 @quotation Attention 
28819 You can activate the extended set of extensions by using either
28820 the @code{-gnatX0} command line flag, or the pragma @code{Extensions_Allowed} with
28821 @code{All_Extensions} as an argument. However, it is not recommended you use
28822 this subset for serious projects; it is only meant as a technology preview
28823 for use in playground experiments.
28824 @end quotation
28825 @end cartouche
28827 @node Curated Extensions,Experimental Language Extensions,How to activate the extended GNAT Ada superset,GNAT language extensions
28828 @anchor{gnat_rm/gnat_language_extensions curated-extensions}@anchor{441}@anchor{gnat_rm/gnat_language_extensions curated-language-extensions}@anchor{69}
28829 @section Curated Extensions
28832 @menu
28833 * Local Declarations Without Block:: 
28834 * Conditional when constructs:: 
28835 * Fixed lower bounds for array types and subtypes:: 
28836 * Prefixed-view notation for calls to primitive subprograms of untagged types:: 
28837 * Expression defaults for generic formal functions:: 
28838 * String interpolation:: 
28839 * Constrained attribute for generic objects:: 
28840 * Static aspect on intrinsic functions:: 
28842 @end menu
28844 @node Local Declarations Without Block,Conditional when constructs,,Curated Extensions
28845 @anchor{gnat_rm/gnat_language_extensions local-declarations-without-block}@anchor{442}
28846 @subsection Local Declarations Without Block
28849 A basic_declarative_item may appear at the place of any statement.
28850 This avoids the heavy syntax of block_statements just to declare
28851 something locally.
28853 Link to the original RFC:
28854 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-local-vars-without-block.md}
28855 For example:
28857 @example
28858 if X > 5 then
28859    X := X + 1;
28861    Squared : constant Integer := X**2;
28863    X := X + Squared;
28864 end if;
28865 @end example
28867 @node Conditional when constructs,Fixed lower bounds for array types and subtypes,Local Declarations Without Block,Curated Extensions
28868 @anchor{gnat_rm/gnat_language_extensions conditional-when-constructs}@anchor{443}
28869 @subsection Conditional when constructs
28872 This feature extends the use of @code{when} as a way to condition a control-flow
28873 related statement, to all control-flow related statements.
28875 To do a conditional return in a procedure the following syntax should be used:
28877 @example
28878 procedure P (Condition : Boolean) is
28879 begin
28880    return when Condition;
28881 end;
28882 @end example
28884 This will return from the procedure if @code{Condition} is true.
28886 When being used in a function the conditional part comes after the return value:
28888 @example
28889 function Is_Null (I : Integer) return Boolean is
28890 begin
28891    return True when I = 0;
28892    return False;
28893 end;
28894 @end example
28896 In a similar way to the @code{exit when} a @code{goto ... when} can be employed:
28898 @example
28899 procedure Low_Level_Optimized is
28900    Flags : Bitmapping;
28901 begin
28902    Do_1 (Flags);
28903    goto Cleanup when Flags (1);
28905    Do_2 (Flags);
28906    goto Cleanup when Flags (32);
28908    --  ...
28910 <<Cleanup>>
28911    --  ...
28912 end;
28913 @end example
28915 @c code-block
28917 To use a conditional raise construct:
28919 @example
28920 procedure Foo is
28921 begin
28922    raise Error when Imported_C_Func /= 0;
28923 end;
28924 @end example
28926 An exception message can also be added:
28928 @example
28929 procedure Foo is
28930 begin
28931    raise Error with "Unix Error"
28932      when Imported_C_Func /= 0;
28933 end;
28934 @end example
28936 Link to the original RFC:
28937 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-conditional-when-constructs.rst}
28939 @node Fixed lower bounds for array types and subtypes,Prefixed-view notation for calls to primitive subprograms of untagged types,Conditional when constructs,Curated Extensions
28940 @anchor{gnat_rm/gnat_language_extensions fixed-lower-bounds-for-array-types-and-subtypes}@anchor{444}
28941 @subsection Fixed lower bounds for array types and subtypes
28944 Unconstrained array types and subtypes can be specified with a lower bound that
28945 is fixed to a certain value, by writing an index range that uses the syntax
28946 @code{<lower-bound-expression> .. <>}. This guarantees that all objects of the
28947 type or subtype will have the specified lower bound.
28949 For example, a matrix type with fixed lower bounds of zero for each dimension
28950 can be declared by the following:
28952 @example
28953 type Matrix is
28954   array (Natural range 0 .. <>, Natural range 0 .. <>) of Integer;
28955 @end example
28957 Objects of type @code{Matrix} declared with an index constraint must have index
28958 ranges starting at zero:
28960 @example
28961 M1 : Matrix (0 .. 9, 0 .. 19);
28962 M2 : Matrix (2 .. 11, 3 .. 22);  -- Warning about bounds; will raise CE
28963 @end example
28965 Similarly, a subtype of @code{String} can be declared that specifies the lower
28966 bound of objects of that subtype to be @code{1}:
28968 @quotation
28970 @example
28971 subtype String_1 is String (1 .. <>);
28972 @end example
28973 @end quotation
28975 If a string slice is passed to a formal of subtype @code{String_1} in a call to a
28976 subprogram @code{S}, the slice’s bounds will “slide” so that the lower bound is
28977 @code{1}.
28979 Within @code{S}, the lower bound of the formal is known to be @code{1}, so, unlike a
28980 normal unconstrained @code{String} formal, there is no need to worry about
28981 accounting for other possible lower-bound values. Sliding of bounds also occurs
28982 in other contexts, such as for object declarations with an unconstrained
28983 subtype with fixed lower bound, as well as in subtype conversions.
28985 Use of this feature increases safety by simplifying code, and can also improve
28986 the efficiency of indexing operations, since the compiler statically knows the
28987 lower bound of unconstrained array formals when the formal’s subtype has index
28988 ranges with static fixed lower bounds.
28990 Link to the original RFC:
28991 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-fixed-lower-bound.rst}
28993 @node Prefixed-view notation for calls to primitive subprograms of untagged types,Expression defaults for generic formal functions,Fixed lower bounds for array types and subtypes,Curated Extensions
28994 @anchor{gnat_rm/gnat_language_extensions prefixed-view-notation-for-calls-to-primitive-subprograms-of-untagged-types}@anchor{445}
28995 @subsection Prefixed-view notation for calls to primitive subprograms of untagged types
28998 When operating on an untagged type, if it has any primitive operations, and the
28999 first parameter of an operation is of the type (or is an access parameter with
29000 an anonymous type that designates the type), you may invoke these operations
29001 using an @code{object.op(...)} notation, where the parameter that would normally be
29002 the first parameter is brought out front, and the remaining parameters (if any)
29003 appear within parentheses after the name of the primitive operation.
29005 This same notation is already available for tagged types. This extension allows
29006 for untagged types. It is allowed for all primitive operations of the type
29007 independent of whether they were originally declared in a package spec or its
29008 private part, or were inherited and/or overridden as part of a derived type
29009 declaration occuring anywhere, so long as the first parameter is of the type,
29010 or an access parameter designating the type.
29012 For example:
29014 @example
29015 generic
29016    type Elem_Type is private;
29017 package Vectors is
29018     type Vector is private;
29019     procedure Add_Element (V : in out Vector; Elem : Elem_Type);
29020     function Nth_Element (V : Vector; N : Positive) return Elem_Type;
29021     function Length (V : Vector) return Natural;
29022 private
29023     function Capacity (V : Vector) return Natural;
29024        --  Return number of elements that may be added without causing
29025        --  any new allocation of space
29027     type Vector is ...
29028       with Type_Invariant => Vector.Length <= Vector.Capacity;
29029     ...
29030 end Vectors;
29032 package Int_Vecs is new Vectors(Integer);
29034 V : Int_Vecs.Vector;
29036 V.Add_Element(42);
29037 V.Add_Element(-33);
29039 pragma Assert (V.Length = 2);
29040 pragma Assert (V.Nth_Element(1) = 42);
29041 @end example
29043 Link to the original RFC:
29044 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-prefixed-untagged.rst}
29046 @node Expression defaults for generic formal functions,String interpolation,Prefixed-view notation for calls to primitive subprograms of untagged types,Curated Extensions
29047 @anchor{gnat_rm/gnat_language_extensions expression-defaults-for-generic-formal-functions}@anchor{446}
29048 @subsection Expression defaults for generic formal functions
29051 The declaration of a generic formal function is allowed to specify
29052 an expression as a default, using the syntax of an expression function.
29054 Here is an example of this feature:
29056 @example
29057 generic
29058    type T is private;
29059    with function Copy (Item : T) return T is (Item); -- Defaults to Item
29060 package Stacks is
29062    type Stack is limited private;
29064    procedure Push (S : in out Stack; X : T); -- Calls Copy on X
29065    function Pop (S : in out Stack) return T; -- Calls Copy to return item
29067 private
29068    -- ...
29069 end Stacks;
29070 @end example
29072 Link to the original RFC:
29073 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-expression-functions-as-default-for-generic-formal-function-parameters.rst}
29075 @node String interpolation,Constrained attribute for generic objects,Expression defaults for generic formal functions,Curated Extensions
29076 @anchor{gnat_rm/gnat_language_extensions string-interpolation}@anchor{447}
29077 @subsection String interpolation
29080 The syntax for string literals is extended to support string interpolation.
29082 Within an interpolated string literal, an arbitrary expression, when
29083 enclosed in @code{@{ ... @}}, is expanded at run time into the result of calling
29084 @code{'Image} on the result of evaluating the expression enclosed by the brace
29085 characters, unless it is already a string or a single character.
29087 Here is an example of this feature where the expressions @code{Name} and @code{X + Y}
29088 will be evaluated and included in the string.
29090 @example
29091 procedure Test_Interpolation is
29092    X    : Integer := 12;
29093    Y    : Integer := 15;
29094    Name : String := "Leo";
29095 begin
29096    Put_Line (f"The name is @{Name@} and the sum is @{X + Y@}.");
29097 end Test_Interpolation;
29098 @end example
29100 In addition, an escape character (@code{\}) is provided for inserting certain
29101 standard control characters (such as @code{\t} for tabulation or @code{\n} for
29102 newline) or to escape characters with special significance to the
29103 interpolated string syntax, namely @code{"}, @code{@{}, @code{@}},and @code{\} itself.
29106 @multitable {xxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
29107 @item
29109 escaped_character
29111 @tab
29113 meaning
29115 @item
29117 @code{\a}
29119 @tab
29121 ALERT
29123 @item
29125 @code{\b}
29127 @tab
29129 BACKSPACE
29131 @item
29133 @code{\f}
29135 @tab
29137 FORM FEED
29139 @item
29141 @code{\n}
29143 @tab
29145 LINE FEED
29147 @item
29149 @code{\r}
29151 @tab
29153 CARRIAGE RETURN
29155 @item
29157 @code{\t}
29159 @tab
29161 CHARACTER TABULATION
29163 @item
29165 @code{\v}
29167 @tab
29169 LINE TABULATION
29171 @item
29173 @code{\0}
29175 @tab
29179 @item
29181 @code{\\}
29183 @tab
29185 @code{\}
29187 @item
29189 @code{\"}
29191 @tab
29193 @code{"}
29195 @item
29197 @code{\@{}
29199 @tab
29201 @code{@{}
29203 @item
29205 @code{\@}}
29207 @tab
29209 @code{@}}
29211 @end multitable
29214 Note that, unlike normal string literals, doubled characters have no
29215 special significance. So to include a double-quote or a brace character
29216 in an interpolated string, they must be preceded by a @code{\}.
29217 For example:
29219 @example
29220 Put_Line
29221   (f"X = @{X@} and Y = @{Y@} and X+Y = @{X+Y@};\n" &
29222    f" a double quote is \" and" &
29223    f" an open brace is \@{");
29224 @end example
29226 Finally, a syntax is provided for creating multi-line string literals,
29227 without having to explicitly use an escape sequence such as @code{\n}. For
29228 example:
29230 @example
29231 Put_Line
29232   (f"This is a multi-line"
29233     "string literal"
29234     "There is no ambiguity about how many"
29235     "spaces are included in each line");
29236 @end example
29238 Here is a link to the original RFC   :
29239 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-string-interpolation.rst}
29241 @node Constrained attribute for generic objects,Static aspect on intrinsic functions,String interpolation,Curated Extensions
29242 @anchor{gnat_rm/gnat_language_extensions constrained-attribute-for-generic-objects}@anchor{448}
29243 @subsection Constrained attribute for generic objects
29246 The @code{Constrained} attribute is permitted for objects of generic types. The
29247 result indicates whether the corresponding actual is constrained.
29249 @node Static aspect on intrinsic functions,,Constrained attribute for generic objects,Curated Extensions
29250 @anchor{gnat_rm/gnat_language_extensions static-aspect-on-intrinsic-functions}@anchor{449}
29251 @subsection @code{Static} aspect on intrinsic functions
29254 The Ada 202x @code{Static} aspect can be specified on Intrinsic imported functions
29255 and the compiler will evaluate some of these intrinsics statically, in
29256 particular the @code{Shift_Left} and @code{Shift_Right} intrinsics.
29258 @node Experimental Language Extensions,,Curated Extensions,GNAT language extensions
29259 @anchor{gnat_rm/gnat_language_extensions experimental-language-extensions}@anchor{6a}@anchor{gnat_rm/gnat_language_extensions id2}@anchor{44a}
29260 @section Experimental Language Extensions
29263 @menu
29264 * Storage Model:: 
29265 * Attribute Super:: 
29266 * Simpler accessibility model:: 
29267 * Case pattern matching:: 
29268 * Mutably Tagged Types with Size’Class Aspect:: 
29269 * Generalized Finalization:: 
29271 @end menu
29273 @node Storage Model,Attribute Super,,Experimental Language Extensions
29274 @anchor{gnat_rm/gnat_language_extensions storage-model}@anchor{44b}
29275 @subsection Storage Model
29278 This feature proposes to redesign the concepts of Storage Pools into a more
29279 efficient model allowing higher performances and easier integration with low
29280 footprint embedded run-times.
29282 It also extends it to support distributed memory models, in particular to
29283 support interactions with GPU.
29285 Here is a link to the full RFC:
29286 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-storage-model.rst}
29288 @node Attribute Super,Simpler accessibility model,Storage Model,Experimental Language Extensions
29289 @anchor{gnat_rm/gnat_language_extensions attribute-super}@anchor{44c}
29290 @subsection Attribute Super
29293 @geindex Super
29295 The @code{Super} attribute can be applied to objects of tagged types in order
29296 to obtain a view conversion to the most immediate specific parent type.
29298 It cannot be applied to objects of types without any ancestors, or types whose
29299 immediate parent is abstract.
29301 @example
29302 type T1 is tagged null record;
29303 procedure P (V : T1);
29305 type T2 is new T1 with null record;
29306 procedure P (V : T2);
29308 procedure Call (V : T2'Class) is
29309 begin
29310   V'Super.P; --  Equivalent to "P (T1 (V));", a nondispatching call
29311              --  to T1's primitive procedure P.
29312 end;
29313 @end example
29315 Here is a link to the full RFC:
29316 @indicateurl{https://github.com/QuentinOchem/ada-spark-rfcs/blob/oop/considered/rfc-oop-super.rst}
29318 @node Simpler accessibility model,Case pattern matching,Attribute Super,Experimental Language Extensions
29319 @anchor{gnat_rm/gnat_language_extensions simpler-accessibility-model}@anchor{44d}
29320 @subsection Simpler accessibility model
29323 The goal of this feature is to restore a common understanding of accessibility
29324 rules for implementers and users alike. The new rules should both be effective
29325 at preventing errors and feel natural and compatible in an Ada environment
29326 while removing dynamic accessibility checking.
29328 Here is a link to the full RFC:
29329 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-simpler-accessibility.md}
29331 @node Case pattern matching,Mutably Tagged Types with Size’Class Aspect,Simpler accessibility model,Experimental Language Extensions
29332 @anchor{gnat_rm/gnat_language_extensions case-pattern-matching}@anchor{44e}
29333 @subsection Case pattern matching
29336 The selector for a case statement (but not yet for a case expression) may be of a composite type, subject to
29337 some restrictions (described below). Aggregate syntax is used for choices
29338 of such a case statement; however, in cases where a “normal” aggregate would
29339 require a discrete value, a discrete subtype may be used instead; box
29340 notation can also be used to match all values.
29342 Consider this example:
29344 @example
29345 type Rec is record
29346    F1, F2 : Integer;
29347 end record;
29349 procedure Caser_1 (X : Rec) is
29350 begin
29351    case X is
29352       when (F1 => Positive, F2 => Positive) =>
29353          Do_This;
29354       when (F1 => Natural, F2 => <>) | (F1 => <>, F2 => Natural) =>
29355          Do_That;
29356       when others =>
29357           Do_The_Other_Thing;
29358    end case;
29359 end Caser_1;
29360 @end example
29362 If @code{Caser_1} is called and both components of X are positive, then
29363 @code{Do_This} will be called; otherwise, if either component is nonnegative
29364 then @code{Do_That} will be called; otherwise, @code{Do_The_Other_Thing} will be
29365 called.
29367 In addition, pattern bindings are supported. This is a mechanism
29368 for binding a name to a component of a matching value for use within
29369 an alternative of a case statement. For a component association
29370 that occurs within a case choice, the expression may be followed by
29371 @code{is <identifier>}. In the special case of a “box” component association,
29372 the identifier may instead be provided within the box. Either of these
29373 indicates that the given identifier denotes (a constant view of) the matching
29374 subcomponent of the case selector.
29376 @cartouche
29377 @quotation Attention 
29378 Binding is not yet supported for arrays or subcomponents
29379 thereof.
29380 @end quotation
29381 @end cartouche
29383 Consider this example (which uses type @code{Rec} from the previous example):
29385 @example
29386 procedure Caser_2 (X : Rec) is
29387 begin
29388    case X is
29389       when (F1 => Positive is Abc, F2 => Positive) =>
29390          Do_This (Abc)
29391       when (F1 => Natural is N1, F2 => <N2>) |
29392            (F1 => <N2>, F2 => Natural is N1) =>
29393          Do_That (Param_1 => N1, Param_2 => N2);
29394       when others =>
29395          Do_The_Other_Thing;
29396    end case;
29397 end Caser_2;
29398 @end example
29400 This example is the same as the previous one with respect to determining
29401 whether @code{Do_This}, @code{Do_That}, or @code{Do_The_Other_Thing} will be called. But
29402 for this version, @code{Do_This} takes a parameter and @code{Do_That} takes two
29403 parameters. If @code{Do_This} is called, the actual parameter in the call will be
29404 @code{X.F1}.
29406 If @code{Do_That} is called, the situation is more complex because there are two
29407 choices for that alternative. If @code{Do_That} is called because the first choice
29408 matched (i.e., because @code{X.F1} is nonnegative and either @code{X.F1} or @code{X.F2}
29409 is zero or negative), then the actual parameters of the call will be (in order)
29410 @code{X.F1} and @code{X.F2}. If @code{Do_That} is called because the second choice
29411 matched (and the first one did not), then the actual parameters will be
29412 reversed.
29414 Within the choice list for single alternative, each choice must define the same
29415 set of bindings and the component subtypes for for a given identifer must all
29416 statically match. Currently, the case of a binding for a nondiscrete component
29417 is not implemented.
29419 If the set of values that match the choice(s) of an earlier alternative
29420 overlaps the corresponding set of a later alternative, then the first set shall
29421 be a proper subset of the second (and the later alternative will not be
29422 executed if the earlier alternative “matches”). All possible values of the
29423 composite type shall be covered. The composite type of the selector shall be an
29424 array or record type that is neither limited nor class-wide. Currently, a “when
29425 others =>” case choice is required; it is intended that this requirement will
29426 be relaxed at some point.
29428 If a subcomponent’s subtype does not meet certain restrictions, then the only
29429 value that can be specified for that subcomponent in a case choice expression
29430 is a “box” component association (which matches all possible values for the
29431 subcomponent). This restriction applies if:
29434 @itemize -
29436 @item 
29437 the component subtype is not a record, array, or discrete type; or
29439 @item 
29440 the component subtype is subject to a non-static constraint or has a
29441 predicate; or:
29443 @item 
29444 the component type is an enumeration type that is subject to an enumeration
29445 representation clause; or
29447 @item 
29448 the component type is a multidimensional array type or an array type with a
29449 nonstatic index subtype.
29450 @end itemize
29452 Support for casing on arrays (and on records that contain arrays) is
29453 currently subject to some restrictions. Non-positional
29454 array aggregates are not supported as (or within) case choices. Likewise
29455 for array type and subtype names. The current implementation exceeds
29456 compile-time capacity limits in some annoyingly common scenarios; the
29457 message generated in such cases is usually “Capacity exceeded in compiling
29458 case statement with composite selector type”.
29460 Link to the original RFC:
29461 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-pattern-matching.rst}
29463 @node Mutably Tagged Types with Size’Class Aspect,Generalized Finalization,Case pattern matching,Experimental Language Extensions
29464 @anchor{gnat_rm/gnat_language_extensions mutably-tagged-types-with-size-class-aspect}@anchor{44f}
29465 @subsection Mutably Tagged Types with Size’Class Aspect
29468 The @cite{Size’Class} aspect can be applied to a tagged type to specify a size
29469 constraint for the type and its descendants. When this aspect is specified
29470 on a tagged type, the class-wide type of that type is considered to be a
29471 “mutably tagged” type - meaning that objects of the class-wide type can have
29472 their tag changed by assignment from objects with a different tag.
29474 When the aspect is applied to a type, the size of each of its descendant types
29475 must not exceed the size specified for the aspect.
29477 Example:
29479 @example
29480 type Base is tagged null record
29481     with Size'Class => 16 * 8;  -- Size in bits (128 bits, or 16 bytes)
29483 type Derived_Type is new Base with record
29484    Data_Field : Integer;
29485 end record;  -- ERROR if Derived_Type exceeds 16 bytes
29486 @end example
29488 Class-wide types with a specified @cite{Size’Class} can be used as the type of
29489 array components, record components, and stand-alone objects.
29491 @example
29492 Inst : Base'Class;
29493 type Array_of_Base is array (Positive range <>) of Base'Class;
29494 @end example
29496 Note: Legality of the @cite{Size’Class} aspect is subject to certain restrictions on
29497 the tagged type, such as being undiscriminated, having no dynamic composite
29498 subcomponents, among others detailed in the RFC.
29500 Link to the original RFC:
29501 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/topic/rfc-finally/considered/rfc-class-size.md}
29503 @node Generalized Finalization,,Mutably Tagged Types with Size’Class Aspect,Experimental Language Extensions
29504 @anchor{gnat_rm/gnat_language_extensions generalized-finalization}@anchor{450}
29505 @subsection Generalized Finalization
29508 The @cite{Finalizable} aspect can be applied to any record type, tagged or not,
29509 to specify that it provides the same level of control on the operations of initialization, finalization, and assignment of objects as the controlled
29510 types (see RM 7.6(2) for a high-level overview). The only restriction is
29511 that the record type must be a root type, in other words not a derived type.
29513 The aspect additionally makes it possible to specify relaxed semantics for
29514 the finalization operations by means of the @cite{Relaxed_Finalization} setting.
29516 Example:
29518 @example
29519 type Ctrl is record
29520   Id : Natural := 0;
29521 end record
29522   with Finalizable => (Initialize           => Initialize,
29523                        Adjust               => Adjust,
29524                        Finalize             => Finalize,
29525                        Relaxed_Finalization => True);
29527 procedure Adjust     (Obj : in out Ctrl);
29528 procedure Finalize   (Obj : in out Ctrl);
29529 procedure Initialize (Obj : in out Ctrl);
29530 @end example
29532 As of this writing, the relaxed semantics for finalization operations are
29533 only implemented for dynamically allocated objects.
29535 Link to the original RFC:
29536 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/topic/finalization-rehaul/considered/rfc-generalized-finalization.md}
29538 @node Security Hardening Features,Obsolescent Features,GNAT language extensions,Top
29539 @anchor{gnat_rm/security_hardening_features doc}@anchor{451}@anchor{gnat_rm/security_hardening_features id1}@anchor{452}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15}
29540 @chapter Security Hardening Features
29543 This chapter describes Ada extensions aimed at security hardening that
29544 are provided by GNAT.
29546 The features in this chapter are currently experimental and subject to
29547 change.
29549 @c Register Scrubbing:
29551 @menu
29552 * Register Scrubbing:: 
29553 * Stack Scrubbing:: 
29554 * Hardened Conditionals:: 
29555 * Hardened Booleans:: 
29556 * Control Flow Redundancy:: 
29558 @end menu
29560 @node Register Scrubbing,Stack Scrubbing,,Security Hardening Features
29561 @anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{453}
29562 @section Register Scrubbing
29565 GNAT can generate code to zero-out hardware registers before returning
29566 from a subprogram.
29568 It can be enabled with the @code{-fzero-call-used-regs=`choice'}
29569 command-line option, to affect all subprograms in a compilation, and
29570 with a @code{Machine_Attribute} pragma, to affect only specific
29571 subprograms.
29573 @example
29574 procedure Foo;
29575 pragma Machine_Attribute (Foo, "zero_call_used_regs", "used");
29576 --  Before returning, Foo scrubs only call-clobbered registers
29577 --  that it uses itself.
29579 function Bar return Integer;
29580 pragma Machine_Attribute (Bar, "zero_call_used_regs", "all");
29581 --  Before returning, Bar scrubs all call-clobbered registers.
29583 function Baz return Integer;
29584 pragma Machine_Attribute (Bar, "zero_call_used_regs", "leafy");
29585 --  Before returning, Bar scrubs call-clobbered registers, either
29586 --  those it uses itself, if it can be identified as a leaf
29587 --  function, or all of them otherwise.
29588 @end example
29590 For usage and more details on the command-line option, on the
29591 @code{zero_call_used_regs} attribute, and on their use with other
29592 programming languages, see @cite{Using the GNU Compiler Collection (GCC)}.
29594 @c Stack Scrubbing:
29596 @node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features
29597 @anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{454}
29598 @section Stack Scrubbing
29601 GNAT can generate code to zero-out stack frames used by subprograms.
29603 It can be activated with the @code{Machine_Attribute} pragma, on
29604 specific subprograms and variables, or their types.  (This attribute
29605 always applies to a type, even when it is associated with a subprogram
29606 or a variable.)
29608 @example
29609 function Foo returns Integer;
29610 pragma Machine_Attribute (Foo, "strub");
29611 --  Foo and its callers are modified so as to scrub the stack
29612 --  space used by Foo after it returns.  Shorthand for:
29613 --  pragma Machine_Attribute (Foo, "strub", "at-calls");
29615 procedure Bar;
29616 pragma Machine_Attribute (Bar, "strub", "internal");
29617 --  Bar is turned into a wrapper for its original body,
29618 --  and they scrub the stack used by the original body.
29620 Var : Integer;
29621 pragma Machine_Attribute (Var, "strub");
29622 --  Reading from Var in a subprogram enables stack scrubbing
29623 --  of the stack space used by the subprogram.  Furthermore, if
29624 --  Var is declared within a subprogram, this also enables
29625 --  scrubbing of the stack space used by that subprogram.
29626 @end example
29628 Given these declarations, Foo has its type and body modified as
29629 follows:
29631 @example
29632 function Foo (<WaterMark> : in out System.Address) returns Integer
29634   --  ...
29635 begin
29636   <__strub_update> (<WaterMark>);  --  Updates the stack WaterMark.
29637   --  ...
29638 end;
29639 @end example
29641 whereas its callers are modified from:
29643 @example
29644 X := Foo;
29645 @end example
29649 @example
29650 declare
29651   <WaterMark> : System.Address;
29652 begin
29653   <__strub_enter> (<WaterMark>);  -- Initialize <WaterMark>.
29654   X := Foo (<WaterMark>);
29655   <__strub_leave> (<WaterMark>);  -- Scrubs stack up to <WaterMark>.
29656 end;
29657 @end example
29659 As for Bar, because it is strubbed in internal mode, its callers are
29660 not modified.  Its definition is modified roughly as follows:
29662 @example
29663 procedure Bar is
29664   <WaterMark> : System.Address;
29665   procedure Strubbed_Bar (<WaterMark> : in out System.Address) is
29666   begin
29667     <__strub_update> (<WaterMark>);  --  Updates the stack WaterMark.
29668     -- original Bar body.
29669   end Strubbed_Bar;
29670 begin
29671   <__strub_enter> (<WaterMark>);  -- Initialize <WaterMark>.
29672   Strubbed_Bar (<WaterMark>);
29673   <__strub_leave> (<WaterMark>);  -- Scrubs stack up to <WaterMark>.
29674 end Bar;
29675 @end example
29677 There are also @code{-fstrub=`choice'} command-line options to
29678 control default settings.  For usage and more details on the
29679 command-line options, on the @code{strub} attribute, and their use with
29680 other programming languages, see @cite{Using the GNU Compiler Collection (GCC)}.
29682 Note that Ada secondary stacks are not scrubbed.  The restriction
29683 @code{No_Secondary_Stack} avoids their use, and thus their accidental
29684 preservation of data that should be scrubbed.
29686 Attributes @code{Access} and @code{Unconstrained_Access} of variables and
29687 constants with @code{strub} enabled require types with @code{strub} enabled;
29688 there is no way to express an access-to-strub type otherwise.
29689 @code{Unchecked_Access} bypasses this constraint, but the resulting
29690 access type designates a non-strub type.
29692 @example
29693 VI : aliased Integer;
29694 pragma Machine_Attribute (VI, "strub");
29695 XsVI : access Integer := VI'Access; -- Error.
29696 UXsVI : access Integer := VI'Unchecked_Access; -- OK,
29697 --  UXsVI does *not* enable strub in subprograms that
29698 --  dereference it to obtain the UXsVI.all value.
29700 type Strub_Int is new Integer;
29701 pragma Machine_Attribute (Strub_Int, "strub");
29702 VSI : aliased Strub_Int;
29703 XsVSI : access Strub_Int := VSI'Access; -- OK,
29704 --  VSI and XsVSI.all both enable strub in subprograms that
29705 --  read their values.
29706 @end example
29708 Every access-to-subprogram type, renaming, and overriding and
29709 overridden dispatching operations that may refer to a subprogram with
29710 an attribute-modified interface must be annotated with the same
29711 interface-modifying attribute.  Access-to-subprogram types can be
29712 explicitly converted to different strub modes, as long as they are
29713 interface-compatible (i.e., adding or removing @code{at-calls} is not
29714 allowed).  For example, a @code{strub}-@code{disabled} subprogram can be
29715 turned @code{callable} through such an explicit conversion:
29717 @example
29718 type TBar is access procedure;
29720 type TBar_Callable is access procedure;
29721 pragma Machine_Attribute (TBar_Callable, "strub", "callable");
29722 --  The attribute modifies the procedure type, rather than the
29723 --  access type, because of the extra argument after "strub",
29724 --  only applicable to subprogram types.
29726 Bar_Callable_Ptr : constant TBar_Callable
29727            := TBar_Callable (TBar'(Bar'Access));
29729 procedure Bar_Callable renames Bar_Callable_Ptr.all;
29730 pragma Machine_Attribute (Bar_Callable, "strub", "callable");
29731 @end example
29733 Note that the renaming declaration is expanded to a full subprogram
29734 body, it won’t be just an alias.  Only if it is inlined will it be as
29735 efficient as a call by dereferencing the access-to-subprogram constant
29736 Bar_Callable_Ptr.
29738 @c Hardened Conditionals:
29740 @node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features
29741 @anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{455}
29742 @section Hardened Conditionals
29745 GNAT can harden conditionals to protect against control-flow attacks.
29747 This is accomplished by two complementary transformations, each
29748 activated by a separate command-line option.
29750 The option @code{-fharden-compares} enables hardening of compares
29751 that compute results stored in variables, adding verification that the
29752 reversed compare yields the opposite result, turning:
29754 @example
29755 B := X = Y;
29756 @end example
29758 into:
29760 @example
29761 B := X = Y;
29762 declare
29763   NotB : Boolean := X /= Y; -- Computed independently of B.
29764 begin
29765   if B = NotB then
29766     <__builtin_trap>;
29767   end if;
29768 end;
29769 @end example
29771 The option @code{-fharden-conditional-branches} enables hardening
29772 of compares that guard conditional branches, adding verification of
29773 the reversed compare to both execution paths, turning:
29775 @example
29776 if X = Y then
29777   X := Z + 1;
29778 else
29779   Y := Z - 1;
29780 end if;
29781 @end example
29783 into:
29785 @example
29786 if X = Y then
29787   if X /= Y then -- Computed independently of X = Y.
29788     <__builtin_trap>;
29789   end if;
29790   X := Z + 1;
29791 else
29792   if X /= Y then -- Computed independently of X = Y.
29793     null;
29794   else
29795     <__builtin_trap>;
29796   end if;
29797   Y := Z - 1;
29798 end if;
29799 @end example
29801 These transformations are introduced late in the compilation pipeline,
29802 long after boolean expressions are decomposed into separate compares,
29803 each one turned into either a conditional branch or a compare whose
29804 result is stored in a boolean variable or temporary.  Compiler
29805 optimizations, if enabled, may also turn conditional branches into
29806 stored compares, and vice-versa, or into operations with implied
29807 conditionals (e.g. MIN and MAX).  Conditionals may also be optimized
29808 out entirely, if their value can be determined at compile time, and
29809 occasionally multiple compares can be combined into one.
29811 It is thus difficult to predict which of these two options will affect
29812 a specific compare operation expressed in source code.  Using both
29813 options ensures that every compare that is neither optimized out nor
29814 optimized into implied conditionals will be hardened.
29816 The addition of reversed compares can be observed by enabling the dump
29817 files of the corresponding passes, through command-line options
29818 @code{-fdump-tree-hardcmp} and @code{-fdump-tree-hardcbr},
29819 respectively.
29821 They are separate options, however, because of the significantly
29822 different performance impact of the hardening transformations.
29824 For usage and more details on the command-line options, see
29825 @cite{Using the GNU Compiler Collection (GCC)}.  These options can
29826 be used with other programming languages supported by GCC.
29828 @c Hardened Booleans:
29830 @node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features
29831 @anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{456}
29832 @section Hardened Booleans
29835 Ada has built-in support for introducing boolean types with
29836 alternative representations, using representation clauses:
29838 @example
29839 type HBool is new Boolean;
29840 for HBool use (16#5a#, 16#a5#);
29841 for HBool'Size use 8;
29842 @end example
29844 When validity checking is enabled, the compiler will check that
29845 variables of such types hold values corresponding to the selected
29846 representations.
29848 There are multiple strategies for where to introduce validity checking
29849 (see @code{-gnatV} options).  Their goal is to guard against
29850 various kinds of programming errors, and GNAT strives to omit checks
29851 when program logic rules out an invalid value, and optimizers may
29852 further remove checks found to be redundant.
29854 For additional hardening, the @code{hardbool} @code{Machine_Attribute}
29855 pragma can be used to annotate boolean types with representation
29856 clauses, so that expressions of such types used as conditions are
29857 checked even when compiling with @code{-gnatVT}:
29859 @example
29860 pragma Machine_Attribute (HBool, "hardbool");
29862 function To_Boolean (X : HBool) returns Boolean is (Boolean (X));
29863 @end example
29865 is compiled roughly like:
29867 @example
29868 function To_Boolean (X : HBool) returns Boolean is
29869 begin
29870   if X not in True | False then
29871     raise Constraint_Error;
29872   elsif X in True then
29873     return True;
29874   else
29875     return False;
29876   end if;
29877 end To_Boolean;
29878 @end example
29880 Note that @code{-gnatVn} will disable even @code{hardbool} testing.
29882 Analogous behavior is available as a GCC extension to the C and
29883 Objective C programming languages, through the @code{hardbool} attribute,
29884 with the difference that, instead of raising a Constraint_Error
29885 exception, when a hardened boolean variable is found to hold a value
29886 that stands for neither True nor False, the program traps.  For usage
29887 and more details on that attribute, see @cite{Using the GNU Compiler Collection (GCC)}.
29889 @c Control Flow Redundancy:
29891 @node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features
29892 @anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{457}
29893 @section Control Flow Redundancy
29896 GNAT can guard against unexpected execution flows, such as branching
29897 into the middle of subprograms, as in Return Oriented Programming
29898 exploits.
29900 In units compiled with @code{-fharden-control-flow-redundancy},
29901 subprograms are instrumented so that, every time they are called,
29902 basic blocks take note as control flows through them, and, before
29903 returning, subprograms verify that the taken notes are consistent with
29904 the control-flow graph.
29906 The performance impact of verification on leaf subprograms can be much
29907 higher, while the averted risks are much lower on them.
29908 Instrumentation can be disabled for leaf subprograms with
29909 @code{-fhardcfr-skip-leaf}.
29911 Functions with too many basic blocks, or with multiple return points,
29912 call a run-time function to perform the verification.  Other functions
29913 perform the verification inline before returning.
29915 Optimizing the inlined verification can be quite time consuming, so
29916 the default upper limit for the inline mode is set at 16 blocks.
29917 Command-line option @code{--param hardcfr-max-inline-blocks=} can
29918 override it.
29920 Even though typically sparse control-flow graphs exhibit run-time
29921 verification time nearly proportional to the block count of a
29922 subprogram, it may become very significant for generated subprograms
29923 with thousands of blocks.  Command-line option
29924 @code{--param hardcfr-max-blocks=} can set an upper limit for
29925 instrumentation.
29927 For each block that is marked as visited, the mechanism checks that at
29928 least one of its predecessors, and at least one of its successors, are
29929 also marked as visited.
29931 Verification is performed just before a subprogram returns.  The
29932 following fragment:
29934 @example
29935 if X then
29936   Y := F (Z);
29937   return;
29938 end if;
29939 @end example
29941 gets turned into:
29943 @example
29944 type Visited_Bitmap is array (1..N) of Boolean with Pack;
29945 Visited : aliased Visited_Bitmap := (others => False);
29946 --  Bitmap of visited blocks.  N is the basic block count.
29947 [...]
29948 --  Basic block #I
29949 Visited(I) := True;
29950 if X then
29951   --  Basic block #J
29952   Visited(J) := True;
29953   Y := F (Z);
29954   CFR.Check (N, Visited'Access, CFG'Access);
29955   --  CFR is a hypothetical package whose Check procedure calls
29956   --  libgcc's __hardcfr_check, that traps if the Visited bitmap
29957   --  does not hold a valid path in CFG, the run-time
29958   --  representation of the control flow graph in the enclosing
29959   --  subprogram.
29960   return;
29961 end if;
29962 --  Basic block #K
29963 Visited(K) := True;
29964 @end example
29966 Verification would also be performed before tail calls, if any
29967 front-ends marked them as mandatory or desirable, but none do.
29968 Regular calls are optimized into tail calls too late for this
29969 transformation to act on it.
29971 In order to avoid adding verification after potential tail calls,
29972 which would prevent tail-call optimization, we recognize returning
29973 calls, i.e., calls whose result, if any, is returned by the calling
29974 subprogram to its caller immediately after the call returns.
29975 Verification is performed before such calls, whether or not they are
29976 ultimately optimized to tail calls.  This behavior is enabled by
29977 default whenever sibcall optimization is enabled (see
29978 @code{-foptimize-sibling-calls}); it may be disabled with
29979 @code{-fno-hardcfr-check-returning-calls}, or enabled with
29980 @code{-fhardcfr-check-returning-calls}, regardless of the
29981 optimization, but the lack of other optimizations may prevent calls
29982 from being recognized as returning calls:
29984 @example
29985 --  CFR.Check here, with -fhardcfr-check-returning-calls.
29986 P (X);
29987 --  CFR.Check here, with -fno-hardcfr-check-returning-calls.
29988 return;
29989 @end example
29993 @example
29994 --  CFR.Check here, with -fhardcfr-check-returning-calls.
29995 R := F (X);
29996 --  CFR.Check here, with -fno-hardcfr-check-returning-calls.
29997 return R;
29998 @end example
30000 Any subprogram from which an exception may escape, i.e., that may
30001 raise or propagate an exception that isn’t handled internally, is
30002 conceptually enclosed by a cleanup handler that performs verification,
30003 unless this is disabled with @code{-fno-hardcfr-check-exceptions}.
30004 With this feature enabled, a subprogram body containing:
30006 @example
30007 --  ...
30008   Y := F (X);  -- May raise exceptions.
30009 --  ...
30010   raise E;  -- Not handled internally.
30011 --  ...
30012 @end example
30014 gets modified as follows:
30016 @example
30017 begin
30018   --  ...
30019     Y := F (X);  -- May raise exceptions.
30020   --  ...
30021     raise E;  -- Not handled internally.
30022   --  ...
30023 exception
30024   when others =>
30025     CFR.Check (N, Visited'Access, CFG'Access);
30026     raise;
30027 end;
30028 @end example
30030 Verification may also be performed before No_Return calls, whether all
30031 of them, with @code{-fhardcfr-check-noreturn-calls=always}; all but
30032 internal subprograms involved in exception-raising or -reraising or
30033 subprograms explicitly marked with both @code{No_Return} and
30034 @code{Machine_Attribute} @code{expected_throw} pragmas, with
30035 @code{-fhardcfr-check-noreturn-calls=no-xthrow} (default); only
30036 nothrow ones, with @code{-fhardcfr-check-noreturn-calls=nothrow};
30037 or none, with @code{-fhardcfr-check-noreturn-calls=never}.
30039 When a No_Return call returns control to its caller through an
30040 exception, verification may have already been performed before the
30041 call, if @code{-fhardcfr-check-noreturn-calls=always} or
30042 @code{-fhardcfr-check-noreturn-calls=no-xthrow} is in effect.  The
30043 compiler arranges for already-checked No_Return calls without a
30044 preexisting handler to bypass the implicitly-added cleanup handler and
30045 thus the redundant check, but a local exception or cleanup handler, if
30046 present, will modify the set of visited blocks, and checking will take
30047 place again when the caller reaches the next verification point,
30048 whether it is a return or reraise statement after the exception is
30049 otherwise handled, or even another No_Return call.
30051 The instrumentation for hardening with control flow redundancy can be
30052 observed in dump files generated by the command-line option
30053 @code{-fdump-tree-hardcfr}.
30055 For more details on the control flow redundancy command-line options,
30056 see @cite{Using the GNU Compiler Collection (GCC)}.  These options
30057 can be used with other programming languages supported by GCC.
30059 @node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top
30060 @anchor{gnat_rm/obsolescent_features doc}@anchor{458}@anchor{gnat_rm/obsolescent_features id1}@anchor{459}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16}
30061 @chapter Obsolescent Features
30064 This chapter describes features that are provided by GNAT, but are
30065 considered obsolescent since there are preferred ways of achieving
30066 the same effect. These features are provided solely for historical
30067 compatibility purposes.
30069 @menu
30070 * pragma No_Run_Time:: 
30071 * pragma Ravenscar:: 
30072 * pragma Restricted_Run_Time:: 
30073 * pragma Task_Info:: 
30074 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
30076 @end menu
30078 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
30079 @anchor{gnat_rm/obsolescent_features id2}@anchor{45a}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{45b}
30080 @section pragma No_Run_Time
30083 The pragma @code{No_Run_Time} is used to achieve an affect similar
30084 to the use of the “Zero Foot Print” configurable run time, but without
30085 requiring a specially configured run time. The result of using this
30086 pragma, which must be used for all units in a partition, is to restrict
30087 the use of any language features requiring run-time support code. The
30088 preferred usage is to use an appropriately configured run-time that
30089 includes just those features that are to be made accessible.
30091 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
30092 @anchor{gnat_rm/obsolescent_features id3}@anchor{45c}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{45d}
30093 @section pragma Ravenscar
30096 The pragma @code{Ravenscar} has exactly the same effect as pragma
30097 @code{Profile (Ravenscar)}. The latter usage is preferred since it
30098 is part of the new Ada 2005 standard.
30100 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
30101 @anchor{gnat_rm/obsolescent_features id4}@anchor{45e}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{45f}
30102 @section pragma Restricted_Run_Time
30105 The pragma @code{Restricted_Run_Time} has exactly the same effect as
30106 pragma @code{Profile (Restricted)}. The latter usage is
30107 preferred since the Ada 2005 pragma @code{Profile} is intended for
30108 this kind of implementation dependent addition.
30110 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
30111 @anchor{gnat_rm/obsolescent_features id5}@anchor{460}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{461}
30112 @section pragma Task_Info
30115 The functionality provided by pragma @code{Task_Info} is now part of the
30116 Ada language. The @code{CPU} aspect and the package
30117 @code{System.Multiprocessors} offer a less system-dependent way to specify
30118 task affinity or to query the number of processors.
30120 Syntax
30122 @example
30123 pragma Task_Info (EXPRESSION);
30124 @end example
30126 This pragma appears within a task definition (like pragma
30127 @code{Priority}) and applies to the task in which it appears.  The
30128 argument must be of type @code{System.Task_Info.Task_Info_Type}.
30129 The @code{Task_Info} pragma provides system dependent control over
30130 aspects of tasking implementation, for example, the ability to map
30131 tasks to specific processors.  For details on the facilities available
30132 for the version of GNAT that you are using, see the documentation
30133 in the spec of package System.Task_Info in the runtime
30134 library.
30136 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
30137 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{462}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{463}
30138 @section package System.Task_Info (@code{s-tasinf.ads})
30141 This package provides target dependent functionality that is used
30142 to support the @code{Task_Info} pragma. The predefined Ada package
30143 @code{System.Multiprocessors} and the @code{CPU} aspect now provide a
30144 standard replacement for GNAT’s @code{Task_Info} functionality.
30146 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
30147 @anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{464}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{465}
30148 @chapter Compatibility and Porting Guide
30151 This chapter presents some guidelines for developing portable Ada code,
30152 describes the compatibility issues that may arise between
30153 GNAT and other Ada compilation systems (including those for Ada 83),
30154 and shows how GNAT can expedite porting
30155 applications developed in other Ada environments.
30157 @menu
30158 * Writing Portable Fixed-Point Declarations:: 
30159 * Compatibility with Ada 83:: 
30160 * Compatibility between Ada 95 and Ada 2005:: 
30161 * Implementation-dependent characteristics:: 
30162 * Compatibility with Other Ada Systems:: 
30163 * Representation Clauses:: 
30164 * Compatibility with HP Ada 83:: 
30166 @end menu
30168 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
30169 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{466}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{467}
30170 @section Writing Portable Fixed-Point Declarations
30173 The Ada Reference Manual gives an implementation freedom to choose bounds
30174 that are narrower by @code{Small} from the given bounds.
30175 For example, if we write
30177 @example
30178 type F1 is delta 1.0 range -128.0 .. +128.0;
30179 @end example
30181 then the implementation is allowed to choose -128.0 .. +127.0 if it
30182 likes, but is not required to do so.
30184 This leads to possible portability problems, so let’s have a closer
30185 look at this, and figure out how to avoid these problems.
30187 First, why does this freedom exist, and why would an implementation
30188 take advantage of it? To answer this, take a closer look at the type
30189 declaration for @code{F1} above. If the compiler uses the given bounds,
30190 it would need 9 bits to hold the largest positive value (and typically
30191 that means 16 bits on all machines). But if the implementation chooses
30192 the +127.0 bound then it can fit values of the type in 8 bits.
30194 Why not make the user write +127.0 if that’s what is wanted?
30195 The rationale is that if you are thinking of fixed point
30196 as a kind of ‘poor man’s floating-point’, then you don’t want
30197 to be thinking about the scaled integers that are used in its
30198 representation. Let’s take another example:
30200 @example
30201 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
30202 @end example
30204 Looking at this declaration, it seems casually as though
30205 it should fit in 16 bits, but again that extra positive value
30206 +1.0 has the scaled integer equivalent of 2**15 which is one too
30207 big for signed 16 bits. The implementation can treat this as:
30209 @example
30210 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
30211 @end example
30213 and the Ada language design team felt that this was too annoying
30214 to require. We don’t need to debate this decision at this point,
30215 since it is well established (the rule about narrowing the ranges
30216 dates to Ada 83).
30218 But the important point is that an implementation is not required
30219 to do this narrowing, so we have a potential portability problem.
30220 We could imagine three types of implementation:
30223 @enumerate a
30225 @item 
30226 those that narrow the range automatically if they can figure
30227 out that the narrower range will allow storage in a smaller machine unit,
30229 @item 
30230 those that will narrow only if forced to by a @code{'Size} clause, and
30232 @item 
30233 those that will never narrow.
30234 @end enumerate
30236 Now if we are language theoreticians, we can imagine a fourth
30237 approach: to narrow all the time, e.g. to treat
30239 @example
30240 type F3 is delta 1.0 range -10.0 .. +23.0;
30241 @end example
30243 as though it had been written:
30245 @example
30246 type F3 is delta 1.0 range -9.0 .. +22.0;
30247 @end example
30249 But although technically allowed, such a behavior would be hostile and silly,
30250 and no real compiler would do this. All real compilers will fall into one of
30251 the categories (a), (b) or (c) above.
30253 So, how do you get the compiler to do what you want? The answer is give the
30254 actual bounds you want, and then use a @code{'Small} clause and a
30255 @code{'Size} clause to absolutely pin down what the compiler does.
30256 E.g., for @code{F2} above, we will write:
30258 @example
30259 My_Small : constant := 2.0**(-15);
30260 My_First : constant := -1.0;
30261 My_Last  : constant := +1.0 - My_Small;
30263 type F2 is delta My_Small range My_First .. My_Last;
30264 @end example
30266 and then add
30268 @example
30269 for F2'Small use my_Small;
30270 for F2'Size  use 16;
30271 @end example
30273 In practice all compilers will do the same thing here and will give you
30274 what you want, so the above declarations are fully portable. If you really
30275 want to play language lawyer and guard against ludicrous behavior by the
30276 compiler you could add
30278 @example
30279 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
30280 Test2 : constant := 1 / Boolean'Pos (F2'Last  = My_Last);
30281 @end example
30283 One or other or both are allowed to be illegal if the compiler is
30284 behaving in a silly manner, but at least the silly compiler will not
30285 get away with silently messing with your (very clear) intentions.
30287 If you follow this scheme you will be guaranteed that your fixed-point
30288 types will be portable.
30290 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
30291 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{468}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{469}
30292 @section Compatibility with Ada 83
30295 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
30297 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
30298 are highly upwards compatible with Ada 83.  In
30299 particular, the design intention was that the difficulties associated
30300 with moving from Ada 83 to later versions of the standard should be no greater
30301 than those that occur when moving from one Ada 83 system to another.
30303 However, there are a number of points at which there are minor
30304 incompatibilities.  The @cite{Ada 95 Annotated Reference Manual} contains
30305 full details of these issues as they relate to Ada 95,
30306 and should be consulted for a complete treatment.
30307 In practice the
30308 following subsections treat the most likely issues to be encountered.
30310 @menu
30311 * Legal Ada 83 programs that are illegal in Ada 95:: 
30312 * More deterministic semantics:: 
30313 * Changed semantics:: 
30314 * Other language compatibility issues:: 
30316 @end menu
30318 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
30319 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{46a}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{46b}
30320 @subsection Legal Ada 83 programs that are illegal in Ada 95
30323 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
30324 Ada 95 and later versions of the standard:
30327 @itemize *
30329 @item 
30330 `Character literals'
30332 Some uses of character literals are ambiguous.  Since Ada 95 has introduced
30333 @code{Wide_Character} as a new predefined character type, some uses of
30334 character literals that were legal in Ada 83 are illegal in Ada 95.
30335 For example:
30337 @example
30338 for Char in 'A' .. 'Z' loop ... end loop;
30339 @end example
30341 The problem is that ‘A’ and ‘Z’ could be from either
30342 @code{Character} or @code{Wide_Character}.  The simplest correction
30343 is to make the type explicit; e.g.:
30345 @example
30346 for Char in Character range 'A' .. 'Z' loop ... end loop;
30347 @end example
30349 @item 
30350 `New reserved words'
30352 The identifiers @code{abstract}, @code{aliased}, @code{protected},
30353 @code{requeue}, @code{tagged}, and @code{until} are reserved in Ada 95.
30354 Existing Ada 83 code using any of these identifiers must be edited to
30355 use some alternative name.
30357 @item 
30358 `Freezing rules'
30360 The rules in Ada 95 are slightly different with regard to the point at
30361 which entities are frozen, and representation pragmas and clauses are
30362 not permitted past the freeze point.  This shows up most typically in
30363 the form of an error message complaining that a representation item
30364 appears too late, and the appropriate corrective action is to move
30365 the item nearer to the declaration of the entity to which it refers.
30367 A particular case is that representation pragmas
30368 cannot be applied to a subprogram body.  If necessary, a separate subprogram
30369 declaration must be introduced to which the pragma can be applied.
30371 @item 
30372 `Optional bodies for library packages'
30374 In Ada 83, a package that did not require a package body was nevertheless
30375 allowed to have one.  This lead to certain surprises in compiling large
30376 systems (situations in which the body could be unexpectedly ignored by the
30377 binder).  In Ada 95, if a package does not require a body then it is not
30378 permitted to have a body.  To fix this problem, simply remove a redundant
30379 body if it is empty, or, if it is non-empty, introduce a dummy declaration
30380 into the spec that makes the body required.  One approach is to add a private
30381 part to the package declaration (if necessary), and define a parameterless
30382 procedure called @code{Requires_Body}, which must then be given a dummy
30383 procedure body in the package body, which then becomes required.
30384 Another approach (assuming that this does not introduce elaboration
30385 circularities) is to add an @code{Elaborate_Body} pragma to the package spec,
30386 since one effect of this pragma is to require the presence of a package body.
30388 @item 
30389 `Numeric_Error is the same exception as Constraint_Error'
30391 In Ada 95, the exception @code{Numeric_Error} is a renaming of @code{Constraint_Error}.
30392 This means that it is illegal to have separate exception handlers for
30393 the two exceptions.  The fix is simply to remove the handler for the
30394 @code{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
30395 @code{Constraint_Error} in place of @code{Numeric_Error} in all cases).
30397 @item 
30398 `Indefinite subtypes in generics'
30400 In Ada 83, it was permissible to pass an indefinite type (e.g, @code{String})
30401 as the actual for a generic formal private type, but then the instantiation
30402 would be illegal if there were any instances of declarations of variables
30403 of this type in the generic body.  In Ada 95, to avoid this clear violation
30404 of the methodological principle known as the ‘contract model’,
30405 the generic declaration explicitly indicates whether
30406 or not such instantiations are permitted.  If a generic formal parameter
30407 has explicit unknown discriminants, indicated by using @code{(<>)} after the
30408 subtype name, then it can be instantiated with indefinite types, but no
30409 stand-alone variables can be declared of this type.  Any attempt to declare
30410 such a variable will result in an illegality at the time the generic is
30411 declared.  If the @code{(<>)} notation is not used, then it is illegal
30412 to instantiate the generic with an indefinite type.
30413 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
30414 It will show up as a compile time error, and
30415 the fix is usually simply to add the @code{(<>)} to the generic declaration.
30416 @end itemize
30418 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
30419 @anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{46c}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{46d}
30420 @subsection More deterministic semantics
30424 @itemize *
30426 @item 
30427 `Conversions'
30429 Conversions from real types to integer types round away from 0.  In Ada 83
30430 the conversion Integer(2.5) could deliver either 2 or 3 as its value.  This
30431 implementation freedom was intended to support unbiased rounding in
30432 statistical applications, but in practice it interfered with portability.
30433 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
30434 is required.  Numeric code may be affected by this change in semantics.
30435 Note, though, that this issue is no worse than already existed in Ada 83
30436 when porting code from one vendor to another.
30438 @item 
30439 `Tasking'
30441 The Real-Time Annex introduces a set of policies that define the behavior of
30442 features that were implementation dependent in Ada 83, such as the order in
30443 which open select branches are executed.
30444 @end itemize
30446 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
30447 @anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{46e}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{46f}
30448 @subsection Changed semantics
30451 The worst kind of incompatibility is one where a program that is legal in
30452 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
30453 possible in Ada 83.  Fortunately this is extremely rare, but the one
30454 situation that you should be alert to is the change in the predefined type
30455 @code{Character} from 7-bit ASCII to 8-bit Latin-1.
30457 @quotation
30459 @geindex Latin-1
30460 @end quotation
30463 @itemize *
30465 @item 
30466 `Range of type `@w{`}Character`@w{`}'
30468 The range of @code{Standard.Character} is now the full 256 characters
30469 of Latin-1, whereas in most Ada 83 implementations it was restricted
30470 to 128 characters. Although some of the effects of
30471 this change will be manifest in compile-time rejection of legal
30472 Ada 83 programs it is possible for a working Ada 83 program to have
30473 a different effect in Ada 95, one that was not permitted in Ada 83.
30474 As an example, the expression
30475 @code{Character'Pos(Character'Last)} returned @code{127} in Ada 83 and now
30476 delivers @code{255} as its value.
30477 In general, you should look at the logic of any
30478 character-processing Ada 83 program and see whether it needs to be adapted
30479 to work correctly with Latin-1.  Note that the predefined Ada 95 API has a
30480 character handling package that may be relevant if code needs to be adapted
30481 to account for the additional Latin-1 elements.
30482 The desirable fix is to
30483 modify the program to accommodate the full character set, but in some cases
30484 it may be convenient to define a subtype or derived type of Character that
30485 covers only the restricted range.
30486 @end itemize
30488 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
30489 @anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{470}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{471}
30490 @subsection Other language compatibility issues
30494 @itemize *
30496 @item 
30497 `-gnat83' switch
30499 All implementations of GNAT provide a switch that causes GNAT to operate
30500 in Ada 83 mode.  In this mode, some but not all compatibility problems
30501 of the type described above are handled automatically.  For example, the
30502 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
30503 as identifiers as in Ada 83.  However,
30504 in practice, it is usually advisable to make the necessary modifications
30505 to the program to remove the need for using this switch.
30506 See the @code{Compiling Different Versions of Ada} section in
30507 the @cite{GNAT User’s Guide}.
30509 @item 
30510 Support for removed Ada 83 pragmas and attributes
30512 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
30513 generally because they were replaced by other mechanisms.  Ada 95 and Ada 2005
30514 compilers are allowed, but not required, to implement these missing
30515 elements.  In contrast with some other compilers, GNAT implements all
30516 such pragmas and attributes, eliminating this compatibility concern.  These
30517 include @code{pragma Interface} and the floating point type attributes
30518 (@code{Emax}, @code{Mantissa}, etc.), among other items.
30519 @end itemize
30521 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
30522 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{472}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{473}
30523 @section Compatibility between Ada 95 and Ada 2005
30526 @geindex Compatibility between Ada 95 and Ada 2005
30528 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
30529 a number of incompatibilities. Several are enumerated below;
30530 for a complete description please see the
30531 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
30532 @cite{Rationale for Ada 2005}.
30535 @itemize *
30537 @item 
30538 `New reserved words.'
30540 The words @code{interface}, @code{overriding} and @code{synchronized} are
30541 reserved in Ada 2005.
30542 A pre-Ada 2005 program that uses any of these as an identifier will be
30543 illegal.
30545 @item 
30546 `New declarations in predefined packages.'
30548 A number of packages in the predefined environment contain new declarations:
30549 @code{Ada.Exceptions}, @code{Ada.Real_Time}, @code{Ada.Strings},
30550 @code{Ada.Strings.Fixed}, @code{Ada.Strings.Bounded},
30551 @code{Ada.Strings.Unbounded}, @code{Ada.Strings.Wide_Fixed},
30552 @code{Ada.Strings.Wide_Bounded}, @code{Ada.Strings.Wide_Unbounded},
30553 @code{Ada.Tags}, @code{Ada.Text_IO}, and @code{Interfaces.C}.
30554 If an Ada 95 program does a @code{with} and @code{use} of any of these
30555 packages, the new declarations may cause name clashes.
30557 @item 
30558 `Access parameters.'
30560 A nondispatching subprogram with an access parameter cannot be renamed
30561 as a dispatching operation.  This was permitted in Ada 95.
30563 @item 
30564 `Access types, discriminants, and constraints.'
30566 Rule changes in this area have led to some incompatibilities; for example,
30567 constrained subtypes of some access types are not permitted in Ada 2005.
30569 @item 
30570 `Aggregates for limited types.'
30572 The allowance of aggregates for limited types in Ada 2005 raises the
30573 possibility of ambiguities in legal Ada 95 programs, since additional types
30574 now need to be considered in expression resolution.
30576 @item 
30577 `Fixed-point multiplication and division.'
30579 Certain expressions involving ‘*’ or ‘/’ for a fixed-point type, which
30580 were legal in Ada 95 and invoked the predefined versions of these operations,
30581 are now ambiguous.
30582 The ambiguity may be resolved either by applying a type conversion to the
30583 expression, or by explicitly invoking the operation from package
30584 @code{Standard}.
30586 @item 
30587 `Return-by-reference types.'
30589 The Ada 95 return-by-reference mechanism has been removed.  Instead, the user
30590 can declare a function returning a value from an anonymous access type.
30591 @end itemize
30593 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
30594 @anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{474}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{475}
30595 @section Implementation-dependent characteristics
30598 Although the Ada language defines the semantics of each construct as
30599 precisely as practical, in some situations (for example for reasons of
30600 efficiency, or where the effect is heavily dependent on the host or target
30601 platform) the implementation is allowed some freedom.  In porting Ada 83
30602 code to GNAT, you need to be aware of whether / how the existing code
30603 exercised such implementation dependencies.  Such characteristics fall into
30604 several categories, and GNAT offers specific support in assisting the
30605 transition from certain Ada 83 compilers.
30607 @menu
30608 * Implementation-defined pragmas:: 
30609 * Implementation-defined attributes:: 
30610 * Libraries:: 
30611 * Elaboration order:: 
30612 * Target-specific aspects:: 
30614 @end menu
30616 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
30617 @anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{476}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{477}
30618 @subsection Implementation-defined pragmas
30621 Ada compilers are allowed to supplement the language-defined pragmas, and
30622 these are a potential source of non-portability.  All GNAT-defined pragmas
30623 are described in @ref{7,,Implementation Defined Pragmas},
30624 and these include several that are specifically
30625 intended to correspond to other vendors’ Ada 83 pragmas.
30626 For migrating from VADS, the pragma @code{Use_VADS_Size} may be useful.
30627 For compatibility with HP Ada 83, GNAT supplies the pragmas
30628 @code{Extend_System}, @code{Ident}, @code{Inline_Generic},
30629 @code{Interface_Name}, @code{Passive}, @code{Suppress_All},
30630 and @code{Volatile}.
30631 Other relevant pragmas include @code{External} and @code{Link_With}.
30632 Some vendor-specific
30633 Ada 83 pragmas (@code{Share_Generic}, @code{Subtitle}, and @code{Title}) are
30634 recognized, thus
30635 avoiding compiler rejection of units that contain such pragmas; they are not
30636 relevant in a GNAT context and hence are not otherwise implemented.
30638 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
30639 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{478}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{479}
30640 @subsection Implementation-defined attributes
30643 Analogous to pragmas, the set of attributes may be extended by an
30644 implementation.  All GNAT-defined attributes are described in
30645 @ref{8,,Implementation Defined Attributes},
30646 and these include several that are specifically intended
30647 to correspond to other vendors’ Ada 83 attributes.  For migrating from VADS,
30648 the attribute @code{VADS_Size} may be useful.  For compatibility with HP
30649 Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
30650 @code{Type_Class}.
30652 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
30653 @anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{47a}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{47b}
30654 @subsection Libraries
30657 Vendors may supply libraries to supplement the standard Ada API.  If Ada 83
30658 code uses vendor-specific libraries then there are several ways to manage
30659 this in Ada 95 and later versions of the standard:
30662 @itemize *
30664 @item 
30665 If the source code for the libraries (specs and bodies) are
30666 available, then the libraries can be migrated in the same way as the
30667 application.
30669 @item 
30670 If the source code for the specs but not the bodies are
30671 available, then you can reimplement the bodies.
30673 @item 
30674 Some features introduced by Ada 95 obviate the need for library support.  For
30675 example most Ada 83 vendors supplied a package for unsigned integers.  The
30676 Ada 95 modular type feature is the preferred way to handle this need, so
30677 instead of migrating or reimplementing the unsigned integer package it may
30678 be preferable to retrofit the application using modular types.
30679 @end itemize
30681 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
30682 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{47c}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{47d}
30683 @subsection Elaboration order
30686 The implementation can choose any elaboration order consistent with the unit
30687 dependency relationship.  This freedom means that some orders can result in
30688 Program_Error being raised due to an ‘Access Before Elaboration’: an attempt
30689 to invoke a subprogram before its body has been elaborated, or to instantiate
30690 a generic before the generic body has been elaborated.  By default GNAT
30691 attempts to choose a safe order (one that will not encounter access before
30692 elaboration problems) by implicitly inserting @code{Elaborate} or
30693 @code{Elaborate_All} pragmas where
30694 needed.  However, this can lead to the creation of elaboration circularities
30695 and a resulting rejection of the program by gnatbind.  This issue is
30696 thoroughly described in the `Elaboration Order Handling in GNAT' appendix
30697 in the @cite{GNAT User’s Guide}.
30698 In brief, there are several
30699 ways to deal with this situation:
30702 @itemize *
30704 @item 
30705 Modify the program to eliminate the circularities, e.g., by moving
30706 elaboration-time code into explicitly-invoked procedures
30708 @item 
30709 Constrain the elaboration order by including explicit @code{Elaborate_Body} or
30710 @code{Elaborate} pragmas, and then inhibit the generation of implicit
30711 @code{Elaborate_All}
30712 pragmas either globally (as an effect of the `-gnatE' switch) or locally
30713 (by selectively suppressing elaboration checks via pragma
30714 @code{Suppress(Elaboration_Check)} when it is safe to do so).
30715 @end itemize
30717 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
30718 @anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{47e}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{47f}
30719 @subsection Target-specific aspects
30722 Low-level applications need to deal with machine addresses, data
30723 representations, interfacing with assembler code, and similar issues.  If
30724 such an Ada 83 application is being ported to different target hardware (for
30725 example where the byte endianness has changed) then you will need to
30726 carefully examine the program logic; the porting effort will heavily depend
30727 on the robustness of the original design.  Moreover, Ada 95 (and thus
30728 Ada 2005 and Ada 2012) are sometimes
30729 incompatible with typical Ada 83 compiler practices regarding implicit
30730 packing, the meaning of the Size attribute, and the size of access values.
30731 GNAT’s approach to these issues is described in @ref{480,,Representation Clauses}.
30733 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
30734 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{481}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{482}
30735 @section Compatibility with Other Ada Systems
30738 If programs avoid the use of implementation dependent and
30739 implementation defined features, as documented in the
30740 @cite{Ada Reference Manual}, there should be a high degree of portability between
30741 GNAT and other Ada systems.  The following are specific items which
30742 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
30743 compilers, but do not affect porting code to GNAT.
30744 (As of January 2007, GNAT is the only compiler available for Ada 2005;
30745 the following issues may or may not arise for Ada 2005 programs
30746 when other compilers appear.)
30749 @itemize *
30751 @item 
30752 `Ada 83 Pragmas and Attributes'
30754 Ada 95 compilers are allowed, but not required, to implement the missing
30755 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
30756 GNAT implements all such pragmas and attributes, eliminating this as
30757 a compatibility concern, but some other Ada 95 compilers reject these
30758 pragmas and attributes.
30760 @item 
30761 `Specialized Needs Annexes'
30763 GNAT implements the full set of special needs annexes.  At the
30764 current time, it is the only Ada 95 compiler to do so.  This means that
30765 programs making use of these features may not be portable to other Ada
30766 95 compilation systems.
30768 @item 
30769 `Representation Clauses'
30771 Some other Ada 95 compilers implement only the minimal set of
30772 representation clauses required by the Ada 95 reference manual.  GNAT goes
30773 far beyond this minimal set, as described in the next section.
30774 @end itemize
30776 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
30777 @anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{483}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{480}
30778 @section Representation Clauses
30781 The Ada 83 reference manual was quite vague in describing both the minimal
30782 required implementation of representation clauses, and also their precise
30783 effects.  Ada 95 (and thus also Ada 2005) are much more explicit, but the
30784 minimal set of capabilities required is still quite limited.
30786 GNAT implements the full required set of capabilities in
30787 Ada 95 and Ada 2005, but also goes much further, and in particular
30788 an effort has been made to be compatible with existing Ada 83 usage to the
30789 greatest extent possible.
30791 A few cases exist in which Ada 83 compiler behavior is incompatible with
30792 the requirements in Ada 95 (and thus also Ada 2005).  These are instances of
30793 intentional or accidental dependence on specific implementation dependent
30794 characteristics of these Ada 83 compilers.  The following is a list of
30795 the cases most likely to arise in existing Ada 83 code.
30798 @itemize *
30800 @item 
30801 `Implicit Packing'
30803 Some Ada 83 compilers allowed a Size specification to cause implicit
30804 packing of an array or record.  This could cause expensive implicit
30805 conversions for change of representation in the presence of derived
30806 types, and the Ada design intends to avoid this possibility.
30807 Subsequent AI’s were issued to make it clear that such implicit
30808 change of representation in response to a Size clause is inadvisable,
30809 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
30810 Reference Manuals as implementation advice that is followed by GNAT.
30811 The problem will show up as an error
30812 message rejecting the size clause.  The fix is simply to provide
30813 the explicit pragma @code{Pack}, or for more fine tuned control, provide
30814 a Component_Size clause.
30816 @item 
30817 `Meaning of Size Attribute'
30819 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
30820 the minimal number of bits required to hold values of the type.  For example,
30821 on a 32-bit machine, the size of @code{Natural} will typically be 31 and not
30822 32 (since no sign bit is required).  Some Ada 83 compilers gave 31, and
30823 some 32 in this situation.  This problem will usually show up as a compile
30824 time error, but not always.  It is a good idea to check all uses of the
30825 ‘Size attribute when porting Ada 83 code.  The GNAT specific attribute
30826 Object_Size can provide a useful way of duplicating the behavior of
30827 some Ada 83 compiler systems.
30829 @item 
30830 `Size of Access Types'
30832 A common assumption in Ada 83 code is that an access type is in fact a pointer,
30833 and that therefore it will be the same size as a System.Address value.  This
30834 assumption is true for GNAT in most cases with one exception.  For the case of
30835 a pointer to an unconstrained array type (where the bounds may vary from one
30836 value of the access type to another), the default is to use a ‘fat pointer’,
30837 which is represented as two separate pointers, one to the bounds, and one to
30838 the array.  This representation has a number of advantages, including improved
30839 efficiency.  However, it may cause some difficulties in porting existing Ada 83
30840 code which makes the assumption that, for example, pointers fit in 32 bits on
30841 a machine with 32-bit addressing.
30843 To get around this problem, GNAT also permits the use of ‘thin pointers’ for
30844 access types in this case (where the designated type is an unconstrained array
30845 type).  These thin pointers are indeed the same size as a System.Address value.
30846 To specify a thin pointer, use a size clause for the type, for example:
30848 @example
30849 type X is access all String;
30850 for X'Size use Standard'Address_Size;
30851 @end example
30853 which will cause the type X to be represented using a single pointer.
30854 When using this representation, the bounds are right behind the array.
30855 This representation is slightly less efficient, and does not allow quite
30856 such flexibility in the use of foreign pointers or in using the
30857 Unrestricted_Access attribute to create pointers to non-aliased objects.
30858 But for any standard portable use of the access type it will work in
30859 a functionally correct manner and allow porting of existing code.
30860 Note that another way of forcing a thin pointer representation
30861 is to use a component size clause for the element size in an array,
30862 or a record representation clause for an access field in a record.
30864 See the documentation of Unrestricted_Access in the GNAT RM for a
30865 full discussion of possible problems using this attribute in conjunction
30866 with thin pointers.
30867 @end itemize
30869 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
30870 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{484}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{485}
30871 @section Compatibility with HP Ada 83
30874 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
30875 of them can sensibly be implemented.  The description of pragmas in
30876 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
30877 applicable to GNAT.
30880 @itemize *
30882 @item 
30883 `Default floating-point representation'
30885 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
30886 it is VMS format.
30888 @item 
30889 `System'
30891 the package System in GNAT exactly corresponds to the definition in the
30892 Ada 95 reference manual, which means that it excludes many of the
30893 HP Ada 83 extensions.  However, a separate package Aux_DEC is provided
30894 that contains the additional definitions, and a special pragma,
30895 Extend_System allows this package to be treated transparently as an
30896 extension of package System.
30897 @end itemize
30899 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
30900 @anchor{share/gnu_free_documentation_license doc}@anchor{486}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{487}
30901 @chapter GNU Free Documentation License
30904 Version 1.3, 3 November 2008
30906 Copyright  2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc
30907 @indicateurl{https://fsf.org/}
30909 Everyone is permitted to copy and distribute verbatim copies of this
30910 license document, but changing it is not allowed.
30912 `Preamble'
30914 The purpose of this License is to make a manual, textbook, or other
30915 functional and useful document “free” in the sense of freedom: to
30916 assure everyone the effective freedom to copy and redistribute it,
30917 with or without modifying it, either commercially or noncommercially.
30918 Secondarily, this License preserves for the author and publisher a way
30919 to get credit for their work, while not being considered responsible
30920 for modifications made by others.
30922 This License is a kind of “copyleft”, which means that derivative
30923 works of the document must themselves be free in the same sense.  It
30924 complements the GNU General Public License, which is a copyleft
30925 license designed for free software.
30927 We have designed this License in order to use it for manuals for free
30928 software, because free software needs free documentation: a free
30929 program should come with manuals providing the same freedoms that the
30930 software does.  But this License is not limited to software manuals;
30931 it can be used for any textual work, regardless of subject matter or
30932 whether it is published as a printed book.  We recommend this License
30933 principally for works whose purpose is instruction or reference.
30935 `1. APPLICABILITY AND DEFINITIONS'
30937 This License applies to any manual or other work, in any medium, that
30938 contains a notice placed by the copyright holder saying it can be
30939 distributed under the terms of this License.  Such a notice grants a
30940 world-wide, royalty-free license, unlimited in duration, to use that
30941 work under the conditions stated herein.  The `Document', below,
30942 refers to any such manual or work.  Any member of the public is a
30943 licensee, and is addressed as “`you'”.  You accept the license if you
30944 copy, modify or distribute the work in a way requiring permission
30945 under copyright law.
30947 A “`Modified Version'” of the Document means any work containing the
30948 Document or a portion of it, either copied verbatim, or with
30949 modifications and/or translated into another language.
30951 A “`Secondary Section'” is a named appendix or a front-matter section of
30952 the Document that deals exclusively with the relationship of the
30953 publishers or authors of the Document to the Document’s overall subject
30954 (or to related matters) and contains nothing that could fall directly
30955 within that overall subject.  (Thus, if the Document is in part a
30956 textbook of mathematics, a Secondary Section may not explain any
30957 mathematics.)  The relationship could be a matter of historical
30958 connection with the subject or with related matters, or of legal,
30959 commercial, philosophical, ethical or political position regarding
30960 them.
30962 The “`Invariant Sections'” are certain Secondary Sections whose titles
30963 are designated, as being those of Invariant Sections, in the notice
30964 that says that the Document is released under this License.  If a
30965 section does not fit the above definition of Secondary then it is not
30966 allowed to be designated as Invariant.  The Document may contain zero
30967 Invariant Sections.  If the Document does not identify any Invariant
30968 Sections then there are none.
30970 The “`Cover Texts'” are certain short passages of text that are listed,
30971 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
30972 the Document is released under this License.  A Front-Cover Text may
30973 be at most 5 words, and a Back-Cover Text may be at most 25 words.
30975 A “`Transparent'” copy of the Document means a machine-readable copy,
30976 represented in a format whose specification is available to the
30977 general public, that is suitable for revising the document
30978 straightforwardly with generic text editors or (for images composed of
30979 pixels) generic paint programs or (for drawings) some widely available
30980 drawing editor, and that is suitable for input to text formatters or
30981 for automatic translation to a variety of formats suitable for input
30982 to text formatters.  A copy made in an otherwise Transparent file
30983 format whose markup, or absence of markup, has been arranged to thwart
30984 or discourage subsequent modification by readers is not Transparent.
30985 An image format is not Transparent if used for any substantial amount
30986 of text.  A copy that is not “Transparent” is called `Opaque'.
30988 Examples of suitable formats for Transparent copies include plain
30989 ASCII without markup, Texinfo input format, LaTeX input format, SGML
30990 or XML using a publicly available DTD, and standard-conforming simple
30991 HTML, PostScript or PDF designed for human modification.  Examples of
30992 transparent image formats include PNG, XCF and JPG.  Opaque formats
30993 include proprietary formats that can be read and edited only by
30994 proprietary word processors, SGML or XML for which the DTD and/or
30995 processing tools are not generally available, and the
30996 machine-generated HTML, PostScript or PDF produced by some word
30997 processors for output purposes only.
30999 The “`Title Page'” means, for a printed book, the title page itself,
31000 plus such following pages as are needed to hold, legibly, the material
31001 this License requires to appear in the title page.  For works in
31002 formats which do not have any title page as such, “Title Page” means
31003 the text near the most prominent appearance of the work’s title,
31004 preceding the beginning of the body of the text.
31006 The “`publisher'” means any person or entity that distributes
31007 copies of the Document to the public.
31009 A section “`Entitled XYZ'” means a named subunit of the Document whose
31010 title either is precisely XYZ or contains XYZ in parentheses following
31011 text that translates XYZ in another language.  (Here XYZ stands for a
31012 specific section name mentioned below, such as “`Acknowledgements'”,
31013 “`Dedications'”, “`Endorsements'”, or “`History'”.)
31014 To “`Preserve the Title'”
31015 of such a section when you modify the Document means that it remains a
31016 section “Entitled XYZ” according to this definition.
31018 The Document may include Warranty Disclaimers next to the notice which
31019 states that this License applies to the Document.  These Warranty
31020 Disclaimers are considered to be included by reference in this
31021 License, but only as regards disclaiming warranties: any other
31022 implication that these Warranty Disclaimers may have is void and has
31023 no effect on the meaning of this License.
31025 `2. VERBATIM COPYING'
31027 You may copy and distribute the Document in any medium, either
31028 commercially or noncommercially, provided that this License, the
31029 copyright notices, and the license notice saying this License applies
31030 to the Document are reproduced in all copies, and that you add no other
31031 conditions whatsoever to those of this License.  You may not use
31032 technical measures to obstruct or control the reading or further
31033 copying of the copies you make or distribute.  However, you may accept
31034 compensation in exchange for copies.  If you distribute a large enough
31035 number of copies you must also follow the conditions in section 3.
31037 You may also lend copies, under the same conditions stated above, and
31038 you may publicly display copies.
31040 `3. COPYING IN QUANTITY'
31042 If you publish printed copies (or copies in media that commonly have
31043 printed covers) of the Document, numbering more than 100, and the
31044 Document’s license notice requires Cover Texts, you must enclose the
31045 copies in covers that carry, clearly and legibly, all these Cover
31046 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
31047 the back cover.  Both covers must also clearly and legibly identify
31048 you as the publisher of these copies.  The front cover must present
31049 the full title with all words of the title equally prominent and
31050 visible.  You may add other material on the covers in addition.
31051 Copying with changes limited to the covers, as long as they preserve
31052 the title of the Document and satisfy these conditions, can be treated
31053 as verbatim copying in other respects.
31055 If the required texts for either cover are too voluminous to fit
31056 legibly, you should put the first ones listed (as many as fit
31057 reasonably) on the actual cover, and continue the rest onto adjacent
31058 pages.
31060 If you publish or distribute Opaque copies of the Document numbering
31061 more than 100, you must either include a machine-readable Transparent
31062 copy along with each Opaque copy, or state in or with each Opaque copy
31063 a computer-network location from which the general network-using
31064 public has access to download using public-standard network protocols
31065 a complete Transparent copy of the Document, free of added material.
31066 If you use the latter option, you must take reasonably prudent steps,
31067 when you begin distribution of Opaque copies in quantity, to ensure
31068 that this Transparent copy will remain thus accessible at the stated
31069 location until at least one year after the last time you distribute an
31070 Opaque copy (directly or through your agents or retailers) of that
31071 edition to the public.
31073 It is requested, but not required, that you contact the authors of the
31074 Document well before redistributing any large number of copies, to give
31075 them a chance to provide you with an updated version of the Document.
31077 `4. MODIFICATIONS'
31079 You may copy and distribute a Modified Version of the Document under
31080 the conditions of sections 2 and 3 above, provided that you release
31081 the Modified Version under precisely this License, with the Modified
31082 Version filling the role of the Document, thus licensing distribution
31083 and modification of the Modified Version to whoever possesses a copy
31084 of it.  In addition, you must do these things in the Modified Version:
31087 @enumerate A
31089 @item 
31090 Use in the Title Page (and on the covers, if any) a title distinct
31091 from that of the Document, and from those of previous versions
31092 (which should, if there were any, be listed in the History section
31093 of the Document).  You may use the same title as a previous version
31094 if the original publisher of that version gives permission.
31096 @item 
31097 List on the Title Page, as authors, one or more persons or entities
31098 responsible for authorship of the modifications in the Modified
31099 Version, together with at least five of the principal authors of the
31100 Document (all of its principal authors, if it has fewer than five),
31101 unless they release you from this requirement.
31103 @item 
31104 State on the Title page the name of the publisher of the
31105 Modified Version, as the publisher.
31107 @item 
31108 Preserve all the copyright notices of the Document.
31110 @item 
31111 Add an appropriate copyright notice for your modifications
31112 adjacent to the other copyright notices.
31114 @item 
31115 Include, immediately after the copyright notices, a license notice
31116 giving the public permission to use the Modified Version under the
31117 terms of this License, in the form shown in the Addendum below.
31119 @item 
31120 Preserve in that license notice the full lists of Invariant Sections
31121 and required Cover Texts given in the Document’s license notice.
31123 @item 
31124 Include an unaltered copy of this License.
31126 @item 
31127 Preserve the section Entitled “History”, Preserve its Title, and add
31128 to it an item stating at least the title, year, new authors, and
31129 publisher of the Modified Version as given on the Title Page.  If
31130 there is no section Entitled “History” in the Document, create one
31131 stating the title, year, authors, and publisher of the Document as
31132 given on its Title Page, then add an item describing the Modified
31133 Version as stated in the previous sentence.
31135 @item 
31136 Preserve the network location, if any, given in the Document for
31137 public access to a Transparent copy of the Document, and likewise
31138 the network locations given in the Document for previous versions
31139 it was based on.  These may be placed in the “History” section.
31140 You may omit a network location for a work that was published at
31141 least four years before the Document itself, or if the original
31142 publisher of the version it refers to gives permission.
31144 @item 
31145 For any section Entitled “Acknowledgements” or “Dedications”,
31146 Preserve the Title of the section, and preserve in the section all
31147 the substance and tone of each of the contributor acknowledgements
31148 and/or dedications given therein.
31150 @item 
31151 Preserve all the Invariant Sections of the Document,
31152 unaltered in their text and in their titles.  Section numbers
31153 or the equivalent are not considered part of the section titles.
31155 @item 
31156 Delete any section Entitled “Endorsements”.  Such a section
31157 may not be included in the Modified Version.
31159 @item 
31160 Do not retitle any existing section to be Entitled “Endorsements”
31161 or to conflict in title with any Invariant Section.
31163 @item 
31164 Preserve any Warranty Disclaimers.
31165 @end enumerate
31167 If the Modified Version includes new front-matter sections or
31168 appendices that qualify as Secondary Sections and contain no material
31169 copied from the Document, you may at your option designate some or all
31170 of these sections as invariant.  To do this, add their titles to the
31171 list of Invariant Sections in the Modified Version’s license notice.
31172 These titles must be distinct from any other section titles.
31174 You may add a section Entitled “Endorsements”, provided it contains
31175 nothing but endorsements of your Modified Version by various
31176 parties—for example, statements of peer review or that the text has
31177 been approved by an organization as the authoritative definition of a
31178 standard.
31180 You may add a passage of up to five words as a Front-Cover Text, and a
31181 passage of up to 25 words as a Back-Cover Text, to the end of the list
31182 of Cover Texts in the Modified Version.  Only one passage of
31183 Front-Cover Text and one of Back-Cover Text may be added by (or
31184 through arrangements made by) any one entity.  If the Document already
31185 includes a cover text for the same cover, previously added by you or
31186 by arrangement made by the same entity you are acting on behalf of,
31187 you may not add another; but you may replace the old one, on explicit
31188 permission from the previous publisher that added the old one.
31190 The author(s) and publisher(s) of the Document do not by this License
31191 give permission to use their names for publicity for or to assert or
31192 imply endorsement of any Modified Version.
31194 `5. COMBINING DOCUMENTS'
31196 You may combine the Document with other documents released under this
31197 License, under the terms defined in section 4 above for modified
31198 versions, provided that you include in the combination all of the
31199 Invariant Sections of all of the original documents, unmodified, and
31200 list them all as Invariant Sections of your combined work in its
31201 license notice, and that you preserve all their Warranty Disclaimers.
31203 The combined work need only contain one copy of this License, and
31204 multiple identical Invariant Sections may be replaced with a single
31205 copy.  If there are multiple Invariant Sections with the same name but
31206 different contents, make the title of each such section unique by
31207 adding at the end of it, in parentheses, the name of the original
31208 author or publisher of that section if known, or else a unique number.
31209 Make the same adjustment to the section titles in the list of
31210 Invariant Sections in the license notice of the combined work.
31212 In the combination, you must combine any sections Entitled “History”
31213 in the various original documents, forming one section Entitled
31214 “History”; likewise combine any sections Entitled “Acknowledgements”,
31215 and any sections Entitled “Dedications”.  You must delete all sections
31216 Entitled “Endorsements”.
31218 `6. COLLECTIONS OF DOCUMENTS'
31220 You may make a collection consisting of the Document and other documents
31221 released under this License, and replace the individual copies of this
31222 License in the various documents with a single copy that is included in
31223 the collection, provided that you follow the rules of this License for
31224 verbatim copying of each of the documents in all other respects.
31226 You may extract a single document from such a collection, and distribute
31227 it individually under this License, provided you insert a copy of this
31228 License into the extracted document, and follow this License in all
31229 other respects regarding verbatim copying of that document.
31231 `7. AGGREGATION WITH INDEPENDENT WORKS'
31233 A compilation of the Document or its derivatives with other separate
31234 and independent documents or works, in or on a volume of a storage or
31235 distribution medium, is called an “aggregate” if the copyright
31236 resulting from the compilation is not used to limit the legal rights
31237 of the compilation’s users beyond what the individual works permit.
31238 When the Document is included in an aggregate, this License does not
31239 apply to the other works in the aggregate which are not themselves
31240 derivative works of the Document.
31242 If the Cover Text requirement of section 3 is applicable to these
31243 copies of the Document, then if the Document is less than one half of
31244 the entire aggregate, the Document’s Cover Texts may be placed on
31245 covers that bracket the Document within the aggregate, or the
31246 electronic equivalent of covers if the Document is in electronic form.
31247 Otherwise they must appear on printed covers that bracket the whole
31248 aggregate.
31250 `8. TRANSLATION'
31252 Translation is considered a kind of modification, so you may
31253 distribute translations of the Document under the terms of section 4.
31254 Replacing Invariant Sections with translations requires special
31255 permission from their copyright holders, but you may include
31256 translations of some or all Invariant Sections in addition to the
31257 original versions of these Invariant Sections.  You may include a
31258 translation of this License, and all the license notices in the
31259 Document, and any Warranty Disclaimers, provided that you also include
31260 the original English version of this License and the original versions
31261 of those notices and disclaimers.  In case of a disagreement between
31262 the translation and the original version of this License or a notice
31263 or disclaimer, the original version will prevail.
31265 If a section in the Document is Entitled “Acknowledgements”,
31266 “Dedications”, or “History”, the requirement (section 4) to Preserve
31267 its Title (section 1) will typically require changing the actual
31268 title.
31270 `9. TERMINATION'
31272 You may not copy, modify, sublicense, or distribute the Document
31273 except as expressly provided under this License.  Any attempt
31274 otherwise to copy, modify, sublicense, or distribute it is void, and
31275 will automatically terminate your rights under this License.
31277 However, if you cease all violation of this License, then your license
31278 from a particular copyright holder is reinstated (a) provisionally,
31279 unless and until the copyright holder explicitly and finally
31280 terminates your license, and (b) permanently, if the copyright holder
31281 fails to notify you of the violation by some reasonable means prior to
31282 60 days after the cessation.
31284 Moreover, your license from a particular copyright holder is
31285 reinstated permanently if the copyright holder notifies you of the
31286 violation by some reasonable means, this is the first time you have
31287 received notice of violation of this License (for any work) from that
31288 copyright holder, and you cure the violation prior to 30 days after
31289 your receipt of the notice.
31291 Termination of your rights under this section does not terminate the
31292 licenses of parties who have received copies or rights from you under
31293 this License.  If your rights have been terminated and not permanently
31294 reinstated, receipt of a copy of some or all of the same material does
31295 not give you any rights to use it.
31297 `10. FUTURE REVISIONS OF THIS LICENSE'
31299 The Free Software Foundation may publish new, revised versions
31300 of the GNU Free Documentation License from time to time.  Such new
31301 versions will be similar in spirit to the present version, but may
31302 differ in detail to address new problems or concerns.  See
31303 @indicateurl{https://www.gnu.org/copyleft/}.
31305 Each version of the License is given a distinguishing version number.
31306 If the Document specifies that a particular numbered version of this
31307 License “or any later version” applies to it, you have the option of
31308 following the terms and conditions either of that specified version or
31309 of any later version that has been published (not as a draft) by the
31310 Free Software Foundation.  If the Document does not specify a version
31311 number of this License, you may choose any version ever published (not
31312 as a draft) by the Free Software Foundation.  If the Document
31313 specifies that a proxy can decide which future versions of this
31314 License can be used, that proxy’s public statement of acceptance of a
31315 version permanently authorizes you to choose that version for the
31316 Document.
31318 `11. RELICENSING'
31320 “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
31321 World Wide Web server that publishes copyrightable works and also
31322 provides prominent facilities for anybody to edit those works.  A
31323 public wiki that anybody can edit is an example of such a server.  A
31324 “Massive Multiauthor Collaboration” (or “MMC”) contained in the
31325 site means any set of copyrightable works thus published on the MMC
31326 site.
31328 “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
31329 license published by Creative Commons Corporation, a not-for-profit
31330 corporation with a principal place of business in San Francisco,
31331 California, as well as future copyleft versions of that license
31332 published by that same organization.
31334 “Incorporate” means to publish or republish a Document, in whole or
31335 in part, as part of another Document.
31337 An MMC is “eligible for relicensing” if it is licensed under this
31338 License, and if all works that were first published under this License
31339 somewhere other than this MMC, and subsequently incorporated in whole
31340 or in part into the MMC, (1) had no cover texts or invariant sections,
31341 and (2) were thus incorporated prior to November 1, 2008.
31343 The operator of an MMC Site may republish an MMC contained in the site
31344 under CC-BY-SA on the same site at any time before August 1, 2009,
31345 provided the MMC is eligible for relicensing.
31347 `ADDENDUM: How to use this License for your documents'
31349 To use this License in a document you have written, include a copy of
31350 the License in the document and put the following copyright and
31351 license notices just after the title page:
31353 @quotation
31355 Copyright © YEAR  YOUR NAME.
31356 Permission is granted to copy, distribute and/or modify this document
31357 under the terms of the GNU Free Documentation License, Version 1.3
31358 or any later version published by the Free Software Foundation;
31359 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
31360 A copy of the license is included in the section entitled “GNU
31361 Free Documentation License”.
31362 @end quotation
31364 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
31365 replace the “with … Texts.” line with this:
31367 @quotation
31369 with the Invariant Sections being LIST THEIR TITLES, with the
31370 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
31371 @end quotation
31373 If you have Invariant Sections without Cover Texts, or some other
31374 combination of the three, merge those two alternatives to suit the
31375 situation.
31377 If your document contains nontrivial examples of program code, we
31378 recommend releasing these examples in parallel under your choice of
31379 free software license, such as the GNU General Public License,
31380 to permit their use in free software.
31382 @node Index,,GNU Free Documentation License,Top
31383 @unnumbered Index
31386 @printindex ge
31389 @c %**end of body
31390 @bye