ada: Documentation for mixed declarations and statements
[official-gcc.git] / gcc / ada / gnat_rm.texi
blob066c066d19d6b6835b1dc343a153474235d86116
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.2.3.@*
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 , Jul 10, 2023
24 AdaCore
26 Copyright @copyright{} 2008-2023, 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 Annotate:: 
110 * Pragma Assert:: 
111 * Pragma Assert_And_Cut:: 
112 * Pragma Assertion_Policy:: 
113 * Pragma Assume:: 
114 * Pragma Assume_No_Invalid_Values:: 
115 * Pragma Async_Readers:: 
116 * Pragma Async_Writers:: 
117 * Pragma Attribute_Definition:: 
118 * Pragma C_Pass_By_Copy:: 
119 * Pragma Check:: 
120 * Pragma Check_Float_Overflow:: 
121 * Pragma Check_Name:: 
122 * Pragma Check_Policy:: 
123 * Pragma Comment:: 
124 * Pragma Common_Object:: 
125 * Pragma Compile_Time_Error:: 
126 * Pragma Compile_Time_Warning:: 
127 * Pragma Complete_Representation:: 
128 * Pragma Complex_Representation:: 
129 * Pragma Component_Alignment:: 
130 * Pragma Constant_After_Elaboration:: 
131 * Pragma Contract_Cases:: 
132 * Pragma Convention_Identifier:: 
133 * Pragma CPP_Class:: 
134 * Pragma CPP_Constructor:: 
135 * Pragma CPP_Virtual:: 
136 * Pragma CPP_Vtable:: 
137 * Pragma CPU:: 
138 * Pragma Deadline_Floor:: 
139 * Pragma Debug:: 
140 * Pragma Debug_Policy:: 
141 * Pragma Default_Initial_Condition:: 
142 * Pragma Default_Scalar_Storage_Order:: 
143 * Pragma Default_Storage_Pool:: 
144 * Pragma Depends:: 
145 * Pragma Detect_Blocking:: 
146 * Pragma Disable_Atomic_Synchronization:: 
147 * Pragma Dispatching_Domain:: 
148 * Pragma Effective_Reads:: 
149 * Pragma Effective_Writes:: 
150 * Pragma Elaboration_Checks:: 
151 * Pragma Eliminate:: 
152 * Pragma Enable_Atomic_Synchronization:: 
153 * Pragma Export_Function:: 
154 * Pragma Export_Object:: 
155 * Pragma Export_Procedure:: 
156 * Pragma Export_Valued_Procedure:: 
157 * Pragma Extend_System:: 
158 * Pragma Extensions_Allowed:: 
159 * Pragma Extensions_Visible:: 
160 * Pragma External:: 
161 * Pragma External_Name_Casing:: 
162 * Pragma Fast_Math:: 
163 * Pragma Favor_Top_Level:: 
164 * Pragma Finalize_Storage_Only:: 
165 * Pragma Float_Representation:: 
166 * Pragma Ghost:: 
167 * Pragma Global:: 
168 * Pragma Ident:: 
169 * Pragma Ignore_Pragma:: 
170 * Pragma Implementation_Defined:: 
171 * Pragma Implemented:: 
172 * Pragma Implicit_Packing:: 
173 * Pragma Import_Function:: 
174 * Pragma Import_Object:: 
175 * Pragma Import_Procedure:: 
176 * Pragma Import_Valued_Procedure:: 
177 * Pragma Independent:: 
178 * Pragma Independent_Components:: 
179 * Pragma Initial_Condition:: 
180 * Pragma Initialize_Scalars:: 
181 * Pragma Initializes:: 
182 * Pragma Inline_Always:: 
183 * Pragma Inline_Generic:: 
184 * Pragma Interface:: 
185 * Pragma Interface_Name:: 
186 * Pragma Interrupt_Handler:: 
187 * Pragma Interrupt_State:: 
188 * Pragma Invariant:: 
189 * Pragma Keep_Names:: 
190 * Pragma License:: 
191 * Pragma Link_With:: 
192 * Pragma Linker_Alias:: 
193 * Pragma Linker_Constructor:: 
194 * Pragma Linker_Destructor:: 
195 * Pragma Linker_Section:: 
196 * Pragma Lock_Free:: 
197 * Pragma Loop_Invariant:: 
198 * Pragma Loop_Optimize:: 
199 * Pragma Loop_Variant:: 
200 * Pragma Machine_Attribute:: 
201 * Pragma Main:: 
202 * Pragma Main_Storage:: 
203 * Pragma Max_Queue_Length:: 
204 * Pragma No_Body:: 
205 * Pragma No_Caching:: 
206 * Pragma No_Component_Reordering:: 
207 * Pragma No_Elaboration_Code_All:: 
208 * Pragma No_Heap_Finalization:: 
209 * Pragma No_Inline:: 
210 * Pragma No_Return:: 
211 * Pragma No_Strict_Aliasing:: 
212 * Pragma No_Tagged_Streams:: 
213 * Pragma Normalize_Scalars:: 
214 * Pragma Obsolescent:: 
215 * Pragma Optimize_Alignment:: 
216 * Pragma Ordered:: 
217 * Pragma Overflow_Mode:: 
218 * Pragma Overriding_Renamings:: 
219 * Pragma Part_Of:: 
220 * Pragma Partition_Elaboration_Policy:: 
221 * Pragma Passive:: 
222 * Pragma Persistent_BSS:: 
223 * Pragma Post:: 
224 * Pragma Postcondition:: 
225 * Pragma Post_Class:: 
226 * Pragma Pre:: 
227 * Pragma Precondition:: 
228 * Pragma Predicate:: 
229 * Pragma Predicate_Failure:: 
230 * Pragma Preelaborable_Initialization:: 
231 * Pragma Prefix_Exception_Messages:: 
232 * Pragma Pre_Class:: 
233 * Pragma Priority_Specific_Dispatching:: 
234 * Pragma Profile:: 
235 * Pragma Profile_Warnings:: 
236 * Pragma Propagate_Exceptions:: 
237 * Pragma Provide_Shift_Operators:: 
238 * Pragma Psect_Object:: 
239 * Pragma Pure_Function:: 
240 * Pragma Rational:: 
241 * Pragma Ravenscar:: 
242 * Pragma Refined_Depends:: 
243 * Pragma Refined_Global:: 
244 * Pragma Refined_Post:: 
245 * Pragma Refined_State:: 
246 * Pragma Relative_Deadline:: 
247 * Pragma Remote_Access_Type:: 
248 * Pragma Rename_Pragma:: 
249 * Pragma Restricted_Run_Time:: 
250 * Pragma Restriction_Warnings:: 
251 * Pragma Reviewable:: 
252 * Pragma Secondary_Stack_Size:: 
253 * Pragma Share_Generic:: 
254 * Pragma Shared:: 
255 * Pragma Short_Circuit_And_Or:: 
256 * Pragma Short_Descriptors:: 
257 * Pragma Simple_Storage_Pool_Type:: 
258 * Pragma Source_File_Name:: 
259 * Pragma Source_File_Name_Project:: 
260 * Pragma Source_Reference:: 
261 * Pragma SPARK_Mode:: 
262 * Pragma Static_Elaboration_Desired:: 
263 * Pragma Stream_Convert:: 
264 * Pragma Style_Checks:: 
265 * Pragma Subtitle:: 
266 * Pragma Suppress:: 
267 * Pragma Suppress_All:: 
268 * Pragma Suppress_Debug_Info:: 
269 * Pragma Suppress_Exception_Locations:: 
270 * Pragma Suppress_Initialization:: 
271 * Pragma Task_Name:: 
272 * Pragma Task_Storage:: 
273 * Pragma Test_Case:: 
274 * Pragma Thread_Local_Storage:: 
275 * Pragma Time_Slice:: 
276 * Pragma Title:: 
277 * Pragma Type_Invariant:: 
278 * Pragma Type_Invariant_Class:: 
279 * Pragma Unchecked_Union:: 
280 * Pragma Unevaluated_Use_Of_Old:: 
281 * Pragma Unimplemented_Unit:: 
282 * Pragma Universal_Aliasing:: 
283 * Pragma Unmodified:: 
284 * Pragma Unreferenced:: 
285 * Pragma Unreferenced_Objects:: 
286 * Pragma Unreserve_All_Interrupts:: 
287 * Pragma Unsuppress:: 
288 * Pragma Unused:: 
289 * Pragma Use_VADS_Size:: 
290 * Pragma Validity_Checks:: 
291 * Pragma Volatile:: 
292 * Pragma Volatile_Full_Access:: 
293 * Pragma Volatile_Function:: 
294 * Pragma Warning_As_Error:: 
295 * Pragma Warnings:: 
296 * Pragma Weak_External:: 
297 * Pragma Wide_Character_Encoding:: 
299 Implementation Defined Aspects
301 * Aspect Abstract_State:: 
302 * Aspect Annotate:: 
303 * Aspect Async_Readers:: 
304 * Aspect Async_Writers:: 
305 * Aspect Constant_After_Elaboration:: 
306 * Aspect Contract_Cases:: 
307 * Aspect Depends:: 
308 * Aspect Default_Initial_Condition:: 
309 * Aspect Dimension:: 
310 * Aspect Dimension_System:: 
311 * Aspect Disable_Controlled:: 
312 * Aspect Effective_Reads:: 
313 * Aspect Effective_Writes:: 
314 * Aspect Extensions_Visible:: 
315 * Aspect Favor_Top_Level:: 
316 * Aspect Ghost:: 
317 * Aspect Ghost_Predicate:: 
318 * Aspect Global:: 
319 * Aspect Initial_Condition:: 
320 * Aspect Initializes:: 
321 * Aspect Inline_Always:: 
322 * Aspect Invariant:: 
323 * Aspect Invariant’Class:: 
324 * Aspect Iterable:: 
325 * Aspect Linker_Section:: 
326 * Aspect Lock_Free:: 
327 * Aspect Max_Queue_Length:: 
328 * Aspect No_Caching:: 
329 * Aspect No_Elaboration_Code_All:: 
330 * Aspect No_Inline:: 
331 * Aspect No_Tagged_Streams:: 
332 * Aspect No_Task_Parts:: 
333 * Aspect Object_Size:: 
334 * Aspect Obsolescent:: 
335 * Aspect Part_Of:: 
336 * Aspect Persistent_BSS:: 
337 * Aspect Predicate:: 
338 * Aspect Pure_Function:: 
339 * Aspect Refined_Depends:: 
340 * Aspect Refined_Global:: 
341 * Aspect Refined_Post:: 
342 * Aspect Refined_State:: 
343 * Aspect Relaxed_Initialization:: 
344 * Aspect Remote_Access_Type:: 
345 * Aspect Secondary_Stack_Size:: 
346 * Aspect Scalar_Storage_Order:: 
347 * Aspect Shared:: 
348 * Aspect Simple_Storage_Pool:: 
349 * Aspect Simple_Storage_Pool_Type:: 
350 * Aspect SPARK_Mode:: 
351 * Aspect Suppress_Debug_Info:: 
352 * Aspect Suppress_Initialization:: 
353 * Aspect Test_Case:: 
354 * Aspect Thread_Local_Storage:: 
355 * Aspect Universal_Aliasing:: 
356 * Aspect Unmodified:: 
357 * Aspect Unreferenced:: 
358 * Aspect Unreferenced_Objects:: 
359 * Aspect Value_Size:: 
360 * Aspect Volatile_Full_Access:: 
361 * Aspect Volatile_Function:: 
362 * Aspect Warnings:: 
364 Implementation Defined Attributes
366 * Attribute Abort_Signal:: 
367 * Attribute Address_Size:: 
368 * Attribute Asm_Input:: 
369 * Attribute Asm_Output:: 
370 * Attribute Atomic_Always_Lock_Free:: 
371 * Attribute Bit:: 
372 * Attribute Bit_Position:: 
373 * Attribute Code_Address:: 
374 * Attribute Compiler_Version:: 
375 * Attribute Constrained:: 
376 * Attribute Default_Bit_Order:: 
377 * Attribute Default_Scalar_Storage_Order:: 
378 * Attribute Deref:: 
379 * Attribute Descriptor_Size:: 
380 * Attribute Elaborated:: 
381 * Attribute Elab_Body:: 
382 * Attribute Elab_Spec:: 
383 * Attribute Elab_Subp_Body:: 
384 * Attribute Emax:: 
385 * Attribute Enabled:: 
386 * Attribute Enum_Rep:: 
387 * Attribute Enum_Val:: 
388 * Attribute Epsilon:: 
389 * Attribute Fast_Math:: 
390 * Attribute Finalization_Size:: 
391 * Attribute Fixed_Value:: 
392 * Attribute From_Any:: 
393 * Attribute Has_Access_Values:: 
394 * Attribute Has_Discriminants:: 
395 * Attribute Has_Tagged_Values:: 
396 * Attribute Img:: 
397 * Attribute Initialized:: 
398 * Attribute Integer_Value:: 
399 * Attribute Invalid_Value:: 
400 * Attribute Iterable:: 
401 * Attribute Large:: 
402 * Attribute Library_Level:: 
403 * Attribute Loop_Entry:: 
404 * Attribute Machine_Size:: 
405 * Attribute Mantissa:: 
406 * Attribute Maximum_Alignment:: 
407 * Attribute Max_Integer_Size:: 
408 * Attribute Mechanism_Code:: 
409 * Attribute Null_Parameter:: 
410 * Attribute Object_Size:: 
411 * Attribute Old:: 
412 * Attribute Passed_By_Reference:: 
413 * Attribute Pool_Address:: 
414 * Attribute Range_Length:: 
415 * Attribute Restriction_Set:: 
416 * Attribute Result:: 
417 * Attribute Safe_Emax:: 
418 * Attribute Safe_Large:: 
419 * Attribute Safe_Small:: 
420 * Attribute Scalar_Storage_Order:: 
421 * Attribute Simple_Storage_Pool:: 
422 * Attribute Small:: 
423 * Attribute Small_Denominator:: 
424 * Attribute Small_Numerator:: 
425 * Attribute Storage_Unit:: 
426 * Attribute Stub_Type:: 
427 * Attribute System_Allocator_Alignment:: 
428 * Attribute Target_Name:: 
429 * Attribute To_Address:: 
430 * Attribute To_Any:: 
431 * Attribute Type_Class:: 
432 * Attribute Type_Key:: 
433 * Attribute TypeCode:: 
434 * Attribute Unconstrained_Array:: 
435 * Attribute Universal_Literal_String:: 
436 * Attribute Unrestricted_Access:: 
437 * Attribute Update:: 
438 * Attribute Valid_Value:: 
439 * Attribute Valid_Scalars:: 
440 * Attribute VADS_Size:: 
441 * Attribute Value_Size:: 
442 * Attribute Wchar_T_Size:: 
443 * Attribute Word_Size:: 
445 Standard and Implementation Defined Restrictions
447 * Partition-Wide Restrictions:: 
448 * Program Unit Level Restrictions:: 
450 Partition-Wide Restrictions
452 * Immediate_Reclamation:: 
453 * Max_Asynchronous_Select_Nesting:: 
454 * Max_Entry_Queue_Length:: 
455 * Max_Protected_Entries:: 
456 * Max_Select_Alternatives:: 
457 * Max_Storage_At_Blocking:: 
458 * Max_Task_Entries:: 
459 * Max_Tasks:: 
460 * No_Abort_Statements:: 
461 * No_Access_Parameter_Allocators:: 
462 * No_Access_Subprograms:: 
463 * No_Allocators:: 
464 * No_Anonymous_Allocators:: 
465 * No_Asynchronous_Control:: 
466 * No_Calendar:: 
467 * No_Coextensions:: 
468 * No_Default_Initialization:: 
469 * No_Delay:: 
470 * No_Dependence:: 
471 * No_Direct_Boolean_Operators:: 
472 * No_Dispatch:: 
473 * No_Dispatching_Calls:: 
474 * No_Dynamic_Attachment:: 
475 * No_Dynamic_Priorities:: 
476 * No_Entry_Calls_In_Elaboration_Code:: 
477 * No_Enumeration_Maps:: 
478 * No_Exception_Handlers:: 
479 * No_Exception_Propagation:: 
480 * No_Exception_Registration:: 
481 * No_Exceptions:: 
482 * No_Finalization:: 
483 * No_Fixed_Point:: 
484 * No_Floating_Point:: 
485 * No_Implicit_Conditionals:: 
486 * No_Implicit_Dynamic_Code:: 
487 * No_Implicit_Heap_Allocations:: 
488 * No_Implicit_Protected_Object_Allocations:: 
489 * No_Implicit_Task_Allocations:: 
490 * No_Initialize_Scalars:: 
491 * No_IO:: 
492 * No_Local_Allocators:: 
493 * No_Local_Protected_Objects:: 
494 * No_Local_Tagged_Types:: 
495 * No_Local_Timing_Events:: 
496 * No_Long_Long_Integers:: 
497 * No_Multiple_Elaboration:: 
498 * No_Nested_Finalization:: 
499 * No_Protected_Type_Allocators:: 
500 * No_Protected_Types:: 
501 * No_Recursion:: 
502 * No_Reentrancy:: 
503 * No_Relative_Delay:: 
504 * No_Requeue_Statements:: 
505 * No_Secondary_Stack:: 
506 * No_Select_Statements:: 
507 * No_Specific_Termination_Handlers:: 
508 * No_Specification_of_Aspect:: 
509 * No_Standard_Allocators_After_Elaboration:: 
510 * No_Standard_Storage_Pools:: 
511 * No_Stream_Optimizations:: 
512 * No_Streams:: 
513 * No_Tagged_Type_Registration:: 
514 * No_Task_Allocators:: 
515 * No_Task_At_Interrupt_Priority:: 
516 * No_Task_Attributes_Package:: 
517 * No_Task_Hierarchy:: 
518 * No_Task_Termination:: 
519 * No_Tasking:: 
520 * No_Terminate_Alternatives:: 
521 * No_Unchecked_Access:: 
522 * No_Unchecked_Conversion:: 
523 * No_Unchecked_Deallocation:: 
524 * No_Use_Of_Attribute:: 
525 * No_Use_Of_Entity:: 
526 * No_Use_Of_Pragma:: 
527 * Pure_Barriers:: 
528 * Simple_Barriers:: 
529 * Static_Priorities:: 
530 * Static_Storage_Size:: 
532 Program Unit Level Restrictions
534 * No_Elaboration_Code:: 
535 * No_Dynamic_Accessibility_Checks:: 
536 * No_Dynamic_Sized_Objects:: 
537 * No_Entry_Queue:: 
538 * No_Implementation_Aspect_Specifications:: 
539 * No_Implementation_Attributes:: 
540 * No_Implementation_Identifiers:: 
541 * No_Implementation_Pragmas:: 
542 * No_Implementation_Restrictions:: 
543 * No_Implementation_Units:: 
544 * No_Implicit_Aliasing:: 
545 * No_Implicit_Loops:: 
546 * No_Obsolescent_Features:: 
547 * No_Wide_Characters:: 
548 * Static_Dispatch_Tables:: 
549 * SPARK_05:: 
551 Implementation Advice
553 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
554 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
555 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
556 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
557 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
558 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
559 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
560 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
561 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
562 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
563 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
564 * RM 9.6(30-31); Duration’Small: RM 9 6 30-31 Duration’Small. 
565 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
566 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
567 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
568 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
569 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
570 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
571 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
572 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
573 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
574 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
575 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
576 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
577 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
578 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
579 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
580 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
581 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
582 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
583 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
584 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes. 
585 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
586 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
587 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
588 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
589 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
590 * RM A.18; Containers: RM A 18 Containers. 
591 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
592 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
593 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
594 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
595 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
596 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
597 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
598 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
599 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
600 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
601 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
602 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
603 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
604 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
605 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
606 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
607 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
608 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
609 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
610 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
611 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
612 * RM G; Numerics: RM G Numerics. 
613 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
614 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
615 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
616 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
617 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
619 Intrinsic Subprograms
621 * Intrinsic Operators:: 
622 * Compilation_ISO_Date:: 
623 * Compilation_Date:: 
624 * Compilation_Time:: 
625 * Enclosing_Entity:: 
626 * Exception_Information:: 
627 * Exception_Message:: 
628 * Exception_Name:: 
629 * File:: 
630 * Line:: 
631 * Shifts and Rotates:: 
632 * Source_Location:: 
634 Representation Clauses and Pragmas
636 * Alignment Clauses:: 
637 * Size Clauses:: 
638 * Storage_Size Clauses:: 
639 * Size of Variant Record Objects:: 
640 * Biased Representation:: 
641 * Value_Size and Object_Size Clauses:: 
642 * Component_Size Clauses:: 
643 * Bit_Order Clauses:: 
644 * Effect of Bit_Order on Byte Ordering:: 
645 * Pragma Pack for Arrays:: 
646 * Pragma Pack for Records:: 
647 * Record Representation Clauses:: 
648 * Handling of Records with Holes:: 
649 * Enumeration Clauses:: 
650 * Address Clauses:: 
651 * Use of Address Clauses for Memory-Mapped I/O:: 
652 * Effect of Convention on Representation:: 
653 * Conventions and Anonymous Access Types:: 
654 * Determining the Representations chosen by GNAT:: 
656 The Implementation of Standard I/O
658 * Standard I/O Packages:: 
659 * FORM Strings:: 
660 * Direct_IO:: 
661 * Sequential_IO:: 
662 * Text_IO:: 
663 * Wide_Text_IO:: 
664 * Wide_Wide_Text_IO:: 
665 * Stream_IO:: 
666 * Text Translation:: 
667 * Shared Files:: 
668 * Filenames encoding:: 
669 * File content encoding:: 
670 * Open Modes:: 
671 * Operations on C Streams:: 
672 * Interfacing to C Streams:: 
674 Text_IO
676 * Stream Pointer Positioning:: 
677 * Reading and Writing Non-Regular Files:: 
678 * Get_Immediate:: 
679 * Treating Text_IO Files as Streams:: 
680 * Text_IO Extensions:: 
681 * Text_IO Facilities for Unbounded Strings:: 
683 Wide_Text_IO
685 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
686 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
688 Wide_Wide_Text_IO
690 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
691 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
693 The GNAT Library
695 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
696 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
697 * Ada.Characters.Wide_Latin_9 (a-cwila9.ads): Ada Characters Wide_Latin_9 a-cwila9 ads. 
698 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
699 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
700 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
701 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
702 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
703 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
704 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
705 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
706 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
707 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
708 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
709 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
710 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
711 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
712 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
713 * Ada.Task_Initialization (a-tasini.ads): Ada Task_Initialization a-tasini ads. 
714 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
715 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
716 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
717 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
718 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
719 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
720 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
721 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
722 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
723 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
724 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
725 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
726 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
727 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
728 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
729 * GNAT.Binary_Search (g-binsea.ads): GNAT Binary_Search g-binsea ads. 
730 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
731 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads. 
732 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
733 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
734 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
735 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
736 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
737 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
738 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
739 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
740 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
741 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
742 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
743 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
744 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
745 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
746 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
747 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
748 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
749 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
750 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
751 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
752 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
753 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
754 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
755 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
756 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
757 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
758 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
759 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
760 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
761 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
762 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads. 
763 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
764 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
765 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
766 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
767 * GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads): GNAT Generic_Fast_Math_Functions g-gfmafu ads. 
768 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
769 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
770 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
771 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
772 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
773 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
774 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
775 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
776 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
777 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
778 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
779 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
780 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
781 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
782 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
783 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
784 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
785 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
786 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
787 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
788 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
789 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
790 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
791 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
792 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
793 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
794 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
795 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
796 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
797 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
798 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
799 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
800 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
801 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
802 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
803 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
804 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
805 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
806 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
807 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
808 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
809 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
810 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
811 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
812 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
813 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
814 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
815 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
816 * GNAT.UTF_32 (g-utf_32.ads): GNAT UTF_32 g-utf_32 ads. 
817 * GNAT.UTF_32_Spelling_Checker (g-u3spch.ads): GNAT UTF_32_Spelling_Checker g-u3spch ads. 
818 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
819 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
820 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
821 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
822 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
823 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
824 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
825 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
826 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads. 
827 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
828 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
829 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
830 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
831 * System.Memory (s-memory.ads): System Memory s-memory ads. 
832 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
833 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
834 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
835 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
836 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
837 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
838 * System.Rident (s-rident.ads): System Rident s-rident ads. 
839 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
840 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
841 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
842 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
844 Interfacing to Other Languages
846 * Interfacing to C:: 
847 * Interfacing to C++:: 
848 * Interfacing to COBOL:: 
849 * Interfacing to Fortran:: 
850 * Interfacing to non-GNAT Ada code:: 
852 Implementation of Specific Ada Features
854 * Machine Code Insertions:: 
855 * GNAT Implementation of Tasking:: 
856 * GNAT Implementation of Shared Passive Packages:: 
857 * Code Generation for Array Aggregates:: 
858 * The Size of Discriminated Records with Default Discriminants:: 
859 * Image Values For Nonscalar Types:: 
860 * Strict Conformance to the Ada Reference Manual:: 
862 GNAT Implementation of Tasking
864 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
865 * Ensuring Compliance with the Real-Time Annex:: 
866 * Support for Locking Policies:: 
868 Code Generation for Array Aggregates
870 * Static constant aggregates with static bounds:: 
871 * Constant aggregates with unconstrained nominal types:: 
872 * Aggregates with static bounds:: 
873 * Aggregates with nonstatic bounds:: 
874 * Aggregates in assignment statements:: 
876 GNAT language extensions
878 * How to activate the extended GNAT Ada superset:: 
879 * Curated Extensions:: 
880 * Experimental Language Extensions:: 
882 Curated Extensions
884 * Local Declarations Without Block:: 
885 * Conditional when constructs:: 
886 * Case pattern matching:: 
887 * Fixed lower bounds for array types and subtypes:: 
888 * Prefixed-view notation for calls to primitive subprograms of untagged types:: 
889 * Expression defaults for generic formal functions:: 
890 * String interpolation:: 
891 * Constrained attribute for generic objects:: 
892 * Static aspect on intrinsic functions:: 
894 Experimental Language Extensions
896 * Pragma Storage_Model:: 
897 * Simpler accessibility model:: 
899 Security Hardening Features
901 * Register Scrubbing:: 
902 * Stack Scrubbing:: 
903 * Hardened Conditionals:: 
904 * Hardened Booleans:: 
905 * Control Flow Redundancy:: 
907 Obsolescent Features
909 * pragma No_Run_Time:: 
910 * pragma Ravenscar:: 
911 * pragma Restricted_Run_Time:: 
912 * pragma Task_Info:: 
913 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
915 Compatibility and Porting Guide
917 * Writing Portable Fixed-Point Declarations:: 
918 * Compatibility with Ada 83:: 
919 * Compatibility between Ada 95 and Ada 2005:: 
920 * Implementation-dependent characteristics:: 
921 * Compatibility with Other Ada Systems:: 
922 * Representation Clauses:: 
923 * Compatibility with HP Ada 83:: 
925 Compatibility with Ada 83
927 * Legal Ada 83 programs that are illegal in Ada 95:: 
928 * More deterministic semantics:: 
929 * Changed semantics:: 
930 * Other language compatibility issues:: 
932 Implementation-dependent characteristics
934 * Implementation-defined pragmas:: 
935 * Implementation-defined attributes:: 
936 * Libraries:: 
937 * Elaboration order:: 
938 * Target-specific aspects:: 
940 @end detailmenu
941 @end menu
943 @node About This Guide,Implementation Defined Pragmas,Top,Top
944 @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}
945 @chapter About This Guide
949 This manual contains useful information in writing programs using the
950 GNAT compiler.  It includes information on implementation dependent
951 characteristics of GNAT, including all the information required by
952 Annex M of the Ada language standard.
954 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
955 invoked in Ada 83 compatibility mode.
956 By default, GNAT assumes Ada 2012,
957 but you can override with a compiler switch
958 to explicitly specify the language version.
959 (Please refer to the `GNAT User’s Guide' for details on these switches.)
960 Throughout this manual, references to ‘Ada’ without a year suffix
961 apply to all the Ada versions of the language.
963 Ada is designed to be highly portable.
964 In general, a program will have the same effect even when compiled by
965 different compilers on different platforms.
966 However, since Ada is designed to be used in a
967 wide variety of applications, it also contains a number of system
968 dependent features to be used in interfacing to the external world.
970 @geindex Implementation-dependent features
972 @geindex Portability
974 Note: Any program that makes use of implementation-dependent features
975 may be non-portable.  You should follow good programming practice and
976 isolate and clearly document any sections of your program that make use
977 of these features in a non-portable manner.
979 @menu
980 * What This Reference Manual Contains:: 
981 * Conventions:: 
982 * Related Information:: 
984 @end menu
986 @node What This Reference Manual Contains,Conventions,,About This Guide
987 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
988 @section What This Reference Manual Contains
991 This reference manual contains the following chapters:
994 @itemize *
996 @item 
997 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
998 pragmas, which can be used to extend and enhance the functionality of the
999 compiler.
1001 @item 
1002 @ref{8,,Implementation Defined Attributes}, lists GNAT
1003 implementation-dependent attributes, which can be used to extend and
1004 enhance the functionality of the compiler.
1006 @item 
1007 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
1008 implementation-dependent restrictions, which can be used to extend and
1009 enhance the functionality of the compiler.
1011 @item 
1012 @ref{a,,Implementation Advice}, provides information on generally
1013 desirable behavior which are not requirements that all compilers must
1014 follow since it cannot be provided on all systems, or which may be
1015 undesirable on some systems.
1017 @item 
1018 @ref{b,,Implementation Defined Characteristics}, provides a guide to
1019 minimizing implementation dependent features.
1021 @item 
1022 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
1023 implemented by GNAT, and how they can be imported into user
1024 application programs.
1026 @item 
1027 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
1028 way that GNAT represents data, and in particular the exact set
1029 of representation clauses and pragmas that is accepted.
1031 @item 
1032 @ref{e,,Standard Library Routines}, provides a listing of packages and a
1033 brief description of the functionality that is provided by Ada’s
1034 extensive set of standard library routines as implemented by GNAT.
1036 @item 
1037 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
1038 implementation of the input-output facilities.
1040 @item 
1041 @ref{10,,The GNAT Library}, is a catalog of packages that complement
1042 the Ada predefined library.
1044 @item 
1045 @ref{11,,Interfacing to Other Languages}, describes how programs
1046 written in Ada using GNAT can be interfaced to other programming
1047 languages.
1049 @item 
1050 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
1051 of the specialized needs annexes.
1053 @item 
1054 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1055 to GNAT’s implementation of machine code insertions, tasking, and several
1056 other features.
1058 @item 
1059 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1060 GNAT implementation of the Ada 2012 language standard.
1062 @item 
1063 @ref{15,,Security Hardening Features} documents GNAT extensions aimed
1064 at security hardening.
1066 @item 
1067 @ref{16,,Obsolescent Features} documents implementation dependent features,
1068 including pragmas and attributes, which are considered obsolescent, since
1069 there are other preferred ways of achieving the same results. These
1070 obsolescent forms are retained for backwards compatibility.
1072 @item 
1073 @ref{17,,Compatibility and Porting Guide} presents some guidelines for
1074 developing portable Ada code, describes the compatibility issues that
1075 may arise between GNAT and other Ada compilation systems (including those
1076 for Ada 83), and shows how GNAT can expedite porting applications
1077 developed in other Ada environments.
1079 @item 
1080 @ref{1,,GNU Free Documentation License} contains the license for this document.
1081 @end itemize
1083 @geindex Ada 95 Language Reference Manual
1085 @geindex Ada 2005 Language Reference Manual
1087 This reference manual assumes a basic familiarity with the Ada 95 language, as
1088 described in the
1089 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1090 It does not require knowledge of the new features introduced by Ada 2005 or
1091 Ada 2012.
1092 All three reference manuals are included in the GNAT documentation
1093 package.
1095 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1096 @anchor{gnat_rm/about_this_guide conventions}@anchor{18}
1097 @section Conventions
1100 @geindex Conventions
1101 @geindex typographical
1103 @geindex Typographical conventions
1105 Following are examples of the typographical and graphic conventions used
1106 in this guide:
1109 @itemize *
1111 @item 
1112 @code{Functions}, @code{utility program names}, @code{standard names},
1113 and @code{classes}.
1115 @item 
1116 @code{Option flags}
1118 @item 
1119 @code{File names}
1121 @item 
1122 @code{Variables}
1124 @item 
1125 `Emphasis'
1127 @item 
1128 [optional information or parameters]
1130 @item 
1131 Examples are described by text
1133 @example
1134 and then shown this way.
1135 @end example
1137 @item 
1138 Commands that are entered by the user are shown as preceded by a prompt string
1139 comprising the @code{$} character followed by a space.
1140 @end itemize
1142 @node Related Information,,Conventions,About This Guide
1143 @anchor{gnat_rm/about_this_guide related-information}@anchor{19}
1144 @section Related Information
1147 See the following documents for further information on GNAT:
1150 @itemize *
1152 @item 
1153 @cite{GNAT User’s Guide for Native Platforms},
1154 which provides information on how to use the
1155 GNAT development environment.
1157 @item 
1158 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1160 @item 
1161 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1162 of the Ada 95 standard.  The annotations describe
1163 detailed aspects of the design decision, and in particular contain useful
1164 sections on Ada 83 compatibility.
1166 @item 
1167 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1169 @item 
1170 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1171 of the Ada 2005 standard.  The annotations describe
1172 detailed aspects of the design decision.
1174 @item 
1175 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1177 @item 
1178 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1179 which contains specific information on compatibility between GNAT and
1180 DEC Ada 83 systems.
1182 @item 
1183 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1184 describes in detail the pragmas and attributes provided by the DEC Ada 83
1185 compiler system.
1186 @end itemize
1188 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1189 @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}
1190 @chapter Implementation Defined Pragmas
1193 Ada defines a set of pragmas that can be used to supply additional
1194 information to the compiler.  These language defined pragmas are
1195 implemented in GNAT and work as described in the Ada Reference Manual.
1197 In addition, Ada allows implementations to define additional pragmas
1198 whose meaning is defined by the implementation.  GNAT provides a number
1199 of these implementation-defined pragmas, which can be used to extend
1200 and enhance the functionality of the compiler.  This section of the GNAT
1201 Reference Manual describes these additional pragmas.
1203 Note that any program using these pragmas might not be portable to other
1204 compilers (although GNAT implements this set of pragmas on all
1205 platforms).  Therefore if portability to other compilers is an important
1206 consideration, the use of these pragmas should be minimized.
1208 @menu
1209 * Pragma Abort_Defer:: 
1210 * Pragma Abstract_State:: 
1211 * Pragma Ada_83:: 
1212 * Pragma Ada_95:: 
1213 * Pragma Ada_05:: 
1214 * Pragma Ada_2005:: 
1215 * Pragma Ada_12:: 
1216 * Pragma Ada_2012:: 
1217 * Pragma Ada_2022:: 
1218 * Pragma Aggregate_Individually_Assign:: 
1219 * Pragma Allow_Integer_Address:: 
1220 * Pragma Annotate:: 
1221 * Pragma Assert:: 
1222 * Pragma Assert_And_Cut:: 
1223 * Pragma Assertion_Policy:: 
1224 * Pragma Assume:: 
1225 * Pragma Assume_No_Invalid_Values:: 
1226 * Pragma Async_Readers:: 
1227 * Pragma Async_Writers:: 
1228 * Pragma Attribute_Definition:: 
1229 * Pragma C_Pass_By_Copy:: 
1230 * Pragma Check:: 
1231 * Pragma Check_Float_Overflow:: 
1232 * Pragma Check_Name:: 
1233 * Pragma Check_Policy:: 
1234 * Pragma Comment:: 
1235 * Pragma Common_Object:: 
1236 * Pragma Compile_Time_Error:: 
1237 * Pragma Compile_Time_Warning:: 
1238 * Pragma Complete_Representation:: 
1239 * Pragma Complex_Representation:: 
1240 * Pragma Component_Alignment:: 
1241 * Pragma Constant_After_Elaboration:: 
1242 * Pragma Contract_Cases:: 
1243 * Pragma Convention_Identifier:: 
1244 * Pragma CPP_Class:: 
1245 * Pragma CPP_Constructor:: 
1246 * Pragma CPP_Virtual:: 
1247 * Pragma CPP_Vtable:: 
1248 * Pragma CPU:: 
1249 * Pragma Deadline_Floor:: 
1250 * Pragma Debug:: 
1251 * Pragma Debug_Policy:: 
1252 * Pragma Default_Initial_Condition:: 
1253 * Pragma Default_Scalar_Storage_Order:: 
1254 * Pragma Default_Storage_Pool:: 
1255 * Pragma Depends:: 
1256 * Pragma Detect_Blocking:: 
1257 * Pragma Disable_Atomic_Synchronization:: 
1258 * Pragma Dispatching_Domain:: 
1259 * Pragma Effective_Reads:: 
1260 * Pragma Effective_Writes:: 
1261 * Pragma Elaboration_Checks:: 
1262 * Pragma Eliminate:: 
1263 * Pragma Enable_Atomic_Synchronization:: 
1264 * Pragma Export_Function:: 
1265 * Pragma Export_Object:: 
1266 * Pragma Export_Procedure:: 
1267 * Pragma Export_Valued_Procedure:: 
1268 * Pragma Extend_System:: 
1269 * Pragma Extensions_Allowed:: 
1270 * Pragma Extensions_Visible:: 
1271 * Pragma External:: 
1272 * Pragma External_Name_Casing:: 
1273 * Pragma Fast_Math:: 
1274 * Pragma Favor_Top_Level:: 
1275 * Pragma Finalize_Storage_Only:: 
1276 * Pragma Float_Representation:: 
1277 * Pragma Ghost:: 
1278 * Pragma Global:: 
1279 * Pragma Ident:: 
1280 * Pragma Ignore_Pragma:: 
1281 * Pragma Implementation_Defined:: 
1282 * Pragma Implemented:: 
1283 * Pragma Implicit_Packing:: 
1284 * Pragma Import_Function:: 
1285 * Pragma Import_Object:: 
1286 * Pragma Import_Procedure:: 
1287 * Pragma Import_Valued_Procedure:: 
1288 * Pragma Independent:: 
1289 * Pragma Independent_Components:: 
1290 * Pragma Initial_Condition:: 
1291 * Pragma Initialize_Scalars:: 
1292 * Pragma Initializes:: 
1293 * Pragma Inline_Always:: 
1294 * Pragma Inline_Generic:: 
1295 * Pragma Interface:: 
1296 * Pragma Interface_Name:: 
1297 * Pragma Interrupt_Handler:: 
1298 * Pragma Interrupt_State:: 
1299 * Pragma Invariant:: 
1300 * Pragma Keep_Names:: 
1301 * Pragma License:: 
1302 * Pragma Link_With:: 
1303 * Pragma Linker_Alias:: 
1304 * Pragma Linker_Constructor:: 
1305 * Pragma Linker_Destructor:: 
1306 * Pragma Linker_Section:: 
1307 * Pragma Lock_Free:: 
1308 * Pragma Loop_Invariant:: 
1309 * Pragma Loop_Optimize:: 
1310 * Pragma Loop_Variant:: 
1311 * Pragma Machine_Attribute:: 
1312 * Pragma Main:: 
1313 * Pragma Main_Storage:: 
1314 * Pragma Max_Queue_Length:: 
1315 * Pragma No_Body:: 
1316 * Pragma No_Caching:: 
1317 * Pragma No_Component_Reordering:: 
1318 * Pragma No_Elaboration_Code_All:: 
1319 * Pragma No_Heap_Finalization:: 
1320 * Pragma No_Inline:: 
1321 * Pragma No_Return:: 
1322 * Pragma No_Strict_Aliasing:: 
1323 * Pragma No_Tagged_Streams:: 
1324 * Pragma Normalize_Scalars:: 
1325 * Pragma Obsolescent:: 
1326 * Pragma Optimize_Alignment:: 
1327 * Pragma Ordered:: 
1328 * Pragma Overflow_Mode:: 
1329 * Pragma Overriding_Renamings:: 
1330 * Pragma Part_Of:: 
1331 * Pragma Partition_Elaboration_Policy:: 
1332 * Pragma Passive:: 
1333 * Pragma Persistent_BSS:: 
1334 * Pragma Post:: 
1335 * Pragma Postcondition:: 
1336 * Pragma Post_Class:: 
1337 * Pragma Pre:: 
1338 * Pragma Precondition:: 
1339 * Pragma Predicate:: 
1340 * Pragma Predicate_Failure:: 
1341 * Pragma Preelaborable_Initialization:: 
1342 * Pragma Prefix_Exception_Messages:: 
1343 * Pragma Pre_Class:: 
1344 * Pragma Priority_Specific_Dispatching:: 
1345 * Pragma Profile:: 
1346 * Pragma Profile_Warnings:: 
1347 * Pragma Propagate_Exceptions:: 
1348 * Pragma Provide_Shift_Operators:: 
1349 * Pragma Psect_Object:: 
1350 * Pragma Pure_Function:: 
1351 * Pragma Rational:: 
1352 * Pragma Ravenscar:: 
1353 * Pragma Refined_Depends:: 
1354 * Pragma Refined_Global:: 
1355 * Pragma Refined_Post:: 
1356 * Pragma Refined_State:: 
1357 * Pragma Relative_Deadline:: 
1358 * Pragma Remote_Access_Type:: 
1359 * Pragma Rename_Pragma:: 
1360 * Pragma Restricted_Run_Time:: 
1361 * Pragma Restriction_Warnings:: 
1362 * Pragma Reviewable:: 
1363 * Pragma Secondary_Stack_Size:: 
1364 * Pragma Share_Generic:: 
1365 * Pragma Shared:: 
1366 * Pragma Short_Circuit_And_Or:: 
1367 * Pragma Short_Descriptors:: 
1368 * Pragma Simple_Storage_Pool_Type:: 
1369 * Pragma Source_File_Name:: 
1370 * Pragma Source_File_Name_Project:: 
1371 * Pragma Source_Reference:: 
1372 * Pragma SPARK_Mode:: 
1373 * Pragma Static_Elaboration_Desired:: 
1374 * Pragma Stream_Convert:: 
1375 * Pragma Style_Checks:: 
1376 * Pragma Subtitle:: 
1377 * Pragma Suppress:: 
1378 * Pragma Suppress_All:: 
1379 * Pragma Suppress_Debug_Info:: 
1380 * Pragma Suppress_Exception_Locations:: 
1381 * Pragma Suppress_Initialization:: 
1382 * Pragma Task_Name:: 
1383 * Pragma Task_Storage:: 
1384 * Pragma Test_Case:: 
1385 * Pragma Thread_Local_Storage:: 
1386 * Pragma Time_Slice:: 
1387 * Pragma Title:: 
1388 * Pragma Type_Invariant:: 
1389 * Pragma Type_Invariant_Class:: 
1390 * Pragma Unchecked_Union:: 
1391 * Pragma Unevaluated_Use_Of_Old:: 
1392 * Pragma Unimplemented_Unit:: 
1393 * Pragma Universal_Aliasing:: 
1394 * Pragma Unmodified:: 
1395 * Pragma Unreferenced:: 
1396 * Pragma Unreferenced_Objects:: 
1397 * Pragma Unreserve_All_Interrupts:: 
1398 * Pragma Unsuppress:: 
1399 * Pragma Unused:: 
1400 * Pragma Use_VADS_Size:: 
1401 * Pragma Validity_Checks:: 
1402 * Pragma Volatile:: 
1403 * Pragma Volatile_Full_Access:: 
1404 * Pragma Volatile_Function:: 
1405 * Pragma Warning_As_Error:: 
1406 * Pragma Warnings:: 
1407 * Pragma Weak_External:: 
1408 * Pragma Wide_Character_Encoding:: 
1410 @end menu
1412 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1413 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1c}
1414 @section Pragma Abort_Defer
1417 @geindex Deferring aborts
1419 Syntax:
1421 @example
1422 pragma Abort_Defer;
1423 @end example
1425 This pragma must appear at the start of the statement sequence of a
1426 handled sequence of statements (right after the @code{begin}).  It has
1427 the effect of deferring aborts for the sequence of statements (but not
1428 for the declarations or handlers, if any, associated with this statement
1429 sequence). This can also be useful for adding a polling point in Ada code,
1430 where asynchronous abort of tasks is checked when leaving the statement
1431 sequence, and is lighter than, for example, using @code{delay 0.0;}, since with
1432 zero-cost exception handling, propagating exceptions (implicitly used to
1433 implement task abort) cannot be done reliably in an asynchronous way.
1435 An example of usage would be:
1437 @example
1438 --  Add a polling point to check for task aborts
1440 begin
1441    pragma Abort_Defer;
1442 end;
1443 @end example
1445 @node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
1446 @anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}@anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1e}
1447 @section Pragma Abstract_State
1450 Syntax:
1452 @example
1453 pragma Abstract_State (ABSTRACT_STATE_LIST);
1455 ABSTRACT_STATE_LIST ::=
1456      null
1457   |  STATE_NAME_WITH_OPTIONS
1458   | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1460 STATE_NAME_WITH_OPTIONS ::=
1461      STATE_NAME
1462   | (STATE_NAME with OPTION_LIST)
1464 OPTION_LIST ::= OPTION @{, OPTION@}
1466 OPTION ::=
1467     SIMPLE_OPTION
1468   | NAME_VALUE_OPTION
1470 SIMPLE_OPTION ::= Ghost | Synchronous
1472 NAME_VALUE_OPTION ::=
1473     Part_Of => ABSTRACT_STATE
1474   | External [=> EXTERNAL_PROPERTY_LIST]
1476 EXTERNAL_PROPERTY_LIST ::=
1477      EXTERNAL_PROPERTY
1478   | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
1480 EXTERNAL_PROPERTY ::=
1481     Async_Readers    [=> static_boolean_EXPRESSION]
1482   | Async_Writers    [=> static_boolean_EXPRESSION]
1483   | Effective_Reads  [=> static_boolean_EXPRESSION]
1484   | Effective_Writes [=> static_boolean_EXPRESSION]
1485     others            => static_boolean_EXPRESSION
1487 STATE_NAME ::= defining_identifier
1489 ABSTRACT_STATE ::= name
1490 @end example
1492 For the semantics of this pragma, see the entry for aspect @code{Abstract_State} in
1493 the SPARK 2014 Reference Manual, section 7.1.4.
1495 @node Pragma Ada_83,Pragma Ada_95,Pragma Abstract_State,Implementation Defined Pragmas
1496 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{1f}
1497 @section Pragma Ada_83
1500 Syntax:
1502 @example
1503 pragma Ada_83;
1504 @end example
1506 A configuration pragma that establishes Ada 83 mode for the unit to
1507 which it applies, regardless of the mode set by the command line
1508 switches.  In Ada 83 mode, GNAT attempts to be as compatible with
1509 the syntax and semantics of Ada 83, as defined in the original Ada
1510 83 Reference Manual as possible.  In particular, the keywords added by Ada 95
1511 and Ada 2005 are not recognized, optional package bodies are allowed,
1512 and generics may name types with unknown discriminants without using
1513 the @code{(<>)} notation.  In addition, some but not all of the additional
1514 restrictions of Ada 83 are enforced.
1516 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
1517 Ada 83 code to be compiled and adapted to GNAT with less effort.
1518 Secondly, it aids in keeping code backwards compatible with Ada 83.
1519 However, there is no guarantee that code that is processed correctly
1520 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1521 83 compiler, since GNAT does not enforce all the additional checks
1522 required by Ada 83.
1524 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1525 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{20}
1526 @section Pragma Ada_95
1529 Syntax:
1531 @example
1532 pragma Ada_95;
1533 @end example
1535 A configuration pragma that establishes Ada 95 mode for the unit to which
1536 it applies, regardless of the mode set by the command line switches.
1537 This mode is set automatically for the @code{Ada} and @code{System}
1538 packages and their children, so you need not specify it in these
1539 contexts.  This pragma is useful when writing a reusable component that
1540 itself uses Ada 95 features, but which is intended to be usable from
1541 either Ada 83 or Ada 95 programs.
1543 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1544 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{21}
1545 @section Pragma Ada_05
1548 Syntax:
1550 @example
1551 pragma Ada_05;
1552 pragma Ada_05 (local_NAME);
1553 @end example
1555 A configuration pragma that establishes Ada 2005 mode for the unit to which
1556 it applies, regardless of the mode set by the command line switches.
1557 This pragma is useful when writing a reusable component that
1558 itself uses Ada 2005 features, but which is intended to be usable from
1559 either Ada 83 or Ada 95 programs.
1561 The one argument form (which is not a configuration pragma)
1562 is used for managing the transition from
1563 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1564 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1565 mode will generate a warning. In addition, in Ada_83 or Ada_95
1566 mode, a preference rule is established which does not choose
1567 such an entity unless it is unambiguously specified. This avoids
1568 extra subprograms marked this way from generating ambiguities in
1569 otherwise legal pre-Ada_2005 programs. The one argument form is
1570 intended for exclusive use in the GNAT run-time library.
1572 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1573 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{22}
1574 @section Pragma Ada_2005
1577 Syntax:
1579 @example
1580 pragma Ada_2005;
1581 @end example
1583 This configuration pragma is a synonym for pragma Ada_05 and has the
1584 same syntax and effect.
1586 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1587 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{23}
1588 @section Pragma Ada_12
1591 Syntax:
1593 @example
1594 pragma Ada_12;
1595 pragma Ada_12 (local_NAME);
1596 @end example
1598 A configuration pragma that establishes Ada 2012 mode for the unit to which
1599 it applies, regardless of the mode set by the command line switches.
1600 This mode is set automatically for the @code{Ada} and @code{System}
1601 packages and their children, so you need not specify it in these
1602 contexts.  This pragma is useful when writing a reusable component that
1603 itself uses Ada 2012 features, but which is intended to be usable from
1604 Ada 83, Ada 95, or Ada 2005 programs.
1606 The one argument form, which is not a configuration pragma,
1607 is used for managing the transition from Ada
1608 2005 to Ada 2012 in the run-time library. If an entity is marked
1609 as Ada_2012 only, then referencing the entity in any pre-Ada_2012
1610 mode will generate a warning. In addition, in any pre-Ada_2012
1611 mode, a preference rule is established which does not choose
1612 such an entity unless it is unambiguously specified. This avoids
1613 extra subprograms marked this way from generating ambiguities in
1614 otherwise legal pre-Ada_2012 programs. The one argument form is
1615 intended for exclusive use in the GNAT run-time library.
1617 @node Pragma Ada_2012,Pragma Ada_2022,Pragma Ada_12,Implementation Defined Pragmas
1618 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{24}
1619 @section Pragma Ada_2012
1622 Syntax:
1624 @example
1625 pragma Ada_2012;
1626 @end example
1628 This configuration pragma is a synonym for pragma Ada_12 and has the
1629 same syntax and effect.
1631 @node Pragma Ada_2022,Pragma Aggregate_Individually_Assign,Pragma Ada_2012,Implementation Defined Pragmas
1632 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2022}@anchor{25}
1633 @section Pragma Ada_2022
1636 Syntax:
1638 @example
1639 pragma Ada_2022;
1640 pragma Ada_2022 (local_NAME);
1641 @end example
1643 A configuration pragma that establishes Ada 2022 mode for the unit to which
1644 it applies, regardless of the mode set by the command line switches.
1645 This mode is set automatically for the @code{Ada} and @code{System}
1646 packages and their children, so you need not specify it in these
1647 contexts.  This pragma is useful when writing a reusable component that
1648 itself uses Ada 2022 features, but which is intended to be usable from
1649 Ada 83, Ada 95, Ada 2005 or Ada 2012 programs.
1651 The one argument form, which is not a configuration pragma,
1652 is used for managing the transition from Ada
1653 2012 to Ada 2022 in the run-time library. If an entity is marked
1654 as Ada_2022 only, then referencing the entity in any pre-Ada_2022
1655 mode will generate a warning. In addition, in any pre-Ada_2012
1656 mode, a preference rule is established which does not choose
1657 such an entity unless it is unambiguously specified. This avoids
1658 extra subprograms marked this way from generating ambiguities in
1659 otherwise legal pre-Ada_2022 programs. The one argument form is
1660 intended for exclusive use in the GNAT run-time library.
1662 @node Pragma Aggregate_Individually_Assign,Pragma Allow_Integer_Address,Pragma Ada_2022,Implementation Defined Pragmas
1663 @anchor{gnat_rm/implementation_defined_pragmas pragma-aggregate-individually-assign}@anchor{26}
1664 @section Pragma Aggregate_Individually_Assign
1667 Syntax:
1669 @example
1670 pragma Aggregate_Individually_Assign;
1671 @end example
1673 Where possible, GNAT will store the binary representation of a record aggregate
1674 in memory for space and performance reasons. This configuration pragma changes
1675 this behavior so that record aggregates are instead always converted into
1676 individual assignment statements.
1678 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Aggregate_Individually_Assign,Implementation Defined Pragmas
1679 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{27}
1680 @section Pragma Allow_Integer_Address
1683 Syntax:
1685 @example
1686 pragma Allow_Integer_Address;
1687 @end example
1689 In almost all versions of GNAT, @code{System.Address} is a private
1690 type in accordance with the implementation advice in the RM. This
1691 means that integer values,
1692 in particular integer literals, are not allowed as address values.
1693 If the configuration pragma
1694 @code{Allow_Integer_Address} is given, then integer expressions may
1695 be used anywhere a value of type @code{System.Address} is required.
1696 The effect is to introduce an implicit unchecked conversion from the
1697 integer value to type @code{System.Address}. The reverse case of using
1698 an address where an integer type is required is handled analogously.
1699 The following example compiles without errors:
1701 @example
1702 pragma Allow_Integer_Address;
1703 with System; use System;
1704 package AddrAsInt is
1705    X : Integer;
1706    Y : Integer;
1707    for X'Address use 16#1240#;
1708    for Y use at 16#3230#;
1709    m : Address := 16#4000#;
1710    n : constant Address := 4000;
1711    p : constant Address := Address (X + Y);
1712    v : Integer := y'Address;
1713    w : constant Integer := Integer (Y'Address);
1714    type R is new integer;
1715    RR : R := 1000;
1716    Z : Integer;
1717    for Z'Address use RR;
1718 end AddrAsInt;
1719 @end example
1721 Note that pragma @code{Allow_Integer_Address} is ignored if @code{System.Address}
1722 is not a private type. In implementations of @code{GNAT} where
1723 System.Address is a visible integer type,
1724 this pragma serves no purpose but is ignored
1725 rather than rejected to allow common sets of sources to be used
1726 in the two situations.
1728 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1729 @anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{28}@anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{29}
1730 @section Pragma Annotate
1733 Syntax:
1735 @example
1736 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1738 ARG ::= NAME | EXPRESSION
1739 @end example
1741 This pragma is used to annotate programs.  IDENTIFIER identifies
1742 the type of annotation.  GNAT verifies that it is an identifier, but does
1743 not otherwise analyze it. The second optional identifier is also left
1744 unanalyzed, and by convention is used to control the action of the tool to
1745 which the annotation is addressed.  The remaining ARG arguments
1746 can be either string literals or more generally expressions.
1747 String literals (and concatenations of string literals) are assumed to be
1748 either of type
1749 @code{Standard.String} or else @code{Wide_String} or @code{Wide_Wide_String}
1750 depending on the character literals they contain.
1751 All other kinds of arguments are analyzed as expressions, and must be
1752 unambiguous. The last argument if present must have the identifier
1753 @code{Entity} and GNAT verifies that a local name is given.
1755 The analyzed pragma is retained in the tree, but not otherwise processed
1756 by any part of the GNAT compiler, except to generate corresponding note
1757 lines in the generated ALI file. For the format of these note lines, see
1758 the compiler source file lib-writ.ads. This pragma is intended for use by
1759 external tools, including ASIS. The use of pragma Annotate does not
1760 affect the compilation process in any way. This pragma may be used as
1761 a configuration pragma.
1763 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1764 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{2a}
1765 @section Pragma Assert
1768 Syntax:
1770 @example
1771 pragma Assert (
1772   boolean_EXPRESSION
1773   [, string_EXPRESSION]);
1774 @end example
1776 The effect of this pragma depends on whether the corresponding command
1777 line switch is set to activate assertions.  The pragma expands into code
1778 equivalent to the following:
1780 @example
1781 if assertions-enabled then
1782    if not boolean_EXPRESSION then
1783       System.Assertions.Raise_Assert_Failure
1784         (string_EXPRESSION);
1785    end if;
1786 end if;
1787 @end example
1789 The string argument, if given, is the message that will be associated
1790 with the exception occurrence if the exception is raised.  If no second
1791 argument is given, the default message is @code{file}:@code{nnn},
1792 where @code{file} is the name of the source file containing the assert,
1793 and @code{nnn} is the line number of the assert.
1795 Note that, as with the @code{if} statement to which it is equivalent, the
1796 type of the expression is either @code{Standard.Boolean}, or any type derived
1797 from this standard type.
1799 Assert checks can be either checked or ignored. By default they are ignored.
1800 They will be checked if either the command line switch `-gnata' is
1801 used, or if an @code{Assertion_Policy} or @code{Check_Policy} pragma is used
1802 to enable @code{Assert_Checks}.
1804 If assertions are ignored, then there
1805 is no run-time effect (and in particular, any side effects from the
1806 expression will not occur at run time).  (The expression is still
1807 analyzed at compile time, and may cause types to be frozen if they are
1808 mentioned here for the first time).
1810 If assertions are checked, then the given expression is tested, and if
1811 it is @code{False} then @code{System.Assertions.Raise_Assert_Failure} is called
1812 which results in the raising of @code{Assert_Failure} with the given message.
1814 You should generally avoid side effects in the expression arguments of
1815 this pragma, because these side effects will turn on and off with the
1816 setting of the assertions mode, resulting in assertions that have an
1817 effect on the program.  However, the expressions are analyzed for
1818 semantic correctness whether or not assertions are enabled, so turning
1819 assertions on and off cannot affect the legality of a program.
1821 Note that the implementation defined policy @code{DISABLE}, given in a
1822 pragma @code{Assertion_Policy}, can be used to suppress this semantic analysis.
1824 Note: this is a standard language-defined pragma in versions
1825 of Ada from 2005 on. In GNAT, it is implemented in all versions
1826 of Ada, and the DISABLE policy is an implementation-defined
1827 addition.
1829 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1830 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{2b}
1831 @section Pragma Assert_And_Cut
1834 Syntax:
1836 @example
1837 pragma Assert_And_Cut (
1838   boolean_EXPRESSION
1839   [, string_EXPRESSION]);
1840 @end example
1842 The effect of this pragma is identical to that of pragma @code{Assert},
1843 except that in an @code{Assertion_Policy} pragma, the identifier
1844 @code{Assert_And_Cut} is used to control whether it is ignored or checked
1845 (or disabled).
1847 The intention is that this be used within a subprogram when the
1848 given test expresion sums up all the work done so far in the
1849 subprogram, so that the rest of the subprogram can be verified
1850 (informally or formally) using only the entry preconditions,
1851 and the expression in this pragma. This allows dividing up
1852 a subprogram into sections for the purposes of testing or
1853 formal verification. The pragma also serves as useful
1854 documentation.
1856 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1857 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{2c}
1858 @section Pragma Assertion_Policy
1861 Syntax:
1863 @example
1864 pragma Assertion_Policy (CHECK | DISABLE | IGNORE | SUPPRESSIBLE);
1866 pragma Assertion_Policy (
1867     ASSERTION_KIND => POLICY_IDENTIFIER
1868  @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1870 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1872 RM_ASSERTION_KIND ::= Assert                    |
1873                       Static_Predicate          |
1874                       Dynamic_Predicate         |
1875                       Pre                       |
1876                       Pre'Class                 |
1877                       Post                      |
1878                       Post'Class                |
1879                       Type_Invariant            |
1880                       Type_Invariant'Class      |
1881                       Default_Initial_Condition
1883 ID_ASSERTION_KIND ::= Assertions           |
1884                       Assert_And_Cut       |
1885                       Assume               |
1886                       Contract_Cases       |
1887                       Debug                |
1888                       Ghost                |
1889                       Initial_Condition    |
1890                       Invariant            |
1891                       Invariant'Class      |
1892                       Loop_Invariant       |
1893                       Loop_Variant         |
1894                       Postcondition        |
1895                       Precondition         |
1896                       Predicate            |
1897                       Refined_Post         |
1898                       Statement_Assertions |
1899                       Subprogram_Variant
1901 POLICY_IDENTIFIER ::= Check | Disable | Ignore | Suppressible
1902 @end example
1904 This is a standard Ada 2012 pragma that is available as an
1905 implementation-defined pragma in earlier versions of Ada.
1906 The assertion kinds @code{RM_ASSERTION_KIND} are those defined in
1907 the Ada standard. The assertion kinds @code{ID_ASSERTION_KIND}
1908 are implementation defined additions recognized by the GNAT compiler.
1910 The pragma applies in both cases to pragmas and aspects with matching
1911 names, e.g. @code{Pre} applies to the Pre aspect, and @code{Precondition}
1912 applies to both the @code{Precondition} pragma
1913 and the aspect @code{Precondition}. Note that the identifiers for
1914 pragmas Pre_Class and Post_Class are Pre’Class and Post’Class (not
1915 Pre_Class and Post_Class), since these pragmas are intended to be
1916 identical to the corresponding aspects.
1918 If the policy is @code{CHECK}, then assertions are enabled, i.e.
1919 the corresponding pragma or aspect is activated.
1920 If the policy is @code{IGNORE}, then assertions are ignored, i.e.
1921 the corresponding pragma or aspect is deactivated.
1922 This pragma overrides the effect of the `-gnata' switch on the
1923 command line.
1924 If the policy is @code{SUPPRESSIBLE}, then assertions are enabled by default,
1925 however, if the `-gnatp' switch is specified all assertions are ignored.
1927 The implementation defined policy @code{DISABLE} is like
1928 @code{IGNORE} except that it completely disables semantic
1929 checking of the corresponding pragma or aspect. This is
1930 useful when the pragma or aspect argument references subprograms
1931 in a with’ed package which is replaced by a dummy package
1932 for the final build.
1934 The implementation defined assertion kind @code{Assertions} applies to all
1935 assertion kinds. The form with no assertion kind given implies this
1936 choice, so it applies to all assertion kinds (RM defined, and
1937 implementation defined).
1939 The implementation defined assertion kind @code{Statement_Assertions}
1940 applies to @code{Assert}, @code{Assert_And_Cut},
1941 @code{Assume}, @code{Loop_Invariant}, and @code{Loop_Variant}.
1943 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
1944 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2d}
1945 @section Pragma Assume
1948 Syntax:
1950 @example
1951 pragma Assume (
1952   boolean_EXPRESSION
1953   [, string_EXPRESSION]);
1954 @end example
1956 The effect of this pragma is identical to that of pragma @code{Assert},
1957 except that in an @code{Assertion_Policy} pragma, the identifier
1958 @code{Assume} is used to control whether it is ignored or checked
1959 (or disabled).
1961 The intention is that this be used for assumptions about the
1962 external environment. So you cannot expect to verify formally
1963 or informally that the condition is met, this must be
1964 established by examining things outside the program itself.
1965 For example, we may have code that depends on the size of
1966 @code{Long_Long_Integer} being at least 64. So we could write:
1968 @example
1969 pragma Assume (Long_Long_Integer'Size >= 64);
1970 @end example
1972 This assumption cannot be proved from the program itself,
1973 but it acts as a useful run-time check that the assumption
1974 is met, and documents the need to ensure that it is met by
1975 reference to information outside the program.
1977 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
1978 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{2e}
1979 @section Pragma Assume_No_Invalid_Values
1982 @geindex Invalid representations
1984 @geindex Invalid values
1986 Syntax:
1988 @example
1989 pragma Assume_No_Invalid_Values (On | Off);
1990 @end example
1992 This is a configuration pragma that controls the assumptions made by the
1993 compiler about the occurrence of invalid representations (invalid values)
1994 in the code.
1996 The default behavior (corresponding to an Off argument for this pragma), is
1997 to assume that values may in general be invalid unless the compiler can
1998 prove they are valid. Consider the following example:
2000 @example
2001 V1 : Integer range 1 .. 10;
2002 V2 : Integer range 11 .. 20;
2004 for J in V2 .. V1 loop
2005    ...
2006 end loop;
2007 @end example
2009 if V1 and V2 have valid values, then the loop is known at compile
2010 time not to execute since the lower bound must be greater than the
2011 upper bound. However in default mode, no such assumption is made,
2012 and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
2013 is given, the compiler will assume that any occurrence of a variable
2014 other than in an explicit @code{'Valid} test always has a valid
2015 value, and the loop above will be optimized away.
2017 The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
2018 you know your code is free of uninitialized variables and other
2019 possible sources of invalid representations, and may result in
2020 more efficient code. A program that accesses an invalid representation
2021 with this pragma in effect is erroneous, so no guarantees can be made
2022 about its behavior.
2024 It is peculiar though permissible to use this pragma in conjunction
2025 with validity checking (-gnatVa). In such cases, accessing invalid
2026 values will generally give an exception, though formally the program
2027 is erroneous so there are no guarantees that this will always be the
2028 case, and it is recommended that these two options not be used together.
2030 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
2031 @anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{2f}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{30}
2032 @section Pragma Async_Readers
2035 Syntax:
2037 @example
2038 pragma Async_Readers [ (static_boolean_EXPRESSION) ];
2039 @end example
2041 For the semantics of this pragma, see the entry for aspect @code{Async_Readers} in
2042 the SPARK 2014 Reference Manual, section 7.1.2.
2044 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
2045 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{31}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{32}
2046 @section Pragma Async_Writers
2049 Syntax:
2051 @example
2052 pragma Async_Writers [ (static_boolean_EXPRESSION) ];
2053 @end example
2055 For the semantics of this pragma, see the entry for aspect @code{Async_Writers} in
2056 the SPARK 2014 Reference Manual, section 7.1.2.
2058 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
2059 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{33}
2060 @section Pragma Attribute_Definition
2063 Syntax:
2065 @example
2066 pragma Attribute_Definition
2067   ([Attribute  =>] ATTRIBUTE_DESIGNATOR,
2068    [Entity     =>] LOCAL_NAME,
2069    [Expression =>] EXPRESSION | NAME);
2070 @end example
2072 If @code{Attribute} is a known attribute name, this pragma is equivalent to
2073 the attribute definition clause:
2075 @example
2076 for Entity'Attribute use Expression;
2077 @end example
2079 If @code{Attribute} is not a recognized attribute name, the pragma is
2080 ignored, and a warning is emitted. This allows source
2081 code to be written that takes advantage of some new attribute, while remaining
2082 compilable with earlier compilers.
2084 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
2085 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{34}
2086 @section Pragma C_Pass_By_Copy
2089 @geindex Passing by copy
2091 Syntax:
2093 @example
2094 pragma C_Pass_By_Copy
2095   ([Max_Size =>] static_integer_EXPRESSION);
2096 @end example
2098 Normally the default mechanism for passing C convention records to C
2099 convention subprograms is to pass them by reference, as suggested by RM
2100 B.3(69).  Use the configuration pragma @code{C_Pass_By_Copy} to change
2101 this default, by requiring that record formal parameters be passed by
2102 copy if all of the following conditions are met:
2105 @itemize *
2107 @item 
2108 The size of the record type does not exceed the value specified for
2109 @code{Max_Size}.
2111 @item 
2112 The record type has @code{Convention C}.
2114 @item 
2115 The formal parameter has this record type, and the subprogram has a
2116 foreign (non-Ada) convention.
2117 @end itemize
2119 If these conditions are met the argument is passed by copy; i.e., in a
2120 manner consistent with what C expects if the corresponding formal in the
2121 C prototype is a struct (rather than a pointer to a struct).
2123 You can also pass records by copy by specifying the convention
2124 @code{C_Pass_By_Copy} for the record type, or by using the extended
2125 @code{Import} and @code{Export} pragmas, which allow specification of
2126 passing mechanisms on a parameter by parameter basis.
2128 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2129 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{35}
2130 @section Pragma Check
2133 @geindex Assertions
2135 @geindex Named assertions
2137 Syntax:
2139 @example
2140 pragma Check (
2141      [Name    =>] CHECK_KIND,
2142      [Check   =>] Boolean_EXPRESSION
2143   [, [Message =>] string_EXPRESSION] );
2145 CHECK_KIND ::= IDENTIFIER           |
2146                Pre'Class            |
2147                Post'Class           |
2148                Type_Invariant'Class |
2149                Invariant'Class
2150 @end example
2152 This pragma is similar to the predefined pragma @code{Assert} except that an
2153 extra identifier argument is present. In conjunction with pragma
2154 @code{Check_Policy}, this can be used to define groups of assertions that can
2155 be independently controlled. The identifier @code{Assertion} is special, it
2156 refers to the normal set of pragma @code{Assert} statements.
2158 Checks introduced by this pragma are normally deactivated by default. They can
2159 be activated either by the command line option `-gnata', which turns on
2160 all checks, or individually controlled using pragma @code{Check_Policy}.
2162 The identifiers @code{Assertions} and @code{Statement_Assertions} are not
2163 permitted as check kinds, since this would cause confusion with the use
2164 of these identifiers in @code{Assertion_Policy} and @code{Check_Policy}
2165 pragmas, where they are used to refer to sets of assertions.
2167 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2168 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{36}
2169 @section Pragma Check_Float_Overflow
2172 @geindex Floating-point overflow
2174 Syntax:
2176 @example
2177 pragma Check_Float_Overflow;
2178 @end example
2180 In Ada, the predefined floating-point types (@code{Short_Float},
2181 @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
2182 defined to be `unconstrained'. This means that even though each
2183 has a well-defined base range, an operation that delivers a result
2184 outside this base range is not required to raise an exception.
2185 This implementation permission accommodates the notion
2186 of infinities in IEEE floating-point, and corresponds to the
2187 efficient execution mode on most machines. GNAT will not raise
2188 overflow exceptions on these machines; instead it will generate
2189 infinities and NaN’s as defined in the IEEE standard.
2191 Generating infinities, although efficient, is not always desirable.
2192 Often the preferable approach is to check for overflow, even at the
2193 (perhaps considerable) expense of run-time performance.
2194 This can be accomplished by defining your own constrained floating-point subtypes – i.e., by supplying explicit
2195 range constraints – and indeed such a subtype
2196 can have the same base range as its base type. For example:
2198 @example
2199 subtype My_Float is Float range Float'Range;
2200 @end example
2202 Here @code{My_Float} has the same range as
2203 @code{Float} but is constrained, so operations on
2204 @code{My_Float} values will be checked for overflow
2205 against this range.
2207 This style will achieve the desired goal, but
2208 it is often more convenient to be able to simply use
2209 the standard predefined floating-point types as long
2210 as overflow checking could be guaranteed.
2211 The @code{Check_Float_Overflow}
2212 configuration pragma achieves this effect. If a unit is compiled
2213 subject to this configuration pragma, then all operations
2214 on predefined floating-point types including operations on
2215 base types of these floating-point types will be treated as
2216 though those types were constrained, and overflow checks
2217 will be generated. The @code{Constraint_Error}
2218 exception is raised if the result is out of range.
2220 This mode can also be set by use of the compiler
2221 switch `-gnateF'.
2223 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2224 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{37}
2225 @section Pragma Check_Name
2228 @geindex Defining check names
2230 @geindex Check names
2231 @geindex defining
2233 Syntax:
2235 @example
2236 pragma Check_Name (check_name_IDENTIFIER);
2237 @end example
2239 This is a configuration pragma that defines a new implementation
2240 defined check name (unless IDENTIFIER matches one of the predefined
2241 check names, in which case the pragma has no effect). Check names
2242 are global to a partition, so if two or more configuration pragmas
2243 are present in a partition mentioning the same name, only one new
2244 check name is introduced.
2246 An implementation defined check name introduced with this pragma may
2247 be used in only three contexts: @code{pragma Suppress},
2248 @code{pragma Unsuppress},
2249 and as the prefix of a @code{Check_Name'Enabled} attribute reference. For
2250 any of these three cases, the check name must be visible. A check
2251 name is visible if it is in the configuration pragmas applying to
2252 the current unit, or if it appears at the start of any unit that
2253 is part of the dependency set of the current unit (e.g., units that
2254 are mentioned in @code{with} clauses).
2256 Check names introduced by this pragma are subject to control by compiler
2257 switches (in particular -gnatp) in the usual manner.
2259 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2260 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{38}
2261 @section Pragma Check_Policy
2264 @geindex Controlling assertions
2266 @geindex Assertions
2267 @geindex control
2269 @geindex Check pragma control
2271 @geindex Named assertions
2273 Syntax:
2275 @example
2276 pragma Check_Policy
2277  ([Name   =>] CHECK_KIND,
2278   [Policy =>] POLICY_IDENTIFIER);
2280 pragma Check_Policy (
2281     CHECK_KIND => POLICY_IDENTIFIER
2282  @{, CHECK_KIND => POLICY_IDENTIFIER@});
2284 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2286 CHECK_KIND ::= IDENTIFIER           |
2287                Pre'Class            |
2288                Post'Class           |
2289                Type_Invariant'Class |
2290                Invariant'Class
2292 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2293 avoids confusion between the two possible syntax forms for this pragma.
2295 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2296 @end example
2298 This pragma is used to set the checking policy for assertions (specified
2299 by aspects or pragmas), the @code{Debug} pragma, or additional checks
2300 to be checked using the @code{Check} pragma. It may appear either as
2301 a configuration pragma, or within a declarative part of package. In the
2302 latter case, it applies from the point where it appears to the end of
2303 the declarative region (like pragma @code{Suppress}).
2305 The @code{Check_Policy} pragma is similar to the
2306 predefined @code{Assertion_Policy} pragma,
2307 and if the check kind corresponds to one of the assertion kinds that
2308 are allowed by @code{Assertion_Policy}, then the effect is identical.
2310 If the first argument is Debug, then the policy applies to Debug pragmas,
2311 disabling their effect if the policy is @code{OFF}, @code{DISABLE}, or
2312 @code{IGNORE}, and allowing them to execute with normal semantics if
2313 the policy is @code{ON} or @code{CHECK}. In addition if the policy is
2314 @code{DISABLE}, then the procedure call in @code{Debug} pragmas will
2315 be totally ignored and not analyzed semantically.
2317 Finally the first argument may be some other identifier than the above
2318 possibilities, in which case it controls a set of named assertions
2319 that can be checked using pragma @code{Check}. For example, if the pragma:
2321 @example
2322 pragma Check_Policy (Critical_Error, OFF);
2323 @end example
2325 is given, then subsequent @code{Check} pragmas whose first argument is also
2326 @code{Critical_Error} will be disabled.
2328 The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
2329 to turn on corresponding checks. The default for a set of checks for which no
2330 @code{Check_Policy} is given is @code{OFF} unless the compiler switch
2331 `-gnata' is given, which turns on all checks by default.
2333 The check policy settings @code{CHECK} and @code{IGNORE} are recognized
2334 as synonyms for @code{ON} and @code{OFF}. These synonyms are provided for
2335 compatibility with the standard @code{Assertion_Policy} pragma. The check
2336 policy setting @code{DISABLE} causes the second argument of a corresponding
2337 @code{Check} pragma to be completely ignored and not analyzed.
2339 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2340 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{39}
2341 @section Pragma Comment
2344 Syntax:
2346 @example
2347 pragma Comment (static_string_EXPRESSION);
2348 @end example
2350 This is almost identical in effect to pragma @code{Ident}.  It allows the
2351 placement of a comment into the object file and hence into the
2352 executable file if the operating system permits such usage.  The
2353 difference is that @code{Comment}, unlike @code{Ident}, has
2354 no limitations on placement of the pragma (it can be placed
2355 anywhere in the main source unit), and if more than one pragma
2356 is used, all comments are retained.
2358 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2359 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{3a}
2360 @section Pragma Common_Object
2363 Syntax:
2365 @example
2366 pragma Common_Object (
2367      [Internal =>] LOCAL_NAME
2368   [, [External =>] EXTERNAL_SYMBOL]
2369   [, [Size     =>] EXTERNAL_SYMBOL] );
2371 EXTERNAL_SYMBOL ::=
2372   IDENTIFIER
2373 | static_string_EXPRESSION
2374 @end example
2376 This pragma enables the shared use of variables stored in overlaid
2377 linker areas corresponding to the use of @code{COMMON}
2378 in Fortran.  The single
2379 object @code{LOCAL_NAME} is assigned to the area designated by
2380 the @code{External} argument.
2381 You may define a record to correspond to a series
2382 of fields.  The @code{Size} argument
2383 is syntax checked in GNAT, but otherwise ignored.
2385 @code{Common_Object} is not supported on all platforms.  If no
2386 support is available, then the code generator will issue a message
2387 indicating that the necessary attribute for implementation of this
2388 pragma is not available.
2390 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2391 @anchor{gnat_rm/implementation_defined_pragmas compile-time-error}@anchor{3b}@anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{3c}
2392 @section Pragma Compile_Time_Error
2395 Syntax:
2397 @example
2398 pragma Compile_Time_Error
2399          (boolean_EXPRESSION, static_string_EXPRESSION);
2400 @end example
2402 This pragma can be used to generate additional compile time
2403 error messages. It
2404 is particularly useful in generics, where errors can be issued for
2405 specific problematic instantiations. The first parameter is a boolean
2406 expression. The pragma ensures that the value of an expression
2407 is known at compile time, and has the value False. The set of expressions
2408 whose values are known at compile time includes all static boolean
2409 expressions, and also other values which the compiler can determine
2410 at compile time (e.g., the size of a record type set by an explicit
2411 size representation clause, or the value of a variable which was
2412 initialized to a constant and is known not to have been modified).
2413 If these conditions are not met, an error message is generated using
2414 the value given as the second argument. This string value may contain
2415 embedded ASCII.LF characters to break the message into multiple lines.
2417 @node Pragma Compile_Time_Warning,Pragma Complete_Representation,Pragma Compile_Time_Error,Implementation Defined Pragmas
2418 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{3d}
2419 @section Pragma Compile_Time_Warning
2422 Syntax:
2424 @example
2425 pragma Compile_Time_Warning
2426          (boolean_EXPRESSION, static_string_EXPRESSION);
2427 @end example
2429 Same as pragma Compile_Time_Error, except a warning is issued instead
2430 of an error message. If switch `-gnatw_C' is used, a warning is only issued
2431 if the value of the expression is known to be True at compile time, not when
2432 the value of the expression is not known at compile time.
2433 Note that if this pragma is used in a package that
2434 is with’ed by a client, the client will get the warning even though it
2435 is issued by a with’ed package (normally warnings in with’ed units are
2436 suppressed, but this is a special exception to that rule).
2438 One typical use is within a generic where compile time known characteristics
2439 of formal parameters are tested, and warnings given appropriately. Another use
2440 with a first parameter of True is to warn a client about use of a package,
2441 for example that it is not fully implemented.
2443 In previous versions of the compiler, combining `-gnatwe' with
2444 Compile_Time_Warning resulted in a fatal error. Now the compiler always emits
2445 a warning. You can use @ref{3b,,Pragma Compile_Time_Error} to force the generation of
2446 an error.
2448 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2449 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{3e}
2450 @section Pragma Complete_Representation
2453 Syntax:
2455 @example
2456 pragma Complete_Representation;
2457 @end example
2459 This pragma must appear immediately within a record representation
2460 clause. Typical placements are before the first component clause
2461 or after the last component clause. The effect is to give an error
2462 message if any component is missing a component clause. This pragma
2463 may be used to ensure that a record representation clause is
2464 complete, and that this invariant is maintained if fields are
2465 added to the record in the future.
2467 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2468 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{3f}
2469 @section Pragma Complex_Representation
2472 Syntax:
2474 @example
2475 pragma Complex_Representation
2476         ([Entity =>] LOCAL_NAME);
2477 @end example
2479 The @code{Entity} argument must be the name of a record type which has
2480 two fields of the same floating-point type.  The effect of this pragma is
2481 to force gcc to use the special internal complex representation form for
2482 this record, which may be more efficient.  Note that this may result in
2483 the code for this type not conforming to standard ABI (application
2484 binary interface) requirements for the handling of record types.  For
2485 example, in some environments, there is a requirement for passing
2486 records by pointer, and the use of this pragma may result in passing
2487 this type in floating-point registers.
2489 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2490 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{40}
2491 @section Pragma Component_Alignment
2494 @geindex Alignments of components
2496 @geindex Pragma Component_Alignment
2498 Syntax:
2500 @example
2501 pragma Component_Alignment (
2502      [Form =>] ALIGNMENT_CHOICE
2503   [, [Name =>] type_LOCAL_NAME]);
2505 ALIGNMENT_CHOICE ::=
2506   Component_Size
2507 | Component_Size_4
2508 | Storage_Unit
2509 | Default
2510 @end example
2512 Specifies the alignment of components in array or record types.
2513 The meaning of the @code{Form} argument is as follows:
2515 @quotation
2517 @geindex Component_Size (in pragma Component_Alignment)
2518 @end quotation
2521 @table @asis
2523 @item `Component_Size'
2525 Aligns scalar components and subcomponents of the array or record type
2526 on boundaries appropriate to their inherent size (naturally
2527 aligned).  For example, 1-byte components are aligned on byte boundaries,
2528 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2529 integer components are aligned on 4-byte boundaries and so on.  These
2530 alignment rules correspond to the normal rules for C compilers on all
2531 machines except the VAX.
2533 @geindex Component_Size_4 (in pragma Component_Alignment)
2535 @item `Component_Size_4'
2537 Naturally aligns components with a size of four or fewer
2538 bytes.  Components that are larger than 4 bytes are placed on the next
2539 4-byte boundary.
2541 @geindex Storage_Unit (in pragma Component_Alignment)
2543 @item `Storage_Unit'
2545 Specifies that array or record components are byte aligned, i.e.,
2546 aligned on boundaries determined by the value of the constant
2547 @code{System.Storage_Unit}.
2549 @geindex Default (in pragma Component_Alignment)
2551 @item `Default'
2553 Specifies that array or record components are aligned on default
2554 boundaries, appropriate to the underlying hardware or operating system or
2555 both. The @code{Default} choice is the same as @code{Component_Size} (natural
2556 alignment).
2557 @end table
2559 If the @code{Name} parameter is present, @code{type_LOCAL_NAME} must
2560 refer to a local record or array type, and the specified alignment
2561 choice applies to the specified type.  The use of
2562 @code{Component_Alignment} together with a pragma @code{Pack} causes the
2563 @code{Component_Alignment} pragma to be ignored.  The use of
2564 @code{Component_Alignment} together with a record representation clause
2565 is only effective for fields not specified by the representation clause.
2567 If the @code{Name} parameter is absent, the pragma can be used as either
2568 a configuration pragma, in which case it applies to one or more units in
2569 accordance with the normal rules for configuration pragmas, or it can be
2570 used within a declarative part, in which case it applies to types that
2571 are declared within this declarative part, or within any nested scope
2572 within this declarative part.  In either case it specifies the alignment
2573 to be applied to any record or array type which has otherwise standard
2574 representation.
2576 If the alignment for a record or array type is not specified (using
2577 pragma @code{Pack}, pragma @code{Component_Alignment}, or a record rep
2578 clause), the GNAT uses the default alignment as described previously.
2580 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2581 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{41}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{42}
2582 @section Pragma Constant_After_Elaboration
2585 Syntax:
2587 @example
2588 pragma Constant_After_Elaboration [ (static_boolean_EXPRESSION) ];
2589 @end example
2591 For the semantics of this pragma, see the entry for aspect
2592 @code{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2594 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2595 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{43}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{44}
2596 @section Pragma Contract_Cases
2599 @geindex Contract cases
2601 Syntax:
2603 @example
2604 pragma Contract_Cases (CONTRACT_CASE @{, CONTRACT_CASE@});
2606 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2608 CASE_GUARD ::= boolean_EXPRESSION | others
2610 CONSEQUENCE ::= boolean_EXPRESSION
2611 @end example
2613 The @code{Contract_Cases} pragma allows defining fine-grain specifications
2614 that can complement or replace the contract given by a precondition and a
2615 postcondition. Additionally, the @code{Contract_Cases} pragma can be used
2616 by testing and formal verification tools. The compiler checks its validity and,
2617 depending on the assertion policy at the point of declaration of the pragma,
2618 it may insert a check in the executable. For code generation, the contract
2619 cases
2621 @example
2622 pragma Contract_Cases (
2623   Cond1 => Pred1,
2624   Cond2 => Pred2);
2625 @end example
2627 are equivalent to
2629 @example
2630 C1 : constant Boolean := Cond1;  --  evaluated at subprogram entry
2631 C2 : constant Boolean := Cond2;  --  evaluated at subprogram entry
2632 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2633 pragma Postcondition (if C1 then Pred1);
2634 pragma Postcondition (if C2 then Pred2);
2635 @end example
2637 The precondition ensures that one and only one of the case guards is
2638 satisfied on entry to the subprogram.
2639 The postcondition ensures that for the case guard that was True on entry,
2640 the corresponding consequence is True on exit. Other consequence expressions
2641 are not evaluated.
2643 A precondition @code{P} and postcondition @code{Q} can also be
2644 expressed as contract cases:
2646 @example
2647 pragma Contract_Cases (P => Q);
2648 @end example
2650 The placement and visibility rules for @code{Contract_Cases} pragmas are
2651 identical to those described for preconditions and postconditions.
2653 The compiler checks that boolean expressions given in case guards and
2654 consequences are valid, where the rules for case guards are the same as
2655 the rule for an expression in @code{Precondition} and the rules for
2656 consequences are the same as the rule for an expression in
2657 @code{Postcondition}. In particular, attributes @code{'Old} and
2658 @code{'Result} can only be used within consequence expressions.
2659 The case guard for the last contract case may be @code{others}, to denote
2660 any case not captured by the previous cases. The
2661 following is an example of use within a package spec:
2663 @example
2664 package Math_Functions is
2665    ...
2666    function Sqrt (Arg : Float) return Float;
2667    pragma Contract_Cases (((Arg in 0.0 .. 99.0) => Sqrt'Result < 10.0,
2668                            Arg >= 100.0         => Sqrt'Result >= 10.0,
2669                            others               => Sqrt'Result = 0.0));
2670    ...
2671 end Math_Functions;
2672 @end example
2674 The meaning of contract cases is that only one case should apply at each
2675 call, as determined by the corresponding case guard evaluating to True,
2676 and that the consequence for this case should hold when the subprogram
2677 returns.
2679 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2680 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{45}
2681 @section Pragma Convention_Identifier
2684 @geindex Conventions
2685 @geindex synonyms
2687 Syntax:
2689 @example
2690 pragma Convention_Identifier (
2691          [Name =>]       IDENTIFIER,
2692          [Convention =>] convention_IDENTIFIER);
2693 @end example
2695 This pragma provides a mechanism for supplying synonyms for existing
2696 convention identifiers. The @code{Name} identifier can subsequently
2697 be used as a synonym for the given convention in other pragmas (including
2698 for example pragma @code{Import} or another @code{Convention_Identifier}
2699 pragma). As an example of the use of this, suppose you had legacy code
2700 which used Fortran77 as the identifier for Fortran. Then the pragma:
2702 @example
2703 pragma Convention_Identifier (Fortran77, Fortran);
2704 @end example
2706 would allow the use of the convention identifier @code{Fortran77} in
2707 subsequent code, avoiding the need to modify the sources. As another
2708 example, you could use this to parameterize convention requirements
2709 according to systems. Suppose you needed to use @code{Stdcall} on
2710 windows systems, and @code{C} on some other system, then you could
2711 define a convention identifier @code{Library} and use a single
2712 @code{Convention_Identifier} pragma to specify which convention
2713 would be used system-wide.
2715 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2716 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{46}
2717 @section Pragma CPP_Class
2720 @geindex Interfacing with C++
2722 Syntax:
2724 @example
2725 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2726 @end example
2728 The argument denotes an entity in the current declarative region that is
2729 declared as a record type. It indicates that the type corresponds to an
2730 externally declared C++ class type, and is to be laid out the same way
2731 that C++ would lay out the type. If the C++ class has virtual primitives
2732 then the record must be declared as a tagged record type.
2734 Types for which @code{CPP_Class} is specified do not have assignment or
2735 equality operators defined (such operations can be imported or declared
2736 as subprograms as required). Initialization is allowed only by constructor
2737 functions (see pragma @code{CPP_Constructor}). Such types are implicitly
2738 limited if not explicitly declared as limited or derived from a limited
2739 type, and an error is issued in that case.
2741 See @ref{47,,Interfacing to C++} for related information.
2743 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
2744 for backward compatibility but its functionality is available
2745 using pragma @code{Import} with @code{Convention} = @code{CPP}.
2747 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2748 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{48}
2749 @section Pragma CPP_Constructor
2752 @geindex Interfacing with C++
2754 Syntax:
2756 @example
2757 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2758   [, [External_Name =>] static_string_EXPRESSION ]
2759   [, [Link_Name     =>] static_string_EXPRESSION ]);
2760 @end example
2762 This pragma identifies an imported function (imported in the usual way
2763 with pragma @code{Import}) as corresponding to a C++ constructor. If
2764 @code{External_Name} and @code{Link_Name} are not specified then the
2765 @code{Entity} argument is a name that must have been previously mentioned
2766 in a pragma @code{Import} with @code{Convention} = @code{CPP}. Such name
2767 must be of one of the following forms:
2770 @itemize *
2772 @item 
2773 `function' @code{Fname} `return' T`
2775 @item 
2776 `function' @code{Fname} `return' T’Class
2778 @item 
2779 `function' @code{Fname} (…) `return' T`
2781 @item 
2782 `function' @code{Fname} (…) `return' T’Class
2783 @end itemize
2785 where @code{T} is a limited record type imported from C++ with pragma
2786 @code{Import} and @code{Convention} = @code{CPP}.
2788 The first two forms import the default constructor, used when an object
2789 of type @code{T} is created on the Ada side with no explicit constructor.
2790 The latter two forms cover all the non-default constructors of the type.
2791 See the GNAT User’s Guide for details.
2793 If no constructors are imported, it is impossible to create any objects
2794 on the Ada side and the type is implicitly declared abstract.
2796 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
2797 using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
2798 GCC switch).
2799 See @ref{47,,Interfacing to C++} for more related information.
2801 Note: The use of functions returning class-wide types for constructors is
2802 currently obsolete. They are supported for backward compatibility. The
2803 use of functions returning the type T leave the Ada sources more clear
2804 because the imported C++ constructors always return an object of type T;
2805 that is, they never return an object whose type is a descendant of type T.
2807 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2808 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{49}
2809 @section Pragma CPP_Virtual
2812 @geindex Interfacing to C++
2814 This pragma is now obsolete and, other than generating a warning if warnings
2815 on obsolescent features are enabled, is completely ignored.
2816 It is retained for compatibility
2817 purposes. It used to be required to ensure compatibility with C++, but
2818 is no longer required for that purpose because GNAT generates
2819 the same object layout as the G++ compiler by default.
2821 See @ref{47,,Interfacing to C++} for related information.
2823 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2824 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{4a}
2825 @section Pragma CPP_Vtable
2828 @geindex Interfacing with C++
2830 This pragma is now obsolete and, other than generating a warning if warnings
2831 on obsolescent features are enabled, is completely ignored.
2832 It used to be required to ensure compatibility with C++, but
2833 is no longer required for that purpose because GNAT generates
2834 the same object layout as the G++ compiler by default.
2836 See @ref{47,,Interfacing to C++} for related information.
2838 @node Pragma CPU,Pragma Deadline_Floor,Pragma CPP_Vtable,Implementation Defined Pragmas
2839 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{4b}
2840 @section Pragma CPU
2843 Syntax:
2845 @example
2846 pragma CPU (EXPRESSION);
2847 @end example
2849 This pragma is standard in Ada 2012, but is available in all earlier
2850 versions of Ada as an implementation-defined pragma.
2851 See Ada 2012 Reference Manual for details.
2853 @node Pragma Deadline_Floor,Pragma Debug,Pragma CPU,Implementation Defined Pragmas
2854 @anchor{gnat_rm/implementation_defined_pragmas pragma-deadline-floor}@anchor{4c}
2855 @section Pragma Deadline_Floor
2858 Syntax:
2860 @example
2861 pragma Deadline_Floor (time_span_EXPRESSION);
2862 @end example
2864 This pragma applies only to protected types and specifies the floor
2865 deadline inherited by a task when the task enters a protected object.
2866 It is effective only when the EDF scheduling policy is used.
2868 @node Pragma Debug,Pragma Debug_Policy,Pragma Deadline_Floor,Implementation Defined Pragmas
2869 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{4d}
2870 @section Pragma Debug
2873 Syntax:
2875 @example
2876 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2878 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2879   PROCEDURE_NAME
2880 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2881 @end example
2883 The procedure call argument has the syntactic form of an expression, meeting
2884 the syntactic requirements for pragmas.
2886 If debug pragmas are not enabled or if the condition is present and evaluates
2887 to False, this pragma has no effect. If debug pragmas are enabled, the
2888 semantics of the pragma is exactly equivalent to the procedure call statement
2889 corresponding to the argument with a terminating semicolon. Pragmas are
2890 permitted in sequences of declarations, so you can use pragma @code{Debug} to
2891 intersperse calls to debug procedures in the middle of declarations. Debug
2892 pragmas can be enabled either by use of the command line switch `-gnata'
2893 or by use of the pragma @code{Check_Policy} with a first argument of
2894 @code{Debug}.
2896 @node Pragma Debug_Policy,Pragma Default_Initial_Condition,Pragma Debug,Implementation Defined Pragmas
2897 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{4e}
2898 @section Pragma Debug_Policy
2901 Syntax:
2903 @example
2904 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2905 @end example
2907 This pragma is equivalent to a corresponding @code{Check_Policy} pragma
2908 with a first argument of @code{Debug}. It is retained for historical
2909 compatibility reasons.
2911 @node Pragma Default_Initial_Condition,Pragma Default_Scalar_Storage_Order,Pragma Debug_Policy,Implementation Defined Pragmas
2912 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{4f}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{50}
2913 @section Pragma Default_Initial_Condition
2916 Syntax:
2918 @example
2919 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2920 @end example
2922 For the semantics of this pragma, see the entry for aspect
2923 @code{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2925 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2926 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{51}
2927 @section Pragma Default_Scalar_Storage_Order
2930 @geindex Default_Scalar_Storage_Order
2932 @geindex Scalar_Storage_Order
2934 Syntax:
2936 @example
2937 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
2938 @end example
2940 Normally if no explicit @code{Scalar_Storage_Order} is given for a record
2941 type or array type, then the scalar storage order defaults to the ordinary
2942 default for the target. But this default may be overridden using this pragma.
2943 The pragma may appear as a configuration pragma, or locally within a package
2944 spec or declarative part. In the latter case, it applies to all subsequent
2945 types declared within that package spec or declarative part.
2947 The following example shows the use of this pragma:
2949 @example
2950 pragma Default_Scalar_Storage_Order (High_Order_First);
2951 with System; use System;
2952 package DSSO1 is
2953    type H1 is record
2954       a : Integer;
2955    end record;
2957    type L2 is record
2958       a : Integer;
2959    end record;
2960    for L2'Scalar_Storage_Order use Low_Order_First;
2962    type L2a is new L2;
2964    package Inner is
2965       type H3 is record
2966          a : Integer;
2967       end record;
2969       pragma Default_Scalar_Storage_Order (Low_Order_First);
2971       type L4 is record
2972          a : Integer;
2973       end record;
2974    end Inner;
2976    type H4a is new Inner.L4;
2978    type H5 is record
2979       a : Integer;
2980    end record;
2981 end DSSO1;
2982 @end example
2984 In this example record types with names starting with `L' have @cite{Low_Order_First} scalar
2985 storage order, and record types with names starting with `H' have @code{High_Order_First}.
2986 Note that in the case of @code{H4a}, the order is not inherited
2987 from the parent type. Only an explicitly set @code{Scalar_Storage_Order}
2988 gets inherited on type derivation.
2990 If this pragma is used as a configuration pragma which appears within a
2991 configuration pragma file (as opposed to appearing explicitly at the start
2992 of a single unit), then the binder will require that all units in a partition
2993 be compiled in a similar manner, other than run-time units, which are not
2994 affected by this pragma. Note that the use of this form is discouraged because
2995 it may significantly degrade the run-time performance of the software, instead
2996 the default scalar storage order ought to be changed only on a local basis.
2998 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
2999 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{52}
3000 @section Pragma Default_Storage_Pool
3003 @geindex Default_Storage_Pool
3005 Syntax:
3007 @example
3008 pragma Default_Storage_Pool (storage_pool_NAME | null);
3009 @end example
3011 This pragma is standard in Ada 2012, but is available in all earlier
3012 versions of Ada as an implementation-defined pragma.
3013 See Ada 2012 Reference Manual for details.
3015 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
3016 @anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{53}@anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{54}
3017 @section Pragma Depends
3020 Syntax:
3022 @example
3023 pragma Depends (DEPENDENCY_RELATION);
3025 DEPENDENCY_RELATION ::=
3026      null
3027   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
3029 DEPENDENCY_CLAUSE ::=
3030     OUTPUT_LIST =>[+] INPUT_LIST
3031   | NULL_DEPENDENCY_CLAUSE
3033 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
3035 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
3037 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
3039 OUTPUT ::= NAME | FUNCTION_RESULT
3040 INPUT  ::= NAME
3042 where FUNCTION_RESULT is a function Result attribute_reference
3043 @end example
3045 For the semantics of this pragma, see the entry for aspect @code{Depends} in the
3046 SPARK 2014 Reference Manual, section 6.1.5.
3048 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
3049 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{55}
3050 @section Pragma Detect_Blocking
3053 Syntax:
3055 @example
3056 pragma Detect_Blocking;
3057 @end example
3059 This is a standard pragma in Ada 2005, that is available in all earlier
3060 versions of Ada as an implementation-defined pragma.
3062 This is a configuration pragma that forces the detection of potentially
3063 blocking operations within a protected operation, and to raise Program_Error
3064 if that happens.
3066 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
3067 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{56}
3068 @section Pragma Disable_Atomic_Synchronization
3071 @geindex Atomic Synchronization
3073 Syntax:
3075 @example
3076 pragma Disable_Atomic_Synchronization [(Entity)];
3077 @end example
3079 Ada requires that accesses (reads or writes) of an atomic variable be
3080 regarded as synchronization points in the case of multiple tasks.
3081 Particularly in the case of multi-processors this may require special
3082 handling, e.g. the generation of memory barriers. This capability may
3083 be turned off using this pragma in cases where it is known not to be
3084 required.
3086 The placement and scope rules for this pragma are the same as those
3087 for @code{pragma Suppress}. In particular it can be used as a
3088 configuration  pragma, or in a declaration sequence where it applies
3089 till the end of the scope. If an @code{Entity} argument is present,
3090 the action applies only to that entity.
3092 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
3093 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{57}
3094 @section Pragma Dispatching_Domain
3097 Syntax:
3099 @example
3100 pragma Dispatching_Domain (EXPRESSION);
3101 @end example
3103 This pragma is standard in Ada 2012, but is available in all earlier
3104 versions of Ada as an implementation-defined pragma.
3105 See Ada 2012 Reference Manual for details.
3107 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
3108 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{58}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{59}
3109 @section Pragma Effective_Reads
3112 Syntax:
3114 @example
3115 pragma Effective_Reads [ (static_boolean_EXPRESSION) ];
3116 @end example
3118 For the semantics of this pragma, see the entry for aspect @code{Effective_Reads} in
3119 the SPARK 2014 Reference Manual, section 7.1.2.
3121 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3122 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{5a}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{5b}
3123 @section Pragma Effective_Writes
3126 Syntax:
3128 @example
3129 pragma Effective_Writes [ (static_boolean_EXPRESSION) ];
3130 @end example
3132 For the semantics of this pragma, see the entry for aspect @code{Effective_Writes}
3133 in the SPARK 2014 Reference Manual, section 7.1.2.
3135 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3136 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{5c}
3137 @section Pragma Elaboration_Checks
3140 @geindex Elaboration control
3142 Syntax:
3144 @example
3145 pragma Elaboration_Checks (Dynamic | Static);
3146 @end example
3148 This is a configuration pragma which specifies the elaboration model to be
3149 used during compilation. For more information on the elaboration models of
3150 GNAT, consult the chapter on elaboration order handling in the `GNAT User’s
3151 Guide'.
3153 The pragma may appear in the following contexts:
3156 @itemize *
3158 @item 
3159 Configuration pragmas file
3161 @item 
3162 Prior to the context clauses of a compilation unit’s initial declaration
3163 @end itemize
3165 Any other placement of the pragma will result in a warning and the effects of
3166 the offending pragma will be ignored.
3168 If the pragma argument is @code{Dynamic}, then the dynamic elaboration model is in
3169 effect. If the pragma argument is @code{Static}, then the static elaboration model
3170 is in effect.
3172 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3173 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{5d}
3174 @section Pragma Eliminate
3177 @geindex Elimination of unused subprograms
3179 Syntax:
3181 @example
3182 pragma Eliminate (
3183             [  Unit_Name       => ] IDENTIFIER | SELECTED_COMPONENT ,
3184             [  Entity          => ] IDENTIFIER |
3185                                     SELECTED_COMPONENT |
3186                                     STRING_LITERAL
3187             [, Source_Location =>   SOURCE_TRACE ] );
3189         SOURCE_TRACE    ::= STRING_LITERAL
3190 @end example
3192 This pragma indicates that the given entity is not used in the program to be
3193 compiled and built, thus allowing the compiler to
3194 eliminate the code or data associated with the named entity. Any reference to
3195 an eliminated entity causes a compile-time or link-time error.
3197 The pragma has the following semantics, where @code{U} is the unit specified by
3198 the @code{Unit_Name} argument and @code{E} is the entity specified by the @code{Entity}
3199 argument:
3202 @itemize *
3204 @item 
3205 @code{E} must be a subprogram that is explicitly declared either:
3208 @itemize *
3210 @item 
3211 Within @code{U}, or
3213 @item 
3214 Within a generic package that is instantiated in @code{U}, or
3216 @item 
3217 As an instance of generic subprogram instantiated in @code{U}.
3218 @end itemize
3220 Otherwise the pragma is ignored.
3222 @item 
3223 If @code{E} is overloaded within @code{U} then, in the absence of a
3224 @code{Source_Location} argument, all overloadings are eliminated.
3226 @item 
3227 If @code{E} is overloaded within @code{U} and only some overloadings
3228 are to be eliminated, then each overloading to be eliminated
3229 must be specified in a corresponding pragma @code{Eliminate}
3230 with a @code{Source_Location} argument identifying the line where the
3231 declaration appears, as described below.
3233 @item 
3234 If @code{E} is declared as the result of a generic instantiation, then
3235 a @code{Source_Location} argument is needed, as described below.
3236 @end itemize
3238 Pragma @code{Eliminate} allows a program to be compiled in a system-independent
3239 manner, so that unused entities are eliminated but without
3240 needing to modify the source text. Normally the required set of
3241 @code{Eliminate} pragmas is constructed automatically using the @code{gnatelim} tool.
3243 Any source file change that removes, splits, or
3244 adds lines may make the set of @code{Eliminate} pragmas invalid because their
3245 @code{Source_Location} argument values may get out of date.
3247 Pragma @code{Eliminate} may be used where the referenced entity is a dispatching
3248 operation. In this case all the subprograms to which the given operation can
3249 dispatch are considered to be unused (are never called as a result of a direct
3250 or a dispatching call).
3252 The string literal given for the source location specifies the line number
3253 of the declaration of the entity, using the following syntax for @code{SOURCE_TRACE}:
3255 @example
3256 SOURCE_TRACE     ::= SOURCE_REFERENCE [ LBRACKET SOURCE_TRACE RBRACKET ]
3258 LBRACKET         ::= '['
3259 RBRACKET         ::= ']'
3261 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3263 LINE_NUMBER      ::= DIGIT @{DIGIT@}
3264 @end example
3266 Spaces around the colon in a @code{SOURCE_REFERENCE} are optional.
3268 The source trace that is given as the @code{Source_Location} must obey the
3269 following rules (or else the pragma is ignored), where @code{U} is
3270 the unit @code{U} specified by the @code{Unit_Name} argument and @code{E} is the
3271 subprogram specified by the @code{Entity} argument:
3274 @itemize *
3276 @item 
3277 @code{FILE_NAME} is the short name (with no directory
3278 information) of the Ada source file for @code{U}, using the required syntax
3279 for the underlying file system (e.g. case is significant if the underlying
3280 operating system is case sensitive).
3281 If @code{U} is a package and @code{E} is a subprogram declared in the package
3282 specification and its full declaration appears in the package body,
3283 then the  relevant source file is the one for the package specification;
3284 analogously if @code{U} is a generic package.
3286 @item 
3287 If @code{E} is not declared in a generic instantiation (this includes
3288 generic subprogram instances), the source trace includes only one source
3289 line reference. @code{LINE_NUMBER} gives the line number of the occurrence
3290 of the declaration of @code{E} within the source file (as a decimal literal
3291 without an exponent or point).
3293 @item 
3294 If @code{E} is declared by a generic instantiation, its source trace
3295 (from left to right) starts with the source location of the
3296 declaration of @code{E} in the generic unit and ends with the source
3297 location of the instantiation, given in square brackets. This approach is
3298 applied recursively with nested instantiations: the rightmost (nested
3299 most deeply in square brackets) element of the source trace is the location
3300 of the outermost instantiation, and the leftmost element (that is, outside
3301 of any square brackets) is the location of the declaration of @code{E} in
3302 the generic unit.
3303 @end itemize
3305 Examples:
3307 @quotation
3309 @example
3310 pragma Eliminate (Pkg0, Proc);
3311 -- Eliminate (all overloadings of) Proc in Pkg0
3313 pragma Eliminate (Pkg1, Proc,
3314                   Source_Location => "pkg1.ads:8");
3315 -- Eliminate overloading of Proc at line 8 in pkg1.ads
3317 -- Assume the following file contents:
3318 --   gen_pkg.ads
3319 --   1: generic
3320 --   2:   type T is private;
3321 --   3: package Gen_Pkg is
3322 --   4:   procedure Proc(N : T);
3323 --  ...   ...
3324 --  ... end Gen_Pkg;
3326 --    q.adb
3327 --   1: with Gen_Pkg;
3328 --   2: procedure Q is
3329 --   3:   package Inst_Pkg is new Gen_Pkg(Integer);
3330 --  ...   -- No calls on Inst_Pkg.Proc
3331 --  ... end Q;
3333 -- The following pragma eliminates Inst_Pkg.Proc from Q
3334 pragma Eliminate (Q, Proc,
3335                   Source_Location => "gen_pkg.ads:4[q.adb:3]");
3336 @end example
3337 @end quotation
3339 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3340 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{5e}
3341 @section Pragma Enable_Atomic_Synchronization
3344 @geindex Atomic Synchronization
3346 Syntax:
3348 @example
3349 pragma Enable_Atomic_Synchronization [(Entity)];
3350 @end example
3352 Ada requires that accesses (reads or writes) of an atomic variable be
3353 regarded as synchronization points in the case of multiple tasks.
3354 Particularly in the case of multi-processors this may require special
3355 handling, e.g. the generation of memory barriers. This synchronization
3356 is performed by default, but can be turned off using
3357 @code{pragma Disable_Atomic_Synchronization}. The
3358 @code{Enable_Atomic_Synchronization} pragma can be used to turn
3359 it back on.
3361 The placement and scope rules for this pragma are the same as those
3362 for @code{pragma Unsuppress}. In particular it can be used as a
3363 configuration  pragma, or in a declaration sequence where it applies
3364 till the end of the scope. If an @code{Entity} argument is present,
3365 the action applies only to that entity.
3367 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3368 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{5f}
3369 @section Pragma Export_Function
3372 @geindex Argument passing mechanisms
3374 Syntax:
3376 @example
3377 pragma Export_Function (
3378      [Internal         =>] LOCAL_NAME
3379   [, [External         =>] EXTERNAL_SYMBOL]
3380   [, [Parameter_Types  =>] PARAMETER_TYPES]
3381   [, [Result_Type      =>] result_SUBTYPE_MARK]
3382   [, [Mechanism        =>] MECHANISM]
3383   [, [Result_Mechanism =>] MECHANISM_NAME]);
3385 EXTERNAL_SYMBOL ::=
3386   IDENTIFIER
3387 | static_string_EXPRESSION
3388 | ""
3390 PARAMETER_TYPES ::=
3391   null
3392 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3394 TYPE_DESIGNATOR ::=
3395   subtype_NAME
3396 | subtype_Name ' Access
3398 MECHANISM ::=
3399   MECHANISM_NAME
3400 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3402 MECHANISM_ASSOCIATION ::=
3403   [formal_parameter_NAME =>] MECHANISM_NAME
3405 MECHANISM_NAME ::= Value | Reference
3406 @end example
3408 Use this pragma to make a function externally callable and optionally
3409 provide information on mechanisms to be used for passing parameter and
3410 result values.  We recommend, for the purposes of improving portability,
3411 this pragma always be used in conjunction with a separate pragma
3412 @code{Export}, which must precede the pragma @code{Export_Function}.
3413 GNAT does not require a separate pragma @code{Export}, but if none is
3414 present, @code{Convention Ada} is assumed, which is usually
3415 not what is wanted, so it is usually appropriate to use this
3416 pragma in conjunction with a @code{Export} or @code{Convention}
3417 pragma that specifies the desired foreign convention.
3418 Pragma @code{Export_Function}
3419 (and @code{Export}, if present) must appear in the same declarative
3420 region as the function to which they apply.
3422 The @code{internal_name} must uniquely designate the function to which the
3423 pragma applies.  If more than one function name exists of this name in
3424 the declarative part you must use the @code{Parameter_Types} and
3425 @code{Result_Type} parameters to achieve the required
3426 unique designation.  The @cite{subtype_mark}s in these parameters must
3427 exactly match the subtypes in the corresponding function specification,
3428 using positional notation to match parameters with subtype marks.
3429 The form with an @code{'Access} attribute can be used to match an
3430 anonymous access parameter.
3432 @geindex Suppressing external name
3434 Special treatment is given if the EXTERNAL is an explicit null
3435 string or a static string expressions that evaluates to the null
3436 string. In this case, no external name is generated. This form
3437 still allows the specification of parameter mechanisms.
3439 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3440 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{60}
3441 @section Pragma Export_Object
3444 Syntax:
3446 @example
3447 pragma Export_Object (
3448       [Internal =>] LOCAL_NAME
3449    [, [External =>] EXTERNAL_SYMBOL]
3450    [, [Size     =>] EXTERNAL_SYMBOL]);
3452 EXTERNAL_SYMBOL ::=
3453   IDENTIFIER
3454 | static_string_EXPRESSION
3455 @end example
3457 This pragma designates an object as exported, and apart from the
3458 extended rules for external symbols, is identical in effect to the use of
3459 the normal @code{Export} pragma applied to an object.  You may use a
3460 separate Export pragma (and you probably should from the point of view
3461 of portability), but it is not required.  @code{Size} is syntax checked,
3462 but otherwise ignored by GNAT.
3464 @node Pragma Export_Procedure,Pragma Export_Valued_Procedure,Pragma Export_Object,Implementation Defined Pragmas
3465 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{61}
3466 @section Pragma Export_Procedure
3469 Syntax:
3471 @example
3472 pragma Export_Procedure (
3473      [Internal        =>] LOCAL_NAME
3474   [, [External        =>] EXTERNAL_SYMBOL]
3475   [, [Parameter_Types =>] PARAMETER_TYPES]
3476   [, [Mechanism       =>] MECHANISM]);
3478 EXTERNAL_SYMBOL ::=
3479   IDENTIFIER
3480 | static_string_EXPRESSION
3481 | ""
3483 PARAMETER_TYPES ::=
3484   null
3485 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3487 TYPE_DESIGNATOR ::=
3488   subtype_NAME
3489 | subtype_Name ' Access
3491 MECHANISM ::=
3492   MECHANISM_NAME
3493 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3495 MECHANISM_ASSOCIATION ::=
3496   [formal_parameter_NAME =>] MECHANISM_NAME
3498 MECHANISM_NAME ::= Value | Reference
3499 @end example
3501 This pragma is identical to @code{Export_Function} except that it
3502 applies to a procedure rather than a function and the parameters
3503 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
3504 GNAT does not require a separate pragma @code{Export}, but if none is
3505 present, @code{Convention Ada} is assumed, which is usually
3506 not what is wanted, so it is usually appropriate to use this
3507 pragma in conjunction with a @code{Export} or @code{Convention}
3508 pragma that specifies the desired foreign convention.
3510 @geindex Suppressing external name
3512 Special treatment is given if the EXTERNAL is an explicit null
3513 string or a static string expressions that evaluates to the null
3514 string. In this case, no external name is generated. This form
3515 still allows the specification of parameter mechanisms.
3517 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Procedure,Implementation Defined Pragmas
3518 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{62}
3519 @section Pragma Export_Valued_Procedure
3522 Syntax:
3524 @example
3525 pragma Export_Valued_Procedure (
3526      [Internal        =>] LOCAL_NAME
3527   [, [External        =>] EXTERNAL_SYMBOL]
3528   [, [Parameter_Types =>] PARAMETER_TYPES]
3529   [, [Mechanism       =>] MECHANISM]);
3531 EXTERNAL_SYMBOL ::=
3532   IDENTIFIER
3533 | static_string_EXPRESSION
3534 | ""
3536 PARAMETER_TYPES ::=
3537   null
3538 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3540 TYPE_DESIGNATOR ::=
3541   subtype_NAME
3542 | subtype_Name ' Access
3544 MECHANISM ::=
3545   MECHANISM_NAME
3546 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3548 MECHANISM_ASSOCIATION ::=
3549   [formal_parameter_NAME =>] MECHANISM_NAME
3551 MECHANISM_NAME ::= Value | Reference
3552 @end example
3554 This pragma is identical to @code{Export_Procedure} except that the
3555 first parameter of @code{LOCAL_NAME}, which must be present, must be of
3556 mode @code{out}, and externally the subprogram is treated as a function
3557 with this parameter as the result of the function.  GNAT provides for
3558 this capability to allow the use of @code{out} and @code{in out}
3559 parameters in interfacing to external functions (which are not permitted
3560 in Ada functions).
3561 GNAT does not require a separate pragma @code{Export}, but if none is
3562 present, @code{Convention Ada} is assumed, which is almost certainly
3563 not what is wanted since the whole point of this pragma is to interface
3564 with foreign language functions, so it is usually appropriate to use this
3565 pragma in conjunction with a @code{Export} or @code{Convention}
3566 pragma that specifies the desired foreign convention.
3568 @geindex Suppressing external name
3570 Special treatment is given if the EXTERNAL is an explicit null
3571 string or a static string expressions that evaluates to the null
3572 string. In this case, no external name is generated. This form
3573 still allows the specification of parameter mechanisms.
3575 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3576 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{63}
3577 @section Pragma Extend_System
3580 @geindex System
3581 @geindex extending
3583 @geindex DEC Ada 83
3585 Syntax:
3587 @example
3588 pragma Extend_System ([Name =>] IDENTIFIER);
3589 @end example
3591 This pragma is used to provide backwards compatibility with other
3592 implementations that extend the facilities of package @code{System}.  In
3593 GNAT, @code{System} contains only the definitions that are present in
3594 the Ada RM.  However, other implementations, notably the DEC Ada 83
3595 implementation, provide many extensions to package @code{System}.
3597 For each such implementation accommodated by this pragma, GNAT provides a
3598 package @code{Aux_@var{xxx}}, e.g., @code{Aux_DEC} for the DEC Ada 83
3599 implementation, which provides the required additional definitions.  You
3600 can use this package in two ways.  You can @code{with} it in the normal
3601 way and access entities either by selection or using a @code{use}
3602 clause.  In this case no special processing is required.
3604 However, if existing code contains references such as
3605 @code{System.@var{xxx}} where `xxx' is an entity in the extended
3606 definitions provided in package @code{System}, you may use this pragma
3607 to extend visibility in @code{System} in a non-standard way that
3608 provides greater compatibility with the existing code.  Pragma
3609 @code{Extend_System} is a configuration pragma whose single argument is
3610 the name of the package containing the extended definition
3611 (e.g., @code{Aux_DEC} for the DEC Ada case).  A unit compiled under
3612 control of this pragma will be processed using special visibility
3613 processing that looks in package @code{System.Aux_@var{xxx}} where
3614 @code{Aux_@var{xxx}} is the pragma argument for any entity referenced in
3615 package @code{System}, but not found in package @code{System}.
3617 You can use this pragma either to access a predefined @code{System}
3618 extension supplied with the compiler, for example @code{Aux_DEC} or
3619 you can construct your own extension unit following the above
3620 definition.  Note that such a package is a child of @code{System}
3621 and thus is considered part of the implementation.
3622 To compile it you will have to use the `-gnatg' switch
3623 for compiling System units, as explained in the
3624 GNAT User’s Guide.
3626 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3627 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{64}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{65}
3628 @section Pragma Extensions_Allowed
3631 @geindex Ada Extensions
3633 @geindex GNAT Extensions
3635 Syntax:
3637 @example
3638 pragma Extensions_Allowed (On | Off | All);
3639 @end example
3641 This configuration pragma enables (via the “On” or “All” argument) or disables
3642 (via the “Off” argument) the implementation extension mode; the pragma takes
3643 precedence over the @code{-gnatX} and @code{-gnatX0} command switches.
3645 If an argument of @code{"On"} is specified, the latest version of the Ada language
3646 is implemented (currently Ada 2022) and, in addition, a curated set of GNAT
3647 specific extensions are recognized. (See the list here
3648 @ref{66,,here})
3650 An argument of @code{"All"} has the same effect except that some extra
3651 experimental extensions are enabled (See the list here
3652 @ref{67,,here})
3654 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3655 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{68}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{69}
3656 @section Pragma Extensions_Visible
3659 Syntax:
3661 @example
3662 pragma Extensions_Visible [ (static_boolean_EXPRESSION) ];
3663 @end example
3665 For the semantics of this pragma, see the entry for aspect @code{Extensions_Visible}
3666 in the SPARK 2014 Reference Manual, section 6.1.7.
3668 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3669 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{6a}
3670 @section Pragma External
3673 Syntax:
3675 @example
3676 pragma External (
3677   [   Convention    =>] convention_IDENTIFIER,
3678   [   Entity        =>] LOCAL_NAME
3679   [, [External_Name =>] static_string_EXPRESSION ]
3680   [, [Link_Name     =>] static_string_EXPRESSION ]);
3681 @end example
3683 This pragma is identical in syntax and semantics to pragma
3684 @code{Export} as defined in the Ada Reference Manual.  It is
3685 provided for compatibility with some Ada 83 compilers that
3686 used this pragma for exactly the same purposes as pragma
3687 @code{Export} before the latter was standardized.
3689 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3690 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{6b}
3691 @section Pragma External_Name_Casing
3694 @geindex Dec Ada 83 casing compatibility
3696 @geindex External Names
3697 @geindex casing
3699 @geindex Casing of External names
3701 Syntax:
3703 @example
3704 pragma External_Name_Casing (
3705   Uppercase | Lowercase
3706   [, Uppercase | Lowercase | As_Is]);
3707 @end example
3709 This pragma provides control over the casing of external names associated
3710 with Import and Export pragmas.  There are two cases to consider:
3713 @itemize *
3715 @item 
3716 Implicit external names
3718 Implicit external names are derived from identifiers.  The most common case
3719 arises when a standard Ada Import or Export pragma is used with only two
3720 arguments, as in:
3722 @example
3723 pragma Import (C, C_Routine);
3724 @end example
3726 Since Ada is a case-insensitive language, the spelling of the identifier in
3727 the Ada source program does not provide any information on the desired
3728 casing of the external name, and so a convention is needed.  In GNAT the
3729 default treatment is that such names are converted to all lower case
3730 letters.  This corresponds to the normal C style in many environments.
3731 The first argument of pragma @code{External_Name_Casing} can be used to
3732 control this treatment.  If @code{Uppercase} is specified, then the name
3733 will be forced to all uppercase letters.  If @code{Lowercase} is specified,
3734 then the normal default of all lower case letters will be used.
3736 This same implicit treatment is also used in the case of extended DEC Ada 83
3737 compatible Import and Export pragmas where an external name is explicitly
3738 specified using an identifier rather than a string.
3740 @item 
3741 Explicit external names
3743 Explicit external names are given as string literals.  The most common case
3744 arises when a standard Ada Import or Export pragma is used with three
3745 arguments, as in:
3747 @example
3748 pragma Import (C, C_Routine, "C_routine");
3749 @end example
3751 In this case, the string literal normally provides the exact casing required
3752 for the external name.  The second argument of pragma
3753 @code{External_Name_Casing} may be used to modify this behavior.
3754 If @code{Uppercase} is specified, then the name
3755 will be forced to all uppercase letters.  If @code{Lowercase} is specified,
3756 then the name will be forced to all lowercase letters.  A specification of
3757 @code{As_Is} provides the normal default behavior in which the casing is
3758 taken from the string provided.
3759 @end itemize
3761 This pragma may appear anywhere that a pragma is valid. In particular, it
3762 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3763 case it applies to all subsequent compilations, or it can be used as a program
3764 unit pragma, in which case it only applies to the current unit, or it can
3765 be used more locally to control individual Import/Export pragmas.
3767 It was primarily intended for use with OpenVMS systems, where many
3768 compilers convert all symbols to upper case by default.  For interfacing to
3769 such compilers (e.g., the DEC C compiler), it may be convenient to use
3770 the pragma:
3772 @example
3773 pragma External_Name_Casing (Uppercase, Uppercase);
3774 @end example
3776 to enforce the upper casing of all external symbols.
3778 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3779 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{6c}
3780 @section Pragma Fast_Math
3783 Syntax:
3785 @example
3786 pragma Fast_Math;
3787 @end example
3789 This is a configuration pragma which activates a mode in which speed is
3790 considered more important for floating-point operations than absolutely
3791 accurate adherence to the requirements of the standard. Currently the
3792 following operations are affected:
3795 @table @asis
3797 @item `Complex Multiplication'
3799 The normal simple formula for complex multiplication can result in intermediate
3800 overflows for numbers near the end of the range. The Ada standard requires that
3801 this situation be detected and corrected by scaling, but in Fast_Math mode such
3802 cases will simply result in overflow. Note that to take advantage of this you
3803 must instantiate your own version of @code{Ada.Numerics.Generic_Complex_Types}
3804 under control of the pragma, rather than use the preinstantiated versions.
3805 @end table
3807 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3808 @anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{6d}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{6e}
3809 @section Pragma Favor_Top_Level
3812 Syntax:
3814 @example
3815 pragma Favor_Top_Level (type_NAME);
3816 @end example
3818 The argument of pragma @code{Favor_Top_Level} must be a named access-to-subprogram
3819 type. This pragma is an efficiency hint to the compiler, regarding the use of
3820 @code{'Access} or @code{'Unrestricted_Access} on nested (non-library-level) subprograms.
3821 The pragma means that nested subprograms are not used with this type, or are
3822 rare, so that the generated code should be efficient in the top-level case.
3823 When this pragma is used, dynamically generated trampolines may be used on some
3824 targets for nested subprograms. See restriction @code{No_Implicit_Dynamic_Code}.
3826 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3827 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{6f}
3828 @section Pragma Finalize_Storage_Only
3831 Syntax:
3833 @example
3834 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3835 @end example
3837 The argument of pragma @code{Finalize_Storage_Only} must denote a local type which
3838 is derived from @code{Ada.Finalization.Controlled} or @code{Limited_Controlled}. The
3839 pragma suppresses the call to @code{Finalize} for declared library-level objects
3840 of the argument type. This is mostly useful for types where finalization is
3841 only used to deal with storage reclamation since in most environments it is
3842 not necessary to reclaim memory just before terminating execution, hence the
3843 name. Note that this pragma does not suppress Finalize calls for library-level
3844 heap-allocated objects (see pragma @code{No_Heap_Finalization}).
3846 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3847 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{70}
3848 @section Pragma Float_Representation
3851 Syntax:
3853 @example
3854 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3856 FLOAT_REP ::= VAX_Float | IEEE_Float
3857 @end example
3859 In the one argument form, this pragma is a configuration pragma which
3860 allows control over the internal representation chosen for the predefined
3861 floating point types declared in the packages @code{Standard} and
3862 @code{System}. This pragma is only provided for compatibility and has no effect.
3864 The two argument form specifies the representation to be used for
3865 the specified floating-point type. The argument must
3866 be @code{IEEE_Float} to specify the use of IEEE format, as follows:
3869 @itemize *
3871 @item 
3872 For a digits value of 6, 32-bit IEEE short format will be used.
3874 @item 
3875 For a digits value of 15, 64-bit IEEE long format will be used.
3877 @item 
3878 No other value of digits is permitted.
3879 @end itemize
3881 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
3882 @anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{71}@anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{72}
3883 @section Pragma Ghost
3886 Syntax:
3888 @example
3889 pragma Ghost [ (static_boolean_EXPRESSION) ];
3890 @end example
3892 For the semantics of this pragma, see the entry for aspect @code{Ghost} in the SPARK
3893 2014 Reference Manual, section 6.9.
3895 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
3896 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{73}@anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{74}
3897 @section Pragma Global
3900 Syntax:
3902 @example
3903 pragma Global (GLOBAL_SPECIFICATION);
3905 GLOBAL_SPECIFICATION ::=
3906      null
3907   | (GLOBAL_LIST)
3908   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
3910 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
3912 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
3913 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
3914 GLOBAL_ITEM   ::= NAME
3915 @end example
3917 For the semantics of this pragma, see the entry for aspect @code{Global} in the
3918 SPARK 2014 Reference Manual, section 6.1.4.
3920 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
3921 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{75}
3922 @section Pragma Ident
3925 Syntax:
3927 @example
3928 pragma Ident (static_string_EXPRESSION);
3929 @end example
3931 This pragma is identical in effect to pragma @code{Comment}. It is provided
3932 for compatibility with other Ada compilers providing this pragma.
3934 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
3935 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{76}
3936 @section Pragma Ignore_Pragma
3939 Syntax:
3941 @example
3942 pragma Ignore_Pragma (pragma_IDENTIFIER);
3943 @end example
3945 This is a configuration pragma
3946 that takes a single argument that is a simple identifier. Any subsequent
3947 use of a pragma whose pragma identifier matches this argument will be
3948 silently ignored. This may be useful when legacy code or code intended
3949 for compilation with some other compiler contains pragmas that match the
3950 name, but not the exact implementation, of a GNAT pragma. The use of this
3951 pragma allows such pragmas to be ignored, which may be useful in CodePeer
3952 mode, or during porting of legacy code.
3954 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
3955 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{77}
3956 @section Pragma Implementation_Defined
3959 Syntax:
3961 @example
3962 pragma Implementation_Defined (local_NAME);
3963 @end example
3965 This pragma marks a previously declared entity as implementation-defined.
3966 For an overloaded entity, applies to the most recent homonym.
3968 @example
3969 pragma Implementation_Defined;
3970 @end example
3972 The form with no arguments appears anywhere within a scope, most
3973 typically a package spec, and indicates that all entities that are
3974 defined within the package spec are Implementation_Defined.
3976 This pragma is used within the GNAT runtime library to identify
3977 implementation-defined entities introduced in language-defined units,
3978 for the purpose of implementing the No_Implementation_Identifiers
3979 restriction.
3981 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
3982 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{78}
3983 @section Pragma Implemented
3986 Syntax:
3988 @example
3989 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
3991 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
3992 @end example
3994 This is an Ada 2012 representation pragma which applies to protected, task
3995 and synchronized interface primitives. The use of pragma Implemented provides
3996 a way to impose a static requirement on the overriding operation by adhering
3997 to one of the three implementation kinds: entry, protected procedure or any of
3998 the above. This pragma is available in all earlier versions of Ada as an
3999 implementation-defined pragma.
4001 @example
4002 type Synch_Iface is synchronized interface;
4003 procedure Prim_Op (Obj : in out Iface) is abstract;
4004 pragma Implemented (Prim_Op, By_Protected_Procedure);
4006 protected type Prot_1 is new Synch_Iface with
4007    procedure Prim_Op;  --  Legal
4008 end Prot_1;
4010 protected type Prot_2 is new Synch_Iface with
4011    entry Prim_Op;      --  Illegal
4012 end Prot_2;
4014 task type Task_Typ is new Synch_Iface with
4015    entry Prim_Op;      --  Illegal
4016 end Task_Typ;
4017 @end example
4019 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
4020 Implemented determines the runtime behavior of the requeue. Implementation kind
4021 By_Entry guarantees that the action of requeueing will proceed from an entry to
4022 another entry. Implementation kind By_Protected_Procedure transforms the
4023 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
4024 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
4025 the target’s overriding subprogram kind.
4027 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
4028 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{79}
4029 @section Pragma Implicit_Packing
4032 @geindex Rational Profile
4034 Syntax:
4036 @example
4037 pragma Implicit_Packing;
4038 @end example
4040 This is a configuration pragma that requests implicit packing for packed
4041 arrays for which a size clause is given but no explicit pragma Pack or
4042 specification of Component_Size is present. It also applies to records
4043 where no record representation clause is present. Consider this example:
4045 @example
4046 type R is array (0 .. 7) of Boolean;
4047 for R'Size use 8;
4048 @end example
4050 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
4051 does not change the layout of a composite object. So the Size clause in the
4052 above example is normally rejected, since the default layout of the array uses
4053 8-bit components, and thus the array requires a minimum of 64 bits.
4055 If this declaration is compiled in a region of code covered by an occurrence
4056 of the configuration pragma Implicit_Packing, then the Size clause in this
4057 and similar examples will cause implicit packing and thus be accepted. For
4058 this implicit packing to occur, the type in question must be an array of small
4059 components whose size is known at compile time, and the Size clause must
4060 specify the exact size that corresponds to the number of elements in the array
4061 multiplied by the size in bits of the component type (both single and
4062 multi-dimensioned arrays can be controlled with this pragma).
4064 @geindex Array packing
4066 Similarly, the following example shows the use in the record case
4068 @example
4069 type r is record
4070    a, b, c, d, e, f, g, h : boolean;
4071    chr                    : character;
4072 end record;
4073 for r'size use 16;
4074 @end example
4076 Without a pragma Pack, each Boolean field requires 8 bits, so the
4077 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
4078 sufficient. The use of pragma Implicit_Packing allows this record
4079 declaration to compile without an explicit pragma Pack.
4081 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
4082 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{7a}
4083 @section Pragma Import_Function
4086 Syntax:
4088 @example
4089 pragma Import_Function (
4090      [Internal         =>] LOCAL_NAME,
4091   [, [External         =>] EXTERNAL_SYMBOL]
4092   [, [Parameter_Types  =>] PARAMETER_TYPES]
4093   [, [Result_Type      =>] SUBTYPE_MARK]
4094   [, [Mechanism        =>] MECHANISM]
4095   [, [Result_Mechanism =>] MECHANISM_NAME]);
4097 EXTERNAL_SYMBOL ::=
4098   IDENTIFIER
4099 | static_string_EXPRESSION
4101 PARAMETER_TYPES ::=
4102   null
4103 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4105 TYPE_DESIGNATOR ::=
4106   subtype_NAME
4107 | subtype_Name ' Access
4109 MECHANISM ::=
4110   MECHANISM_NAME
4111 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4113 MECHANISM_ASSOCIATION ::=
4114   [formal_parameter_NAME =>] MECHANISM_NAME
4116 MECHANISM_NAME ::=
4117   Value
4118 | Reference
4119 @end example
4121 This pragma is used in conjunction with a pragma @code{Import} to
4122 specify additional information for an imported function.  The pragma
4123 @code{Import} (or equivalent pragma @code{Interface}) must precede the
4124 @code{Import_Function} pragma and both must appear in the same
4125 declarative part as the function specification.
4127 The @code{Internal} argument must uniquely designate
4128 the function to which the
4129 pragma applies.  If more than one function name exists of this name in
4130 the declarative part you must use the @code{Parameter_Types} and
4131 @code{Result_Type} parameters to achieve the required unique
4132 designation.  Subtype marks in these parameters must exactly match the
4133 subtypes in the corresponding function specification, using positional
4134 notation to match parameters with subtype marks.
4135 The form with an @code{'Access} attribute can be used to match an
4136 anonymous access parameter.
4138 You may optionally use the @code{Mechanism} and @code{Result_Mechanism}
4139 parameters to specify passing mechanisms for the
4140 parameters and result.  If you specify a single mechanism name, it
4141 applies to all parameters.  Otherwise you may specify a mechanism on a
4142 parameter by parameter basis using either positional or named
4143 notation.  If the mechanism is not specified, the default mechanism
4144 is used.
4146 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
4147 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{7b}
4148 @section Pragma Import_Object
4151 Syntax:
4153 @example
4154 pragma Import_Object (
4155      [Internal =>] LOCAL_NAME
4156   [, [External =>] EXTERNAL_SYMBOL]
4157   [, [Size     =>] EXTERNAL_SYMBOL]);
4159 EXTERNAL_SYMBOL ::=
4160   IDENTIFIER
4161 | static_string_EXPRESSION
4162 @end example
4164 This pragma designates an object as imported, and apart from the
4165 extended rules for external symbols, is identical in effect to the use of
4166 the normal @code{Import} pragma applied to an object.  Unlike the
4167 subprogram case, you need not use a separate @code{Import} pragma,
4168 although you may do so (and probably should do so from a portability
4169 point of view).  @code{size} is syntax checked, but otherwise ignored by
4170 GNAT.
4172 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
4173 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{7c}
4174 @section Pragma Import_Procedure
4177 Syntax:
4179 @example
4180 pragma Import_Procedure (
4181      [Internal        =>] LOCAL_NAME
4182   [, [External        =>] EXTERNAL_SYMBOL]
4183   [, [Parameter_Types =>] PARAMETER_TYPES]
4184   [, [Mechanism       =>] MECHANISM]);
4186 EXTERNAL_SYMBOL ::=
4187   IDENTIFIER
4188 | static_string_EXPRESSION
4190 PARAMETER_TYPES ::=
4191   null
4192 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4194 TYPE_DESIGNATOR ::=
4195   subtype_NAME
4196 | subtype_Name ' Access
4198 MECHANISM ::=
4199   MECHANISM_NAME
4200 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4202 MECHANISM_ASSOCIATION ::=
4203   [formal_parameter_NAME =>] MECHANISM_NAME
4205 MECHANISM_NAME ::= Value | Reference
4206 @end example
4208 This pragma is identical to @code{Import_Function} except that it
4209 applies to a procedure rather than a function and the parameters
4210 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
4212 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4213 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{7d}
4214 @section Pragma Import_Valued_Procedure
4217 Syntax:
4219 @example
4220 pragma Import_Valued_Procedure (
4221      [Internal        =>] LOCAL_NAME
4222   [, [External        =>] EXTERNAL_SYMBOL]
4223   [, [Parameter_Types =>] PARAMETER_TYPES]
4224   [, [Mechanism       =>] MECHANISM]);
4226 EXTERNAL_SYMBOL ::=
4227   IDENTIFIER
4228 | static_string_EXPRESSION
4230 PARAMETER_TYPES ::=
4231   null
4232 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4234 TYPE_DESIGNATOR ::=
4235   subtype_NAME
4236 | subtype_Name ' Access
4238 MECHANISM ::=
4239   MECHANISM_NAME
4240 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4242 MECHANISM_ASSOCIATION ::=
4243   [formal_parameter_NAME =>] MECHANISM_NAME
4245 MECHANISM_NAME ::= Value | Reference
4246 @end example
4248 This pragma is identical to @code{Import_Procedure} except that the
4249 first parameter of @code{LOCAL_NAME}, which must be present, must be of
4250 mode @code{out}, and externally the subprogram is treated as a function
4251 with this parameter as the result of the function.  The purpose of this
4252 capability is to allow the use of @code{out} and @code{in out}
4253 parameters in interfacing to external functions (which are not permitted
4254 in Ada functions).  You may optionally use the @code{Mechanism}
4255 parameters to specify passing mechanisms for the parameters.
4256 If you specify a single mechanism name, it applies to all parameters.
4257 Otherwise you may specify a mechanism on a parameter by parameter
4258 basis using either positional or named notation.  If the mechanism is not
4259 specified, the default mechanism is used.
4261 Note that it is important to use this pragma in conjunction with a separate
4262 pragma Import that specifies the desired convention, since otherwise the
4263 default convention is Ada, which is almost certainly not what is required.
4265 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4266 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{7e}
4267 @section Pragma Independent
4270 Syntax:
4272 @example
4273 pragma Independent (Local_NAME);
4274 @end example
4276 This pragma is standard in Ada 2012 mode (which also provides an aspect
4277 of the same name). It is also available as an implementation-defined
4278 pragma in all earlier versions. It specifies that the
4279 designated object or all objects of the designated type must be
4280 independently addressable. This means that separate tasks can safely
4281 manipulate such objects. For example, if two components of a record are
4282 independent, then two separate tasks may access these two components.
4283 This may place
4284 constraints on the representation of the object (for instance prohibiting
4285 tight packing).
4287 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4288 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{7f}
4289 @section Pragma Independent_Components
4292 Syntax:
4294 @example
4295 pragma Independent_Components (Local_NAME);
4296 @end example
4298 This pragma is standard in Ada 2012 mode (which also provides an aspect
4299 of the same name). It is also available as an implementation-defined
4300 pragma in all earlier versions. It specifies that the components of the
4301 designated object, or the components of each object of the designated
4302 type, must be
4303 independently addressable. This means that separate tasks can safely
4304 manipulate separate components in the composite object. This may place
4305 constraints on the representation of the object (for instance prohibiting
4306 tight packing).
4308 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4309 @anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{80}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{81}
4310 @section Pragma Initial_Condition
4313 Syntax:
4315 @example
4316 pragma Initial_Condition (boolean_EXPRESSION);
4317 @end example
4319 For the semantics of this pragma, see the entry for aspect @code{Initial_Condition}
4320 in the SPARK 2014 Reference Manual, section 7.1.6.
4322 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4323 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{82}
4324 @section Pragma Initialize_Scalars
4327 @geindex debugging with Initialize_Scalars
4329 Syntax:
4331 @example
4332 pragma Initialize_Scalars
4333   [ ( TYPE_VALUE_PAIR @{, TYPE_VALUE_PAIR@} ) ];
4335 TYPE_VALUE_PAIR ::=
4336   SCALAR_TYPE => static_EXPRESSION
4338 SCALAR_TYPE :=
4339   Short_Float
4340 | Float
4341 | Long_Float
4342 | Long_Long_Flat
4343 | Signed_8
4344 | Signed_16
4345 | Signed_32
4346 | Signed_64
4347 | Unsigned_8
4348 | Unsigned_16
4349 | Unsigned_32
4350 | Unsigned_64
4351 @end example
4353 This pragma is similar to @code{Normalize_Scalars} conceptually but has two
4354 important differences.
4356 First, there is no requirement for the pragma to be used uniformly in all units
4357 of a partition. In particular, it is fine to use this just for some or all of
4358 the application units of a partition, without needing to recompile the run-time
4359 library. In the case where some units are compiled with the pragma, and some
4360 without, then a declaration of a variable where the type is defined in package
4361 Standard or is locally declared will always be subject to initialization, as
4362 will any declaration of a scalar variable. For composite variables, whether the
4363 variable is initialized may also depend on whether the package in which the
4364 type of the variable is declared is compiled with the pragma.
4366 The other important difference is that the programmer can control the value
4367 used for initializing scalar objects. This effect can be achieved in several
4368 different ways:
4371 @itemize *
4373 @item 
4374 At compile time, the programmer can specify the invalid value for a
4375 particular family of scalar types using the optional arguments of the pragma.
4377 The compile-time approach is intended to optimize the generated code for the
4378 pragma, by possibly using fast operations such as @code{memset}. Note that such
4379 optimizations require using values where the bytes all have the same binary
4380 representation.
4382 @item 
4383 At bind time, the programmer has several options:
4386 @itemize *
4388 @item 
4389 Initialization with invalid values (similar to Normalize_Scalars, though
4390 for Initialize_Scalars it is not always possible to determine the invalid
4391 values in complex cases like signed component fields with nonstandard
4392 sizes).
4394 @item 
4395 Initialization with high values.
4397 @item 
4398 Initialization with low values.
4400 @item 
4401 Initialization with a specific bit pattern.
4402 @end itemize
4404 See the GNAT User’s Guide for binder options for specifying these cases.
4406 The bind-time approach is intended to provide fast turnaround for testing
4407 with different values, without having to recompile the program.
4409 @item 
4410 At execution time, the programmer can specify the invalid values using an
4411 environment variable. See the GNAT User’s Guide for details.
4413 The execution-time approach is intended to provide fast turnaround for
4414 testing with different values, without having to recompile and rebind the
4415 program.
4416 @end itemize
4418 Note that pragma @code{Initialize_Scalars} is particularly useful in conjunction
4419 with the enhanced validity checking that is now provided in GNAT, which checks
4420 for invalid values under more conditions. Using this feature (see description
4421 of the `-gnatV' flag in the GNAT User’s Guide) in conjunction with pragma
4422 @code{Initialize_Scalars} provides a powerful new tool to assist in the detection
4423 of problems caused by uninitialized variables.
4425 Note: the use of @code{Initialize_Scalars} has a fairly extensive effect on the
4426 generated code. This may cause your code to be substantially larger. It may
4427 also cause an increase in the amount of stack required, so it is probably a
4428 good idea to turn on stack checking (see description of stack checking in the
4429 GNAT User’s Guide) when using this pragma.
4431 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4432 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{83}@anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{84}
4433 @section Pragma Initializes
4436 Syntax:
4438 @example
4439 pragma Initializes (INITIALIZATION_LIST);
4441 INITIALIZATION_LIST ::=
4442      null
4443   | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4445 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4447 INPUT_LIST ::=
4448      null
4449   |  INPUT
4450   | (INPUT @{, INPUT@})
4452 INPUT ::= name
4453 @end example
4455 For the semantics of this pragma, see the entry for aspect @code{Initializes} in the
4456 SPARK 2014 Reference Manual, section 7.1.5.
4458 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4459 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{85}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{86}
4460 @section Pragma Inline_Always
4463 Syntax:
4465 @example
4466 pragma Inline_Always (NAME [, NAME]);
4467 @end example
4469 Similar to pragma @code{Inline} except that inlining is unconditional.
4470 Inline_Always instructs the compiler to inline every direct call to the
4471 subprogram or else to emit a compilation error, independently of any
4472 option, in particular `-gnatn' or `-gnatN' or the optimization level.
4473 It is an error to take the address or access of @code{NAME}. It is also an error to
4474 apply this pragma to a primitive operation of a tagged type. Thanks to such
4475 restrictions, the compiler is allowed to remove the out-of-line body of @code{NAME}.
4477 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4478 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{87}
4479 @section Pragma Inline_Generic
4482 Syntax:
4484 @example
4485 pragma Inline_Generic (GNAME @{, GNAME@});
4487 GNAME ::= generic_unit_NAME | generic_instance_NAME
4488 @end example
4490 This pragma is provided for compatibility with Dec Ada 83. It has
4491 no effect in GNAT (which always inlines generics), other
4492 than to check that the given names are all names of generic units or
4493 generic instances.
4495 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4496 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{88}
4497 @section Pragma Interface
4500 Syntax:
4502 @example
4503 pragma Interface (
4504      [Convention    =>] convention_identifier,
4505      [Entity        =>] local_NAME
4506   [, [External_Name =>] static_string_expression]
4507   [, [Link_Name     =>] static_string_expression]);
4508 @end example
4510 This pragma is identical in syntax and semantics to
4511 the standard Ada pragma @code{Import}.  It is provided for compatibility
4512 with Ada 83.  The definition is upwards compatible both with pragma
4513 @code{Interface} as defined in the Ada 83 Reference Manual, and also
4514 with some extended implementations of this pragma in certain Ada 83
4515 implementations.  The only difference between pragma @code{Interface}
4516 and pragma @code{Import} is that there is special circuitry to allow
4517 both pragmas to appear for the same subprogram entity (normally it
4518 is illegal to have multiple @code{Import} pragmas). This is useful in
4519 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4520 Ada 83 compilers.
4522 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4523 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{89}
4524 @section Pragma Interface_Name
4527 Syntax:
4529 @example
4530 pragma Interface_Name (
4531      [Entity        =>] LOCAL_NAME
4532   [, [External_Name =>] static_string_EXPRESSION]
4533   [, [Link_Name     =>] static_string_EXPRESSION]);
4534 @end example
4536 This pragma provides an alternative way of specifying the interface name
4537 for an interfaced subprogram, and is provided for compatibility with Ada
4538 83 compilers that use the pragma for this purpose.  You must provide at
4539 least one of @code{External_Name} or @code{Link_Name}.
4541 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4542 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{8a}
4543 @section Pragma Interrupt_Handler
4546 Syntax:
4548 @example
4549 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4550 @end example
4552 This program unit pragma is supported for parameterless protected procedures
4553 as described in Annex C of the Ada Reference Manual.
4555 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4556 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{8b}
4557 @section Pragma Interrupt_State
4560 Syntax:
4562 @example
4563 pragma Interrupt_State
4564  ([Name  =>] value,
4565   [State =>] SYSTEM | RUNTIME | USER);
4566 @end example
4568 Normally certain interrupts are reserved to the implementation.  Any attempt
4569 to attach an interrupt causes Program_Error to be raised, as described in
4570 RM C.3.2(22).  A typical example is the @code{SIGINT} interrupt used in
4571 many systems for an @code{Ctrl-C} interrupt.  Normally this interrupt is
4572 reserved to the implementation, so that @code{Ctrl-C} can be used to
4573 interrupt execution.  Additionally, signals such as @code{SIGSEGV},
4574 @code{SIGABRT}, @code{SIGFPE} and @code{SIGILL} are often mapped to specific
4575 Ada exceptions, or used to implement run-time functions such as the
4576 @code{abort} statement and stack overflow checking.
4578 Pragma @code{Interrupt_State} provides a general mechanism for overriding
4579 such uses of interrupts.  It subsumes the functionality of pragma
4580 @code{Unreserve_All_Interrupts}.  Pragma @code{Interrupt_State} is not
4581 available on Windows.  On all other platforms than VxWorks,
4582 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4583 and may be used to mark interrupts required by the board support package
4584 as reserved.
4586 Interrupts can be in one of three states:
4589 @itemize *
4591 @item 
4592 System
4594 The interrupt is reserved (no Ada handler can be installed), and the
4595 Ada run-time may not install a handler. As a result you are guaranteed
4596 standard system default action if this interrupt is raised. This also allows
4597 installing a low level handler via C APIs such as sigaction(), outside
4598 of Ada control.
4600 @item 
4601 Runtime
4603 The interrupt is reserved (no Ada handler can be installed). The run time
4604 is allowed to install a handler for internal control purposes, but is
4605 not required to do so.
4607 @item 
4608 User
4610 The interrupt is unreserved.  The user may install an Ada handler via
4611 Ada.Interrupts and pragma Interrupt_Handler or Attach_Handler to provide
4612 some other action.
4613 @end itemize
4615 These states are the allowed values of the @code{State} parameter of the
4616 pragma.  The @code{Name} parameter is a value of the type
4617 @code{Ada.Interrupts.Interrupt_ID}.  Typically, it is a name declared in
4618 @code{Ada.Interrupts.Names}.
4620 This is a configuration pragma, and the binder will check that there
4621 are no inconsistencies between different units in a partition in how a
4622 given interrupt is specified. It may appear anywhere a pragma is legal.
4624 The effect is to move the interrupt to the specified state.
4626 By declaring interrupts to be SYSTEM, you guarantee the standard system
4627 action, such as a core dump.
4629 By declaring interrupts to be USER, you guarantee that you can install
4630 a handler.
4632 Note that certain signals on many operating systems cannot be caught and
4633 handled by applications.  In such cases, the pragma is ignored.  See the
4634 operating system documentation, or the value of the array @code{Reserved}
4635 declared in the spec of package @code{System.OS_Interface}.
4637 Overriding the default state of signals used by the Ada runtime may interfere
4638 with an application’s runtime behavior in the cases of the synchronous signals,
4639 and in the case of the signal used to implement the @code{abort} statement.
4641 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupt_State,Implementation Defined Pragmas
4642 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{8c}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{8d}
4643 @section Pragma Invariant
4646 Syntax:
4648 @example
4649 pragma Invariant
4650   ([Entity =>]    private_type_LOCAL_NAME,
4651    [Check  =>]    EXPRESSION
4652    [,[Message =>] String_Expression]);
4653 @end example
4655 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4656 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4657 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4658 requires the use of the aspect syntax, which is not available except in 2012
4659 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4660 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4661 note that the aspect Invariant is a synonym in GNAT for the aspect
4662 Type_Invariant, but there is no pragma Type_Invariant.
4664 The pragma must appear within the visible part of the package specification,
4665 after the type to which its Entity argument appears. As with the Invariant
4666 aspect, the Check expression is not analyzed until the end of the visible
4667 part of the package, so it may contain forward references. The Message
4668 argument, if present, provides the exception message used if the invariant
4669 is violated. If no Message parameter is provided, a default message that
4670 identifies the line on which the pragma appears is used.
4672 It is permissible to have multiple Invariants for the same type entity, in
4673 which case they are and’ed together. It is permissible to use this pragma
4674 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4675 invariant pragma for the same entity.
4677 For further details on the use of this pragma, see the Ada 2012 documentation
4678 of the Type_Invariant aspect.
4680 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4681 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{8e}
4682 @section Pragma Keep_Names
4685 Syntax:
4687 @example
4688 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4689 @end example
4691 The @code{LOCAL_NAME} argument
4692 must refer to an enumeration first subtype
4693 in the current declarative part. The effect is to retain the enumeration
4694 literal names for use by @code{Image} and @code{Value} even if a global
4695 @code{Discard_Names} pragma applies. This is useful when you want to
4696 generally suppress enumeration literal names and for example you therefore
4697 use a @code{Discard_Names} pragma in the @code{gnat.adc} file, but you
4698 want to retain the names for specific enumeration types.
4700 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4701 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{8f}
4702 @section Pragma License
4705 @geindex License checking
4707 Syntax:
4709 @example
4710 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4711 @end example
4713 This pragma is provided to allow automated checking for appropriate license
4714 conditions with respect to the standard and modified GPL.  A pragma
4715 @code{License}, which is a configuration pragma that typically appears at
4716 the start of a source file or in a separate @code{gnat.adc} file, specifies
4717 the licensing conditions of a unit as follows:
4720 @itemize *
4722 @item 
4723 Unrestricted
4724 This is used for a unit that can be freely used with no license restrictions.
4725 Examples of such units are public domain units, and units from the Ada
4726 Reference Manual.
4728 @item 
4730 This is used for a unit that is licensed under the unmodified GPL, and which
4731 therefore cannot be @code{with}ed by a restricted unit.
4733 @item 
4734 Modified_GPL
4735 This is used for a unit licensed under the GNAT modified GPL that includes
4736 a special exception paragraph that specifically permits the inclusion of
4737 the unit in programs without requiring the entire program to be released
4738 under the GPL.
4740 @item 
4741 Restricted
4742 This is used for a unit that is restricted in that it is not permitted to
4743 depend on units that are licensed under the GPL.  Typical examples are
4744 proprietary code that is to be released under more restrictive license
4745 conditions.  Note that restricted units are permitted to @code{with} units
4746 which are licensed under the modified GPL (this is the whole point of the
4747 modified GPL).
4748 @end itemize
4750 Normally a unit with no @code{License} pragma is considered to have an
4751 unknown license, and no checking is done.  However, standard GNAT headers
4752 are recognized, and license information is derived from them as follows.
4754 A GNAT license header starts with a line containing 78 hyphens.  The following
4755 comment text is searched for the appearance of any of the following strings.
4757 If the string ‘GNU General Public License’ is found, then the unit is assumed
4758 to have GPL license, unless the string ‘As a special exception’ follows, in
4759 which case the license is assumed to be modified GPL.
4761 If one of the strings
4762 ‘This specification is adapted from the Ada Semantic Interface’ or
4763 ‘This specification is derived from the Ada Reference Manual’ is found
4764 then the unit is assumed to be unrestricted.
4766 These default actions means that a program with a restricted license pragma
4767 will automatically get warnings if a GPL unit is inappropriately
4768 @code{with}ed.  For example, the program:
4770 @example
4771 with Sem_Ch3;
4772 with GNAT.Sockets;
4773 procedure Secret_Stuff is
4774   ...
4775 end Secret_Stuff
4776 @end example
4778 if compiled with pragma @code{License} (@code{Restricted}) in a
4779 @code{gnat.adc} file will generate the warning:
4781 @example
4782 1.  with Sem_Ch3;
4783         |
4784    >>> license of withed unit "Sem_Ch3" is incompatible
4786 2.  with GNAT.Sockets;
4787 3.  procedure Secret_Stuff is
4788 @end example
4790 Here we get a warning on @code{Sem_Ch3} since it is part of the GNAT
4791 compiler and is licensed under the
4792 GPL, but no warning for @code{GNAT.Sockets} which is part of the GNAT
4793 run time, and is therefore licensed under the modified GPL.
4795 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4796 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{90}
4797 @section Pragma Link_With
4800 Syntax:
4802 @example
4803 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4804 @end example
4806 This pragma is provided for compatibility with certain Ada 83 compilers.
4807 It has exactly the same effect as pragma @code{Linker_Options} except
4808 that spaces occurring within one of the string expressions are treated
4809 as separators. For example, in the following case:
4811 @example
4812 pragma Link_With ("-labc -ldef");
4813 @end example
4815 results in passing the strings @code{-labc} and @code{-ldef} as two
4816 separate arguments to the linker. In addition pragma Link_With allows
4817 multiple arguments, with the same effect as successive pragmas.
4819 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4820 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{91}
4821 @section Pragma Linker_Alias
4824 Syntax:
4826 @example
4827 pragma Linker_Alias (
4828   [Entity =>] LOCAL_NAME,
4829   [Target =>] static_string_EXPRESSION);
4830 @end example
4832 @code{LOCAL_NAME} must refer to an object that is declared at the library
4833 level. This pragma establishes the given entity as a linker alias for the
4834 given target. It is equivalent to @code{__attribute__((alias))} in GNU C
4835 and causes @code{LOCAL_NAME} to be emitted as an alias for the symbol
4836 @code{static_string_EXPRESSION} in the object file, that is to say no space
4837 is reserved for @code{LOCAL_NAME} by the assembler and it will be resolved
4838 to the same address as @code{static_string_EXPRESSION} by the linker.
4840 The actual linker name for the target must be used (e.g., the fully
4841 encoded name with qualification in Ada, or the mangled name in C++),
4842 or it must be declared using the C convention with @code{pragma Import}
4843 or @code{pragma Export}.
4845 Not all target machines support this pragma. On some of them it is accepted
4846 only if @code{pragma Weak_External} has been applied to @code{LOCAL_NAME}.
4848 @example
4849 --  Example of the use of pragma Linker_Alias
4851 package p is
4852   i : Integer := 1;
4853   pragma Export (C, i);
4855   new_name_for_i : Integer;
4856   pragma Linker_Alias (new_name_for_i, "i");
4857 end p;
4858 @end example
4860 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4861 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{92}
4862 @section Pragma Linker_Constructor
4865 Syntax:
4867 @example
4868 pragma Linker_Constructor (procedure_LOCAL_NAME);
4869 @end example
4871 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4872 is declared at the library level. A procedure to which this pragma is
4873 applied will be treated as an initialization routine by the linker.
4874 It is equivalent to @code{__attribute__((constructor))} in GNU C and
4875 causes @code{procedure_LOCAL_NAME} to be invoked before the entry point
4876 of the executable is called (or immediately after the shared library is
4877 loaded if the procedure is linked in a shared library), in particular
4878 before the Ada run-time environment is set up.
4880 Because of these specific contexts, the set of operations such a procedure
4881 can perform is very limited and the type of objects it can manipulate is
4882 essentially restricted to the elementary types. In particular, it must only
4883 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
4885 This pragma is used by GNAT to implement auto-initialization of shared Stand
4886 Alone Libraries, which provides a related capability without the restrictions
4887 listed above. Where possible, the use of Stand Alone Libraries is preferable
4888 to the use of this pragma.
4890 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
4891 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{93}
4892 @section Pragma Linker_Destructor
4895 Syntax:
4897 @example
4898 pragma Linker_Destructor (procedure_LOCAL_NAME);
4899 @end example
4901 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4902 is declared at the library level. A procedure to which this pragma is
4903 applied will be treated as a finalization routine by the linker.
4904 It is equivalent to @code{__attribute__((destructor))} in GNU C and
4905 causes @code{procedure_LOCAL_NAME} to be invoked after the entry point
4906 of the executable has exited (or immediately before the shared library
4907 is unloaded if the procedure is linked in a shared library), in particular
4908 after the Ada run-time environment is shut down.
4910 See @code{pragma Linker_Constructor} for the set of restrictions that apply
4911 because of these specific contexts.
4913 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
4914 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{94}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{95}
4915 @section Pragma Linker_Section
4918 Syntax:
4920 @example
4921 pragma Linker_Section (
4922   [Entity  =>] LOCAL_NAME,
4923   [Section =>] static_string_EXPRESSION);
4924 @end example
4926 @code{LOCAL_NAME} must refer to an object, type, or subprogram that is
4927 declared at the library level. This pragma specifies the name of the
4928 linker section for the given entity. It is equivalent to
4929 @code{__attribute__((section))} in GNU C and causes @code{LOCAL_NAME} to
4930 be placed in the @code{static_string_EXPRESSION} section of the
4931 executable (assuming the linker doesn’t rename the section).
4932 GNAT also provides an implementation defined aspect of the same name.
4934 In the case of specifying this aspect for a type, the effect is to
4935 specify the corresponding section for all library-level objects of
4936 the type that do not have an explicit linker section set. Note that
4937 this only applies to whole objects, not to components of composite objects.
4939 In the case of a subprogram, the linker section applies to all previously
4940 declared matching overloaded subprograms in the current declarative part
4941 which do not already have a linker section assigned. The linker section
4942 aspect is useful in this case for specifying different linker sections
4943 for different elements of such an overloaded set.
4945 Note that an empty string specifies that no linker section is specified.
4946 This is not quite the same as omitting the pragma or aspect, since it
4947 can be used to specify that one element of an overloaded set of subprograms
4948 has the default linker section, or that one object of a type for which a
4949 linker section is specified should has the default linker section.
4951 The compiler normally places library-level entities in standard sections
4952 depending on the class: procedures and functions generally go in the
4953 @code{.text} section, initialized variables in the @code{.data} section
4954 and uninitialized variables in the @code{.bss} section.
4956 Other, special sections may exist on given target machines to map special
4957 hardware, for example I/O ports or flash memory. This pragma is a means to
4958 defer the final layout of the executable to the linker, thus fully working
4959 at the symbolic level with the compiler.
4961 Some file formats do not support arbitrary sections so not all target
4962 machines support this pragma. The use of this pragma may cause a program
4963 execution to be erroneous if it is used to place an entity into an
4964 inappropriate section (e.g., a modified variable into the @code{.text}
4965 section). See also @code{pragma Persistent_BSS}.
4967 @example
4968 --  Example of the use of pragma Linker_Section
4970 package IO_Card is
4971   Port_A : Integer;
4972   pragma Volatile (Port_A);
4973   pragma Linker_Section (Port_A, ".bss.port_a");
4975   Port_B : Integer;
4976   pragma Volatile (Port_B);
4977   pragma Linker_Section (Port_B, ".bss.port_b");
4979   type Port_Type is new Integer with Linker_Section => ".bss";
4980   PA : Port_Type with Linker_Section => ".bss.PA";
4981   PB : Port_Type; --  ends up in linker section ".bss"
4983   procedure Q with Linker_Section => "Qsection";
4984 end IO_Card;
4985 @end example
4987 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
4988 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{96}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{97}
4989 @section Pragma Lock_Free
4992 Syntax:
4993 This pragma may be specified for protected types or objects. It specifies that
4994 the implementation of protected operations must be implemented without locks.
4995 Compilation fails if the compiler cannot generate lock-free code for the
4996 operations.
4998 The current conditions required to support this pragma are:
5001 @itemize *
5003 @item 
5004 Protected type declarations may not contain entries
5006 @item 
5007 Protected subprogram declarations may not have nonelementary parameters
5008 @end itemize
5010 In addition, each protected subprogram body must satisfy:
5013 @itemize *
5015 @item 
5016 May reference only one protected component
5018 @item 
5019 May not reference nonconstant entities outside the protected subprogram
5020 scope
5022 @item 
5023 May not contain address representation items, allocators, or quantified
5024 expressions
5026 @item 
5027 May not contain delay, goto, loop, or procedure-call statements
5029 @item 
5030 May not contain exported and imported entities
5032 @item 
5033 May not dereferenced access values
5035 @item 
5036 Function calls and attribute references must be static
5037 @end itemize
5039 If the Lock_Free aspect is specified to be True for a protected unit
5040 and the Ceiling_Locking locking policy is in effect, then the run-time
5041 actions associated with the Ceiling_Locking locking policy (described in
5042 Ada RM D.3) are not performed when a protected operation of the protected
5043 unit is executed.
5045 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
5046 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{98}
5047 @section Pragma Loop_Invariant
5050 Syntax:
5052 @example
5053 pragma Loop_Invariant ( boolean_EXPRESSION );
5054 @end example
5056 The effect of this pragma is similar to that of pragma @code{Assert},
5057 except that in an @code{Assertion_Policy} pragma, the identifier
5058 @code{Loop_Invariant} is used to control whether it is ignored or checked
5059 (or disabled).
5061 @code{Loop_Invariant} can only appear as one of the items in the sequence
5062 of statements of a loop body, or nested inside block statements that
5063 appear in the sequence of statements of a loop body.
5064 The intention is that it be used to
5065 represent a “loop invariant” assertion, i.e. something that is true each
5066 time through the loop, and which can be used to show that the loop is
5067 achieving its purpose.
5069 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5070 apply to the same loop should be grouped in the same sequence of
5071 statements.
5073 To aid in writing such invariants, the special attribute @code{Loop_Entry}
5074 may be used to refer to the value of an expression on entry to the loop. This
5075 attribute can only be used within the expression of a @code{Loop_Invariant}
5076 pragma. For full details, see documentation of attribute @code{Loop_Entry}.
5078 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
5079 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{99}
5080 @section Pragma Loop_Optimize
5083 Syntax:
5085 @example
5086 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
5088 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
5089 @end example
5091 This pragma must appear immediately within a loop statement.  It allows the
5092 programmer to specify optimization hints for the enclosing loop.  The hints
5093 are not mutually exclusive and can be freely mixed, but not all combinations
5094 will yield a sensible outcome.
5096 There are five supported optimization hints for a loop:
5099 @itemize *
5101 @item 
5102 Ivdep
5104 The programmer asserts that there are no loop-carried dependencies
5105 which would prevent consecutive iterations of the loop from being
5106 executed simultaneously.
5108 @item 
5109 No_Unroll
5111 The loop must not be unrolled.  This is a strong hint: the compiler will not
5112 unroll a loop marked with this hint.
5114 @item 
5115 Unroll
5117 The loop should be unrolled.  This is a weak hint: the compiler will try to
5118 apply unrolling to this loop preferably to other optimizations, notably
5119 vectorization, but there is no guarantee that the loop will be unrolled.
5121 @item 
5122 No_Vector
5124 The loop must not be vectorized.  This is a strong hint: the compiler will not
5125 vectorize a loop marked with this hint.
5127 @item 
5128 Vector
5130 The loop should be vectorized.  This is a weak hint: the compiler will try to
5131 apply vectorization to this loop preferably to other optimizations, notably
5132 unrolling, but there is no guarantee that the loop will be vectorized.
5133 @end itemize
5135 These hints do not remove the need to pass the appropriate switches to the
5136 compiler in order to enable the relevant optimizations, that is to say
5137 `-funroll-loops' for unrolling and `-ftree-vectorize' for
5138 vectorization.
5140 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
5141 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{9a}
5142 @section Pragma Loop_Variant
5145 Syntax:
5147 @example
5148 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
5149 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
5150 CHANGE_DIRECTION ::= Increases | Decreases
5151 @end example
5153 @code{Loop_Variant} can only appear as one of the items in the sequence
5154 of statements of a loop body, or nested inside block statements that
5155 appear in the sequence of statements of a loop body.
5156 It allows the specification of quantities which must always
5157 decrease or increase in successive iterations of the loop. In its simplest
5158 form, just one expression is specified, whose value must increase or decrease
5159 on each iteration of the loop.
5161 In a more complex form, multiple arguments can be given which are interpreted
5162 in a nesting lexicographic manner. For example:
5164 @example
5165 pragma Loop_Variant (Increases => X, Decreases => Y);
5166 @end example
5168 specifies that each time through the loop either X increases, or X stays
5169 the same and Y decreases. A @code{Loop_Variant} pragma ensures that the
5170 loop is making progress. It can be useful in helping to show informally
5171 or prove formally that the loop always terminates.
5173 @code{Loop_Variant} is an assertion whose effect can be controlled using
5174 an @code{Assertion_Policy} with a check name of @code{Loop_Variant}. The
5175 policy can be @code{Check} to enable the loop variant check, @code{Ignore}
5176 to ignore the check (in which case the pragma has no effect on the program),
5177 or @code{Disable} in which case the pragma is not even checked for correct
5178 syntax.
5180 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5181 apply to the same loop should be grouped in the same sequence of
5182 statements.
5184 The @code{Loop_Entry} attribute may be used within the expressions of the
5185 @code{Loop_Variant} pragma to refer to values on entry to the loop.
5187 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
5188 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{9b}
5189 @section Pragma Machine_Attribute
5192 Syntax:
5194 @example
5195 pragma Machine_Attribute (
5196      [Entity         =>] LOCAL_NAME,
5197      [Attribute_Name =>] static_string_EXPRESSION
5198   [, [Info           =>] static_EXPRESSION @{, static_EXPRESSION@}] );
5199 @end example
5201 Machine-dependent attributes can be specified for types and/or
5202 declarations.  This pragma is semantically equivalent to
5203 @code{__attribute__((@var{attribute_name}))} (if @code{info} is not
5204 specified) or @code{__attribute__((@var{attribute_name(info})))}
5205 or @code{__attribute__((@var{attribute_name(info,...})))} in GNU C,
5206 where `attribute_name' is recognized by the compiler middle-end
5207 or the @code{TARGET_ATTRIBUTE_TABLE} machine specific macro.  Note
5208 that a string literal for the optional parameter @code{info} or the
5209 following ones is transformed by default into an identifier,
5210 which may make this pragma unusable for some attributes.
5211 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
5213 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
5214 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{9c}
5215 @section Pragma Main
5218 Syntax:
5220 @example
5221 pragma Main
5222  (MAIN_OPTION [, MAIN_OPTION]);
5224 MAIN_OPTION ::=
5225   [Stack_Size              =>] static_integer_EXPRESSION
5226 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
5227 | [Time_Slicing_Enabled    =>] static_boolean_EXPRESSION
5228 @end example
5230 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
5231 no effect in GNAT, other than being syntax checked.
5233 @node Pragma Main_Storage,Pragma Max_Queue_Length,Pragma Main,Implementation Defined Pragmas
5234 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{9d}
5235 @section Pragma Main_Storage
5238 Syntax:
5240 @example
5241 pragma Main_Storage
5242   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
5244 MAIN_STORAGE_OPTION ::=
5245   [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
5246 | [TOP_GUARD       =>] static_SIMPLE_EXPRESSION
5247 @end example
5249 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
5250 no effect in GNAT, other than being syntax checked.
5252 @node Pragma Max_Queue_Length,Pragma No_Body,Pragma Main_Storage,Implementation Defined Pragmas
5253 @anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{9e}@anchor{gnat_rm/implementation_defined_pragmas pragma-max-queue-length}@anchor{9f}
5254 @section Pragma Max_Queue_Length
5257 Syntax:
5259 @example
5260 pragma Max_Entry_Queue (static_integer_EXPRESSION);
5261 @end example
5263 This pragma is used to specify the maximum callers per entry queue for
5264 individual protected entries and entry families. It accepts a single
5265 integer (-1 or more) as a parameter and must appear after the declaration of an
5266 entry.
5268 A value of -1 represents no additional restriction on queue length.
5270 @node Pragma No_Body,Pragma No_Caching,Pragma Max_Queue_Length,Implementation Defined Pragmas
5271 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{a0}
5272 @section Pragma No_Body
5275 Syntax:
5277 @example
5278 pragma No_Body;
5279 @end example
5281 There are a number of cases in which a package spec does not require a body,
5282 and in fact a body is not permitted. GNAT will not permit the spec to be
5283 compiled if there is a body around. The pragma No_Body allows you to provide
5284 a body file, even in a case where no body is allowed. The body file must
5285 contain only comments and a single No_Body pragma. This is recognized by
5286 the compiler as indicating that no body is logically present.
5288 This is particularly useful during maintenance when a package is modified in
5289 such a way that a body needed before is no longer needed. The provision of a
5290 dummy body with a No_Body pragma ensures that there is no interference from
5291 earlier versions of the package body.
5293 @node Pragma No_Caching,Pragma No_Component_Reordering,Pragma No_Body,Implementation Defined Pragmas
5294 @anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a1}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-caching}@anchor{a2}
5295 @section Pragma No_Caching
5298 Syntax:
5300 @example
5301 pragma No_Caching [ (static_boolean_EXPRESSION) ];
5302 @end example
5304 For the semantics of this pragma, see the entry for aspect @code{No_Caching} in
5305 the SPARK 2014 Reference Manual, section 7.1.2.
5307 @node Pragma No_Component_Reordering,Pragma No_Elaboration_Code_All,Pragma No_Caching,Implementation Defined Pragmas
5308 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-component-reordering}@anchor{a3}
5309 @section Pragma No_Component_Reordering
5312 Syntax:
5314 @example
5315 pragma No_Component_Reordering [([Entity =>] type_LOCAL_NAME)];
5316 @end example
5318 @code{type_LOCAL_NAME} must refer to a record type declaration in the current
5319 declarative part. The effect is to preclude any reordering of components
5320 for the layout of the record, i.e. the record is laid out by the compiler
5321 in the order in which the components are declared textually. The form with
5322 no argument is a configuration pragma which applies to all record types
5323 declared in units to which the pragma applies and there is a requirement
5324 that this pragma be used consistently within a partition.
5326 @node Pragma No_Elaboration_Code_All,Pragma No_Heap_Finalization,Pragma No_Component_Reordering,Implementation Defined Pragmas
5327 @anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{a4}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{a5}
5328 @section Pragma No_Elaboration_Code_All
5331 Syntax:
5333 @example
5334 pragma No_Elaboration_Code_All [(program_unit_NAME)];
5335 @end example
5337 This is a program unit pragma (there is also an equivalent aspect of the
5338 same name) that establishes the restriction @code{No_Elaboration_Code} for
5339 the current unit and any extended main source units (body and subunits).
5340 It also has the effect of enforcing a transitive application of this
5341 aspect, so that if any unit is implicitly or explicitly with’ed by the
5342 current unit, it must also have the No_Elaboration_Code_All aspect set.
5343 It may be applied to package or subprogram specs or their generic versions.
5345 @node Pragma No_Heap_Finalization,Pragma No_Inline,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5346 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-heap-finalization}@anchor{a6}
5347 @section Pragma No_Heap_Finalization
5350 Syntax:
5352 @example
5353 pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ];
5354 @end example
5356 Pragma @code{No_Heap_Finalization} may be used as a configuration pragma or as a
5357 type-specific pragma.
5359 In its configuration form, the pragma must appear within a configuration file
5360 such as gnat.adc, without an argument. The pragma suppresses the call to
5361 @code{Finalize} for heap-allocated objects created through library-level named
5362 access-to-object types in cases where the designated type requires finalization
5363 actions.
5365 In its type-specific form, the argument of the pragma must denote a
5366 library-level named access-to-object type. The pragma suppresses the call to
5367 @code{Finalize} for heap-allocated objects created through the specific access type
5368 in cases where the designated type requires finalization actions.
5370 It is still possible to finalize such heap-allocated objects by explicitly
5371 deallocating them.
5373 A library-level named access-to-object type declared within a generic unit will
5374 lose its @code{No_Heap_Finalization} pragma when the corresponding instance does not
5375 appear at the library level.
5377 @node Pragma No_Inline,Pragma No_Return,Pragma No_Heap_Finalization,Implementation Defined Pragmas
5378 @anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{a7}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{a8}
5379 @section Pragma No_Inline
5382 Syntax:
5384 @example
5385 pragma No_Inline (NAME @{, NAME@});
5386 @end example
5388 This pragma suppresses inlining for the callable entity or the instances of
5389 the generic subprogram designated by @code{NAME}, including inlining that
5390 results from the use of pragma @code{Inline}.  This pragma is always active,
5391 in particular it is not subject to the use of option `-gnatn' or
5392 `-gnatN'.  It is illegal to specify both pragma @code{No_Inline} and
5393 pragma @code{Inline_Always} for the same @code{NAME}.
5395 @node Pragma No_Return,Pragma No_Strict_Aliasing,Pragma No_Inline,Implementation Defined Pragmas
5396 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{a9}
5397 @section Pragma No_Return
5400 Syntax:
5402 @example
5403 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5404 @end example
5406 Each @code{procedure_LOCAL_NAME} argument must refer to one or more procedure
5407 declarations in the current declarative part.  A procedure to which this
5408 pragma is applied may not contain any explicit @code{return} statements.
5409 In addition, if the procedure contains any implicit returns from falling
5410 off the end of a statement sequence, then execution of that implicit
5411 return will cause Program_Error to be raised.
5413 One use of this pragma is to identify procedures whose only purpose is to raise
5414 an exception. Another use of this pragma is to suppress incorrect warnings
5415 about missing returns in functions, where the last statement of a function
5416 statement sequence is a call to such a procedure.
5418 Note that in Ada 2005 mode, this pragma is part of the language. It is
5419 available in all earlier versions of Ada as an implementation-defined
5420 pragma.
5422 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Return,Implementation Defined Pragmas
5423 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{aa}
5424 @section Pragma No_Strict_Aliasing
5427 Syntax:
5429 @example
5430 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5431 @end example
5433 @code{type_LOCAL_NAME} must refer to an access type
5434 declaration in the current declarative part.  The effect is to inhibit
5435 strict aliasing optimization for the given type.  The form with no
5436 arguments is a configuration pragma which applies to all access types
5437 declared in units to which the pragma applies. For a detailed
5438 description of the strict aliasing optimization, and the situations
5439 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5440 in the @cite{GNAT User’s Guide}.
5442 This pragma currently has no effects on access to unconstrained array types.
5444 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5445 @anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{ab}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{ac}
5446 @section Pragma No_Tagged_Streams
5449 Syntax:
5451 @example
5452 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5453 @end example
5455 Normally when a tagged type is introduced using a full type declaration,
5456 part of the processing includes generating stream access routines to be
5457 used by stream attributes referencing the type (or one of its subtypes
5458 or derived types). This can involve the generation of significant amounts
5459 of code which is wasted space if stream routines are not needed for the
5460 type in question.
5462 The @code{No_Tagged_Streams} pragma causes the generation of these stream
5463 routines to be skipped, and any attempt to use stream operations on
5464 types subject to this pragma will be statically rejected as illegal.
5466 There are two forms of the pragma. The form with no arguments must appear
5467 in a declarative sequence or in the declarations of a package spec. This
5468 pragma affects all subsequent root tagged types declared in the declaration
5469 sequence, and specifies that no stream routines be generated. The form with
5470 an argument (for which there is also a corresponding aspect) specifies a
5471 single root tagged type for which stream routines are not to be generated.
5473 Once the pragma has been given for a particular root tagged type, all subtypes
5474 and derived types of this type inherit the pragma automatically, so the effect
5475 applies to a complete hierarchy (this is necessary to deal with the class-wide
5476 dispatching versions of the stream routines).
5478 When pragmas @code{Discard_Names} and @code{No_Tagged_Streams} are simultaneously
5479 applied to a tagged type its Expanded_Name and External_Tag are initialized
5480 with empty strings. This is useful to avoid exposing entity names at binary
5481 level but has a negative impact on the debuggability of tagged types.
5483 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5484 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{ad}
5485 @section Pragma Normalize_Scalars
5488 Syntax:
5490 @example
5491 pragma Normalize_Scalars;
5492 @end example
5494 This is a language defined pragma which is fully implemented in GNAT.  The
5495 effect is to cause all scalar objects that are not otherwise initialized
5496 to be initialized.  The initial values are implementation dependent and
5497 are as follows:
5500 @table @asis
5502 @item `Standard.Character'
5504 Objects whose root type is Standard.Character are initialized to
5505 Character’Last unless the subtype range excludes NUL (in which case
5506 NUL is used). This choice will always generate an invalid value if
5507 one exists.
5509 @item `Standard.Wide_Character'
5511 Objects whose root type is Standard.Wide_Character are initialized to
5512 Wide_Character’Last unless the subtype range excludes NUL (in which case
5513 NUL is used). This choice will always generate an invalid value if
5514 one exists.
5516 @item `Standard.Wide_Wide_Character'
5518 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5519 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5520 which case NUL is used). This choice will always generate an invalid value if
5521 one exists.
5523 @item `Integer types'
5525 Objects of an integer type are treated differently depending on whether
5526 negative values are present in the subtype. If no negative values are
5527 present, then all one bits is used as the initial value except in the
5528 special case where zero is excluded from the subtype, in which case
5529 all zero bits are used. This choice will always generate an invalid
5530 value if one exists.
5532 For subtypes with negative values present, the largest negative number
5533 is used, except in the unusual case where this largest negative number
5534 is in the subtype, and the largest positive number is not, in which case
5535 the largest positive value is used. This choice will always generate
5536 an invalid value if one exists.
5538 @item `Floating-Point Types'
5540 Objects of all floating-point types are initialized to all 1-bits. For
5541 standard IEEE format, this corresponds to a NaN (not a number) which is
5542 indeed an invalid value.
5544 @item `Fixed-Point Types'
5546 Objects of all fixed-point types are treated as described above for integers,
5547 with the rules applying to the underlying integer value used to represent
5548 the fixed-point value.
5550 @item `Modular types'
5552 Objects of a modular type are initialized to all one bits, except in
5553 the special case where zero is excluded from the subtype, in which
5554 case all zero bits are used. This choice will always generate an
5555 invalid value if one exists.
5557 @item `Enumeration types'
5559 Objects of an enumeration type are initialized to all one-bits, i.e., to
5560 the value @code{2 ** typ'Size - 1} unless the subtype excludes the literal
5561 whose Pos value is zero, in which case a code of zero is used. This choice
5562 will always generate an invalid value if one exists.
5563 @end table
5565 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5566 @anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{ae}@anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{af}
5567 @section Pragma Obsolescent
5570 Syntax:
5572 @example
5573 pragma Obsolescent;
5575 pragma Obsolescent (
5576   [Message =>] static_string_EXPRESSION
5577 [,[Version =>] Ada_05]);
5579 pragma Obsolescent (
5580   [Entity  =>] NAME
5581 [,[Message =>] static_string_EXPRESSION
5582 [,[Version =>] Ada_05]]);
5583 @end example
5585 This pragma can occur immediately following a declaration of an entity,
5586 including the case of a record component. If no Entity argument is present,
5587 then this declaration is the one to which the pragma applies. If an Entity
5588 parameter is present, it must either match the name of the entity in this
5589 declaration, or alternatively, the pragma can immediately follow an enumeration
5590 type declaration, where the Entity argument names one of the enumeration
5591 literals.
5593 This pragma is used to indicate that the named entity
5594 is considered obsolescent and should not be used. Typically this is
5595 used when an API must be modified by eventually removing or modifying
5596 existing subprograms or other entities. The pragma can be used at an
5597 intermediate stage when the entity is still present, but will be
5598 removed later.
5600 The effect of this pragma is to output a warning message on a reference to
5601 an entity thus marked that the subprogram is obsolescent if the appropriate
5602 warning option in the compiler is activated. If the @code{Message} parameter is
5603 present, then a second warning message is given containing this text. In
5604 addition, a reference to the entity is considered to be a violation of pragma
5605 @code{Restrictions (No_Obsolescent_Features)}.
5607 This pragma can also be used as a program unit pragma for a package,
5608 in which case the entity name is the name of the package, and the
5609 pragma indicates that the entire package is considered
5610 obsolescent. In this case a client @code{with}ing such a package
5611 violates the restriction, and the @code{with} clause is
5612 flagged with warnings if the warning option is set.
5614 If the @code{Version} parameter is present (which must be exactly
5615 the identifier @code{Ada_05}, no other argument is allowed), then the
5616 indication of obsolescence applies only when compiling in Ada 2005
5617 mode. This is primarily intended for dealing with the situations
5618 in the predefined library where subprograms or packages
5619 have become defined as obsolescent in Ada 2005
5620 (e.g., in @code{Ada.Characters.Handling}), but may be used anywhere.
5622 The following examples show typical uses of this pragma:
5624 @example
5625 package p is
5626    pragma Obsolescent (p, Message => "use pp instead of p");
5627 end p;
5629 package q is
5630    procedure q2;
5631    pragma Obsolescent ("use q2new instead");
5633    type R is new integer;
5634    pragma Obsolescent
5635      (Entity  => R,
5636       Message => "use RR in Ada 2005",
5637       Version => Ada_05);
5639    type M is record
5640       F1 : Integer;
5641       F2 : Integer;
5642       pragma Obsolescent;
5643       F3 : Integer;
5644    end record;
5646    type E is (a, bc, 'd', quack);
5647    pragma Obsolescent (Entity => bc)
5648    pragma Obsolescent (Entity => 'd')
5650    function "+"
5651      (a, b : character) return character;
5652    pragma Obsolescent (Entity => "+");
5653 end;
5654 @end example
5656 Note that, as for all pragmas, if you use a pragma argument identifier,
5657 then all subsequent parameters must also use a pragma argument identifier.
5658 So if you specify @code{Entity =>} for the @code{Entity} argument, and a @code{Message}
5659 argument is present, it must be preceded by @code{Message =>}.
5661 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5662 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{b0}
5663 @section Pragma Optimize_Alignment
5666 @geindex Alignment
5667 @geindex default settings
5669 Syntax:
5671 @example
5672 pragma Optimize_Alignment (TIME | SPACE | OFF);
5673 @end example
5675 This is a configuration pragma which affects the choice of default alignments
5676 for types and objects where no alignment is explicitly specified. There is a
5677 time/space trade-off in the selection of these values. Large alignments result
5678 in more efficient code, at the expense of larger data space, since sizes have
5679 to be increased to match these alignments. Smaller alignments save space, but
5680 the access code is slower. The normal choice of default alignments for types
5681 and individual alignment promotions for objects (which is what you get if you
5682 do not use this pragma, or if you use an argument of OFF), tries to balance
5683 these two requirements.
5685 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5686 First any packed record is given an alignment of 1. Second, if a size is given
5687 for the type, then the alignment is chosen to avoid increasing this size. For
5688 example, consider:
5690 @example
5691 type R is record
5692    X : Integer;
5693    Y : Character;
5694 end record;
5696 for R'Size use 5*8;
5697 @end example
5699 In the default mode, this type gets an alignment of 4, so that access to the
5700 Integer field X are efficient. But this means that objects of the type end up
5701 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5702 allowed to be bigger than the size of the type, but it can waste space if for
5703 example fields of type R appear in an enclosing record. If the above type is
5704 compiled in @code{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5706 However, there is one case in which SPACE is ignored. If a variable length
5707 record (that is a discriminated record with a component which is an array
5708 whose length depends on a discriminant), has a pragma Pack, then it is not
5709 in general possible to set the alignment of such a record to one, so the
5710 pragma is ignored in this case (with a warning).
5712 Specifying SPACE also disables alignment promotions for standalone objects,
5713 which occur when the compiler increases the alignment of a specific object
5714 without changing the alignment of its type.
5716 Specifying SPACE also disables component reordering in unpacked record types,
5717 which can result in larger sizes in order to meet alignment requirements.
5719 Specifying TIME causes larger default alignments to be chosen in the case of
5720 small types with sizes that are not a power of 2. For example, consider:
5722 @example
5723 type R is record
5724    A : Character;
5725    B : Character;
5726    C : Boolean;
5727 end record;
5729 pragma Pack (R);
5730 for R'Size use 17;
5731 @end example
5733 The default alignment for this record is normally 1, but if this type is
5734 compiled in @code{Optimize_Alignment (Time)} mode, then the alignment is set
5735 to 4, which wastes space for objects of the type, since they are now 4 bytes
5736 long, but results in more efficient access when the whole record is referenced.
5738 As noted above, this is a configuration pragma, and there is a requirement
5739 that all units in a partition be compiled with a consistent setting of the
5740 optimization setting. This would normally be achieved by use of a configuration
5741 pragma file containing the appropriate setting. The exception to this rule is
5742 that units with an explicit configuration pragma in the same file as the source
5743 unit are excluded from the consistency check, as are all predefined units. The
5744 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5745 pragma appears at the start of the file.
5747 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5748 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{b1}
5749 @section Pragma Ordered
5752 Syntax:
5754 @example
5755 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5756 @end example
5758 Most enumeration types are from a conceptual point of view unordered.
5759 For example, consider:
5761 @example
5762 type Color is (Red, Blue, Green, Yellow);
5763 @end example
5765 By Ada semantics @code{Blue > Red} and @code{Green > Blue},
5766 but really these relations make no sense; the enumeration type merely
5767 specifies a set of possible colors, and the order is unimportant.
5769 For unordered enumeration types, it is generally a good idea if
5770 clients avoid comparisons (other than equality or inequality) and
5771 explicit ranges. (A `client' is a unit where the type is referenced,
5772 other than the unit where the type is declared, its body, and its subunits.)
5773 For example, if code buried in some client says:
5775 @example
5776 if Current_Color < Yellow then ...
5777 if Current_Color in Blue .. Green then ...
5778 @end example
5780 then the client code is relying on the order, which is undesirable.
5781 It makes the code hard to read and creates maintenance difficulties if
5782 entries have to be added to the enumeration type. Instead,
5783 the code in the client should list the possibilities, or an
5784 appropriate subtype should be declared in the unit that declares
5785 the original enumeration type. E.g., the following subtype could
5786 be declared along with the type @code{Color}:
5788 @example
5789 subtype RBG is Color range Red .. Green;
5790 @end example
5792 and then the client could write:
5794 @example
5795 if Current_Color in RBG then ...
5796 if Current_Color = Blue or Current_Color = Green then ...
5797 @end example
5799 However, some enumeration types are legitimately ordered from a conceptual
5800 point of view. For example, if you declare:
5802 @example
5803 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5804 @end example
5806 then the ordering imposed by the language is reasonable, and
5807 clients can depend on it, writing for example:
5809 @example
5810 if D in Mon .. Fri then ...
5811 if D < Wed then ...
5812 @end example
5814 The pragma `Ordered' is provided to mark enumeration types that
5815 are conceptually ordered, alerting the reader that clients may depend
5816 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5817 rather than one to mark them as unordered, since in our experience,
5818 the great majority of enumeration types are conceptually unordered.
5820 The types @code{Boolean}, @code{Character}, @code{Wide_Character},
5821 and @code{Wide_Wide_Character}
5822 are considered to be ordered types, so each is declared with a
5823 pragma @code{Ordered} in package @code{Standard}.
5825 Normally pragma @code{Ordered} serves only as documentation and a guide for
5826 coding standards, but GNAT provides a warning switch `-gnatw.u' that
5827 requests warnings for inappropriate uses (comparisons and explicit
5828 subranges) for unordered types. If this switch is used, then any
5829 enumeration type not marked with pragma @code{Ordered} will be considered
5830 as unordered, and will generate warnings for inappropriate uses.
5832 Note that generic types are not considered ordered or unordered (since the
5833 template can be instantiated for both cases), so we never generate warnings
5834 for the case of generic enumerated types.
5836 For additional information please refer to the description of the
5837 `-gnatw.u' switch in the GNAT User’s Guide.
5839 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5840 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{b2}
5841 @section Pragma Overflow_Mode
5844 Syntax:
5846 @example
5847 pragma Overflow_Mode
5848  (  [General    =>] MODE
5849   [,[Assertions =>] MODE]);
5851 MODE ::= STRICT | MINIMIZED | ELIMINATED
5852 @end example
5854 This pragma sets the current overflow mode to the given setting. For details
5855 of the meaning of these modes, please refer to the
5856 ‘Overflow Check Handling in GNAT’ appendix in the
5857 GNAT User’s Guide. If only the @code{General} parameter is present,
5858 the given mode applies to all expressions. If both parameters are present,
5859 the @code{General} mode applies to expressions outside assertions, and
5860 the @code{Eliminated} mode applies to expressions within assertions.
5862 The case of the @code{MODE} parameter is ignored,
5863 so @code{MINIMIZED}, @code{Minimized} and
5864 @code{minimized} all have the same effect.
5866 The @code{Overflow_Mode} pragma has the same scoping and placement
5867 rules as pragma @code{Suppress}, so it can occur either as a
5868 configuration pragma, specifying a default for the whole
5869 program, or in a declarative scope, where it applies to the
5870 remaining declarations and statements in that scope.
5872 The pragma @code{Suppress (Overflow_Check)} suppresses
5873 overflow checking, but does not affect the overflow mode.
5875 The pragma @code{Unsuppress (Overflow_Check)} unsuppresses (enables)
5876 overflow checking, but does not affect the overflow mode.
5878 @node Pragma Overriding_Renamings,Pragma Part_Of,Pragma Overflow_Mode,Implementation Defined Pragmas
5879 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{b3}
5880 @section Pragma Overriding_Renamings
5883 @geindex Rational profile
5885 @geindex Rational compatibility
5887 Syntax:
5889 @example
5890 pragma Overriding_Renamings;
5891 @end example
5893 This is a GNAT configuration pragma to simplify porting
5894 legacy code accepted by the Rational
5895 Ada compiler. In the presence of this pragma, a renaming declaration that
5896 renames an inherited operation declared in the same scope is legal if selected
5897 notation is used as in:
5899 @example
5900 pragma Overriding_Renamings;
5902 package R is
5903   function F (..);
5904   ...
5905   function F (..) renames R.F;
5906 end R;
5907 @end example
5909 even though
5910 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5911 declaration of the overriding operation.
5913 @node Pragma Part_Of,Pragma Partition_Elaboration_Policy,Pragma Overriding_Renamings,Implementation Defined Pragmas
5914 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{b4}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{b5}
5915 @section Pragma Part_Of
5918 Syntax:
5920 @example
5921 pragma Part_Of (ABSTRACT_STATE);
5923 ABSTRACT_STATE ::= NAME
5924 @end example
5926 For the semantics of this pragma, see the entry for aspect @code{Part_Of} in the
5927 SPARK 2014 Reference Manual, section 7.2.6.
5929 @node Pragma Partition_Elaboration_Policy,Pragma Passive,Pragma Part_Of,Implementation Defined Pragmas
5930 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{b6}
5931 @section Pragma Partition_Elaboration_Policy
5934 Syntax:
5936 @example
5937 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
5939 POLICY_IDENTIFIER ::= Concurrent | Sequential
5940 @end example
5942 This pragma is standard in Ada 2005, but is available in all earlier
5943 versions of Ada as an implementation-defined pragma.
5944 See Ada 2012 Reference Manual for details.
5946 @node Pragma Passive,Pragma Persistent_BSS,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
5947 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{b7}
5948 @section Pragma Passive
5951 Syntax:
5953 @example
5954 pragma Passive [(Semaphore | No)];
5955 @end example
5957 Syntax checked, but otherwise ignored by GNAT.  This is recognized for
5958 compatibility with DEC Ada 83 implementations, where it is used within a
5959 task definition to request that a task be made passive.  If the argument
5960 @code{Semaphore} is present, or the argument is omitted, then DEC Ada 83
5961 treats the pragma as an assertion that the containing task is passive
5962 and that optimization of context switch with this task is permitted and
5963 desired.  If the argument @code{No} is present, the task must not be
5964 optimized.  GNAT does not attempt to optimize any tasks in this manner
5965 (since protected objects are available in place of passive tasks).
5967 For more information on the subject of passive tasks, see the section
5968 ‘Passive Task Optimization’ in the GNAT Users Guide.
5970 @node Pragma Persistent_BSS,Pragma Post,Pragma Passive,Implementation Defined Pragmas
5971 @anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{b8}@anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{b9}
5972 @section Pragma Persistent_BSS
5975 Syntax:
5977 @example
5978 pragma Persistent_BSS [(LOCAL_NAME)]
5979 @end example
5981 This pragma allows selected objects to be placed in the @code{.persistent_bss}
5982 section. On some targets the linker and loader provide for special
5983 treatment of this section, allowing a program to be reloaded without
5984 affecting the contents of this data (hence the name persistent).
5986 There are two forms of usage. If an argument is given, it must be the
5987 local name of a library-level object, with no explicit initialization
5988 and whose type is potentially persistent. If no argument is given, then
5989 the pragma is a configuration pragma, and applies to all library-level
5990 objects with no explicit initialization of potentially persistent types.
5992 A potentially persistent type is a scalar type, or an untagged,
5993 non-discriminated record, all of whose components have no explicit
5994 initialization and are themselves of a potentially persistent type,
5995 or an array, all of whose constraints are static, and whose component
5996 type is potentially persistent.
5998 If this pragma is used on a target where this feature is not supported,
5999 then the pragma will be ignored. See also @code{pragma Linker_Section}.
6001 @node Pragma Post,Pragma Postcondition,Pragma Persistent_BSS,Implementation Defined Pragmas
6002 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{ba}
6003 @section Pragma Post
6006 @geindex Post
6008 @geindex Checks
6009 @geindex postconditions
6011 Syntax:
6013 @example
6014 pragma Post (Boolean_Expression);
6015 @end example
6017 The @code{Post} pragma is intended to be an exact replacement for
6018 the language-defined
6019 @code{Post} aspect, and shares its restrictions and semantics.
6020 It must appear either immediately following the corresponding
6021 subprogram declaration (only other pragmas may intervene), or
6022 if there is no separate subprogram declaration, then it can
6023 appear at the start of the declarations in a subprogram body
6024 (preceded only by other pragmas).
6026 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
6027 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{bb}
6028 @section Pragma Postcondition
6031 @geindex Postcondition
6033 @geindex Checks
6034 @geindex postconditions
6036 Syntax:
6038 @example
6039 pragma Postcondition (
6040    [Check   =>] Boolean_Expression
6041  [,[Message =>] String_Expression]);
6042 @end example
6044 The @code{Postcondition} pragma allows specification of automatic
6045 postcondition checks for subprograms. These checks are similar to
6046 assertions, but are automatically inserted just prior to the return
6047 statements of the subprogram with which they are associated (including
6048 implicit returns at the end of procedure bodies and associated
6049 exception handlers).
6051 In addition, the boolean expression which is the condition which
6052 must be true may contain references to function’Result in the case
6053 of a function to refer to the returned value.
6055 @code{Postcondition} pragmas may appear either immediately following the
6056 (separate) declaration of a subprogram, or at the start of the
6057 declarations of a subprogram body. Only other pragmas may intervene
6058 (that is appear between the subprogram declaration and its
6059 postconditions, or appear before the postcondition in the
6060 declaration sequence in a subprogram body). In the case of a
6061 postcondition appearing after a subprogram declaration, the
6062 formal arguments of the subprogram are visible, and can be
6063 referenced in the postcondition expressions.
6065 The postconditions are collected and automatically tested just
6066 before any return (implicit or explicit) in the subprogram body.
6067 A postcondition is only recognized if postconditions are active
6068 at the time the pragma is encountered. The compiler switch `gnata'
6069 turns on all postconditions by default, and pragma @code{Check_Policy}
6070 with an identifier of @code{Postcondition} can also be used to
6071 control whether postconditions are active.
6073 The general approach is that postconditions are placed in the spec
6074 if they represent functional aspects which make sense to the client.
6075 For example we might have:
6077 @example
6078 function Direction return Integer;
6079 pragma Postcondition
6080  (Direction'Result = +1
6081     or else
6082   Direction'Result = -1);
6083 @end example
6085 which serves to document that the result must be +1 or -1, and
6086 will test that this is the case at run time if postcondition
6087 checking is active.
6089 Postconditions within the subprogram body can be used to
6090 check that some internal aspect of the implementation,
6091 not visible to the client, is operating as expected.
6092 For instance if a square root routine keeps an internal
6093 counter of the number of times it is called, then we
6094 might have the following postcondition:
6096 @example
6097 Sqrt_Calls : Natural := 0;
6099 function Sqrt (Arg : Float) return Float is
6100   pragma Postcondition
6101     (Sqrt_Calls = Sqrt_Calls'Old + 1);
6102   ...
6103 end Sqrt
6104 @end example
6106 As this example, shows, the use of the @code{Old} attribute
6107 is often useful in postconditions to refer to the state on
6108 entry to the subprogram.
6110 Note that postconditions are only checked on normal returns
6111 from the subprogram. If an abnormal return results from
6112 raising an exception, then the postconditions are not checked.
6114 If a postcondition fails, then the exception
6115 @code{System.Assertions.Assert_Failure} is raised. If
6116 a message argument was supplied, then the given string
6117 will be used as the exception message. If no message
6118 argument was supplied, then the default message has
6119 the form “Postcondition failed at file_name:line”. The
6120 exception is raised in the context of the subprogram
6121 body, so it is possible to catch postcondition failures
6122 within the subprogram body itself.
6124 Within a package spec, normal visibility rules
6125 in Ada would prevent forward references within a
6126 postcondition pragma to functions defined later in
6127 the same package. This would introduce undesirable
6128 ordering constraints. To avoid this problem, all
6129 postcondition pragmas are analyzed at the end of
6130 the package spec, allowing forward references.
6132 The following example shows that this even allows
6133 mutually recursive postconditions as in:
6135 @example
6136 package Parity_Functions is
6137    function Odd  (X : Natural) return Boolean;
6138    pragma Postcondition
6139      (Odd'Result =
6140         (x = 1
6141           or else
6142         (x /= 0 and then Even (X - 1))));
6144    function Even (X : Natural) return Boolean;
6145    pragma Postcondition
6146      (Even'Result =
6147         (x = 0
6148           or else
6149         (x /= 1 and then Odd (X - 1))));
6151 end Parity_Functions;
6152 @end example
6154 There are no restrictions on the complexity or form of
6155 conditions used within @code{Postcondition} pragmas.
6156 The following example shows that it is even possible
6157 to verify performance behavior.
6159 @example
6160 package Sort is
6162    Performance : constant Float;
6163    --  Performance constant set by implementation
6164    --  to match target architecture behavior.
6166    procedure Treesort (Arg : String);
6167    --  Sorts characters of argument using N*logN sort
6168    pragma Postcondition
6169      (Float (Clock - Clock'Old) <=
6170         Float (Arg'Length) *
6171         log (Float (Arg'Length)) *
6172         Performance);
6173 end Sort;
6174 @end example
6176 Note: postcondition pragmas associated with subprograms that are
6177 marked as Inline_Always, or those marked as Inline with front-end
6178 inlining (-gnatN option set) are accepted and legality-checked
6179 by the compiler, but are ignored at run-time even if postcondition
6180 checking is enabled.
6182 Note that pragma @code{Postcondition} differs from the language-defined
6183 @code{Post} aspect (and corresponding @code{Post} pragma) in allowing
6184 multiple occurrences, allowing occurences in the body even if there
6185 is a separate spec, and allowing a second string parameter, and the
6186 use of the pragma identifier @code{Check}. Historically, pragma
6187 @code{Postcondition} was implemented prior to the development of
6188 Ada 2012, and has been retained in its original form for
6189 compatibility purposes.
6191 @node Pragma Post_Class,Pragma Pre,Pragma Postcondition,Implementation Defined Pragmas
6192 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{bc}
6193 @section Pragma Post_Class
6196 @geindex Post
6198 @geindex Checks
6199 @geindex postconditions
6201 Syntax:
6203 @example
6204 pragma Post_Class (Boolean_Expression);
6205 @end example
6207 The @code{Post_Class} pragma is intended to be an exact replacement for
6208 the language-defined
6209 @code{Post'Class} aspect, and shares its restrictions and semantics.
6210 It must appear either immediately following the corresponding
6211 subprogram declaration (only other pragmas may intervene), or
6212 if there is no separate subprogram declaration, then it can
6213 appear at the start of the declarations in a subprogram body
6214 (preceded only by other pragmas).
6216 Note: This pragma is called @code{Post_Class} rather than
6217 @code{Post'Class} because the latter would not be strictly
6218 conforming to the allowed syntax for pragmas. The motivation
6219 for providing pragmas equivalent to the aspects is to allow a program
6220 to be written using the pragmas, and then compiled if necessary
6221 using an Ada compiler that does not recognize the pragmas or
6222 aspects, but is prepared to ignore the pragmas. The assertion
6223 policy that controls this pragma is @code{Post'Class}, not
6224 @code{Post_Class}.
6226 @node Pragma Pre,Pragma Precondition,Pragma Post_Class,Implementation Defined Pragmas
6227 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{bd}
6228 @section Pragma Pre
6231 @geindex Pre
6233 @geindex Checks
6234 @geindex preconditions
6236 Syntax:
6238 @example
6239 pragma Pre (Boolean_Expression);
6240 @end example
6242 The @code{Pre} pragma is intended to be an exact replacement for
6243 the language-defined
6244 @code{Pre} aspect, and shares its restrictions and semantics.
6245 It must appear either immediately following the corresponding
6246 subprogram declaration (only other pragmas may intervene), or
6247 if there is no separate subprogram declaration, then it can
6248 appear at the start of the declarations in a subprogram body
6249 (preceded only by other pragmas).
6251 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
6252 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{be}
6253 @section Pragma Precondition
6256 @geindex Preconditions
6258 @geindex Checks
6259 @geindex preconditions
6261 Syntax:
6263 @example
6264 pragma Precondition (
6265    [Check   =>] Boolean_Expression
6266  [,[Message =>] String_Expression]);
6267 @end example
6269 The @code{Precondition} pragma is similar to @code{Postcondition}
6270 except that the corresponding checks take place immediately upon
6271 entry to the subprogram, and if a precondition fails, the exception
6272 is raised in the context of the caller, and the attribute ‘Result
6273 cannot be used within the precondition expression.
6275 Otherwise, the placement and visibility rules are identical to those
6276 described for postconditions. The following is an example of use
6277 within a package spec:
6279 @example
6280 package Math_Functions is
6281    ...
6282    function Sqrt (Arg : Float) return Float;
6283    pragma Precondition (Arg >= 0.0)
6284    ...
6285 end Math_Functions;
6286 @end example
6288 @code{Precondition} pragmas may appear either immediately following the
6289 (separate) declaration of a subprogram, or at the start of the
6290 declarations of a subprogram body. Only other pragmas may intervene
6291 (that is appear between the subprogram declaration and its
6292 postconditions, or appear before the postcondition in the
6293 declaration sequence in a subprogram body).
6295 Note: precondition pragmas associated with subprograms that are
6296 marked as Inline_Always, or those marked as Inline with front-end
6297 inlining (-gnatN option set) are accepted and legality-checked
6298 by the compiler, but are ignored at run-time even if precondition
6299 checking is enabled.
6301 Note that pragma @code{Precondition} differs from the language-defined
6302 @code{Pre} aspect (and corresponding @code{Pre} pragma) in allowing
6303 multiple occurrences, allowing occurences in the body even if there
6304 is a separate spec, and allowing a second string parameter, and the
6305 use of the pragma identifier @code{Check}. Historically, pragma
6306 @code{Precondition} was implemented prior to the development of
6307 Ada 2012, and has been retained in its original form for
6308 compatibility purposes.
6310 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
6311 @anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{bf}@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{c0}
6312 @section Pragma Predicate
6315 Syntax:
6317 @example
6318 pragma Predicate
6319   ([Entity =>] type_LOCAL_NAME,
6320    [Check  =>] EXPRESSION);
6321 @end example
6323 This pragma (available in all versions of Ada in GNAT) encompasses both
6324 the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
6325 Ada 2012. A predicate is regarded as static if it has an allowed form
6326 for @code{Static_Predicate} and is otherwise treated as a
6327 @code{Dynamic_Predicate}. Otherwise, predicates specified by this
6328 pragma behave exactly as described in the Ada 2012 reference manual.
6329 For example, if we have
6331 @example
6332 type R is range 1 .. 10;
6333 subtype S is R;
6334 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6335 subtype Q is R
6336 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6337 @end example
6339 the effect is identical to the following Ada 2012 code:
6341 @example
6342 type R is range 1 .. 10;
6343 subtype S is R with
6344   Static_Predicate => S not in 4 .. 6;
6345 subtype Q is R with
6346   Dynamic_Predicate => F(Q) or G(Q);
6347 @end example
6349 Note that there are no pragmas @code{Dynamic_Predicate}
6350 or @code{Static_Predicate}. That is
6351 because these pragmas would affect legality and semantics of
6352 the program and thus do not have a neutral effect if ignored.
6353 The motivation behind providing pragmas equivalent to
6354 corresponding aspects is to allow a program to be written
6355 using the pragmas, and then compiled with a compiler that
6356 will ignore the pragmas. That doesn’t work in the case of
6357 static and dynamic predicates, since if the corresponding
6358 pragmas are ignored, then the behavior of the program is
6359 fundamentally changed (for example a membership test
6360 @code{A in B} would not take into account a predicate
6361 defined for subtype B). When following this approach, the
6362 use of predicates should be avoided.
6364 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6365 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{c1}
6366 @section Pragma Predicate_Failure
6369 Syntax:
6371 @example
6372 pragma Predicate_Failure
6373   ([Entity  =>] type_LOCAL_NAME,
6374    [Message =>] String_Expression);
6375 @end example
6377 The @code{Predicate_Failure} pragma is intended to be an exact replacement for
6378 the language-defined
6379 @code{Predicate_Failure} aspect, and shares its restrictions and semantics.
6381 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6382 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{c2}
6383 @section Pragma Preelaborable_Initialization
6386 Syntax:
6388 @example
6389 pragma Preelaborable_Initialization (DIRECT_NAME);
6390 @end example
6392 This pragma is standard in Ada 2005, but is available in all earlier
6393 versions of Ada as an implementation-defined pragma.
6394 See Ada 2012 Reference Manual for details.
6396 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6397 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c3}
6398 @section Pragma Prefix_Exception_Messages
6401 @geindex Prefix_Exception_Messages
6403 @geindex exception
6405 @geindex Exception_Message
6407 Syntax:
6409 @example
6410 pragma Prefix_Exception_Messages;
6411 @end example
6413 This is an implementation-defined configuration pragma that affects the
6414 behavior of raise statements with a message given as a static string
6415 constant (typically a string literal). In such cases, the string will
6416 be automatically prefixed by the name of the enclosing entity (giving
6417 the package and subprogram containing the raise statement). This helps
6418 to identify where messages are coming from, and this mode is automatic
6419 for the run-time library.
6421 The pragma has no effect if the message is computed with an expression other
6422 than a static string constant, since the assumption in this case is that
6423 the program computes exactly the string it wants. If you still want the
6424 prefixing in this case, you can always call
6425 @code{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6427 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6428 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c4}
6429 @section Pragma Pre_Class
6432 @geindex Pre_Class
6434 @geindex Checks
6435 @geindex preconditions
6437 Syntax:
6439 @example
6440 pragma Pre_Class (Boolean_Expression);
6441 @end example
6443 The @code{Pre_Class} pragma is intended to be an exact replacement for
6444 the language-defined
6445 @code{Pre'Class} aspect, and shares its restrictions and semantics.
6446 It must appear either immediately following the corresponding
6447 subprogram declaration (only other pragmas may intervene), or
6448 if there is no separate subprogram declaration, then it can
6449 appear at the start of the declarations in a subprogram body
6450 (preceded only by other pragmas).
6452 Note: This pragma is called @code{Pre_Class} rather than
6453 @code{Pre'Class} because the latter would not be strictly
6454 conforming to the allowed syntax for pragmas. The motivation
6455 for providing pragmas equivalent to the aspects is to allow a program
6456 to be written using the pragmas, and then compiled if necessary
6457 using an Ada compiler that does not recognize the pragmas or
6458 aspects, but is prepared to ignore the pragmas. The assertion
6459 policy that controls this pragma is @code{Pre'Class}, not
6460 @code{Pre_Class}.
6462 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6463 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c5}
6464 @section Pragma Priority_Specific_Dispatching
6467 Syntax:
6469 @example
6470 pragma Priority_Specific_Dispatching (
6471    POLICY_IDENTIFIER,
6472    first_priority_EXPRESSION,
6473    last_priority_EXPRESSION)
6475 POLICY_IDENTIFIER ::=
6476    EDF_Across_Priorities            |
6477    FIFO_Within_Priorities           |
6478    Non_Preemptive_Within_Priorities |
6479    Round_Robin_Within_Priorities
6480 @end example
6482 This pragma is standard in Ada 2005, but is available in all earlier
6483 versions of Ada as an implementation-defined pragma.
6484 See Ada 2012 Reference Manual for details.
6486 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6487 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c6}
6488 @section Pragma Profile
6491 Syntax:
6493 @example
6494 pragma Profile (Ravenscar | Restricted | Rational | Jorvik |
6495                 GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
6496 @end example
6498 This pragma is standard in Ada 2005, but is available in all earlier
6499 versions of Ada as an implementation-defined pragma. This is a
6500 configuration pragma that establishes a set of configuration pragmas
6501 that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
6502 @code{Jorvik} is standard in Ada 202x.
6503 The other possibilities (@code{Restricted}, @code{Rational},
6504 @code{GNAT_Extended_Ravenscar}, @code{GNAT_Ravenscar_EDF})
6505 are implementation-defined.  @code{GNAT_Extended_Ravenscar} is an alias for @code{Jorvik}.
6507 The set of configuration pragmas is defined in the following sections.
6510 @itemize *
6512 @item 
6513 Pragma Profile (Ravenscar)
6515 The @code{Ravenscar} profile is standard in Ada 2005,
6516 but is available in all earlier
6517 versions of Ada as an implementation-defined pragma. This profile
6518 establishes the following set of configuration pragmas:
6521 @itemize *
6523 @item 
6524 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6526 [RM D.2.2] Tasks are dispatched following a preemptive
6527 priority-ordered scheduling policy.
6529 @item 
6530 @code{Locking_Policy (Ceiling_Locking)}
6532 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6533 the ceiling priority of the corresponding protected object.
6535 @item 
6536 @code{Detect_Blocking}
6538 This pragma forces the detection of potentially blocking operations within a
6539 protected operation, and to raise Program_Error if that happens.
6540 @end itemize
6542 plus the following set of restrictions:
6545 @itemize *
6547 @item 
6548 @code{Max_Entry_Queue_Length => 1}
6550 No task can be queued on a protected entry.
6552 @item 
6553 @code{Max_Protected_Entries => 1}
6555 @item 
6556 @code{Max_Task_Entries => 0}
6558 No rendezvous statements are allowed.
6560 @item 
6561 @code{No_Abort_Statements}
6563 @item 
6564 @code{No_Dynamic_Attachment}
6566 @item 
6567 @code{No_Dynamic_Priorities}
6569 @item 
6570 @code{No_Implicit_Heap_Allocations}
6572 @item 
6573 @code{No_Local_Protected_Objects}
6575 @item 
6576 @code{No_Local_Timing_Events}
6578 @item 
6579 @code{No_Protected_Type_Allocators}
6581 @item 
6582 @code{No_Relative_Delay}
6584 @item 
6585 @code{No_Requeue_Statements}
6587 @item 
6588 @code{No_Select_Statements}
6590 @item 
6591 @code{No_Specific_Termination_Handlers}
6593 @item 
6594 @code{No_Task_Allocators}
6596 @item 
6597 @code{No_Task_Hierarchy}
6599 @item 
6600 @code{No_Task_Termination}
6602 @item 
6603 @code{Simple_Barriers}
6604 @end itemize
6606 The Ravenscar profile also includes the following restrictions that specify
6607 that there are no semantic dependencies on the corresponding predefined
6608 packages:
6611 @itemize *
6613 @item 
6614 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6616 @item 
6617 @code{No_Dependence => Ada.Calendar}
6619 @item 
6620 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6622 @item 
6623 @code{No_Dependence => Ada.Execution_Time.Timers}
6625 @item 
6626 @code{No_Dependence => Ada.Task_Attributes}
6628 @item 
6629 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6630 @end itemize
6632 This set of configuration pragmas and restrictions correspond to the
6633 definition of the ‘Ravenscar Profile’ for limited tasking, devised and
6634 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6635 A description is also available at
6636 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6638 The original definition of the profile was revised at subsequent IRTAW
6639 meetings. It has been included in the ISO
6640 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6641 and was made part of the Ada 2005 standard.
6642 The formal definition given by
6643 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6644 AI-305) available at
6645 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6646 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6648 The above set is a superset of the restrictions provided by pragma
6649 @code{Profile (Restricted)}, it includes six additional restrictions
6650 (@code{Simple_Barriers}, @code{No_Select_Statements},
6651 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6652 @code{No_Relative_Delay} and @code{No_Task_Termination}).  This means
6653 that pragma @code{Profile (Ravenscar)}, like the pragma
6654 @code{Profile (Restricted)},
6655 automatically causes the use of a simplified,
6656 more efficient version of the tasking run-time library.
6658 @item 
6659 Pragma Profile (Jorvik)
6661 @code{Jorvik} is the new profile added to the Ada 202x draft standard,
6662 previously implemented under the name @code{GNAT_Extended_Ravenscar}.
6664 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6665 by @code{No_Implicit_Task_Allocations} and
6666 @code{No_Implicit_Protected_Object_Allocations}.
6668 The @code{Simple_Barriers} restriction has been replaced by
6669 @code{Pure_Barriers}.
6671 The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
6672 @code{No_Relative_Delay} restrictions have been removed.
6674 Details on the rationale for @code{Jorvik} and implications for use may be
6675 found in @cite{A New Ravenscar-Based Profile} by P. Rogers, J. Ruiz,
6676 T. Gingold and P. Bernardi, in @cite{Reliable Software Technologies – Ada Europe 2017}, Springer-Verlag Lecture Notes in Computer Science,
6677 Number 10300.
6679 @item 
6680 Pragma Profile (GNAT_Ravenscar_EDF)
6682 This profile corresponds to the Ravenscar profile but using
6683 EDF_Across_Priority as the Task_Scheduling_Policy.
6685 @item 
6686 Pragma Profile (Restricted)
6688 This profile corresponds to the GNAT restricted run time. It
6689 establishes the following set of restrictions:
6692 @itemize *
6694 @item 
6695 @code{No_Abort_Statements}
6697 @item 
6698 @code{No_Entry_Queue}
6700 @item 
6701 @code{No_Task_Hierarchy}
6703 @item 
6704 @code{No_Task_Allocators}
6706 @item 
6707 @code{No_Dynamic_Priorities}
6709 @item 
6710 @code{No_Terminate_Alternatives}
6712 @item 
6713 @code{No_Dynamic_Attachment}
6715 @item 
6716 @code{No_Protected_Type_Allocators}
6718 @item 
6719 @code{No_Local_Protected_Objects}
6721 @item 
6722 @code{No_Requeue_Statements}
6724 @item 
6725 @code{No_Task_Attributes_Package}
6727 @item 
6728 @code{Max_Asynchronous_Select_Nesting =  0}
6730 @item 
6731 @code{Max_Task_Entries =  0}
6733 @item 
6734 @code{Max_Protected_Entries = 1}
6736 @item 
6737 @code{Max_Select_Alternatives = 0}
6738 @end itemize
6740 This set of restrictions causes the automatic selection of a simplified
6741 version of the run time that provides improved performance for the
6742 limited set of tasking functionality permitted by this set of restrictions.
6744 @item 
6745 Pragma Profile (Rational)
6747 The Rational profile is intended to facilitate porting legacy code that
6748 compiles with the Rational APEX compiler, even when the code includes non-
6749 conforming Ada constructs.  The profile enables the following three pragmas:
6752 @itemize *
6754 @item 
6755 @code{pragma Implicit_Packing}
6757 @item 
6758 @code{pragma Overriding_Renamings}
6760 @item 
6761 @code{pragma Use_VADS_Size}
6762 @end itemize
6763 @end itemize
6765 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6766 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{c7}
6767 @section Pragma Profile_Warnings
6770 Syntax:
6772 @example
6773 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6774 @end example
6776 This is an implementation-defined pragma that is similar in
6777 effect to @code{pragma Profile} except that instead of
6778 generating @code{Restrictions} pragmas, it generates
6779 @code{Restriction_Warnings} pragmas. The result is that
6780 violations of the profile generate warning messages instead
6781 of error messages.
6783 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6784 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{c8}
6785 @section Pragma Propagate_Exceptions
6788 @geindex Interfacing to C++
6790 Syntax:
6792 @example
6793 pragma Propagate_Exceptions;
6794 @end example
6796 This pragma is now obsolete and, other than generating a warning if warnings
6797 on obsolescent features are enabled, is ignored.
6798 It is retained for compatibility
6799 purposes. It used to be used in connection with optimization of
6800 a now-obsolete mechanism for implementation of exceptions.
6802 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
6803 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{c9}
6804 @section Pragma Provide_Shift_Operators
6807 @geindex Shift operators
6809 Syntax:
6811 @example
6812 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
6813 @end example
6815 This pragma can be applied to a first subtype local name that specifies
6816 either an unsigned or signed type. It has the effect of providing the
6817 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
6818 Rotate_Left and Rotate_Right) for the given type. It is similar to
6819 including the function declarations for these five operators, together
6820 with the pragma Import (Intrinsic, …) statements.
6822 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
6823 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{ca}
6824 @section Pragma Psect_Object
6827 Syntax:
6829 @example
6830 pragma Psect_Object (
6831      [Internal =>] LOCAL_NAME,
6832   [, [External =>] EXTERNAL_SYMBOL]
6833   [, [Size     =>] EXTERNAL_SYMBOL]);
6835 EXTERNAL_SYMBOL ::=
6836   IDENTIFIER
6837 | static_string_EXPRESSION
6838 @end example
6840 This pragma is identical in effect to pragma @code{Common_Object}.
6842 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
6843 @anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{cb}@anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{cc}
6844 @section Pragma Pure_Function
6847 Syntax:
6849 @example
6850 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
6851 @end example
6853 This pragma appears in the same declarative part as a function
6854 declaration (or a set of function declarations if more than one
6855 overloaded declaration exists, in which case the pragma applies
6856 to all entities).  It specifies that the function @code{Entity} is
6857 to be considered pure for the purposes of code generation.  This means
6858 that the compiler can assume that there are no side effects, and
6859 in particular that two identical calls produce the same result in
6860 the same context. It also means that the function can be used in
6861 an address clause.
6863 Note that, quite deliberately, there are no static checks to try
6864 to ensure that this promise is met, so @code{Pure_Function} can be used
6865 with functions that are conceptually pure, even if they do modify
6866 global variables.  For example, a square root function that is
6867 instrumented to count the number of times it is called is still
6868 conceptually pure, and can still be optimized, even though it
6869 modifies a global variable (the count).  Memo functions are another
6870 example (where a table of previous calls is kept and consulted to
6871 avoid re-computation).
6873 Note also that the normal rules excluding optimization of subprograms
6874 in pure units (when parameter types are descended from System.Address,
6875 or when the full view of a parameter type is limited), do not apply
6876 for the Pure_Function case. If you explicitly specify Pure_Function,
6877 the compiler may optimize away calls with identical arguments, and
6878 if that results in unexpected behavior, the proper action is not to
6879 use the pragma for subprograms that are not (conceptually) pure.
6881 Note: Most functions in a @code{Pure} package are automatically pure, and
6882 there is no need to use pragma @code{Pure_Function} for such functions.  One
6883 exception is any function that has at least one formal of type
6884 @code{System.Address} or a type derived from it.  Such functions are not
6885 considered pure by default, since the compiler assumes that the
6886 @code{Address} parameter may be functioning as a pointer and that the
6887 referenced data may change even if the address value does not.
6888 Similarly, imported functions are not considered to be pure by default,
6889 since there is no way of checking that they are in fact pure.  The use
6890 of pragma @code{Pure_Function} for such a function will override these default
6891 assumption, and cause the compiler to treat a designated subprogram as pure
6892 in these cases.
6894 Note: If pragma @code{Pure_Function} is applied to a renamed function, it
6895 applies to the underlying renamed function.  This can be used to
6896 disambiguate cases of overloading where some but not all functions
6897 in a set of overloaded functions are to be designated as pure.
6899 If pragma @code{Pure_Function} is applied to a library-level function, the
6900 function is also considered pure from an optimization point of view, but the
6901 unit is not a Pure unit in the categorization sense. So for example, a function
6902 thus marked is free to @code{with} non-pure units.
6904 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
6905 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{cd}
6906 @section Pragma Rational
6909 Syntax:
6911 @example
6912 pragma Rational;
6913 @end example
6915 This pragma is considered obsolescent, but is retained for
6916 compatibility purposes. It is equivalent to:
6918 @example
6919 pragma Profile (Rational);
6920 @end example
6922 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
6923 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{ce}
6924 @section Pragma Ravenscar
6927 Syntax:
6929 @example
6930 pragma Ravenscar;
6931 @end example
6933 This pragma is considered obsolescent, but is retained for
6934 compatibility purposes. It is equivalent to:
6936 @example
6937 pragma Profile (Ravenscar);
6938 @end example
6940 which is the preferred method of setting the @code{Ravenscar} profile.
6942 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
6943 @anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{cf}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{d0}
6944 @section Pragma Refined_Depends
6947 Syntax:
6949 @example
6950 pragma Refined_Depends (DEPENDENCY_RELATION);
6952 DEPENDENCY_RELATION ::=
6953      null
6954   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
6956 DEPENDENCY_CLAUSE ::=
6957     OUTPUT_LIST =>[+] INPUT_LIST
6958   | NULL_DEPENDENCY_CLAUSE
6960 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
6962 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
6964 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
6966 OUTPUT ::= NAME | FUNCTION_RESULT
6967 INPUT  ::= NAME
6969 where FUNCTION_RESULT is a function Result attribute_reference
6970 @end example
6972 For the semantics of this pragma, see the entry for aspect @code{Refined_Depends} in
6973 the SPARK 2014 Reference Manual, section 6.1.5.
6975 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
6976 @anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d1}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{d2}
6977 @section Pragma Refined_Global
6980 Syntax:
6982 @example
6983 pragma Refined_Global (GLOBAL_SPECIFICATION);
6985 GLOBAL_SPECIFICATION ::=
6986      null
6987   | (GLOBAL_LIST)
6988   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
6990 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
6992 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
6993 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
6994 GLOBAL_ITEM   ::= NAME
6995 @end example
6997 For the semantics of this pragma, see the entry for aspect @code{Refined_Global} in
6998 the SPARK 2014 Reference Manual, section 6.1.4.
7000 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
7001 @anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d3}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d4}
7002 @section Pragma Refined_Post
7005 Syntax:
7007 @example
7008 pragma Refined_Post (boolean_EXPRESSION);
7009 @end example
7011 For the semantics of this pragma, see the entry for aspect @code{Refined_Post} in
7012 the SPARK 2014 Reference Manual, section 7.2.7.
7014 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
7015 @anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{d5}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{d6}
7016 @section Pragma Refined_State
7019 Syntax:
7021 @example
7022 pragma Refined_State (REFINEMENT_LIST);
7024 REFINEMENT_LIST ::=
7025   (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
7027 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
7029 CONSTITUENT_LIST ::=
7030      null
7031   |  CONSTITUENT
7032   | (CONSTITUENT @{, CONSTITUENT@})
7034 CONSTITUENT ::= object_NAME | state_NAME
7035 @end example
7037 For the semantics of this pragma, see the entry for aspect @code{Refined_State} in
7038 the SPARK 2014 Reference Manual, section 7.2.2.
7040 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
7041 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{d7}
7042 @section Pragma Relative_Deadline
7045 Syntax:
7047 @example
7048 pragma Relative_Deadline (time_span_EXPRESSION);
7049 @end example
7051 This pragma is standard in Ada 2005, but is available in all earlier
7052 versions of Ada as an implementation-defined pragma.
7053 See Ada 2012 Reference Manual for details.
7055 @node Pragma Remote_Access_Type,Pragma Rename_Pragma,Pragma Relative_Deadline,Implementation Defined Pragmas
7056 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{d8}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{d9}
7057 @section Pragma Remote_Access_Type
7060 Syntax:
7062 @example
7063 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
7064 @end example
7066 This pragma appears in the formal part of a generic declaration.
7067 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
7068 the use of a remote access to class-wide type as actual for a formal
7069 access type.
7071 When this pragma applies to a formal access type @code{Entity}, that
7072 type is treated as a remote access to class-wide type in the generic.
7073 It must be a formal general access type, and its designated type must
7074 be the class-wide type of a formal tagged limited private type from the
7075 same generic declaration.
7077 In the generic unit, the formal type is subject to all restrictions
7078 pertaining to remote access to class-wide types. At instantiation, the
7079 actual type must be a remote access to class-wide type.
7081 @node Pragma Rename_Pragma,Pragma Restricted_Run_Time,Pragma Remote_Access_Type,Implementation Defined Pragmas
7082 @anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{da}
7083 @section Pragma Rename_Pragma
7086 @geindex Pragmas
7087 @geindex synonyms
7089 Syntax:
7091 @example
7092 pragma Rename_Pragma (
7093          [New_Name =>] IDENTIFIER,
7094          [Renamed  =>] pragma_IDENTIFIER);
7095 @end example
7097 This pragma provides a mechanism for supplying new names for existing
7098 pragmas. The @code{New_Name} identifier can subsequently be used as a synonym for
7099 the Renamed pragma. For example, suppose you have code that was originally
7100 developed on a compiler that supports Inline_Only as an implementation defined
7101 pragma. And suppose the semantics of pragma Inline_Only are identical to (or at
7102 least very similar to) the GNAT implementation defined pragma
7103 Inline_Always. You could globally replace Inline_Only with Inline_Always.
7105 However, to avoid that source modification, you could instead add a
7106 configuration pragma:
7108 @example
7109 pragma Rename_Pragma (
7110          New_Name => Inline_Only,
7111          Renamed  => Inline_Always);
7112 @end example
7114 Then GNAT will treat “pragma Inline_Only …” as if you had written
7115 “pragma Inline_Always …”.
7117 Pragma Inline_Only will not necessarily mean the same thing as the other Ada
7118 compiler; it’s up to you to make sure the semantics are close enough.
7120 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Rename_Pragma,Implementation Defined Pragmas
7121 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{db}
7122 @section Pragma Restricted_Run_Time
7125 Syntax:
7127 @example
7128 pragma Restricted_Run_Time;
7129 @end example
7131 This pragma is considered obsolescent, but is retained for
7132 compatibility purposes. It is equivalent to:
7134 @example
7135 pragma Profile (Restricted);
7136 @end example
7138 which is the preferred method of setting the restricted run time
7139 profile.
7141 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
7142 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{dc}
7143 @section Pragma Restriction_Warnings
7146 Syntax:
7148 @example
7149 pragma Restriction_Warnings
7150   (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
7151 @end example
7153 This pragma allows a series of restriction identifiers to be
7154 specified (the list of allowed identifiers is the same as for
7155 pragma @code{Restrictions}). For each of these identifiers
7156 the compiler checks for violations of the restriction, but
7157 generates a warning message rather than an error message
7158 if the restriction is violated.
7160 One use of this is in situations where you want to know
7161 about violations of a restriction, but you want to ignore some of
7162 these violations. Consider this example, where you want to set
7163 Ada_95 mode and enable style checks, but you want to know about
7164 any other use of implementation pragmas:
7166 @example
7167 pragma Restriction_Warnings (No_Implementation_Pragmas);
7168 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
7169 pragma Ada_95;
7170 pragma Style_Checks ("2bfhkM160");
7171 pragma Warnings (On, "violation of No_Implementation_Pragmas");
7172 @end example
7174 By including the above lines in a configuration pragmas file,
7175 the Ada_95 and Style_Checks pragmas are accepted without
7176 generating a warning, but any other use of implementation
7177 defined pragmas will cause a warning to be generated.
7179 @node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
7180 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{dd}
7181 @section Pragma Reviewable
7184 Syntax:
7186 @example
7187 pragma Reviewable;
7188 @end example
7190 This pragma is an RM-defined standard pragma, but has no effect on the
7191 program being compiled, or on the code generated for the program.
7193 To obtain the required output specified in RM H.3.1, the compiler must be
7194 run with various special switches as follows:
7197 @itemize *
7199 @item 
7200 `Where compiler-generated run-time checks remain'
7202 The switch `-gnatGL'
7203 may be used to list the expanded code in pseudo-Ada form.
7204 Runtime checks show up in the listing either as explicit
7205 checks or operators marked with @{@} to indicate a check is present.
7207 @item 
7208 `An identification of known exceptions at compile time'
7210 If the program is compiled with `-gnatwa',
7211 the compiler warning messages will indicate all cases where the compiler
7212 detects that an exception is certain to occur at run time.
7214 @item 
7215 `Possible reads of uninitialized variables'
7217 The compiler warns of many such cases, but its output is incomplete.
7218 @end itemize
7221 A supplemental static analysis tool
7222 may be used to obtain a comprehensive list of all
7223 possible points at which uninitialized data may be read.
7226 @itemize *
7228 @item 
7229 `Where run-time support routines are implicitly invoked'
7231 In the output from `-gnatGL',
7232 run-time calls are explicitly listed as calls to the relevant
7233 run-time routine.
7235 @item 
7236 `Object code listing'
7238 This may be obtained either by using the `-S' switch,
7239 or the objdump utility.
7241 @item 
7242 `Constructs known to be erroneous at compile time'
7244 These are identified by warnings issued by the compiler (use `-gnatwa').
7246 @item 
7247 `Stack usage information'
7249 Static stack usage data (maximum per-subprogram) can be obtained via the
7250 `-fstack-usage' switch to the compiler.
7251 Dynamic stack usage data (per task) can be obtained via the `-u' switch
7252 to gnatbind
7253 @end itemize
7257 @itemize *
7259 @item 
7260 `Object code listing of entire partition'
7262 This can be obtained by compiling the partition with `-S',
7263 or by applying objdump
7264 to all the object files that are part of the partition.
7266 @item 
7267 `A description of the run-time model'
7269 The full sources of the run-time are available, and the documentation of
7270 these routines describes how these run-time routines interface to the
7271 underlying operating system facilities.
7273 @item 
7274 `Control and data-flow information'
7275 @end itemize
7278 A supplemental static analysis tool
7279 may be used to obtain complete control and data-flow information, as well as
7280 comprehensive messages identifying possible problems based on this
7281 information.
7283 @node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
7284 @anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{de}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{df}
7285 @section Pragma Secondary_Stack_Size
7288 Syntax:
7290 @example
7291 pragma Secondary_Stack_Size (integer_EXPRESSION);
7292 @end example
7294 This pragma appears within the task definition of a single task declaration
7295 or a task type declaration (like pragma @code{Storage_Size}) and applies to all
7296 task objects of that type. The argument specifies the size of the secondary
7297 stack to be used by these task objects, and must be of an integer type. The
7298 secondary stack is used to handle functions that return a variable-sized
7299 result, for example a function returning an unconstrained String.
7301 Note this pragma only applies to targets using fixed secondary stacks, like
7302 VxWorks 653 and bare board targets, where a fixed block for the
7303 secondary stack is allocated from the primary stack of the task. By default,
7304 these targets assign a percentage of the primary stack for the secondary stack,
7305 as defined by @code{System.Parameter.Sec_Stack_Percentage}. With this pragma,
7306 an @code{integer_EXPRESSION} of bytes is assigned from the primary stack instead.
7308 For most targets, the pragma does not apply as the secondary stack grows on
7309 demand: allocated as a chain of blocks in the heap. The default size of these
7310 blocks can be modified via the @code{-D} binder option as described in
7311 @cite{GNAT User’s Guide}.
7313 Note that no check is made to see if the secondary stack can fit inside the
7314 primary stack.
7316 Note the pragma cannot appear when the restriction @code{No_Secondary_Stack}
7317 is in effect.
7319 @node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
7320 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{e0}
7321 @section Pragma Share_Generic
7324 Syntax:
7326 @example
7327 pragma Share_Generic (GNAME @{, GNAME@});
7329 GNAME ::= generic_unit_NAME | generic_instance_NAME
7330 @end example
7332 This pragma is provided for compatibility with Dec Ada 83. It has
7333 no effect in GNAT (which does not implement shared generics), other
7334 than to check that the given names are all names of generic units or
7335 generic instances.
7337 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
7338 @anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e1}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{e2}
7339 @section Pragma Shared
7342 This pragma is provided for compatibility with Ada 83. The syntax and
7343 semantics are identical to pragma Atomic.
7345 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
7346 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{e3}
7347 @section Pragma Short_Circuit_And_Or
7350 Syntax:
7352 @example
7353 pragma Short_Circuit_And_Or;
7354 @end example
7356 This configuration pragma causes any occurrence of the AND operator applied to
7357 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
7358 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
7359 may be useful in the context of certification protocols requiring the use of
7360 short-circuited logical operators. If this configuration pragma occurs locally
7361 within the file being compiled, it applies only to the file being compiled.
7362 There is no requirement that all units in a partition use this option.
7364 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
7365 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e4}
7366 @section Pragma Short_Descriptors
7369 Syntax:
7371 @example
7372 pragma Short_Descriptors;
7373 @end example
7375 This pragma is provided for compatibility with other Ada implementations. It
7376 is recognized but ignored by all current versions of GNAT.
7378 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
7379 @anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{e5}@anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{e6}
7380 @section Pragma Simple_Storage_Pool_Type
7383 @geindex Storage pool
7384 @geindex simple
7386 @geindex Simple storage pool
7388 Syntax:
7390 @example
7391 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
7392 @end example
7394 A type can be established as a ‘simple storage pool type’ by applying
7395 the representation pragma @code{Simple_Storage_Pool_Type} to the type.
7396 A type named in the pragma must be a library-level immutably limited record
7397 type or limited tagged type declared immediately within a package declaration.
7398 The type can also be a limited private type whose full type is allowed as
7399 a simple storage pool type.
7401 For a simple storage pool type @code{SSP}, nonabstract primitive subprograms
7402 @code{Allocate}, @code{Deallocate}, and @code{Storage_Size} can be declared that
7403 are subtype conformant with the following subprogram declarations:
7405 @example
7406 procedure Allocate
7407   (Pool                     : in out SSP;
7408    Storage_Address          : out System.Address;
7409    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7410    Alignment                : System.Storage_Elements.Storage_Count);
7412 procedure Deallocate
7413   (Pool : in out SSP;
7414    Storage_Address          : System.Address;
7415    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7416    Alignment                : System.Storage_Elements.Storage_Count);
7418 function Storage_Size (Pool : SSP)
7419   return System.Storage_Elements.Storage_Count;
7420 @end example
7422 Procedure @code{Allocate} must be declared, whereas @code{Deallocate} and
7423 @code{Storage_Size} are optional. If @code{Deallocate} is not declared, then
7424 applying an unchecked deallocation has no effect other than to set its actual
7425 parameter to null. If @code{Storage_Size} is not declared, then the
7426 @code{Storage_Size} attribute applied to an access type associated with
7427 a pool object of type SSP returns zero. Additional operations can be declared
7428 for a simple storage pool type (such as for supporting a mark/release
7429 storage-management discipline).
7431 An object of a simple storage pool type can be associated with an access
7432 type by specifying the attribute
7433 @ref{e7,,Simple_Storage_Pool}. For example:
7435 @example
7436 My_Pool : My_Simple_Storage_Pool_Type;
7438 type Acc is access My_Data_Type;
7440 for Acc'Simple_Storage_Pool use My_Pool;
7441 @end example
7443 See attribute @ref{e7,,Simple_Storage_Pool}
7444 for further details.
7446 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7447 @anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{e8}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{e9}
7448 @section Pragma Source_File_Name
7451 Syntax:
7453 @example
7454 pragma Source_File_Name (
7455   [Unit_Name     =>] unit_NAME,
7456   Spec_File_Name =>  STRING_LITERAL,
7457   [Index => INTEGER_LITERAL]);
7459 pragma Source_File_Name (
7460   [Unit_Name     =>] unit_NAME,
7461   Body_File_Name =>  STRING_LITERAL,
7462   [Index => INTEGER_LITERAL]);
7463 @end example
7465 Use this to override the normal naming convention.  It is a configuration
7466 pragma, and so has the usual applicability of configuration pragmas
7467 (i.e., it applies to either an entire partition, or to all units in a
7468 compilation, or to a single unit, depending on how it is used).
7469 @code{unit_name} is mapped to @code{file_name_literal}.  The identifier for
7470 the second argument is required, and indicates whether this is the file
7471 name for the spec or for the body.
7473 The optional Index argument should be used when a file contains multiple
7474 units, and when you do not want to use @code{gnatchop} to separate then
7475 into multiple files (which is the recommended procedure to limit the
7476 number of recompilations that are needed when some sources change).
7477 For instance, if the source file @code{source.ada} contains
7479 @example
7480 package B is
7482 end B;
7484 with B;
7485 procedure A is
7486 begin
7487    ..
7488 end A;
7489 @end example
7491 you could use the following configuration pragmas:
7493 @example
7494 pragma Source_File_Name
7495   (B, Spec_File_Name => "source.ada", Index => 1);
7496 pragma Source_File_Name
7497   (A, Body_File_Name => "source.ada", Index => 2);
7498 @end example
7500 Note that the @code{gnatname} utility can also be used to generate those
7501 configuration pragmas.
7503 Another form of the @code{Source_File_Name} pragma allows
7504 the specification of patterns defining alternative file naming schemes
7505 to apply to all files.
7507 @example
7508 pragma Source_File_Name
7509   (  [Spec_File_Name  =>] STRING_LITERAL
7510    [,[Casing          =>] CASING_SPEC]
7511    [,[Dot_Replacement =>] STRING_LITERAL]);
7513 pragma Source_File_Name
7514   (  [Body_File_Name  =>] STRING_LITERAL
7515    [,[Casing          =>] CASING_SPEC]
7516    [,[Dot_Replacement =>] STRING_LITERAL]);
7518 pragma Source_File_Name
7519   (  [Subunit_File_Name =>] STRING_LITERAL
7520    [,[Casing            =>] CASING_SPEC]
7521    [,[Dot_Replacement   =>] STRING_LITERAL]);
7523 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7524 @end example
7526 The first argument is a pattern that contains a single asterisk indicating
7527 the point at which the unit name is to be inserted in the pattern string
7528 to form the file name.  The second argument is optional.  If present it
7529 specifies the casing of the unit name in the resulting file name string.
7530 The default is lower case.  Finally the third argument allows for systematic
7531 replacement of any dots in the unit name by the specified string literal.
7533 Note that Source_File_Name pragmas should not be used if you are using
7534 project files. The reason for this rule is that the project manager is not
7535 aware of these pragmas, and so other tools that use the project file would not
7536 be aware of the intended naming conventions. If you are using project files,
7537 file naming is controlled by Source_File_Name_Project pragmas, which are
7538 usually supplied automatically by the project manager. A pragma
7539 Source_File_Name cannot appear after a @ref{ea,,Pragma Source_File_Name_Project}.
7541 For more details on the use of the @code{Source_File_Name} pragma, see the
7542 sections on @cite{Using Other File Names} and @cite{Alternative File Naming Schemes}
7543 in the @cite{GNAT User’s Guide}.
7545 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7546 @anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{eb}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{ea}
7547 @section Pragma Source_File_Name_Project
7550 This pragma has the same syntax and semantics as pragma Source_File_Name.
7551 It is only allowed as a stand-alone configuration pragma.
7552 It cannot appear after a @ref{e9,,Pragma Source_File_Name}, and
7553 most importantly, once pragma Source_File_Name_Project appears,
7554 no further Source_File_Name pragmas are allowed.
7556 The intention is that Source_File_Name_Project pragmas are always
7557 generated by the Project Manager in a manner consistent with the naming
7558 specified in a project file, and when naming is controlled in this manner,
7559 it is not permissible to attempt to modify this naming scheme using
7560 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7561 known to the project manager).
7563 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7564 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{ec}
7565 @section Pragma Source_Reference
7568 Syntax:
7570 @example
7571 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7572 @end example
7574 This pragma must appear as the first line of a source file.
7575 @code{integer_literal} is the logical line number of the line following
7576 the pragma line (for use in error messages and debugging
7577 information).  @code{string_literal} is a static string constant that
7578 specifies the file name to be used in error messages and debugging
7579 information.  This is most notably used for the output of @code{gnatchop}
7580 with the `-r' switch, to make sure that the original unchopped
7581 source file is the one referred to.
7583 The second argument must be a string literal, it cannot be a static
7584 string expression other than a string literal.  This is because its value
7585 is needed for error messages issued by all phases of the compiler.
7587 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7588 @anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{ed}@anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{ee}
7589 @section Pragma SPARK_Mode
7592 Syntax:
7594 @example
7595 pragma SPARK_Mode [(On | Off)] ;
7596 @end example
7598 In general a program can have some parts that are in SPARK 2014 (and
7599 follow all the rules in the SPARK Reference Manual), and some parts
7600 that are full Ada 2012.
7602 The SPARK_Mode pragma is used to identify which parts are in SPARK
7603 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7604 be used in the following places:
7607 @itemize *
7609 @item 
7610 As a configuration pragma, in which case it sets the default mode for
7611 all units compiled with this pragma.
7613 @item 
7614 Immediately following a library-level subprogram spec
7616 @item 
7617 Immediately within a library-level package body
7619 @item 
7620 Immediately following the @code{private} keyword of a library-level
7621 package spec
7623 @item 
7624 Immediately following the @code{begin} keyword of a library-level
7625 package body
7627 @item 
7628 Immediately within a library-level subprogram body
7629 @end itemize
7631 Normally a subprogram or package spec/body inherits the current mode
7632 that is active at the point it is declared. But this can be overridden
7633 by pragma within the spec or body as above.
7635 The basic consistency rule is that you can’t turn SPARK_Mode back
7636 @code{On}, once you have explicitly (with a pragma) turned if
7637 @code{Off}. So the following rules apply:
7639 If a subprogram spec has SPARK_Mode @code{Off}, then the body must
7640 also have SPARK_Mode @code{Off}.
7642 For a package, we have four parts:
7645 @itemize *
7647 @item 
7648 the package public declarations
7650 @item 
7651 the package private part
7653 @item 
7654 the body of the package
7656 @item 
7657 the elaboration code after @code{begin}
7658 @end itemize
7660 For a package, the rule is that if you explicitly turn SPARK_Mode
7661 @code{Off} for any part, then all the following parts must have
7662 SPARK_Mode @code{Off}. Note that this may require repeating a pragma
7663 SPARK_Mode (@code{Off}) in the body. For example, if we have a
7664 configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
7665 default everywhere, and one particular package spec has pragma
7666 SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
7667 the package body.
7669 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7670 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{ef}
7671 @section Pragma Static_Elaboration_Desired
7674 Syntax:
7676 @example
7677 pragma Static_Elaboration_Desired;
7678 @end example
7680 This pragma is used to indicate that the compiler should attempt to initialize
7681 statically the objects declared in the library unit to which the pragma applies,
7682 when these objects are initialized (explicitly or implicitly) by an aggregate.
7683 In the absence of this pragma, aggregates in object declarations are expanded
7684 into assignments and loops, even when the aggregate components are static
7685 constants. When the aggregate is present the compiler builds a static expression
7686 that requires no run-time code, so that the initialized object can be placed in
7687 read-only data space. If the components are not static, or the aggregate has
7688 more that 100 components, the compiler emits a warning that the pragma cannot
7689 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7690 construction of larger aggregates with static components that include an others
7691 choice.)
7693 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7694 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{f0}
7695 @section Pragma Stream_Convert
7698 Syntax:
7700 @example
7701 pragma Stream_Convert (
7702   [Entity =>] type_LOCAL_NAME,
7703   [Read   =>] function_NAME,
7704   [Write  =>] function_NAME);
7705 @end example
7707 This pragma provides an efficient way of providing user-defined stream
7708 attributes.  Not only is it simpler to use than specifying the attributes
7709 directly, but more importantly, it allows the specification to be made in such
7710 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7711 needed (i.e. unless the stream attributes are actually used); the use of
7712 the Stream_Convert pragma adds no overhead at all, unless the stream
7713 attributes are actually used on the designated type.
7715 The first argument specifies the type for which stream functions are
7716 provided.  The second parameter provides a function used to read values
7717 of this type.  It must name a function whose argument type may be any
7718 subtype, and whose returned type must be the type given as the first
7719 argument to the pragma.
7721 The meaning of the @code{Read} parameter is that if a stream attribute directly
7722 or indirectly specifies reading of the type given as the first parameter,
7723 then a value of the type given as the argument to the Read function is
7724 read from the stream, and then the Read function is used to convert this
7725 to the required target type.
7727 Similarly the @code{Write} parameter specifies how to treat write attributes
7728 that directly or indirectly apply to the type given as the first parameter.
7729 It must have an input parameter of the type specified by the first parameter,
7730 and the return type must be the same as the input type of the Read function.
7731 The effect is to first call the Write function to convert to the given stream
7732 type, and then write the result type to the stream.
7734 The Read and Write functions must not be overloaded subprograms.  If necessary
7735 renamings can be supplied to meet this requirement.
7736 The usage of this attribute is best illustrated by a simple example, taken
7737 from the GNAT implementation of package Ada.Strings.Unbounded:
7739 @example
7740 function To_Unbounded (S : String) return Unbounded_String
7741   renames To_Unbounded_String;
7743 pragma Stream_Convert
7744   (Unbounded_String, To_Unbounded, To_String);
7745 @end example
7747 The specifications of the referenced functions, as given in the Ada
7748 Reference Manual are:
7750 @example
7751 function To_Unbounded_String (Source : String)
7752   return Unbounded_String;
7754 function To_String (Source : Unbounded_String)
7755   return String;
7756 @end example
7758 The effect is that if the value of an unbounded string is written to a stream,
7759 then the representation of the item in the stream is in the same format that
7760 would be used for @code{Standard.String'Output}, and this same representation
7761 is expected when a value of this type is read from the stream. Note that the
7762 value written always includes the bounds, even for Unbounded_String’Write,
7763 since Unbounded_String is not an array type.
7765 Note that the @code{Stream_Convert} pragma is not effective in the case of
7766 a derived type of a non-limited tagged type. If such a type is specified then
7767 the pragma is silently ignored, and the default implementation of the stream
7768 attributes is used instead.
7770 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7771 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{f1}
7772 @section Pragma Style_Checks
7775 Syntax:
7777 @example
7778 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7779                      On | Off [, LOCAL_NAME]);
7780 @end example
7782 This pragma is used in conjunction with compiler switches to control the
7783 built in style checking provided by GNAT.  The compiler switches, if set,
7784 provide an initial setting for the switches, and this pragma may be used
7785 to modify these settings, or the settings may be provided entirely by
7786 the use of the pragma.  This pragma can be used anywhere that a pragma
7787 is legal, including use as a configuration pragma (including use in
7788 the @code{gnat.adc} file).
7790 The form with a string literal specifies which style options are to be
7791 activated.  These are additive, so they apply in addition to any previously
7792 set style check options.  The codes for the options are the same as those
7793 used in the `-gnaty' switch to `gcc' or `gnatmake'.
7794 For example the following two methods can be used to enable
7795 layout checking:
7798 @itemize *
7800 @item 
7801 @example
7802 pragma Style_Checks ("l");
7803 @end example
7805 @item 
7806 @example
7807 gcc -c -gnatyl ...
7808 @end example
7809 @end itemize
7811 The form @code{ALL_CHECKS} activates all standard checks (its use is equivalent
7812 to the use of the @code{gnaty} switch with no options.
7813 See the @cite{GNAT User’s Guide} for details.)
7815 Note: the behavior is slightly different in GNAT mode (@code{-gnatg} used).
7816 In this case, @code{ALL_CHECKS} implies the standard set of GNAT mode style check
7817 options (i.e. equivalent to @code{-gnatyg}).
7819 The forms with @code{Off} and @code{On}
7820 can be used to temporarily disable style checks
7821 as shown in the following example:
7823 @example
7824 pragma Style_Checks ("k"); -- requires keywords in lower case
7825 pragma Style_Checks (Off); -- turn off style checks
7826 NULL;                      -- this will not generate an error message
7827 pragma Style_Checks (On);  -- turn style checks back on
7828 NULL;                      -- this will generate an error message
7829 @end example
7831 Finally the two argument form is allowed only if the first argument is
7832 @code{On} or @code{Off}.  The effect is to turn of semantic style checks
7833 for the specified entity, as shown in the following example:
7835 @example
7836 pragma Style_Checks ("r"); -- require consistency of identifier casing
7837 Arg : Integer;
7838 Rf1 : Integer := ARG;      -- incorrect, wrong case
7839 pragma Style_Checks (Off, Arg);
7840 Rf2 : Integer := ARG;      -- OK, no error
7841 @end example
7843 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
7844 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{f2}
7845 @section Pragma Subtitle
7848 Syntax:
7850 @example
7851 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
7852 @end example
7854 This pragma is recognized for compatibility with other Ada compilers
7855 but is ignored by GNAT.
7857 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
7858 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{f3}
7859 @section Pragma Suppress
7862 Syntax:
7864 @example
7865 pragma Suppress (Identifier [, [On =>] Name]);
7866 @end example
7868 This is a standard pragma, and supports all the check names required in
7869 the RM. It is included here because GNAT recognizes some additional check
7870 names that are implementation defined (as permitted by the RM):
7873 @itemize *
7875 @item 
7876 @code{Alignment_Check} can be used to suppress alignment checks
7877 on addresses used in address clauses. Such checks can also be suppressed
7878 by suppressing range checks, but the specific use of @code{Alignment_Check}
7879 allows suppression of alignment checks without suppressing other range checks.
7880 Note that @code{Alignment_Check} is suppressed by default on machines (such as
7881 the x86) with non-strict alignment.
7883 @item 
7884 @code{Atomic_Synchronization} can be used to suppress the special memory
7885 synchronization instructions that are normally generated for access to
7886 @code{Atomic} variables to ensure correct synchronization between tasks
7887 that use such variables for synchronization purposes.
7889 @item 
7890 @code{Duplicated_Tag_Check} Can be used to suppress the check that is generated
7891 for a duplicated tag value when a tagged type is declared.
7893 @item 
7894 @code{Container_Checks} Can be used to suppress all checks within Ada.Containers
7895 and instances of its children, including Tampering_Check.
7897 @item 
7898 @code{Tampering_Check} Can be used to suppress tampering check in the containers.
7900 @item 
7901 @code{Predicate_Check} can be used to control whether predicate checks are
7902 active. It is applicable only to predicates for which the policy is
7903 @code{Check}. Unlike @code{Assertion_Policy}, which determines if a given
7904 predicate is ignored or checked for the whole program, the use of
7905 @code{Suppress} and @code{Unsuppress} with this check name allows a given
7906 predicate to be turned on and off at specific points in the program.
7908 @item 
7909 @code{Validity_Check} can be used specifically to control validity checks.
7910 If @code{Suppress} is used to suppress validity checks, then no validity
7911 checks are performed, including those specified by the appropriate compiler
7912 switch or the @code{Validity_Checks} pragma.
7914 @item 
7915 Additional check names previously introduced by use of the @code{Check_Name}
7916 pragma are also allowed.
7917 @end itemize
7919 Note that pragma Suppress gives the compiler permission to omit
7920 checks, but does not require the compiler to omit checks. The compiler
7921 will generate checks if they are essentially free, even when they are
7922 suppressed. In particular, if the compiler can prove that a certain
7923 check will necessarily fail, it will generate code to do an
7924 unconditional ‘raise’, even if checks are suppressed. The compiler
7925 warns in this case.
7927 Of course, run-time checks are omitted whenever the compiler can prove
7928 that they will not fail, whether or not checks are suppressed.
7930 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
7931 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{f4}
7932 @section Pragma Suppress_All
7935 Syntax:
7937 @example
7938 pragma Suppress_All;
7939 @end example
7941 This pragma can appear anywhere within a unit.
7942 The effect is to apply @code{Suppress (All_Checks)} to the unit
7943 in which it appears.  This pragma is implemented for compatibility with DEC
7944 Ada 83 usage where it appears at the end of a unit, and for compatibility
7945 with Rational Ada, where it appears as a program unit pragma.
7946 The use of the standard Ada pragma @code{Suppress (All_Checks)}
7947 as a normal configuration pragma is the preferred usage in GNAT.
7949 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
7950 @anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{f5}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{f6}
7951 @section Pragma Suppress_Debug_Info
7954 Syntax:
7956 @example
7957 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
7958 @end example
7960 This pragma can be used to suppress generation of debug information
7961 for the specified entity. It is intended primarily for use in debugging
7962 the debugger, and navigating around debugger problems.
7964 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
7965 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f7}
7966 @section Pragma Suppress_Exception_Locations
7969 Syntax:
7971 @example
7972 pragma Suppress_Exception_Locations;
7973 @end example
7975 In normal mode, a raise statement for an exception by default generates
7976 an exception message giving the file name and line number for the location
7977 of the raise. This is useful for debugging and logging purposes, but this
7978 entails extra space for the strings for the messages. The configuration
7979 pragma @code{Suppress_Exception_Locations} can be used to suppress the
7980 generation of these strings, with the result that space is saved, but the
7981 exception message for such raises is null. This configuration pragma may
7982 appear in a global configuration pragma file, or in a specific unit as
7983 usual. It is not required that this pragma be used consistently within
7984 a partition, so it is fine to have some units within a partition compiled
7985 with this pragma and others compiled in normal mode without it.
7987 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
7988 @anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{f8}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{f9}
7989 @section Pragma Suppress_Initialization
7992 @geindex Suppressing initialization
7994 @geindex Initialization
7995 @geindex suppression of
7997 Syntax:
7999 @example
8000 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
8001 @end example
8003 Here variable_or_subtype_Name is the name introduced by a type declaration
8004 or subtype declaration or the name of a variable introduced by an
8005 object declaration.
8007 In the case of a type or subtype
8008 this pragma suppresses any implicit or explicit initialization
8009 for all variables of the given type or subtype,
8010 including initialization resulting from the use of pragmas
8011 Normalize_Scalars or Initialize_Scalars.
8013 This is considered a representation item, so it cannot be given after
8014 the type is frozen. It applies to all subsequent object declarations,
8015 and also any allocator that creates objects of the type.
8017 If the pragma is given for the first subtype, then it is considered
8018 to apply to the base type and all its subtypes. If the pragma is given
8019 for other than a first subtype, then it applies only to the given subtype.
8020 The pragma may not be given after the type is frozen.
8022 Note that this includes eliminating initialization of discriminants
8023 for discriminated types, and tags for tagged types. In these cases,
8024 you will have to use some non-portable mechanism (e.g. address
8025 overlays or unchecked conversion) to achieve required initialization
8026 of these fields before accessing any object of the corresponding type.
8028 For the variable case, implicit initialization for the named variable
8029 is suppressed, just as though its subtype had been given in a pragma
8030 Suppress_Initialization, as described above.
8032 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
8033 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{fa}
8034 @section Pragma Task_Name
8037 Syntax
8039 @example
8040 pragma Task_Name (string_EXPRESSION);
8041 @end example
8043 This pragma appears within a task definition (like pragma
8044 @code{Priority}) and applies to the task in which it appears.  The
8045 argument must be of type String, and provides a name to be used for
8046 the task instance when the task is created.  Note that this expression
8047 is not required to be static, and in particular, it can contain
8048 references to task discriminants.  This facility can be used to
8049 provide different names for different tasks as they are created,
8050 as illustrated in the example below.
8052 The task name is recorded internally in the run-time structures
8053 and is accessible to tools like the debugger.  In addition the
8054 routine @code{Ada.Task_Identification.Image} will return this
8055 string, with a unique task address appended.
8057 @example
8058 --  Example of the use of pragma Task_Name
8060 with Ada.Task_Identification;
8061 use Ada.Task_Identification;
8062 with Text_IO; use Text_IO;
8063 procedure t3 is
8065    type Astring is access String;
8067    task type Task_Typ (Name : access String) is
8068       pragma Task_Name (Name.all);
8069    end Task_Typ;
8071    task body Task_Typ is
8072       Nam : constant String := Image (Current_Task);
8073    begin
8074       Put_Line ("-->" & Nam (1 .. 14) & "<--");
8075    end Task_Typ;
8077    type Ptr_Task is access Task_Typ;
8078    Task_Var : Ptr_Task;
8080 begin
8081    Task_Var :=
8082      new Task_Typ (new String'("This is task 1"));
8083    Task_Var :=
8084      new Task_Typ (new String'("This is task 2"));
8085 end;
8086 @end example
8088 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
8089 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{fb}
8090 @section Pragma Task_Storage
8093 Syntax:
8095 @example
8096 pragma Task_Storage (
8097   [Task_Type =>] LOCAL_NAME,
8098   [Top_Guard =>] static_integer_EXPRESSION);
8099 @end example
8101 This pragma specifies the length of the guard area for tasks.  The guard
8102 area is an additional storage area allocated to a task.  A value of zero
8103 means that either no guard area is created or a minimal guard area is
8104 created, depending on the target.  This pragma can appear anywhere a
8105 @code{Storage_Size} attribute definition clause is allowed for a task
8106 type.
8108 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
8109 @anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{fc}@anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{fd}
8110 @section Pragma Test_Case
8113 @geindex Test cases
8115 Syntax:
8117 @example
8118 pragma Test_Case (
8119    [Name     =>] static_string_Expression
8120   ,[Mode     =>] (Nominal | Robustness)
8121  [, Requires =>  Boolean_Expression]
8122  [, Ensures  =>  Boolean_Expression]);
8123 @end example
8125 The @code{Test_Case} pragma allows defining fine-grain specifications
8126 for use by testing tools.
8127 The compiler checks the validity of the @code{Test_Case} pragma, but its
8128 presence does not lead to any modification of the code generated by the
8129 compiler.
8131 @code{Test_Case} pragmas may only appear immediately following the
8132 (separate) declaration of a subprogram in a package declaration, inside
8133 a package spec unit. Only other pragmas may intervene (that is appear
8134 between the subprogram declaration and a test case).
8136 The compiler checks that boolean expressions given in @code{Requires} and
8137 @code{Ensures} are valid, where the rules for @code{Requires} are the
8138 same as the rule for an expression in @code{Precondition} and the rules
8139 for @code{Ensures} are the same as the rule for an expression in
8140 @code{Postcondition}. In particular, attributes @code{'Old} and
8141 @code{'Result} can only be used within the @code{Ensures}
8142 expression. The following is an example of use within a package spec:
8144 @example
8145 package Math_Functions is
8146    ...
8147    function Sqrt (Arg : Float) return Float;
8148    pragma Test_Case (Name     => "Test 1",
8149                      Mode     => Nominal,
8150                      Requires => Arg < 10000.0,
8151                      Ensures  => Sqrt'Result < 10.0);
8152    ...
8153 end Math_Functions;
8154 @end example
8156 The meaning of a test case is that there is at least one context where
8157 @code{Requires} holds such that, if the associated subprogram is executed in
8158 that context, then @code{Ensures} holds when the subprogram returns.
8159 Mode @code{Nominal} indicates that the input context should also satisfy the
8160 precondition of the subprogram, and the output context should also satisfy its
8161 postcondition. Mode @code{Robustness} indicates that the precondition and
8162 postcondition of the subprogram should be ignored for this test case.
8164 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
8165 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{fe}@anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{ff}
8166 @section Pragma Thread_Local_Storage
8169 @geindex Task specific storage
8171 @geindex TLS (Thread Local Storage)
8173 @geindex Task_Attributes
8175 Syntax:
8177 @example
8178 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
8179 @end example
8181 This pragma specifies that the specified entity, which must be
8182 a variable declared in a library-level package, is to be marked as
8183 “Thread Local Storage” (@code{TLS}). On systems supporting this (which
8184 include Windows, Solaris, GNU/Linux, and VxWorks), this causes each
8185 thread (and hence each Ada task) to see a distinct copy of the variable.
8187 The variable must not have default initialization, and if there is
8188 an explicit initialization, it must be either @code{null} for an
8189 access variable, a static expression for a scalar variable, or a fully
8190 static aggregate for a composite type, that is to say, an aggregate all
8191 of whose components are static, and which does not include packed or
8192 discriminated components.
8194 This provides a low-level mechanism similar to that provided by
8195 the @code{Ada.Task_Attributes} package, but much more efficient
8196 and is also useful in writing interface code that will interact
8197 with foreign threads.
8199 If this pragma is used on a system where @code{TLS} is not supported,
8200 then an error message will be generated and the program will be rejected.
8202 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
8203 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{100}
8204 @section Pragma Time_Slice
8207 Syntax:
8209 @example
8210 pragma Time_Slice (static_duration_EXPRESSION);
8211 @end example
8213 For implementations of GNAT on operating systems where it is possible
8214 to supply a time slice value, this pragma may be used for this purpose.
8215 It is ignored if it is used in a system that does not allow this control,
8216 or if it appears in other than the main program unit.
8218 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
8219 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{101}
8220 @section Pragma Title
8223 Syntax:
8225 @example
8226 pragma Title (TITLING_OPTION [, TITLING OPTION]);
8228 TITLING_OPTION ::=
8229   [Title    =>] STRING_LITERAL,
8230 | [Subtitle =>] STRING_LITERAL
8231 @end example
8233 Syntax checked but otherwise ignored by GNAT.  This is a listing control
8234 pragma used in DEC Ada 83 implementations to provide a title and/or
8235 subtitle for the program listing.  The program listing generated by GNAT
8236 does not have titles or subtitles.
8238 Unlike other pragmas, the full flexibility of named notation is allowed
8239 for this pragma, i.e., the parameters may be given in any order if named
8240 notation is used, and named and positional notation can be mixed
8241 following the normal rules for procedure calls in Ada.
8243 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
8244 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{102}
8245 @section Pragma Type_Invariant
8248 Syntax:
8250 @example
8251 pragma Type_Invariant
8252   ([Entity =>] type_LOCAL_NAME,
8253    [Check  =>] EXPRESSION);
8254 @end example
8256 The @code{Type_Invariant} pragma is intended to be an exact
8257 replacement for the language-defined @code{Type_Invariant}
8258 aspect, and shares its restrictions and semantics. It differs
8259 from the language defined @code{Invariant} pragma in that it
8260 does not permit a string parameter, and it is
8261 controlled by the assertion identifier @code{Type_Invariant}
8262 rather than @code{Invariant}.
8264 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
8265 @anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{103}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{104}
8266 @section Pragma Type_Invariant_Class
8269 Syntax:
8271 @example
8272 pragma Type_Invariant_Class
8273   ([Entity =>] type_LOCAL_NAME,
8274    [Check  =>] EXPRESSION);
8275 @end example
8277 The @code{Type_Invariant_Class} pragma is intended to be an exact
8278 replacement for the language-defined @code{Type_Invariant'Class}
8279 aspect, and shares its restrictions and semantics.
8281 Note: This pragma is called @code{Type_Invariant_Class} rather than
8282 @code{Type_Invariant'Class} because the latter would not be strictly
8283 conforming to the allowed syntax for pragmas. The motivation
8284 for providing pragmas equivalent to the aspects is to allow a program
8285 to be written using the pragmas, and then compiled if necessary
8286 using an Ada compiler that does not recognize the pragmas or
8287 aspects, but is prepared to ignore the pragmas. The assertion
8288 policy that controls this pragma is @code{Type_Invariant'Class},
8289 not @code{Type_Invariant_Class}.
8291 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
8292 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{105}
8293 @section Pragma Unchecked_Union
8296 @geindex Unions in C
8298 Syntax:
8300 @example
8301 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
8302 @end example
8304 This pragma is used to specify a representation of a record type that is
8305 equivalent to a C union. It was introduced as a GNAT implementation defined
8306 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
8307 pragma, making it language defined, and GNAT fully implements this extended
8308 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
8309 details, consult the Ada 2012 Reference Manual, section B.3.3.
8311 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
8312 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{106}
8313 @section Pragma Unevaluated_Use_Of_Old
8316 @geindex Attribute Old
8318 @geindex Attribute Loop_Entry
8320 @geindex Unevaluated_Use_Of_Old
8322 Syntax:
8324 @example
8325 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
8326 @end example
8328 This pragma controls the processing of attributes Old and Loop_Entry.
8329 If either of these attributes is used in a potentially unevaluated
8330 expression  (e.g. the then or else parts of an if expression), then
8331 normally this usage is considered illegal if the prefix of the attribute
8332 is other than an entity name. The language requires this
8333 behavior for Old, and GNAT copies the same rule for Loop_Entry.
8335 The reason for this rule is that otherwise, we can have a situation
8336 where we save the Old value, and this results in an exception, even
8337 though we might not evaluate the attribute. Consider this example:
8339 @example
8340 package UnevalOld is
8341    K : Character;
8342    procedure U (A : String; C : Boolean)  -- ERROR
8343      with Post => (if C then A(1)'Old = K else True);
8344 end;
8345 @end example
8347 If procedure U is called with a string with a lower bound of 2, and
8348 C false, then an exception would be raised trying to evaluate A(1)
8349 on entry even though the value would not be actually used.
8351 Although the rule guarantees against this possibility, it is sometimes
8352 too restrictive. For example if we know that the string has a lower
8353 bound of 1, then we will never raise an exception.
8354 The pragma @code{Unevaluated_Use_Of_Old} can be
8355 used to modify this behavior. If the argument is @code{Error} then an
8356 error is given (this is the default RM behavior). If the argument is
8357 @code{Warn} then the usage is allowed as legal but with a warning
8358 that an exception might be raised. If the argument is @code{Allow}
8359 then the usage is allowed as legal without generating a warning.
8361 This pragma may appear as a configuration pragma, or in a declarative
8362 part or package specification. In the latter case it applies to
8363 uses up to the end of the corresponding statement sequence or
8364 sequence of package declarations.
8366 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
8367 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{107}
8368 @section Pragma Unimplemented_Unit
8371 Syntax:
8373 @example
8374 pragma Unimplemented_Unit;
8375 @end example
8377 If this pragma occurs in a unit that is processed by the compiler, GNAT
8378 aborts with the message @code{xxx not implemented}, where
8379 @code{xxx} is the name of the current compilation unit.  This pragma is
8380 intended to allow the compiler to handle unimplemented library units in
8381 a clean manner.
8383 The abort only happens if code is being generated.  Thus you can use
8384 specs of unimplemented packages in syntax or semantic checking mode.
8386 @node Pragma Universal_Aliasing,Pragma Unmodified,Pragma Unimplemented_Unit,Implementation Defined Pragmas
8387 @anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{108}@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{109}
8388 @section Pragma Universal_Aliasing
8391 Syntax:
8393 @example
8394 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
8395 @end example
8397 @code{type_LOCAL_NAME} must refer to a type declaration in the current
8398 declarative part.  The effect is to inhibit strict type-based aliasing
8399 optimization for the given type.  In other words, the effect is as though
8400 access types designating this type were subject to pragma No_Strict_Aliasing.
8401 For a detailed description of the strict aliasing optimization, and the
8402 situations in which it must be suppressed, see the section on
8403 @code{Optimization and Strict Aliasing} in the @cite{GNAT User’s Guide}.
8405 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Aliasing,Implementation Defined Pragmas
8406 @anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10a}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{10b}
8407 @section Pragma Unmodified
8410 @geindex Warnings
8411 @geindex unmodified
8413 Syntax:
8415 @example
8416 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8417 @end example
8419 This pragma signals that the assignable entities (variables,
8420 @code{out} parameters, @code{in out} parameters) whose names are listed are
8421 deliberately not assigned in the current source unit. This
8422 suppresses warnings about the
8423 entities being referenced but not assigned, and in addition a warning will be
8424 generated if one of these entities is in fact assigned in the
8425 same unit as the pragma (or in the corresponding body, or one
8426 of its subunits).
8428 This is particularly useful for clearly signaling that a particular
8429 parameter is not modified, even though the spec suggests that it might
8432 For the variable case, warnings are never given for unreferenced variables
8433 whose name contains one of the substrings
8434 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSE, TMP, TEMP} in any casing. Such names
8435 are typically to be used in cases where such warnings are expected.
8436 Thus it is never necessary to use @code{pragma Unmodified} for such
8437 variables, though it is harmless to do so.
8439 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8440 @anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{10c}@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{10d}
8441 @section Pragma Unreferenced
8444 @geindex Warnings
8445 @geindex unreferenced
8447 Syntax:
8449 @example
8450 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8451 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8452 @end example
8454 This pragma signals that the entities whose names are listed are
8455 deliberately not referenced in the current source unit after the
8456 occurrence of the pragma. This
8457 suppresses warnings about the
8458 entities being unreferenced, and in addition a warning will be
8459 generated if one of these entities is in fact subsequently referenced in the
8460 same unit as the pragma (or in the corresponding body, or one
8461 of its subunits).
8463 This is particularly useful for clearly signaling that a particular
8464 parameter is not referenced in some particular subprogram implementation
8465 and that this is deliberate. It can also be useful in the case of
8466 objects declared only for their initialization or finalization side
8467 effects.
8469 If @code{LOCAL_NAME} identifies more than one matching homonym in the
8470 current scope, then the entity most recently declared is the one to which
8471 the pragma applies. Note that in the case of accept formals, the pragma
8472 Unreferenced may appear immediately after the keyword @code{do} which
8473 allows the indication of whether or not accept formals are referenced
8474 or not to be given individually for each accept statement.
8476 The left hand side of an assignment does not count as a reference for the
8477 purpose of this pragma. Thus it is fine to assign to an entity for which
8478 pragma Unreferenced is given. However, use of an entity as an actual for
8479 an out parameter does count as a reference unless warnings for unread output
8480 parameters are enabled via @code{-gnatw.o}.
8482 Note that if a warning is desired for all calls to a given subprogram,
8483 regardless of whether they occur in the same unit as the subprogram
8484 declaration, then this pragma should not be used (calls from another
8485 unit would not be flagged); pragma Obsolescent can be used instead
8486 for this purpose, see @ref{af,,Pragma Obsolescent}.
8488 The second form of pragma @code{Unreferenced} is used within a context
8489 clause. In this case the arguments must be unit names of units previously
8490 mentioned in @code{with} clauses (similar to the usage of pragma
8491 @code{Elaborate_All}). The effect is to suppress warnings about unreferenced
8492 units and unreferenced entities within these units.
8494 For the variable case, warnings are never given for unreferenced variables
8495 whose name contains one of the substrings
8496 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8497 are typically to be used in cases where such warnings are expected.
8498 Thus it is never necessary to use @code{pragma Unreferenced} for such
8499 variables, though it is harmless to do so.
8501 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8502 @anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{10e}@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{10f}
8503 @section Pragma Unreferenced_Objects
8506 @geindex Warnings
8507 @geindex unreferenced
8509 Syntax:
8511 @example
8512 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8513 @end example
8515 This pragma signals that for the types or subtypes whose names are
8516 listed, objects which are declared with one of these types or subtypes may
8517 not be referenced, and if no references appear, no warnings are given.
8519 This is particularly useful for objects which are declared solely for their
8520 initialization and finalization effect. Such variables are sometimes referred
8521 to as RAII variables (Resource Acquisition Is Initialization). Using this
8522 pragma on the relevant type (most typically a limited controlled type), the
8523 compiler will automatically suppress unwanted warnings about these variables
8524 not being referenced.
8526 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8527 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{110}
8528 @section Pragma Unreserve_All_Interrupts
8531 Syntax:
8533 @example
8534 pragma Unreserve_All_Interrupts;
8535 @end example
8537 Normally certain interrupts are reserved to the implementation.  Any attempt
8538 to attach an interrupt causes Program_Error to be raised, as described in
8539 RM C.3.2(22).  A typical example is the @code{SIGINT} interrupt used in
8540 many systems for a @code{Ctrl-C} interrupt.  Normally this interrupt is
8541 reserved to the implementation, so that @code{Ctrl-C} can be used to
8542 interrupt execution.
8544 If the pragma @code{Unreserve_All_Interrupts} appears anywhere in any unit in
8545 a program, then all such interrupts are unreserved.  This allows the
8546 program to handle these interrupts, but disables their standard
8547 functions.  For example, if this pragma is used, then pressing
8548 @code{Ctrl-C} will not automatically interrupt execution.  However,
8549 a program can then handle the @code{SIGINT} interrupt as it chooses.
8551 For a full list of the interrupts handled in a specific implementation,
8552 see the source code for the spec of @code{Ada.Interrupts.Names} in
8553 file @code{a-intnam.ads}.  This is a target dependent file that contains the
8554 list of interrupts recognized for a given target.  The documentation in
8555 this file also specifies what interrupts are affected by the use of
8556 the @code{Unreserve_All_Interrupts} pragma.
8558 For a more general facility for controlling what interrupts can be
8559 handled, see pragma @code{Interrupt_State}, which subsumes the functionality
8560 of the @code{Unreserve_All_Interrupts} pragma.
8562 @node Pragma Unsuppress,Pragma Unused,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8563 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{111}
8564 @section Pragma Unsuppress
8567 Syntax:
8569 @example
8570 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8571 @end example
8573 This pragma undoes the effect of a previous pragma @code{Suppress}.  If
8574 there is no corresponding pragma @code{Suppress} in effect, it has no
8575 effect.  The range of the effect is the same as for pragma
8576 @code{Suppress}.  The meaning of the arguments is identical to that used
8577 in pragma @code{Suppress}.
8579 One important application is to ensure that checks are on in cases where
8580 code depends on the checks for its correct functioning, so that the code
8581 will compile correctly even if the compiler switches are set to suppress
8582 checks. For example, in a program that depends on external names of tagged
8583 types and wants to ensure that the duplicated tag check occurs even if all
8584 run-time checks are suppressed by a compiler switch, the following
8585 configuration pragma will ensure this test is not suppressed:
8587 @example
8588 pragma Unsuppress (Duplicated_Tag_Check);
8589 @end example
8591 This pragma is standard in Ada 2005. It is available in all earlier versions
8592 of Ada as an implementation-defined pragma.
8594 Note that in addition to the checks defined in the Ada RM, GNAT recognizes a
8595 number of implementation-defined check names. See the description of pragma
8596 @code{Suppress} for full details.
8598 @node Pragma Unused,Pragma Use_VADS_Size,Pragma Unsuppress,Implementation Defined Pragmas
8599 @anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{112}@anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{113}
8600 @section Pragma Unused
8603 @geindex Warnings
8604 @geindex unused
8606 Syntax:
8608 @example
8609 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8610 @end example
8612 This pragma signals that the assignable entities (variables,
8613 @code{out} parameters, and @code{in out} parameters) whose names are listed
8614 deliberately do not get assigned or referenced in the current source unit
8615 after the occurrence of the pragma in the current source unit. This
8616 suppresses warnings about the entities that are unreferenced and/or not
8617 assigned, and, in addition, a warning will be generated if one of these
8618 entities gets assigned or subsequently referenced in the same unit as the
8619 pragma (in the corresponding body or one of its subunits).
8621 This is particularly useful for clearly signaling that a particular
8622 parameter is not modified or referenced, even though the spec suggests
8623 that it might be.
8625 For the variable case, warnings are never given for unreferenced
8626 variables whose name contains one of the substrings
8627 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8628 are typically to be used in cases where such warnings are expected.
8629 Thus it is never necessary to use @code{pragma Unused} for such
8630 variables, though it is harmless to do so.
8632 @node Pragma Use_VADS_Size,Pragma Validity_Checks,Pragma Unused,Implementation Defined Pragmas
8633 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{114}
8634 @section Pragma Use_VADS_Size
8637 @geindex Size
8638 @geindex VADS compatibility
8640 @geindex Rational profile
8642 Syntax:
8644 @example
8645 pragma Use_VADS_Size;
8646 @end example
8648 This is a configuration pragma.  In a unit to which it applies, any use
8649 of the ‘Size attribute is automatically interpreted as a use of the
8650 ‘VADS_Size attribute.  Note that this may result in incorrect semantic
8651 processing of valid Ada 95 or Ada 2005 programs.  This is intended to aid in
8652 the handling of existing code which depends on the interpretation of Size
8653 as implemented in the VADS compiler.  See description of the VADS_Size
8654 attribute for further details.
8656 @node Pragma Validity_Checks,Pragma Volatile,Pragma Use_VADS_Size,Implementation Defined Pragmas
8657 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{115}
8658 @section Pragma Validity_Checks
8661 Syntax:
8663 @example
8664 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8665 @end example
8667 This pragma is used in conjunction with compiler switches to control the
8668 built-in validity checking provided by GNAT.  The compiler switches, if set
8669 provide an initial setting for the switches, and this pragma may be used
8670 to modify these settings, or the settings may be provided entirely by
8671 the use of the pragma.  This pragma can be used anywhere that a pragma
8672 is legal, including use as a configuration pragma (including use in
8673 the @code{gnat.adc} file).
8675 The form with a string literal specifies which validity options are to be
8676 activated.  The validity checks are first set to include only the default
8677 reference manual settings, and then a string of letters in the string
8678 specifies the exact set of options required.  The form of this string
8679 is exactly as described for the `-gnatVx' compiler switch (see the
8680 GNAT User’s Guide for details).  For example the following two
8681 methods can be used to enable validity checking for mode @code{in} and
8682 @code{in out} subprogram parameters:
8685 @itemize *
8687 @item 
8688 @example
8689 pragma Validity_Checks ("im");
8690 @end example
8692 @item 
8693 @example
8694 $ gcc -c -gnatVim ...
8695 @end example
8696 @end itemize
8698 The form ALL_CHECKS activates all standard checks (its use is equivalent
8699 to the use of the @code{gnatVa} switch).
8701 The forms with @code{Off} and @code{On} can be used to temporarily disable
8702 validity checks as shown in the following example:
8704 @example
8705 pragma Validity_Checks ("c"); -- validity checks for copies
8706 pragma Validity_Checks (Off); -- turn off validity checks
8707 A := B;                       -- B will not be validity checked
8708 pragma Validity_Checks (On);  -- turn validity checks back on
8709 A := C;                       -- C will be validity checked
8710 @end example
8712 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8713 @anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{116}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{117}
8714 @section Pragma Volatile
8717 Syntax:
8719 @example
8720 pragma Volatile (LOCAL_NAME);
8721 @end example
8723 This pragma is defined by the Ada Reference Manual, and the GNAT
8724 implementation is fully conformant with this definition.  The reason it
8725 is mentioned in this section is that a pragma of the same name was supplied
8726 in some Ada 83 compilers, including DEC Ada 83.  The Ada 95 / Ada 2005
8727 implementation of pragma Volatile is upwards compatible with the
8728 implementation in DEC Ada 83.
8730 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8731 @anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{118}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{119}
8732 @section Pragma Volatile_Full_Access
8735 Syntax:
8737 @example
8738 pragma Volatile_Full_Access (LOCAL_NAME);
8739 @end example
8741 This is similar in effect to pragma Volatile, except that any reference to the
8742 object is guaranteed to be done only with instructions that read or write all
8743 the bits of the object. Furthermore, if the object is of a composite type,
8744 then any reference to a subcomponent of the object is guaranteed to read
8745 and/or write all the bits of the object.
8747 The intention is that this be suitable for use with memory-mapped I/O devices
8748 on some machines. Note that there are two important respects in which this is
8749 different from @code{pragma Atomic}. First a reference to a @code{Volatile_Full_Access}
8750 object is not a sequential action in the RM 9.10 sense and, therefore, does
8751 not create a synchronization point. Second, in the case of @code{pragma Atomic},
8752 there is no guarantee that all the bits will be accessed if the reference
8753 is not to the whole object; the compiler is allowed (and generally will)
8754 access only part of the object in this case.
8756 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8757 @anchor{gnat_rm/implementation_defined_pragmas id56}@anchor{11a}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{11b}
8758 @section Pragma Volatile_Function
8761 Syntax:
8763 @example
8764 pragma Volatile_Function [ (static_boolean_EXPRESSION) ];
8765 @end example
8767 For the semantics of this pragma, see the entry for aspect @code{Volatile_Function}
8768 in the SPARK 2014 Reference Manual, section 7.1.2.
8770 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
8771 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{11c}
8772 @section Pragma Warning_As_Error
8775 Syntax:
8777 @example
8778 pragma Warning_As_Error (static_string_EXPRESSION);
8779 @end example
8781 This configuration pragma allows the programmer to specify a set
8782 of warnings that will be treated as errors. Any warning that
8783 matches the pattern given by the pragma argument will be treated
8784 as an error. This gives more precise control than -gnatwe,
8785 which treats warnings as errors.
8787 This pragma can apply to regular warnings (messages enabled by -gnatw)
8788 and to style warnings (messages that start with “(style)”,
8789 enabled by -gnaty).
8791 The pattern may contain asterisks, which match zero or more characters
8792 in the message. For example, you can use @code{pragma Warning_As_Error
8793 ("bits of*unused")} to treat the warning message @code{warning: 960 bits of
8794 "a" unused} as an error. All characters other than asterisk are treated
8795 as literal characters in the match. The match is case insensitive; for
8796 example XYZ matches xyz.
8798 Note that the pattern matches if it occurs anywhere within the warning
8799 message string (it is not necessary to put an asterisk at the start and
8800 the end of the message, since this is implied).
8802 Another possibility for the static_string_EXPRESSION which works whether
8803 or not error tags are enabled (`-gnatw.d') is to use a single
8804 `-gnatw' tag string, enclosed in brackets,
8805 as shown in the example below, to treat one category of warnings as errors.
8806 Note that if you want to treat multiple categories of warnings as errors,
8807 you can use multiple pragma Warning_As_Error.
8809 The above use of patterns to match the message applies only to warning
8810 messages generated by the front end. This pragma can also be applied to
8811 warnings provided by the back end and mentioned in @ref{11d,,Pragma Warnings}.
8812 By using a single full `-Wxxx' switch in the pragma, such warnings
8813 can also be treated as errors.
8815 The pragma can appear either in a global configuration pragma file
8816 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
8817 configuration pragma file containing:
8819 @example
8820 pragma Warning_As_Error ("[-gnatwj]");
8821 @end example
8823 which will treat all obsolescent feature warnings as errors, the
8824 following program compiles as shown (compile options here are
8825 `-gnatwa.d -gnatl -gnatj55').
8827 @example
8828     1. pragma Warning_As_Error ("*never assigned*");
8829     2. function Warnerr return String is
8830     3.    X : Integer;
8831           |
8832        >>> error: variable "X" is never read and
8833            never assigned [-gnatwv] [warning-as-error]
8835     4.    Y : Integer;
8836           |
8837        >>> warning: variable "Y" is assigned but
8838            never read [-gnatwu]
8840     5. begin
8841     6.    Y := 0;
8842     7.    return %ABC%;
8843                  |
8844        >>> error: use of "%" is an obsolescent
8845            feature (RM J.2(4)), use """ instead
8846            [-gnatwj] [warning-as-error]
8848     8. end;
8850 8 lines: No errors, 3 warnings (2 treated as errors)
8851 @end example
8853 Note that this pragma does not affect the set of warnings issued in
8854 any way, it merely changes the effect of a matching warning if one
8855 is produced as a result of other warnings options. As shown in this
8856 example, if the pragma results in a warning being treated as an error,
8857 the tag is changed from “warning:” to “error:” and the string
8858 “[warning-as-error]” is appended to the end of the message.
8860 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
8861 @anchor{gnat_rm/implementation_defined_pragmas id57}@anchor{11e}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{11d}
8862 @section Pragma Warnings
8865 Syntax:
8867 @example
8868 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
8870 DETAILS ::= On | Off
8871 DETAILS ::= On | Off, local_NAME
8872 DETAILS ::= static_string_EXPRESSION
8873 DETAILS ::= On | Off, static_string_EXPRESSION
8875 TOOL_NAME ::= GNAT | GNATprove
8877 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
8878 @end example
8880 Note: in Ada 83 mode, a string literal may be used in place of a static string
8881 expression (which does not exist in Ada 83).
8883 Note if the second argument of @code{DETAILS} is a @code{local_NAME} then the
8884 second form is always understood. If the intention is to use
8885 the fourth form, then you can write @code{NAME & ""} to force the
8886 interpretation as a `static_string_EXPRESSION'.
8888 Note: if the first argument is a valid @code{TOOL_NAME}, it will be interpreted
8889 that way. The use of the @code{TOOL_NAME} argument is relevant only to users
8890 of SPARK and GNATprove, see last part of this section for details.
8892 Normally warnings are enabled, with the output being controlled by
8893 the command line switch.  Warnings (@code{Off}) turns off generation of
8894 warnings until a Warnings (@code{On}) is encountered or the end of the
8895 current unit.  If generation of warnings is turned off using this
8896 pragma, then some or all of the warning messages are suppressed,
8897 regardless of the setting of the command line switches.
8899 The @code{Reason} parameter may optionally appear as the last argument
8900 in any of the forms of this pragma. It is intended purely for the
8901 purposes of documenting the reason for the @code{Warnings} pragma.
8902 The compiler will check that the argument is a static string but
8903 otherwise ignore this argument. Other tools may provide specialized
8904 processing for this string.
8906 The form with a single argument (or two arguments if Reason present),
8907 where the first argument is @code{ON} or @code{OFF}
8908 may be used as a configuration pragma.
8910 If the @code{LOCAL_NAME} parameter is present, warnings are suppressed for
8911 the specified entity.  This suppression is effective from the point where
8912 it occurs till the end of the extended scope of the variable (similar to
8913 the scope of @code{Suppress}). This form cannot be used as a configuration
8914 pragma.
8916 In the case where the first argument is other than @code{ON} or
8917 @code{OFF},
8918 the third form with a single static_string_EXPRESSION argument (and possible
8919 reason) provides more precise
8920 control over which warnings are active. The string is a list of letters
8921 specifying which warnings are to be activated and which deactivated. The
8922 code for these letters is the same as the string used in the command
8923 line switch controlling warnings. For a brief summary, use the gnatmake
8924 command with no arguments, which will generate usage information containing
8925 the list of warnings switches supported. For
8926 full details see the section on @code{Warning Message Control} in the
8927 @cite{GNAT User’s Guide}.
8928 This form can also be used as a configuration pragma.
8930 The warnings controlled by the @code{-gnatw} switch are generated by the
8931 front end of the compiler. The GCC back end can provide additional warnings
8932 and they are controlled by the @code{-W} switch. Such warnings can be
8933 identified by the appearance of a string of the form @code{[-W@{xxx@}]} in the
8934 message which designates the @code{-W`xxx'} switch that controls the message.
8935 The form with a single `static_string_EXPRESSION' argument also works for these
8936 warnings, but the string must be a single full @code{-W`xxx'} switch in this
8937 case. The above reference lists a few examples of these additional warnings.
8939 The specified warnings will be in effect until the end of the program
8940 or another pragma @code{Warnings} is encountered. The effect of the pragma is
8941 cumulative. Initially the set of warnings is the standard default set
8942 as possibly modified by compiler switches. Then each pragma Warning
8943 modifies this set of warnings as specified. This form of the pragma may
8944 also be used as a configuration pragma.
8946 The fourth form, with an @code{On|Off} parameter and a string, is used to
8947 control individual messages, based on their text. The string argument
8948 is a pattern that is used to match against the text of individual
8949 warning messages (not including the initial “warning: ” tag).
8951 The pattern may contain asterisks, which match zero or more characters in
8952 the message. For example, you can use
8953 @code{pragma Warnings (Off, "bits of*unused")} to suppress the warning
8954 message @code{warning: 960 bits of "a" unused}. No other regular
8955 expression notations are permitted. All characters other than asterisk in
8956 these three specific cases are treated as literal characters in the match.
8957 The match is case insensitive, for example XYZ matches xyz.
8959 Note that the pattern matches if it occurs anywhere within the warning
8960 message string (it is not necessary to put an asterisk at the start and
8961 the end of the message, since this is implied).
8963 The above use of patterns to match the message applies only to warning
8964 messages generated by the front end. This form of the pragma with a string
8965 argument can also be used to control warnings provided by the back end and
8966 mentioned above. By using a single full @code{-W`xxx'} switch in the pragma,
8967 such warnings can be turned on and off.
8969 There are two ways to use the pragma in this form. The OFF form can be used
8970 as a configuration pragma. The effect is to suppress all warnings (if any)
8971 that match the pattern string throughout the compilation (or match the
8972 -W switch in the back end case).
8974 The second usage is to suppress a warning locally, and in this case, two
8975 pragmas must appear in sequence:
8977 @example
8978 pragma Warnings (Off, Pattern);
8979 ... code where given warning is to be suppressed
8980 pragma Warnings (On, Pattern);
8981 @end example
8983 In this usage, the pattern string must match in the Off and On
8984 pragmas, and (if `-gnatw.w' is given) at least one matching
8985 warning must be suppressed.
8987 Note: if the ON form is not found, then the effect of the OFF form extends
8988 until the end of the file (pragma Warnings is purely textual, so its effect
8989 does not stop at the end of the enclosing scope).
8991 Note: to write a string that will match any warning, use the string
8992 @code{"***"}. It will not work to use a single asterisk or two
8993 asterisks since this looks like an operator name. This form with three
8994 asterisks is similar in effect to specifying @code{pragma Warnings (Off)} except (if @code{-gnatw.w} is given) that a matching
8995 @code{pragma Warnings (On, "***")} will be required. This can be
8996 helpful in avoiding forgetting to turn warnings back on.
8998 Note: the debug flag @code{-gnatd.i} can be
8999 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
9000 be useful in checking whether obsolete pragmas in existing programs are hiding
9001 real problems.
9003 Note: pragma Warnings does not affect the processing of style messages. See
9004 separate entry for pragma Style_Checks for control of style messages.
9006 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
9007 use the version of the pragma with a @code{TOOL_NAME} parameter.
9009 If present, @code{TOOL_NAME} is the name of a tool, currently either @code{GNAT} for the
9010 compiler or @code{GNATprove} for the formal verification tool. A given tool only
9011 takes into account pragma Warnings that do not specify a tool name, or that
9012 specify the matching tool name. This makes it possible to disable warnings
9013 selectively for each tool, and as a consequence to detect useless pragma
9014 Warnings with switch @code{-gnatw.w}.
9016 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
9017 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{11f}
9018 @section Pragma Weak_External
9021 Syntax:
9023 @example
9024 pragma Weak_External ([Entity =>] LOCAL_NAME);
9025 @end example
9027 @code{LOCAL_NAME} must refer to an object that is declared at the library
9028 level. This pragma specifies that the given entity should be marked as a
9029 weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
9030 in GNU C and causes @code{LOCAL_NAME} to be emitted as a weak symbol instead
9031 of a regular symbol, that is to say a symbol that does not have to be
9032 resolved by the linker if used in conjunction with a pragma Import.
9034 When a weak symbol is not resolved by the linker, its address is set to
9035 zero. This is useful in writing interfaces to external modules that may
9036 or may not be linked in the final executable, for example depending on
9037 configuration settings.
9039 If a program references at run time an entity to which this pragma has been
9040 applied, and the corresponding symbol was not resolved at link time, then
9041 the execution of the program is erroneous. It is not erroneous to take the
9042 Address of such an entity, for example to guard potential references,
9043 as shown in the example below.
9045 Some file formats do not support weak symbols so not all target machines
9046 support this pragma.
9048 @example
9049 --  Example of the use of pragma Weak_External
9051 package External_Module is
9052   key : Integer;
9053   pragma Import (C, key);
9054   pragma Weak_External (key);
9055   function Present return boolean;
9056 end External_Module;
9058 with System; use System;
9059 package body External_Module is
9060   function Present return boolean is
9061   begin
9062     return key'Address /= System.Null_Address;
9063   end Present;
9064 end External_Module;
9065 @end example
9067 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
9068 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{120}
9069 @section Pragma Wide_Character_Encoding
9072 Syntax:
9074 @example
9075 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
9076 @end example
9078 This pragma specifies the wide character encoding to be used in program
9079 source text appearing subsequently. It is a configuration pragma, but may
9080 also be used at any point that a pragma is allowed, and it is permissible
9081 to have more than one such pragma in a file, allowing multiple encodings
9082 to appear within the same file.
9084 However, note that the pragma cannot immediately precede the relevant
9085 wide character, because then the previous encoding will still be in
9086 effect, causing “illegal character” errors.
9088 The argument can be an identifier or a character literal. In the identifier
9089 case, it is one of @code{HEX}, @code{UPPER}, @code{SHIFT_JIS},
9090 @code{EUC}, @code{UTF8}, or @code{BRACKETS}. In the character literal
9091 case it is correspondingly one of the characters @code{h}, @code{u},
9092 @code{s}, @code{e}, @code{8}, or @code{b}.
9094 Note that when the pragma is used within a file, it affects only the
9095 encoding within that file, and does not affect withed units, specs,
9096 or subunits.
9098 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
9099 @anchor{gnat_rm/implementation_defined_aspects doc}@anchor{121}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{122}@anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{123}
9100 @chapter Implementation Defined Aspects
9103 Ada defines (throughout the Ada 2012 reference manual, summarized
9104 in Annex K) a set of aspects that can be specified for certain entities.
9105 These language defined aspects are implemented in GNAT in Ada 2012 mode
9106 and work as described in the Ada 2012 Reference Manual.
9108 In addition, Ada 2012 allows implementations to define additional aspects
9109 whose meaning is defined by the implementation.  GNAT provides
9110 a number of these implementation-defined aspects which can be used
9111 to extend and enhance the functionality of the compiler.  This section of
9112 the GNAT reference manual describes these additional aspects.
9114 Note that any program using these aspects may not be portable to
9115 other compilers (although GNAT implements this set of aspects on all
9116 platforms).  Therefore if portability to other compilers is an important
9117 consideration, you should minimize the use of these aspects.
9119 Note that for many of these aspects, the effect is essentially similar
9120 to the use of a pragma or attribute specification with the same name
9121 applied to the entity. For example, if we write:
9123 @example
9124 type R is range 1 .. 100
9125   with Value_Size => 10;
9126 @end example
9128 then the effect is the same as:
9130 @example
9131 type R is range 1 .. 100;
9132 for R'Value_Size use 10;
9133 @end example
9135 and if we write:
9137 @example
9138 type R is new Integer
9139   with Shared => True;
9140 @end example
9142 then the effect is the same as:
9144 @example
9145 type R is new Integer;
9146 pragma Shared (R);
9147 @end example
9149 In the documentation below, such cases are simply marked
9150 as being boolean aspects equivalent to the corresponding pragma
9151 or attribute definition clause.
9153 @menu
9154 * Aspect Abstract_State:: 
9155 * Aspect Annotate:: 
9156 * Aspect Async_Readers:: 
9157 * Aspect Async_Writers:: 
9158 * Aspect Constant_After_Elaboration:: 
9159 * Aspect Contract_Cases:: 
9160 * Aspect Depends:: 
9161 * Aspect Default_Initial_Condition:: 
9162 * Aspect Dimension:: 
9163 * Aspect Dimension_System:: 
9164 * Aspect Disable_Controlled:: 
9165 * Aspect Effective_Reads:: 
9166 * Aspect Effective_Writes:: 
9167 * Aspect Extensions_Visible:: 
9168 * Aspect Favor_Top_Level:: 
9169 * Aspect Ghost:: 
9170 * Aspect Ghost_Predicate:: 
9171 * Aspect Global:: 
9172 * Aspect Initial_Condition:: 
9173 * Aspect Initializes:: 
9174 * Aspect Inline_Always:: 
9175 * Aspect Invariant:: 
9176 * Aspect Invariant’Class:: 
9177 * Aspect Iterable:: 
9178 * Aspect Linker_Section:: 
9179 * Aspect Lock_Free:: 
9180 * Aspect Max_Queue_Length:: 
9181 * Aspect No_Caching:: 
9182 * Aspect No_Elaboration_Code_All:: 
9183 * Aspect No_Inline:: 
9184 * Aspect No_Tagged_Streams:: 
9185 * Aspect No_Task_Parts:: 
9186 * Aspect Object_Size:: 
9187 * Aspect Obsolescent:: 
9188 * Aspect Part_Of:: 
9189 * Aspect Persistent_BSS:: 
9190 * Aspect Predicate:: 
9191 * Aspect Pure_Function:: 
9192 * Aspect Refined_Depends:: 
9193 * Aspect Refined_Global:: 
9194 * Aspect Refined_Post:: 
9195 * Aspect Refined_State:: 
9196 * Aspect Relaxed_Initialization:: 
9197 * Aspect Remote_Access_Type:: 
9198 * Aspect Secondary_Stack_Size:: 
9199 * Aspect Scalar_Storage_Order:: 
9200 * Aspect Shared:: 
9201 * Aspect Simple_Storage_Pool:: 
9202 * Aspect Simple_Storage_Pool_Type:: 
9203 * Aspect SPARK_Mode:: 
9204 * Aspect Suppress_Debug_Info:: 
9205 * Aspect Suppress_Initialization:: 
9206 * Aspect Test_Case:: 
9207 * Aspect Thread_Local_Storage:: 
9208 * Aspect Universal_Aliasing:: 
9209 * Aspect Unmodified:: 
9210 * Aspect Unreferenced:: 
9211 * Aspect Unreferenced_Objects:: 
9212 * Aspect Value_Size:: 
9213 * Aspect Volatile_Full_Access:: 
9214 * Aspect Volatile_Function:: 
9215 * Aspect Warnings:: 
9217 @end menu
9219 @node Aspect Abstract_State,Aspect Annotate,,Implementation Defined Aspects
9220 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{124}
9221 @section Aspect Abstract_State
9224 @geindex Abstract_State
9226 This aspect is equivalent to @ref{1e,,pragma Abstract_State}.
9228 @node Aspect Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
9229 @anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{125}
9230 @section Aspect Annotate
9233 @geindex Annotate
9235 There are three forms of this aspect (where ID is an identifier,
9236 and ARG is a general expression),
9237 corresponding to @ref{29,,pragma Annotate}.
9240 @table @asis
9242 @item `Annotate => ID'
9244 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9246 @item `Annotate => (ID)'
9248 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9250 @item `Annotate => (ID ,ID @{, ARG@})'
9252 Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
9253 @end table
9255 @node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
9256 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{126}
9257 @section Aspect Async_Readers
9260 @geindex Async_Readers
9262 This boolean aspect is equivalent to @ref{30,,pragma Async_Readers}.
9264 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
9265 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{127}
9266 @section Aspect Async_Writers
9269 @geindex Async_Writers
9271 This boolean aspect is equivalent to @ref{32,,pragma Async_Writers}.
9273 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
9274 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{128}
9275 @section Aspect Constant_After_Elaboration
9278 @geindex Constant_After_Elaboration
9280 This aspect is equivalent to @ref{42,,pragma Constant_After_Elaboration}.
9282 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
9283 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{129}
9284 @section Aspect Contract_Cases
9287 @geindex Contract_Cases
9289 This aspect is equivalent to @ref{44,,pragma Contract_Cases}, the sequence
9290 of clauses being enclosed in parentheses so that syntactically it is an
9291 aggregate.
9293 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
9294 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{12a}
9295 @section Aspect Depends
9298 @geindex Depends
9300 This aspect is equivalent to @ref{54,,pragma Depends}.
9302 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
9303 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{12b}
9304 @section Aspect Default_Initial_Condition
9307 @geindex Default_Initial_Condition
9309 This aspect is equivalent to @ref{50,,pragma Default_Initial_Condition}.
9311 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
9312 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{12c}
9313 @section Aspect Dimension
9316 @geindex Dimension
9318 The @code{Dimension} aspect is used to specify the dimensions of a given
9319 subtype of a dimensioned numeric type. The aspect also specifies a symbol
9320 used when doing formatted output of dimensioned quantities. The syntax is:
9322 @example
9323 with Dimension =>
9324   ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
9326 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
9328 DIMENSION_VALUE ::=
9329   RATIONAL
9330 | others               => RATIONAL
9331 | DISCRETE_CHOICE_LIST => RATIONAL
9333 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
9334 @end example
9336 This aspect can only be applied to a subtype whose parent type has
9337 a @code{Dimension_System} aspect. The aspect must specify values for
9338 all dimensions of the system. The rational values are the powers of the
9339 corresponding dimensions that are used by the compiler to verify that
9340 physical (numeric) computations are dimensionally consistent. For example,
9341 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
9342 For further examples of the usage
9343 of this aspect, see package @code{System.Dim.Mks}.
9344 Note that when the dimensioned type is an integer type, then any
9345 dimension value must be an integer literal.
9347 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
9348 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{12d}
9349 @section Aspect Dimension_System
9352 @geindex Dimension_System
9354 The @code{Dimension_System} aspect is used to define a system of
9355 dimensions that will be used in subsequent subtype declarations with
9356 @code{Dimension} aspects that reference this system. The syntax is:
9358 @example
9359 with Dimension_System => (DIMENSION @{, DIMENSION@});
9361 DIMENSION ::= ([Unit_Name   =>] IDENTIFIER,
9362                [Unit_Symbol =>] SYMBOL,
9363                [Dim_Symbol  =>] SYMBOL)
9365 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
9366 @end example
9368 This aspect is applied to a type, which must be a numeric derived type
9369 (typically a floating-point type), that
9370 will represent values within the dimension system. Each @code{DIMENSION}
9371 corresponds to one particular dimension. A maximum of 7 dimensions may
9372 be specified. @code{Unit_Name} is the name of the dimension (for example
9373 @code{Meter}). @code{Unit_Symbol} is the shorthand used for quantities
9374 of this dimension (for example @code{m} for @code{Meter}).
9375 @code{Dim_Symbol} gives
9376 the identification within the dimension system (typically this is a
9377 single letter, e.g. @code{L} standing for length for unit name @code{Meter}).
9378 The @code{Unit_Symbol} is used in formatted output of dimensioned quantities.
9379 The @code{Dim_Symbol} is used in error messages when numeric operations have
9380 inconsistent dimensions.
9382 GNAT provides the standard definition of the International MKS system in
9383 the run-time package @code{System.Dim.Mks}. You can easily define
9384 similar packages for cgs units or British units, and define conversion factors
9385 between values in different systems. The MKS system is characterized by the
9386 following aspect:
9388 @example
9389 type Mks_Type is new Long_Long_Float with
9390   Dimension_System => (
9391     (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
9392     (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
9393     (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
9394     (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
9395     (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => '@@'),
9396     (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
9397     (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
9398 @end example
9400 Note that in the above type definition, we use the @code{at} symbol (@code{@@}) to
9401 represent a theta character (avoiding the use of extended Latin-1
9402 characters in this context).
9404 See section ‘Performing Dimensionality Analysis in GNAT’ in the GNAT Users
9405 Guide for detailed examples of use of the dimension system.
9407 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
9408 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{12e}
9409 @section Aspect Disable_Controlled
9412 @geindex Disable_Controlled
9414 The aspect  @code{Disable_Controlled} is defined for controlled record types. If
9415 active, this aspect causes suppression of all related calls to @code{Initialize},
9416 @code{Adjust}, and @code{Finalize}. The intended use is for conditional compilation,
9417 where for example you might want a record to be controlled or not depending on
9418 whether some run-time check is enabled or suppressed.
9420 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9421 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{12f}
9422 @section Aspect Effective_Reads
9425 @geindex Effective_Reads
9427 This aspect is equivalent to @ref{59,,pragma Effective_Reads}.
9429 @node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
9430 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{130}
9431 @section Aspect Effective_Writes
9434 @geindex Effective_Writes
9436 This aspect is equivalent to @ref{5b,,pragma Effective_Writes}.
9438 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
9439 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{131}
9440 @section Aspect Extensions_Visible
9443 @geindex Extensions_Visible
9445 This aspect is equivalent to @ref{69,,pragma Extensions_Visible}.
9447 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9448 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{132}
9449 @section Aspect Favor_Top_Level
9452 @geindex Favor_Top_Level
9454 This boolean aspect is equivalent to @ref{6e,,pragma Favor_Top_Level}.
9456 @node Aspect Ghost,Aspect Ghost_Predicate,Aspect Favor_Top_Level,Implementation Defined Aspects
9457 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{133}
9458 @section Aspect Ghost
9461 @geindex Ghost
9463 This aspect is equivalent to @ref{72,,pragma Ghost}.
9465 @node Aspect Ghost_Predicate,Aspect Global,Aspect Ghost,Implementation Defined Aspects
9466 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost-predicate}@anchor{134}
9467 @section Aspect Ghost_Predicate
9470 @geindex Ghost_Predicate
9472 This aspect introduces a subtype predicate that can reference ghost
9473 entities. The subtype cannot appear as a subtype_mark in a membership test.
9475 For the detailed semantics of this aspect, see the entry for subtype predicates
9476 in the SPARK Reference Manual, section 3.2.4.
9478 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost_Predicate,Implementation Defined Aspects
9479 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{135}
9480 @section Aspect Global
9483 @geindex Global
9485 This aspect is equivalent to @ref{74,,pragma Global}.
9487 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9488 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{136}
9489 @section Aspect Initial_Condition
9492 @geindex Initial_Condition
9494 This aspect is equivalent to @ref{81,,pragma Initial_Condition}.
9496 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9497 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{137}
9498 @section Aspect Initializes
9501 @geindex Initializes
9503 This aspect is equivalent to @ref{84,,pragma Initializes}.
9505 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9506 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{138}
9507 @section Aspect Inline_Always
9510 @geindex Inline_Always
9512 This boolean aspect is equivalent to @ref{86,,pragma Inline_Always}.
9514 @node Aspect Invariant,Aspect Invariant’Class,Aspect Inline_Always,Implementation Defined Aspects
9515 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{139}
9516 @section Aspect Invariant
9519 @geindex Invariant
9521 This aspect is equivalent to @ref{8d,,pragma Invariant}. It is a
9522 synonym for the language defined aspect @code{Type_Invariant} except
9523 that it is separately controllable using pragma @code{Assertion_Policy}.
9525 @node Aspect Invariant’Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9526 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{13a}
9527 @section Aspect Invariant’Class
9530 @geindex Invariant'Class
9532 This aspect is equivalent to @ref{104,,pragma Type_Invariant_Class}. It is a
9533 synonym for the language defined aspect @code{Type_Invariant'Class} except
9534 that it is separately controllable using pragma @code{Assertion_Policy}.
9536 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant’Class,Implementation Defined Aspects
9537 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{13b}
9538 @section Aspect Iterable
9541 @geindex Iterable
9543 This aspect provides a light-weight mechanism for loops and quantified
9544 expressions over container types, without the overhead imposed by the tampering
9545 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9546 with six named components, of which the last three are optional: @code{First},
9547 @code{Next}, @code{Has_Element}, @code{Element}, @code{Last}, and @code{Previous}.
9548 When only the first three components are specified, only the
9549 @code{for .. in} form of iteration over cursors is available. When @code{Element}
9550 is specified, both this form and the @code{for .. of} form of iteration over
9551 elements are available. If the last two components are specified, reverse
9552 iterations over the container can be specified (analogous to what can be done
9553 over predefined containers that support the @code{Reverse_Iterator} interface).
9554 The following is a typical example of use:
9556 @example
9557 type List is private with
9558     Iterable => (First       => First_Cursor,
9559                  Next        => Advance,
9560                  Has_Element => Cursor_Has_Element
9561                [,Element     => Get_Element]
9562                [,Last        => Last_Cursor]
9563                [,Previous    => Retreat]);
9564 @end example
9567 @itemize *
9569 @item 
9570 The values of @code{First} and @code{Last} are primitive operations of the
9571 container type that return a @code{Cursor}, which must be a type declared in
9572 the container package or visible from it. For example:
9573 @end itemize
9575 @example
9576 function First_Cursor (Cont : Container) return Cursor;
9577 function Last_Cursor  (Cont : Container) return Cursor;
9578 @end example
9581 @itemize *
9583 @item 
9584 The values of @code{Next} and @code{Previous} are primitive operations of the container type that take
9585 both a container and a cursor and yield a cursor. For example:
9586 @end itemize
9588 @example
9589 function Advance (Cont : Container; Position : Cursor) return Cursor;
9590 function Retreat (Cont : Container; Position : Cursor) return Cursor;
9591 @end example
9594 @itemize *
9596 @item 
9597 The value of @code{Has_Element} is a primitive operation of the container type
9598 that takes both a container and a cursor and yields a boolean. For example:
9599 @end itemize
9601 @example
9602 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9603 @end example
9606 @itemize *
9608 @item 
9609 The value of @code{Element} is a primitive operation of the container type that
9610 takes both a container and a cursor and yields an @code{Element_Type}, which must
9611 be a type declared in the container package or visible from it. For example:
9612 @end itemize
9614 @example
9615 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9616 @end example
9618 This aspect is used in the GNAT-defined formal container packages.
9620 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
9621 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{13c}
9622 @section Aspect Linker_Section
9625 @geindex Linker_Section
9627 This aspect is equivalent to @ref{95,,pragma Linker_Section}.
9629 @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects
9630 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{13d}
9631 @section Aspect Lock_Free
9634 @geindex Lock_Free
9636 This boolean aspect is equivalent to @ref{97,,pragma Lock_Free}.
9638 @node Aspect Max_Queue_Length,Aspect No_Caching,Aspect Lock_Free,Implementation Defined Aspects
9639 @anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{13e}
9640 @section Aspect Max_Queue_Length
9643 @geindex Max_Queue_Length
9645 This aspect is equivalent to @ref{9f,,pragma Max_Queue_Length}.
9647 @node Aspect No_Caching,Aspect No_Elaboration_Code_All,Aspect Max_Queue_Length,Implementation Defined Aspects
9648 @anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{13f}
9649 @section Aspect No_Caching
9652 @geindex No_Caching
9654 This boolean aspect is equivalent to @ref{a2,,pragma No_Caching}.
9656 @node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect No_Caching,Implementation Defined Aspects
9657 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{140}
9658 @section Aspect No_Elaboration_Code_All
9661 @geindex No_Elaboration_Code_All
9663 This aspect is equivalent to @ref{a5,,pragma No_Elaboration_Code_All}
9664 for a program unit.
9666 @node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9667 @anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{141}
9668 @section Aspect No_Inline
9671 @geindex No_Inline
9673 This boolean aspect is equivalent to @ref{a8,,pragma No_Inline}.
9675 @node Aspect No_Tagged_Streams,Aspect No_Task_Parts,Aspect No_Inline,Implementation Defined Aspects
9676 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{142}
9677 @section Aspect No_Tagged_Streams
9680 @geindex No_Tagged_Streams
9682 This aspect is equivalent to @ref{ac,,pragma No_Tagged_Streams} with an
9683 argument specifying a root tagged type (thus this aspect can only be
9684 applied to such a type).
9686 @node Aspect No_Task_Parts,Aspect Object_Size,Aspect No_Tagged_Streams,Implementation Defined Aspects
9687 @anchor{gnat_rm/implementation_defined_aspects aspect-no-task-parts}@anchor{143}
9688 @section Aspect No_Task_Parts
9691 @geindex No_Task_Parts
9693 Applies to a type. If True, requires that the type and any descendants
9694 do not have any task parts. The rules for this aspect are the same as
9695 for the language-defined No_Controlled_Parts aspect (see RM-H.4.1),
9696 replacing “controlled” with “task”.
9698 If No_Task_Parts is True for a type T, then the compiler can optimize
9699 away certain tasking-related code that would otherwise be needed
9700 for T’Class, because descendants of T might contain tasks.
9702 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Task_Parts,Implementation Defined Aspects
9703 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{144}
9704 @section Aspect Object_Size
9707 @geindex Object_Size
9709 This aspect is equivalent to @ref{145,,attribute Object_Size}.
9711 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9712 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{146}
9713 @section Aspect Obsolescent
9716 @geindex Obsolescent
9718 This aspect is equivalent to @ref{af,,pragma Obsolescent}. Note that the
9719 evaluation of this aspect happens at the point of occurrence, it is not
9720 delayed until the freeze point.
9722 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9723 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{147}
9724 @section Aspect Part_Of
9727 @geindex Part_Of
9729 This aspect is equivalent to @ref{b5,,pragma Part_Of}.
9731 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9732 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{148}
9733 @section Aspect Persistent_BSS
9736 @geindex Persistent_BSS
9738 This boolean aspect is equivalent to @ref{b9,,pragma Persistent_BSS}.
9740 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9741 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{149}
9742 @section Aspect Predicate
9745 @geindex Predicate
9747 This aspect is equivalent to @ref{c0,,pragma Predicate}. It is thus
9748 similar to the language defined aspects @code{Dynamic_Predicate}
9749 and @code{Static_Predicate} except that whether the resulting
9750 predicate is static or dynamic is controlled by the form of the
9751 expression. It is also separately controllable using pragma
9752 @code{Assertion_Policy}.
9754 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9755 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{14a}
9756 @section Aspect Pure_Function
9759 @geindex Pure_Function
9761 This boolean aspect is equivalent to @ref{cc,,pragma Pure_Function}.
9763 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
9764 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{14b}
9765 @section Aspect Refined_Depends
9768 @geindex Refined_Depends
9770 This aspect is equivalent to @ref{d0,,pragma Refined_Depends}.
9772 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
9773 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{14c}
9774 @section Aspect Refined_Global
9777 @geindex Refined_Global
9779 This aspect is equivalent to @ref{d2,,pragma Refined_Global}.
9781 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
9782 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{14d}
9783 @section Aspect Refined_Post
9786 @geindex Refined_Post
9788 This aspect is equivalent to @ref{d4,,pragma Refined_Post}.
9790 @node Aspect Refined_State,Aspect Relaxed_Initialization,Aspect Refined_Post,Implementation Defined Aspects
9791 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{14e}
9792 @section Aspect Refined_State
9795 @geindex Refined_State
9797 This aspect is equivalent to @ref{d6,,pragma Refined_State}.
9799 @node Aspect Relaxed_Initialization,Aspect Remote_Access_Type,Aspect Refined_State,Implementation Defined Aspects
9800 @anchor{gnat_rm/implementation_defined_aspects aspect-relaxed-initialization}@anchor{14f}
9801 @section Aspect Relaxed_Initialization
9804 @geindex Refined_Initialization
9806 For the syntax and semantics of this aspect, see the SPARK 2014 Reference
9807 Manual, section 6.10.
9809 @node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Relaxed_Initialization,Implementation Defined Aspects
9810 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{150}
9811 @section Aspect Remote_Access_Type
9814 @geindex Remote_Access_Type
9816 This aspect is equivalent to @ref{d9,,pragma Remote_Access_Type}.
9818 @node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects
9819 @anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{151}
9820 @section Aspect Secondary_Stack_Size
9823 @geindex Secondary_Stack_Size
9825 This aspect is equivalent to @ref{df,,pragma Secondary_Stack_Size}.
9827 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects
9828 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{152}
9829 @section Aspect Scalar_Storage_Order
9832 @geindex Scalar_Storage_Order
9834 This aspect is equivalent to a @ref{153,,attribute Scalar_Storage_Order}.
9836 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
9837 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{154}
9838 @section Aspect Shared
9841 @geindex Shared
9843 This boolean aspect is equivalent to @ref{e2,,pragma Shared}
9844 and is thus a synonym for aspect @code{Atomic}.
9846 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
9847 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{155}
9848 @section Aspect Simple_Storage_Pool
9851 @geindex Simple_Storage_Pool
9853 This aspect is equivalent to @ref{e7,,attribute Simple_Storage_Pool}.
9855 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
9856 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{156}
9857 @section Aspect Simple_Storage_Pool_Type
9860 @geindex Simple_Storage_Pool_Type
9862 This boolean aspect is equivalent to @ref{e6,,pragma Simple_Storage_Pool_Type}.
9864 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
9865 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{157}
9866 @section Aspect SPARK_Mode
9869 @geindex SPARK_Mode
9871 This aspect is equivalent to @ref{ee,,pragma SPARK_Mode} and
9872 may be specified for either or both of the specification and body
9873 of a subprogram or package.
9875 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
9876 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{158}
9877 @section Aspect Suppress_Debug_Info
9880 @geindex Suppress_Debug_Info
9882 This boolean aspect is equivalent to @ref{f6,,pragma Suppress_Debug_Info}.
9884 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
9885 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{159}
9886 @section Aspect Suppress_Initialization
9889 @geindex Suppress_Initialization
9891 This boolean aspect is equivalent to @ref{f9,,pragma Suppress_Initialization}.
9893 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
9894 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{15a}
9895 @section Aspect Test_Case
9898 @geindex Test_Case
9900 This aspect is equivalent to @ref{fd,,pragma Test_Case}.
9902 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
9903 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{15b}
9904 @section Aspect Thread_Local_Storage
9907 @geindex Thread_Local_Storage
9909 This boolean aspect is equivalent to @ref{ff,,pragma Thread_Local_Storage}.
9911 @node Aspect Universal_Aliasing,Aspect Unmodified,Aspect Thread_Local_Storage,Implementation Defined Aspects
9912 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{15c}
9913 @section Aspect Universal_Aliasing
9916 @geindex Universal_Aliasing
9918 This boolean aspect is equivalent to @ref{109,,pragma Universal_Aliasing}.
9920 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Aliasing,Implementation Defined Aspects
9921 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{15d}
9922 @section Aspect Unmodified
9925 @geindex Unmodified
9927 This boolean aspect is equivalent to @ref{10b,,pragma Unmodified}.
9929 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
9930 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{15e}
9931 @section Aspect Unreferenced
9934 @geindex Unreferenced
9936 This boolean aspect is equivalent to @ref{10d,,pragma Unreferenced}.
9938 When using the @code{-gnat2022} switch, this aspect is also supported on formal
9939 parameters, which is in particular the only form possible for expression
9940 functions.
9942 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
9943 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{15f}
9944 @section Aspect Unreferenced_Objects
9947 @geindex Unreferenced_Objects
9949 This boolean aspect is equivalent to @ref{10f,,pragma Unreferenced_Objects}.
9951 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
9952 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{160}
9953 @section Aspect Value_Size
9956 @geindex Value_Size
9958 This aspect is equivalent to @ref{161,,attribute Value_Size}.
9960 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
9961 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{162}
9962 @section Aspect Volatile_Full_Access
9965 @geindex Volatile_Full_Access
9967 This boolean aspect is equivalent to @ref{119,,pragma Volatile_Full_Access}.
9969 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
9970 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{163}
9971 @section Aspect Volatile_Function
9974 @geindex Volatile_Function
9976 This boolean aspect is equivalent to @ref{11b,,pragma Volatile_Function}.
9978 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
9979 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{164}
9980 @section Aspect Warnings
9983 @geindex Warnings
9985 This aspect is equivalent to the two argument form of @ref{11d,,pragma Warnings},
9986 where the first argument is @code{ON} or @code{OFF} and the second argument
9987 is the entity.
9989 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
9990 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{165}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{166}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}
9991 @chapter Implementation Defined Attributes
9994 Ada defines (throughout the Ada reference manual,
9995 summarized in Annex K),
9996 a set of attributes that provide useful additional functionality in all
9997 areas of the language.  These language defined attributes are implemented
9998 in GNAT and work as described in the Ada Reference Manual.
10000 In addition, Ada allows implementations to define additional
10001 attributes whose meaning is defined by the implementation.  GNAT provides
10002 a number of these implementation-dependent attributes which can be used
10003 to extend and enhance the functionality of the compiler.  This section of
10004 the GNAT reference manual describes these additional attributes.  It also
10005 describes additional implementation-dependent features of standard
10006 language-defined attributes.
10008 Note that any program using these attributes may not be portable to
10009 other compilers (although GNAT implements this set of attributes on all
10010 platforms).  Therefore if portability to other compilers is an important
10011 consideration, you should minimize the use of these attributes.
10013 @menu
10014 * Attribute Abort_Signal:: 
10015 * Attribute Address_Size:: 
10016 * Attribute Asm_Input:: 
10017 * Attribute Asm_Output:: 
10018 * Attribute Atomic_Always_Lock_Free:: 
10019 * Attribute Bit:: 
10020 * Attribute Bit_Position:: 
10021 * Attribute Code_Address:: 
10022 * Attribute Compiler_Version:: 
10023 * Attribute Constrained:: 
10024 * Attribute Default_Bit_Order:: 
10025 * Attribute Default_Scalar_Storage_Order:: 
10026 * Attribute Deref:: 
10027 * Attribute Descriptor_Size:: 
10028 * Attribute Elaborated:: 
10029 * Attribute Elab_Body:: 
10030 * Attribute Elab_Spec:: 
10031 * Attribute Elab_Subp_Body:: 
10032 * Attribute Emax:: 
10033 * Attribute Enabled:: 
10034 * Attribute Enum_Rep:: 
10035 * Attribute Enum_Val:: 
10036 * Attribute Epsilon:: 
10037 * Attribute Fast_Math:: 
10038 * Attribute Finalization_Size:: 
10039 * Attribute Fixed_Value:: 
10040 * Attribute From_Any:: 
10041 * Attribute Has_Access_Values:: 
10042 * Attribute Has_Discriminants:: 
10043 * Attribute Has_Tagged_Values:: 
10044 * Attribute Img:: 
10045 * Attribute Initialized:: 
10046 * Attribute Integer_Value:: 
10047 * Attribute Invalid_Value:: 
10048 * Attribute Iterable:: 
10049 * Attribute Large:: 
10050 * Attribute Library_Level:: 
10051 * Attribute Loop_Entry:: 
10052 * Attribute Machine_Size:: 
10053 * Attribute Mantissa:: 
10054 * Attribute Maximum_Alignment:: 
10055 * Attribute Max_Integer_Size:: 
10056 * Attribute Mechanism_Code:: 
10057 * Attribute Null_Parameter:: 
10058 * Attribute Object_Size:: 
10059 * Attribute Old:: 
10060 * Attribute Passed_By_Reference:: 
10061 * Attribute Pool_Address:: 
10062 * Attribute Range_Length:: 
10063 * Attribute Restriction_Set:: 
10064 * Attribute Result:: 
10065 * Attribute Safe_Emax:: 
10066 * Attribute Safe_Large:: 
10067 * Attribute Safe_Small:: 
10068 * Attribute Scalar_Storage_Order:: 
10069 * Attribute Simple_Storage_Pool:: 
10070 * Attribute Small:: 
10071 * Attribute Small_Denominator:: 
10072 * Attribute Small_Numerator:: 
10073 * Attribute Storage_Unit:: 
10074 * Attribute Stub_Type:: 
10075 * Attribute System_Allocator_Alignment:: 
10076 * Attribute Target_Name:: 
10077 * Attribute To_Address:: 
10078 * Attribute To_Any:: 
10079 * Attribute Type_Class:: 
10080 * Attribute Type_Key:: 
10081 * Attribute TypeCode:: 
10082 * Attribute Unconstrained_Array:: 
10083 * Attribute Universal_Literal_String:: 
10084 * Attribute Unrestricted_Access:: 
10085 * Attribute Update:: 
10086 * Attribute Valid_Value:: 
10087 * Attribute Valid_Scalars:: 
10088 * Attribute VADS_Size:: 
10089 * Attribute Value_Size:: 
10090 * Attribute Wchar_T_Size:: 
10091 * Attribute Word_Size:: 
10093 @end menu
10095 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
10096 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{167}
10097 @section Attribute Abort_Signal
10100 @geindex Abort_Signal
10102 @code{Standard'Abort_Signal} (@code{Standard} is the only allowed
10103 prefix) provides the entity for the special exception used to signal
10104 task abort or asynchronous transfer of control.  Normally this attribute
10105 should only be used in the tasking runtime (it is highly peculiar, and
10106 completely outside the normal semantics of Ada, for a user program to
10107 intercept the abort exception).
10109 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
10110 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{168}
10111 @section Attribute Address_Size
10114 @geindex Size of `@w{`}Address`@w{`}
10116 @geindex Address_Size
10118 @code{Standard'Address_Size} (@code{Standard} is the only allowed
10119 prefix) is a static constant giving the number of bits in an
10120 @code{Address}. It is the same value as System.Address’Size,
10121 but has the advantage of being static, while a direct
10122 reference to System.Address’Size is nonstatic because Address
10123 is a private type.
10125 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
10126 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{169}
10127 @section Attribute Asm_Input
10130 @geindex Asm_Input
10132 The @code{Asm_Input} attribute denotes a function that takes two
10133 parameters.  The first is a string, the second is an expression of the
10134 type designated by the prefix.  The first (string) argument is required
10135 to be a static expression, and is the constraint for the parameter,
10136 (e.g., what kind of register is required).  The second argument is the
10137 value to be used as the input argument.  The possible values for the
10138 constant are the same as those used in the RTL, and are dependent on
10139 the configuration file used to built the GCC back end.
10140 @ref{16a,,Machine Code Insertions}
10142 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
10143 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{16b}
10144 @section Attribute Asm_Output
10147 @geindex Asm_Output
10149 The @code{Asm_Output} attribute denotes a function that takes two
10150 parameters.  The first is a string, the second is the name of a variable
10151 of the type designated by the attribute prefix.  The first (string)
10152 argument is required to be a static expression and designates the
10153 constraint for the parameter (e.g., what kind of register is
10154 required).  The second argument is the variable to be updated with the
10155 result.  The possible values for constraint are the same as those used in
10156 the RTL, and are dependent on the configuration file used to build the
10157 GCC back end.  If there are no output operands, then this argument may
10158 either be omitted, or explicitly given as @code{No_Output_Operands}.
10159 @ref{16a,,Machine Code Insertions}
10161 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
10162 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{16c}
10163 @section Attribute Atomic_Always_Lock_Free
10166 @geindex Atomic_Always_Lock_Free
10168 The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type.
10169 The result is a Boolean value which is True if the type has discriminants,
10170 and False otherwise.  The result indicate whether atomic operations are
10171 supported by the target for the given type.
10173 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
10174 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{16d}
10175 @section Attribute Bit
10178 @geindex Bit
10180 @code{obj'Bit}, where @code{obj} is any object, yields the bit
10181 offset within the storage unit (byte) that contains the first bit of
10182 storage allocated for the object.  The value of this attribute is of the
10183 type `universal_integer' and is always a nonnegative number smaller
10184 than @code{System.Storage_Unit}.
10186 For an object that is a variable or a constant allocated in a register,
10187 the value is zero.  (The use of this attribute does not force the
10188 allocation of a variable to memory).
10190 For an object that is a formal parameter, this attribute applies
10191 to either the matching actual parameter or to a copy of the
10192 matching actual parameter.
10194 For an access object the value is zero.  Note that
10195 @code{obj.all'Bit} is subject to an @code{Access_Check} for the
10196 designated object.  Similarly for a record component
10197 @code{X.C'Bit} is subject to a discriminant check and
10198 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
10199 are subject to index checks.
10201 This attribute is designed to be compatible with the DEC Ada 83 definition
10202 and implementation of the @code{Bit} attribute.
10204 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
10205 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{16e}
10206 @section Attribute Bit_Position
10209 @geindex Bit_Position
10211 @code{R.C'Bit_Position}, where @code{R} is a record object and @code{C} is one
10212 of the fields of the record type, yields the bit
10213 offset within the record contains the first bit of
10214 storage allocated for the object.  The value of this attribute is of the
10215 type `universal_integer'.  The value depends only on the field
10216 @code{C} and is independent of the alignment of
10217 the containing record @code{R}.
10219 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
10220 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{16f}
10221 @section Attribute Code_Address
10224 @geindex Code_Address
10226 @geindex Subprogram address
10228 @geindex Address of subprogram code
10230 The @code{'Address}
10231 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
10232 intended effect seems to be to provide
10233 an address value which can be used to call the subprogram by means of
10234 an address clause as in the following example:
10236 @example
10237 procedure K is ...
10239 procedure L;
10240 for L'Address use K'Address;
10241 pragma Import (Ada, L);
10242 @end example
10244 A call to @code{L} is then expected to result in a call to @code{K}.
10245 In Ada 83, where there were no access-to-subprogram values, this was
10246 a common work-around for getting the effect of an indirect call.
10247 GNAT implements the above use of @code{Address} and the technique
10248 illustrated by the example code works correctly.
10250 However, for some purposes, it is useful to have the address of the start
10251 of the generated code for the subprogram.  On some architectures, this is
10252 not necessarily the same as the @code{Address} value described above.
10253 For example, the @code{Address} value may reference a subprogram
10254 descriptor rather than the subprogram itself.
10256 The @code{'Code_Address} attribute, which can only be applied to
10257 subprogram entities, always returns the address of the start of the
10258 generated code of the specified subprogram, which may or may not be
10259 the same value as is returned by the corresponding @code{'Address}
10260 attribute.
10262 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
10263 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{170}
10264 @section Attribute Compiler_Version
10267 @geindex Compiler_Version
10269 @code{Standard'Compiler_Version} (@code{Standard} is the only allowed
10270 prefix) yields a static string identifying the version of the compiler
10271 being used to compile the unit containing the attribute reference.
10273 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
10274 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{171}
10275 @section Attribute Constrained
10278 @geindex Constrained
10280 In addition to the usage of this attribute in the Ada RM, GNAT
10281 also permits the use of the @code{'Constrained} attribute
10282 in a generic template
10283 for any type, including types without discriminants. The value of this
10284 attribute in the generic instance when applied to a scalar type or a
10285 record type without discriminants is always @code{True}. This usage is
10286 compatible with older Ada compilers, including notably DEC Ada.
10288 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
10289 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{172}
10290 @section Attribute Default_Bit_Order
10293 @geindex Big endian
10295 @geindex Little endian
10297 @geindex Default_Bit_Order
10299 @code{Standard'Default_Bit_Order} (@code{Standard} is the only
10300 allowed prefix), provides the value @code{System.Default_Bit_Order}
10301 as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
10302 @code{Low_Order_First}).  This is used to construct the definition of
10303 @code{Default_Bit_Order} in package @code{System}.
10305 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
10306 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{173}
10307 @section Attribute Default_Scalar_Storage_Order
10310 @geindex Big endian
10312 @geindex Little endian
10314 @geindex Default_Scalar_Storage_Order
10316 @code{Standard'Default_Scalar_Storage_Order} (@code{Standard} is the only
10317 allowed prefix), provides the current value of the default scalar storage
10318 order (as specified using pragma @code{Default_Scalar_Storage_Order}, or
10319 equal to @code{Default_Bit_Order} if unspecified) as a
10320 @code{System.Bit_Order} value. This is a static attribute.
10322 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
10323 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{174}
10324 @section Attribute Deref
10327 @geindex Deref
10329 The attribute @code{typ'Deref(expr)} where @code{expr} is of type @code{System.Address} yields
10330 the variable of type @code{typ} that is located at the given address. It is similar
10331 to @code{(totyp (expr).all)}, where @code{totyp} is an unchecked conversion from address to
10332 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
10333 used on the left side of an assignment.
10335 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
10336 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{175}
10337 @section Attribute Descriptor_Size
10340 @geindex Descriptor
10342 @geindex Dope vector
10344 @geindex Descriptor_Size
10346 Nonstatic attribute @code{Descriptor_Size} returns the size in bits of the
10347 descriptor allocated for a type.  The result is non-zero only for unconstrained
10348 array types and the returned value is of type universal integer.  In GNAT, an
10349 array descriptor contains bounds information and is located immediately before
10350 the first element of the array.
10352 @example
10353 type Unconstr_Array is array (Short_Short_Integer range <>) of Positive;
10354 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
10355 @end example
10357 The attribute takes into account any padding due to the alignment of the
10358 component type. In the example above, the descriptor contains two values
10359 of type @code{Short_Short_Integer} representing the low and high bound. But,
10360 since @code{Positive} has an alignment of 4, the size of the descriptor is
10361 @code{2 * Short_Short_Integer'Size} rounded up to the next multiple of 32,
10362 which yields a size of 32 bits, i.e. including 16 bits of padding.
10364 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
10365 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{176}
10366 @section Attribute Elaborated
10369 @geindex Elaborated
10371 The prefix of the @code{'Elaborated} attribute must be a unit name.  The
10372 value is a Boolean which indicates whether or not the given unit has been
10373 elaborated.  This attribute is primarily intended for internal use by the
10374 generated code for dynamic elaboration checking, but it can also be used
10375 in user programs.  The value will always be True once elaboration of all
10376 units has been completed.  An exception is for units which need no
10377 elaboration, the value is always False for such units.
10379 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
10380 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{177}
10381 @section Attribute Elab_Body
10384 @geindex Elab_Body
10386 This attribute can only be applied to a program unit name.  It returns
10387 the entity for the corresponding elaboration procedure for elaborating
10388 the body of the referenced unit.  This is used in the main generated
10389 elaboration procedure by the binder and is not normally used in any
10390 other context.  However, there may be specialized situations in which it
10391 is useful to be able to call this elaboration procedure from Ada code,
10392 e.g., if it is necessary to do selective re-elaboration to fix some
10393 error.
10395 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
10396 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{178}
10397 @section Attribute Elab_Spec
10400 @geindex Elab_Spec
10402 This attribute can only be applied to a program unit name.  It returns
10403 the entity for the corresponding elaboration procedure for elaborating
10404 the spec of the referenced unit.  This is used in the main
10405 generated elaboration procedure by the binder and is not normally used
10406 in any other context.  However, there may be specialized situations in
10407 which it is useful to be able to call this elaboration procedure from
10408 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
10409 some error.
10411 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
10412 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{179}
10413 @section Attribute Elab_Subp_Body
10416 @geindex Elab_Subp_Body
10418 This attribute can only be applied to a library level subprogram
10419 name and is only allowed in CodePeer mode. It returns the entity
10420 for the corresponding elaboration procedure for elaborating the body
10421 of the referenced subprogram unit. This is used in the main generated
10422 elaboration procedure by the binder in CodePeer mode only and is unrecognized
10423 otherwise.
10425 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
10426 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{17a}
10427 @section Attribute Emax
10430 @geindex Ada 83 attributes
10432 @geindex Emax
10434 The @code{Emax} attribute is provided for compatibility with Ada 83.  See
10435 the Ada 83 reference manual for an exact description of the semantics of
10436 this attribute.
10438 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
10439 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{17b}
10440 @section Attribute Enabled
10443 @geindex Enabled
10445 The @code{Enabled} attribute allows an application program to check at compile
10446 time to see if the designated check is currently enabled. The prefix is a
10447 simple identifier, referencing any predefined check name (other than
10448 @code{All_Checks}) or a check name introduced by pragma Check_Name. If
10449 no argument is given for the attribute, the check is for the general state
10450 of the check, if an argument is given, then it is an entity name, and the
10451 check indicates whether an @code{Suppress} or @code{Unsuppress} has been
10452 given naming the entity (if not, then the argument is ignored).
10454 Note that instantiations inherit the check status at the point of the
10455 instantiation, so a useful idiom is to have a library package that
10456 introduces a check name with @code{pragma Check_Name}, and then contains
10457 generic packages or subprograms which use the @code{Enabled} attribute
10458 to see if the check is enabled. A user of this package can then issue
10459 a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
10460 the package or subprogram, controlling whether the check will be present.
10462 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
10463 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{17c}
10464 @section Attribute Enum_Rep
10467 @geindex Representation of enums
10469 @geindex Enum_Rep
10471 Note that this attribute is now standard in Ada 202x and is available
10472 as an implementation defined attribute for earlier Ada versions.
10474 For every enumeration subtype @code{S}, @code{S'Enum_Rep} denotes a
10475 function with the following spec:
10477 @example
10478 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
10479 @end example
10481 It is also allowable to apply @code{Enum_Rep} directly to an object of an
10482 enumeration type or to a non-overloaded enumeration
10483 literal.  In this case @code{S'Enum_Rep} is equivalent to
10484 @code{typ'Enum_Rep(S)} where @code{typ} is the type of the
10485 enumeration literal or object.
10487 The function returns the representation value for the given enumeration
10488 value.  This will be equal to value of the @code{Pos} attribute in the
10489 absence of an enumeration representation clause.  This is a static
10490 attribute (i.e., the result is static if the argument is static).
10492 @code{S'Enum_Rep} can also be used with integer types and objects,
10493 in which case it simply returns the integer value.  The reason for this
10494 is to allow it to be used for @code{(<>)} discrete formal arguments in
10495 a generic unit that can be instantiated with either enumeration types
10496 or integer types.  Note that if @code{Enum_Rep} is used on a modular
10497 type whose upper bound exceeds the upper bound of the largest signed
10498 integer type, and the argument is a variable, so that the universal
10499 integer calculation is done at run time, then the call to @code{Enum_Rep}
10500 may raise @code{Constraint_Error}.
10502 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10503 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{17d}
10504 @section Attribute Enum_Val
10507 @geindex Representation of enums
10509 @geindex Enum_Val
10511 Note that this attribute is now standard in Ada 202x and is available
10512 as an implementation defined attribute for earlier Ada versions.
10514 For every enumeration subtype @code{S}, @code{S'Enum_Val} denotes a
10515 function with the following spec:
10517 @example
10518 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10519 @end example
10521 The function returns the enumeration value whose representation matches the
10522 argument, or raises Constraint_Error if no enumeration literal of the type
10523 has the matching value.
10524 This will be equal to value of the @code{Val} attribute in the
10525 absence of an enumeration representation clause.  This is a static
10526 attribute (i.e., the result is static if the argument is static).
10528 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10529 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{17e}
10530 @section Attribute Epsilon
10533 @geindex Ada 83 attributes
10535 @geindex Epsilon
10537 The @code{Epsilon} attribute is provided for compatibility with Ada 83.  See
10538 the Ada 83 reference manual for an exact description of the semantics of
10539 this attribute.
10541 @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
10542 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{17f}
10543 @section Attribute Fast_Math
10546 @geindex Fast_Math
10548 @code{Standard'Fast_Math} (@code{Standard} is the only allowed
10549 prefix) yields a static Boolean value that is True if pragma
10550 @code{Fast_Math} is active, and False otherwise.
10552 @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
10553 @anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{180}
10554 @section Attribute Finalization_Size
10557 @geindex Finalization_Size
10559 The prefix of attribute @code{Finalization_Size} must be an object or
10560 a non-class-wide type. This attribute returns the size of any hidden data
10561 reserved by the compiler to handle finalization-related actions. The type of
10562 the attribute is `universal_integer'.
10564 @code{Finalization_Size} yields a value of zero for a type with no controlled
10565 parts, an object whose type has no controlled parts, or an object of a
10566 class-wide type whose tag denotes a type with no controlled parts.
10568 Note that only heap-allocated objects contain finalization data.
10570 @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
10571 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{181}
10572 @section Attribute Fixed_Value
10575 @geindex Fixed_Value
10577 For every fixed-point type @code{S}, @code{S'Fixed_Value} denotes a
10578 function with the following specification:
10580 @example
10581 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10582 @end example
10584 The value returned is the fixed-point value @code{V} such that:
10586 @example
10587 V = Arg * S'Small
10588 @end example
10590 The effect is thus similar to first converting the argument to the
10591 integer type used to represent @code{S}, and then doing an unchecked
10592 conversion to the fixed-point type.  The difference is
10593 that there are full range checks, to ensure that the result is in range.
10594 This attribute is primarily intended for use in implementation of the
10595 input-output functions for fixed-point values.
10597 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10598 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{182}
10599 @section Attribute From_Any
10602 @geindex From_Any
10604 This internal attribute is used for the generation of remote subprogram
10605 stubs in the context of the Distributed Systems Annex.
10607 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10608 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{183}
10609 @section Attribute Has_Access_Values
10612 @geindex Access values
10613 @geindex testing for
10615 @geindex Has_Access_Values
10617 The prefix of the @code{Has_Access_Values} attribute is a type.  The result
10618 is a Boolean value which is True if the is an access type, or is a composite
10619 type with a component (at any nesting depth) that is an access type, and is
10620 False otherwise.
10621 The intended use of this attribute is in conjunction with generic
10622 definitions.  If the attribute is applied to a generic private type, it
10623 indicates whether or not the corresponding actual type has access values.
10625 @node Attribute Has_Discriminants,Attribute Has_Tagged_Values,Attribute Has_Access_Values,Implementation Defined Attributes
10626 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{184}
10627 @section Attribute Has_Discriminants
10630 @geindex Discriminants
10631 @geindex testing for
10633 @geindex Has_Discriminants
10635 The prefix of the @code{Has_Discriminants} attribute is a type.  The result
10636 is a Boolean value which is True if the type has discriminants, and False
10637 otherwise.  The intended use of this attribute is in conjunction with generic
10638 definitions.  If the attribute is applied to a generic private type, it
10639 indicates whether or not the corresponding actual type has discriminants.
10641 @node Attribute Has_Tagged_Values,Attribute Img,Attribute Has_Discriminants,Implementation Defined Attributes
10642 @anchor{gnat_rm/implementation_defined_attributes attribute-has-tagged-values}@anchor{185}
10643 @section Attribute Has_Tagged_Values
10646 @geindex Tagged values
10647 @geindex testing for
10649 @geindex Has_Tagged_Values
10651 The prefix of the @code{Has_Tagged_Values} attribute is a type. The result is a
10652 Boolean value which is True if the type is a composite type (array or record)
10653 that is either a tagged type or has a subcomponent that is tagged, and is False
10654 otherwise. The intended use of this attribute is in conjunction with generic
10655 definitions. If the attribute is applied to a generic private type, it
10656 indicates whether or not the corresponding actual type has access values.
10658 @node Attribute Img,Attribute Initialized,Attribute Has_Tagged_Values,Implementation Defined Attributes
10659 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{186}
10660 @section Attribute Img
10663 @geindex Img
10665 The @code{Img} attribute differs from @code{Image} in that, while both can be
10666 applied directly to an object, @code{Img} cannot be applied to types.
10668 Example usage of the attribute:
10670 @example
10671 Put_Line ("X = " & X'Img);
10672 @end example
10674 which has the same meaning as the more verbose:
10676 @example
10677 Put_Line ("X = " & T'Image (X));
10678 @end example
10680 where @code{T} is the (sub)type of the object @code{X}.
10682 Note that technically, in analogy to @code{Image},
10683 @code{X'Img} returns a parameterless function
10684 that returns the appropriate string when called. This means that
10685 @code{X'Img} can be renamed as a function-returning-string, or used
10686 in an instantiation as a function parameter.
10688 @node Attribute Initialized,Attribute Integer_Value,Attribute Img,Implementation Defined Attributes
10689 @anchor{gnat_rm/implementation_defined_attributes attribute-initialized}@anchor{187}
10690 @section Attribute Initialized
10693 @geindex Initialized
10695 For the syntax and semantics of this attribute, see the SPARK 2014 Reference
10696 Manual, section 6.10.
10698 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Initialized,Implementation Defined Attributes
10699 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{188}
10700 @section Attribute Integer_Value
10703 @geindex Integer_Value
10705 For every integer type @code{S}, @code{S'Integer_Value} denotes a
10706 function with the following spec:
10708 @example
10709 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10710 @end example
10712 The value returned is the integer value @code{V}, such that:
10714 @example
10715 Arg = V * T'Small
10716 @end example
10718 where @code{T} is the type of @code{Arg}.
10719 The effect is thus similar to first doing an unchecked conversion from
10720 the fixed-point type to its corresponding implementation type, and then
10721 converting the result to the target integer type.  The difference is
10722 that there are full range checks, to ensure that the result is in range.
10723 This attribute is primarily intended for use in implementation of the
10724 standard input-output functions for fixed-point values.
10726 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
10727 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{189}
10728 @section Attribute Invalid_Value
10731 @geindex Invalid_Value
10733 For every scalar type S, S’Invalid_Value returns an undefined value of the
10734 type. If possible this value is an invalid representation for the type. The
10735 value returned is identical to the value used to initialize an otherwise
10736 uninitialized value of the type if pragma Initialize_Scalars is used,
10737 including the ability to modify the value with the binder -Sxx flag and
10738 relevant environment variables at run time.
10740 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
10741 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{18a}
10742 @section Attribute Iterable
10745 @geindex Iterable
10747 Equivalent to Aspect Iterable.
10749 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
10750 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{18b}
10751 @section Attribute Large
10754 @geindex Ada 83 attributes
10756 @geindex Large
10758 The @code{Large} attribute is provided for compatibility with Ada 83.  See
10759 the Ada 83 reference manual for an exact description of the semantics of
10760 this attribute.
10762 @node Attribute Library_Level,Attribute Loop_Entry,Attribute Large,Implementation Defined Attributes
10763 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{18c}
10764 @section Attribute Library_Level
10767 @geindex Library_Level
10769 @code{P'Library_Level}, where P is an entity name,
10770 returns a Boolean value which is True if the entity is declared
10771 at the library level, and False otherwise. Note that within a
10772 generic instantiation, the name of the generic unit denotes the
10773 instance, which means that this attribute can be used to test
10774 if a generic is instantiated at the library level, as shown
10775 in this example:
10777 @example
10778 generic
10779   ...
10780 package Gen is
10781   pragma Compile_Time_Error
10782     (not Gen'Library_Level,
10783      "Gen can only be instantiated at library level");
10784   ...
10785 end Gen;
10786 @end example
10788 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Library_Level,Implementation Defined Attributes
10789 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18d}
10790 @section Attribute Loop_Entry
10793 @geindex Loop_Entry
10795 Syntax:
10797 @example
10798 X'Loop_Entry [(loop_name)]
10799 @end example
10801 The @code{Loop_Entry} attribute is used to refer to the value that an
10802 expression had upon entry to a given loop in much the same way that the
10803 @code{Old} attribute in a subprogram postcondition can be used to refer
10804 to the value an expression had upon entry to the subprogram. The
10805 relevant loop is either identified by the given loop name, or it is the
10806 innermost enclosing loop when no loop name is given.
10808 A @code{Loop_Entry} attribute can only occur within an @code{Assert},
10809 @code{Assert_And_Cut}, @code{Assume}, @code{Loop_Variant} or @code{Loop_Invariant} pragma.
10810 In addition, such a pragma must be one of the items in the sequence
10811 of statements of a loop body, or nested inside block statements that
10812 appear in the sequence of statements of a loop body.
10813 A common use of @code{Loop_Entry} is to compare the current value of objects with
10814 their initial value at loop entry, in a @code{Loop_Invariant} pragma.
10816 The effect of using @code{X'Loop_Entry} is the same as declaring
10817 a constant initialized with the initial value of @code{X} at loop
10818 entry. This copy is not performed if the loop is not entered, or if the
10819 corresponding pragmas are ignored or disabled.
10821 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
10822 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18e}
10823 @section Attribute Machine_Size
10826 @geindex Machine_Size
10828 This attribute is identical to the @code{Object_Size} attribute.  It is
10829 provided for compatibility with the DEC Ada 83 attribute of this name.
10831 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
10832 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{18f}
10833 @section Attribute Mantissa
10836 @geindex Ada 83 attributes
10838 @geindex Mantissa
10840 The @code{Mantissa} attribute is provided for compatibility with Ada 83.  See
10841 the Ada 83 reference manual for an exact description of the semantics of
10842 this attribute.
10844 @node Attribute Maximum_Alignment,Attribute Max_Integer_Size,Attribute Mantissa,Implementation Defined Attributes
10845 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{190}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{191}
10846 @section Attribute Maximum_Alignment
10849 @geindex Alignment
10850 @geindex maximum
10852 @geindex Maximum_Alignment
10854 @code{Standard'Maximum_Alignment} (@code{Standard} is the only
10855 allowed prefix) provides the maximum useful alignment value for the
10856 target.  This is a static value that can be used to specify the alignment
10857 for an object, guaranteeing that it is properly aligned in all
10858 cases.
10860 @node Attribute Max_Integer_Size,Attribute Mechanism_Code,Attribute Maximum_Alignment,Implementation Defined Attributes
10861 @anchor{gnat_rm/implementation_defined_attributes attribute-max-integer-size}@anchor{192}
10862 @section Attribute Max_Integer_Size
10865 @geindex Max_Integer_Size
10867 @code{Standard'Max_Integer_Size} (@code{Standard} is the only allowed
10868 prefix) provides the size of the largest supported integer type for
10869 the target. The result is a static constant.
10871 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Max_Integer_Size,Implementation Defined Attributes
10872 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{193}
10873 @section Attribute Mechanism_Code
10876 @geindex Return values
10877 @geindex passing mechanism
10879 @geindex Parameters
10880 @geindex passing mechanism
10882 @geindex Mechanism_Code
10884 @code{func'Mechanism_Code} yields an integer code for the
10885 mechanism used for the result of function @code{func}, and
10886 @code{subprog'Mechanism_Code (n)} yields the mechanism
10887 used for formal parameter number `n' (a static integer value, with 1
10888 meaning the first parameter) of subprogram @code{subprog}.  The code returned is:
10891 @table @asis
10893 @item `1'
10895 by copy (value)
10897 @item `2'
10899 by reference
10900 @end table
10902 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
10903 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{194}
10904 @section Attribute Null_Parameter
10907 @geindex Zero address
10908 @geindex passing
10910 @geindex Null_Parameter
10912 A reference @code{T'Null_Parameter} denotes an imaginary object of
10913 type or subtype @code{T} allocated at machine address zero.  The attribute
10914 is allowed only as the default expression of a formal parameter, or as
10915 an actual expression of a subprogram call.  In either case, the
10916 subprogram must be imported.
10918 The identity of the object is represented by the address zero in the
10919 argument list, independent of the passing mechanism (explicit or
10920 default).
10922 This capability is needed to specify that a zero address should be
10923 passed for a record or other composite object passed by reference.
10924 There is no way of indicating this without the @code{Null_Parameter}
10925 attribute.
10927 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
10928 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{145}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{195}
10929 @section Attribute Object_Size
10932 @geindex Size
10933 @geindex used for objects
10935 @geindex Object_Size
10937 The size of an object is not necessarily the same as the size of the type
10938 of an object.  This is because by default object sizes are increased to be
10939 a multiple of the alignment of the object.  For example,
10940 @code{Natural'Size} is
10941 31, but by default objects of type @code{Natural} will have a size of 32 bits.
10942 Similarly, a record containing an integer and a character:
10944 @example
10945 type Rec is record
10946    I : Integer;
10947    C : Character;
10948 end record;
10949 @end example
10951 will have a size of 40 (that is @code{Rec'Size} will be 40).  The
10952 alignment will be 4, because of the
10953 integer field, and so the default size of record objects for this type
10954 will be 64 (8 bytes).
10956 If the alignment of the above record is specified to be 1, then the
10957 object size will be 40 (5 bytes). This is true by default, and also
10958 an object size of 40 can be explicitly specified in this case.
10960 A consequence of this capability is that different object sizes can be
10961 given to subtypes that would otherwise be considered in Ada to be
10962 statically matching.  But it makes no sense to consider such subtypes
10963 as statically matching.  Consequently, GNAT adds a rule
10964 to the static matching rules that requires object sizes to match.
10965 Consider this example:
10967 @example
10968  1. procedure BadAVConvert is
10969  2.    type R is new Integer;
10970  3.    subtype R1 is R range 1 .. 10;
10971  4.    subtype R2 is R range 1 .. 10;
10972  5.    for R1'Object_Size use 8;
10973  6.    for R2'Object_Size use 16;
10974  7.    type R1P is access all R1;
10975  8.    type R2P is access all R2;
10976  9.    R1PV : R1P := new R1'(4);
10977 10.    R2PV : R2P;
10978 11. begin
10979 12.    R2PV := R2P (R1PV);
10980                |
10981        >>> target designated subtype not compatible with
10982            type "R1" defined at line 3
10984 13. end;
10985 @end example
10987 In the absence of lines 5 and 6,
10988 types @code{R1} and @code{R2} statically match and
10989 hence the conversion on line 12 is legal. But since lines 5 and 6
10990 cause the object sizes to differ, GNAT considers that types
10991 @code{R1} and @code{R2} are not statically matching, and line 12
10992 generates the diagnostic shown above.
10994 Similar additional checks are performed in other contexts requiring
10995 statically matching subtypes.
10997 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
10998 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{196}
10999 @section Attribute Old
11002 @geindex Old
11004 In addition to the usage of @code{Old} defined in the Ada 2012 RM (usage
11005 within @code{Post} aspect), GNAT also permits the use of this attribute
11006 in implementation defined pragmas @code{Postcondition},
11007 @code{Contract_Cases} and @code{Test_Case}. Also usages of
11008 @code{Old} which would be illegal according to the Ada 2012 RM
11009 definition are allowed under control of
11010 implementation defined pragma @code{Unevaluated_Use_Of_Old}.
11012 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
11013 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{197}
11014 @section Attribute Passed_By_Reference
11017 @geindex Parameters
11018 @geindex when passed by reference
11020 @geindex Passed_By_Reference
11022 @code{typ'Passed_By_Reference} for any subtype @cite{typ} returns
11023 a value of type @code{Boolean} value that is @code{True} if the type is
11024 normally passed by reference and @code{False} if the type is normally
11025 passed by copy in calls.  For scalar types, the result is always @code{False}
11026 and is static.  For non-scalar types, the result is nonstatic.
11028 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
11029 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{198}
11030 @section Attribute Pool_Address
11033 @geindex Pool_Address
11035 @code{X'Pool_Address} for any object @code{X} returns the address
11036 of X within its storage pool. This is the same as
11037 @code{X'Address}, except that for an unconstrained array whose
11038 bounds are allocated just before the first component,
11039 @code{X'Pool_Address} returns the address of those bounds,
11040 whereas @code{X'Address} returns the address of the first
11041 component.
11043 Here, we are interpreting ‘storage pool’ broadly to mean
11044 @code{wherever the object is allocated}, which could be a
11045 user-defined storage pool,
11046 the global heap, on the stack, or in a static memory area.
11047 For an object created by @code{new}, @code{Ptr.all'Pool_Address} is
11048 what is passed to @code{Allocate} and returned from @code{Deallocate}.
11050 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
11051 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{199}
11052 @section Attribute Range_Length
11055 @geindex Range_Length
11057 @code{typ'Range_Length} for any discrete type @cite{typ} yields
11058 the number of values represented by the subtype (zero for a null
11059 range).  The result is static for static subtypes.  @code{Range_Length}
11060 applied to the index subtype of a one dimensional array always gives the
11061 same result as @code{Length} applied to the array itself.
11063 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
11064 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{19a}
11065 @section Attribute Restriction_Set
11068 @geindex Restriction_Set
11070 @geindex Restrictions
11072 This attribute allows compile time testing of restrictions that
11073 are currently in effect. It is primarily intended for specializing
11074 code in the run-time based on restrictions that are active (e.g.
11075 don’t need to save fpt registers if restriction No_Floating_Point
11076 is known to be in effect), but can be used anywhere.
11078 There are two forms:
11080 @example
11081 System'Restriction_Set (partition_boolean_restriction_NAME)
11082 System'Restriction_Set (No_Dependence => library_unit_NAME);
11083 @end example
11085 In the case of the first form, the only restriction names
11086 allowed are parameterless restrictions that are checked
11087 for consistency at bind time. For a complete list see the
11088 subtype @code{System.Rident.Partition_Boolean_Restrictions}.
11090 The result returned is True if the restriction is known to
11091 be in effect, and False if the restriction is known not to
11092 be in effect. An important guarantee is that the value of
11093 a Restriction_Set attribute is known to be consistent throughout
11094 all the code of a partition.
11096 This is trivially achieved if the entire partition is compiled
11097 with a consistent set of restriction pragmas. However, the
11098 compilation model does not require this. It is possible to
11099 compile one set of units with one set of pragmas, and another
11100 set of units with another set of pragmas. It is even possible
11101 to compile a spec with one set of pragmas, and then WITH the
11102 same spec with a different set of pragmas. Inconsistencies
11103 in the actual use of the restriction are checked at bind time.
11105 In order to achieve the guarantee of consistency for the
11106 Restriction_Set pragma, we consider that a use of the pragma
11107 that yields False is equivalent to a violation of the
11108 restriction.
11110 So for example if you write
11112 @example
11113 if System'Restriction_Set (No_Floating_Point) then
11114    ...
11115 else
11116    ...
11117 end if;
11118 @end example
11120 And the result is False, so that the else branch is executed,
11121 you can assume that this restriction is not set for any unit
11122 in the partition. This is checked by considering this use of
11123 the restriction pragma to be a violation of the restriction
11124 No_Floating_Point. This means that no other unit can attempt
11125 to set this restriction (if some unit does attempt to set it,
11126 the binder will refuse to bind the partition).
11128 Technical note: The restriction name and the unit name are
11129 intepreted entirely syntactically, as in the corresponding
11130 Restrictions pragma, they are not analyzed semantically,
11131 so they do not have a type.
11133 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
11134 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{19b}
11135 @section Attribute Result
11138 @geindex Result
11140 @code{function'Result} can only be used with in a Postcondition pragma
11141 for a function. The prefix must be the name of the corresponding function. This
11142 is used to refer to the result of the function in the postcondition expression.
11143 For a further discussion of the use of this attribute and examples of its use,
11144 see the description of pragma Postcondition.
11146 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
11147 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{19c}
11148 @section Attribute Safe_Emax
11151 @geindex Ada 83 attributes
11153 @geindex Safe_Emax
11155 The @code{Safe_Emax} attribute is provided for compatibility with Ada 83.  See
11156 the Ada 83 reference manual for an exact description of the semantics of
11157 this attribute.
11159 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
11160 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{19d}
11161 @section Attribute Safe_Large
11164 @geindex Ada 83 attributes
11166 @geindex Safe_Large
11168 The @code{Safe_Large} attribute is provided for compatibility with Ada 83.  See
11169 the Ada 83 reference manual for an exact description of the semantics of
11170 this attribute.
11172 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
11173 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{19e}
11174 @section Attribute Safe_Small
11177 @geindex Ada 83 attributes
11179 @geindex Safe_Small
11181 The @code{Safe_Small} attribute is provided for compatibility with Ada 83.  See
11182 the Ada 83 reference manual for an exact description of the semantics of
11183 this attribute.
11185 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
11186 @anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{153}@anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19f}
11187 @section Attribute Scalar_Storage_Order
11190 @geindex Endianness
11192 @geindex Scalar storage order
11194 @geindex Scalar_Storage_Order
11196 For every array or record type @code{S}, the representation attribute
11197 @code{Scalar_Storage_Order} denotes the order in which storage elements
11198 that make up scalar components are ordered within S. The value given must
11199 be a static expression of type System.Bit_Order. The following is an example
11200 of the use of this feature:
11202 @example
11203 --  Component type definitions
11205 subtype Yr_Type is Natural range 0 .. 127;
11206 subtype Mo_Type is Natural range 1 .. 12;
11207 subtype Da_Type is Natural range 1 .. 31;
11209 --  Record declaration
11211 type Date is record
11212    Years_Since_1980 : Yr_Type;
11213    Month            : Mo_Type;
11214    Day_Of_Month     : Da_Type;
11215 end record;
11217 --  Record representation clause
11219 for Date use record
11220    Years_Since_1980 at 0 range 0  ..  6;
11221    Month            at 0 range 7  .. 10;
11222    Day_Of_Month     at 0 range 11 .. 15;
11223 end record;
11225 --  Attribute definition clauses
11227 for Date'Bit_Order use System.High_Order_First;
11228 for Date'Scalar_Storage_Order use System.High_Order_First;
11229 --  If Scalar_Storage_Order is specified, it must be consistent with
11230 --  Bit_Order, so it's best to always define the latter explicitly if
11231 --  the former is used.
11232 @end example
11234 Other properties are as for the standard representation attribute @code{Bit_Order}
11235 defined by Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
11237 For a record type @code{T}, if @code{T'Scalar_Storage_Order} is
11238 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
11239 this means that if a @code{Scalar_Storage_Order} attribute definition
11240 clause is not confirming, then the type’s @code{Bit_Order} shall be
11241 specified explicitly and set to the same value.
11243 Derived types inherit an explicitly set scalar storage order from their parent
11244 types. This may be overridden for the derived type by giving an explicit scalar
11245 storage order for it. However, for a record extension, the derived type must
11246 have the same scalar storage order as the parent type.
11248 A component of a record type that is itself a record or an array and that does
11249 not start and end on a byte boundary must have have the same scalar storage
11250 order as the record type. A component of a bit-packed array type that is itself
11251 a record or an array must have the same scalar storage order as the array type.
11253 No component of a type that has an explicit @code{Scalar_Storage_Order}
11254 attribute definition may be aliased.
11256 A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
11257 with a value equal to @code{System.Default_Bit_Order}) has no effect.
11259 If the opposite storage order is specified, then whenever the value of
11260 a scalar component of an object of type @code{S} is read, the storage
11261 elements of the enclosing machine scalar are first reversed (before
11262 retrieving the component value, possibly applying some shift and mask
11263 operatings on the enclosing machine scalar), and the opposite operation
11264 is done for writes.
11266 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
11267 are relaxed. Instead, the following rules apply:
11270 @itemize *
11272 @item 
11273 the underlying storage elements are those at positions
11274 @code{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
11276 @item 
11277 the sequence of underlying storage elements shall have
11278 a size no greater than the largest machine scalar
11280 @item 
11281 the enclosing machine scalar is defined as the smallest machine
11282 scalar starting at a position no greater than
11283 @code{position + first_bit / storage_element_size} and covering
11284 storage elements at least up to @code{position + (last_bit + storage_element_size - 1) / storage_element_size}
11286 @item 
11287 the position of the component is interpreted relative to that machine
11288 scalar.
11289 @end itemize
11291 If no scalar storage order is specified for a type (either directly, or by
11292 inheritance in the case of a derived type), then the default is normally
11293 the native ordering of the target, but this default can be overridden using
11294 pragma @code{Default_Scalar_Storage_Order}.
11296 If a component of @code{T} is itself of a record or array type, the specfied
11297 @code{Scalar_Storage_Order} does `not' apply to that nested type: an explicit
11298 attribute definition clause must be provided for the component type as well
11299 if desired.
11301 Representation changes that explicitly or implicitly toggle the scalar storage
11302 order are not supported and may result in erroneous execution of the program,
11303 except when performed by means of an instance of @code{Ada.Unchecked_Conversion}.
11305 In particular, overlays are not supported and a warning is given for them:
11307 @example
11308 type Rec_LE is record
11309    I : Integer;
11310 end record;
11312 for Rec_LE use record
11313    I at 0 range 0 .. 31;
11314 end record;
11316 for Rec_LE'Bit_Order use System.Low_Order_First;
11317 for Rec_LE'Scalar_Storage_Order use System.Low_Order_First;
11319 type Rec_BE is record
11320    I : Integer;
11321 end record;
11323 for Rec_BE use record
11324    I at 0 range 0 .. 31;
11325 end record;
11327 for Rec_BE'Bit_Order use System.High_Order_First;
11328 for Rec_BE'Scalar_Storage_Order use System.High_Order_First;
11330 R_LE : Rec_LE;
11332 R_BE : Rec_BE;
11333 for R_BE'Address use R_LE'Address;
11334 @end example
11336 @code{warning: overlay changes scalar storage order [enabled by default]}
11338 In most cases, such representation changes ought to be replaced by an
11339 instantiation of a function or procedure provided by @code{GNAT.Byte_Swapping}.
11341 Note that the scalar storage order only affects the in-memory data
11342 representation. It has no effect on the representation used by stream
11343 attributes.
11345 Note that debuggers may be unable to display the correct value of scalar
11346 components of a type for which the opposite storage order is specified.
11348 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
11349 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e7}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{1a0}
11350 @section Attribute Simple_Storage_Pool
11353 @geindex Storage pool
11354 @geindex simple
11356 @geindex Simple storage pool
11358 @geindex Simple_Storage_Pool
11360 For every nonformal, nonderived access-to-object type @code{Acc}, the
11361 representation attribute @code{Simple_Storage_Pool} may be specified
11362 via an attribute_definition_clause (or by specifying the equivalent aspect):
11364 @example
11365 My_Pool : My_Simple_Storage_Pool_Type;
11367 type Acc is access My_Data_Type;
11369 for Acc'Simple_Storage_Pool use My_Pool;
11370 @end example
11372 The name given in an attribute_definition_clause for the
11373 @code{Simple_Storage_Pool} attribute shall denote a variable of
11374 a ‘simple storage pool type’ (see pragma @cite{Simple_Storage_Pool_Type}).
11376 The use of this attribute is only allowed for a prefix denoting a type
11377 for which it has been specified. The type of the attribute is the type
11378 of the variable specified as the simple storage pool of the access type,
11379 and the attribute denotes that variable.
11381 It is illegal to specify both @code{Storage_Pool} and @code{Simple_Storage_Pool}
11382 for the same access type.
11384 If the @code{Simple_Storage_Pool} attribute has been specified for an access
11385 type, then applying the @code{Storage_Pool} attribute to the type is flagged
11386 with a warning and its evaluation raises the exception @code{Program_Error}.
11388 If the Simple_Storage_Pool attribute has been specified for an access
11389 type @code{S}, then the evaluation of the attribute @code{S'Storage_Size}
11390 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
11391 which is intended to indicate the number of storage elements reserved for
11392 the simple storage pool. If the Storage_Size function has not been defined
11393 for the simple storage pool type, then this attribute returns zero.
11395 If an access type @code{S} has a specified simple storage pool of type
11396 @code{SSP}, then the evaluation of an allocator for that access type calls
11397 the primitive @code{Allocate} procedure for type @code{SSP}, passing
11398 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
11399 semantics of such allocators is the same as those defined for allocators
11400 in section 13.11 of the @cite{Ada Reference Manual}, with the term
11401 `simple storage pool' substituted for `storage pool'.
11403 If an access type @code{S} has a specified simple storage pool of type
11404 @code{SSP}, then a call to an instance of the @code{Ada.Unchecked_Deallocation}
11405 for that access type invokes the primitive @code{Deallocate} procedure
11406 for type @code{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
11407 parameter. The detailed semantics of such unchecked deallocations is the same
11408 as defined in section 13.11.2 of the Ada Reference Manual, except that the
11409 term `simple storage pool' is substituted for `storage pool'.
11411 @node Attribute Small,Attribute Small_Denominator,Attribute Simple_Storage_Pool,Implementation Defined Attributes
11412 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{1a1}
11413 @section Attribute Small
11416 @geindex Ada 83 attributes
11418 @geindex Small
11420 The @code{Small} attribute is defined in Ada 95 (and Ada 2005) only for
11421 fixed-point types.
11422 GNAT also allows this attribute to be applied to floating-point types
11423 for compatibility with Ada 83.  See
11424 the Ada 83 reference manual for an exact description of the semantics of
11425 this attribute when applied to floating-point types.
11427 @node Attribute Small_Denominator,Attribute Small_Numerator,Attribute Small,Implementation Defined Attributes
11428 @anchor{gnat_rm/implementation_defined_attributes attribute-small-denominator}@anchor{1a2}
11429 @section Attribute Small_Denominator
11432 @geindex Small
11434 @geindex Small_Denominator
11436 @code{typ'Small_Denominator} for any fixed-point subtype @cite{typ} yields the
11437 denominator in the representation of @code{typ'Small} as a rational number
11438 with coprime factors (i.e. as an irreducible fraction).
11440 @node Attribute Small_Numerator,Attribute Storage_Unit,Attribute Small_Denominator,Implementation Defined Attributes
11441 @anchor{gnat_rm/implementation_defined_attributes attribute-small-numerator}@anchor{1a3}
11442 @section Attribute Small_Numerator
11445 @geindex Small
11447 @geindex Small_Numerator
11449 @code{typ'Small_Numerator} for any fixed-point subtype @cite{typ} yields the
11450 numerator in the representation of @code{typ'Small} as a rational number
11451 with coprime factors (i.e. as an irreducible fraction).
11453 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small_Numerator,Implementation Defined Attributes
11454 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{1a4}
11455 @section Attribute Storage_Unit
11458 @geindex Storage_Unit
11460 @code{Standard'Storage_Unit} (@code{Standard} is the only allowed
11461 prefix) provides the same value as @code{System.Storage_Unit}.
11463 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
11464 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{1a5}
11465 @section Attribute Stub_Type
11468 @geindex Stub_Type
11470 The GNAT implementation of remote access-to-classwide types is
11471 organized as described in AARM section E.4 (20.t): a value of an RACW type
11472 (designating a remote object) is represented as a normal access
11473 value, pointing to a “stub” object which in turn contains the
11474 necessary information to contact the designated remote object. A
11475 call on any dispatching operation of such a stub object does the
11476 remote call, if necessary, using the information in the stub object
11477 to locate the target partition, etc.
11479 For a prefix @code{T} that denotes a remote access-to-classwide type,
11480 @code{T'Stub_Type} denotes the type of the corresponding stub objects.
11482 By construction, the layout of @code{T'Stub_Type} is identical to that of
11483 type @code{RACW_Stub_Type} declared in the internal implementation-defined
11484 unit @code{System.Partition_Interface}. Use of this attribute will create
11485 an implicit dependency on this unit.
11487 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
11488 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{1a6}
11489 @section Attribute System_Allocator_Alignment
11492 @geindex Alignment
11493 @geindex allocator
11495 @geindex System_Allocator_Alignment
11497 @code{Standard'System_Allocator_Alignment} (@code{Standard} is the only
11498 allowed prefix) provides the observable guaranteed to be honored by
11499 the system allocator (malloc). This is a static value that can be used
11500 in user storage pools based on malloc either to reject allocation
11501 with alignment too large or to enable a realignment circuitry if the
11502 alignment request is larger than this value.
11504 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
11505 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{1a7}
11506 @section Attribute Target_Name
11509 @geindex Target_Name
11511 @code{Standard'Target_Name} (@code{Standard} is the only allowed
11512 prefix) provides a static string value that identifies the target
11513 for the current compilation. For GCC implementations, this is the
11514 standard gcc target name without the terminating slash (for
11515 example, GNAT 5.0 on windows yields “i586-pc-mingw32msv”).
11517 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
11518 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{1a8}
11519 @section Attribute To_Address
11522 @geindex To_Address
11524 The @code{System'To_Address}
11525 (@code{System} is the only allowed prefix)
11526 denotes a function identical to
11527 @code{System.Storage_Elements.To_Address} except that
11528 it is a static attribute.  This means that if its argument is
11529 a static expression, then the result of the attribute is a
11530 static expression.  This means that such an expression can be
11531 used in contexts (e.g., preelaborable packages) which require a
11532 static expression and where the function call could not be used
11533 (since the function call is always nonstatic, even if its
11534 argument is static). The argument must be in the range
11535 -(2**(m-1)) .. 2**m-1, where m is the memory size
11536 (typically 32 or 64). Negative values are intepreted in a
11537 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
11538 a 32 bits machine).
11540 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
11541 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{1a9}
11542 @section Attribute To_Any
11545 @geindex To_Any
11547 This internal attribute is used for the generation of remote subprogram
11548 stubs in the context of the Distributed Systems Annex.
11550 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
11551 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1aa}
11552 @section Attribute Type_Class
11555 @geindex Type_Class
11557 @code{typ'Type_Class} for any type or subtype @cite{typ} yields
11558 the value of the type class for the full type of @cite{typ}.  If
11559 @cite{typ} is a generic formal type, the value is the value for the
11560 corresponding actual subtype.  The value of this attribute is of type
11561 @code{System.Aux_DEC.Type_Class}, which has the following definition:
11563 @example
11564 type Type_Class is
11565   (Type_Class_Enumeration,
11566    Type_Class_Integer,
11567    Type_Class_Fixed_Point,
11568    Type_Class_Floating_Point,
11569    Type_Class_Array,
11570    Type_Class_Record,
11571    Type_Class_Access,
11572    Type_Class_Task,
11573    Type_Class_Address);
11574 @end example
11576 Protected types yield the value @code{Type_Class_Task}, which thus
11577 applies to all concurrent types.  This attribute is designed to
11578 be compatible with the DEC Ada 83 attribute of the same name.
11580 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
11581 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1ab}
11582 @section Attribute Type_Key
11585 @geindex Type_Key
11587 The @code{Type_Key} attribute is applicable to a type or subtype and
11588 yields a value of type Standard.String containing encoded information
11589 about the type or subtype. This provides improved compatibility with
11590 other implementations that support this attribute.
11592 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
11593 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1ac}
11594 @section Attribute TypeCode
11597 @geindex TypeCode
11599 This internal attribute is used for the generation of remote subprogram
11600 stubs in the context of the Distributed Systems Annex.
11602 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
11603 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1ad}
11604 @section Attribute Unconstrained_Array
11607 @geindex Unconstrained_Array
11609 The @code{Unconstrained_Array} attribute can be used with a prefix that
11610 denotes any type or subtype. It is a static attribute that yields
11611 @code{True} if the prefix designates an unconstrained array,
11612 and @code{False} otherwise. In a generic instance, the result is
11613 still static, and yields the result of applying this test to the
11614 generic actual.
11616 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
11617 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1ae}
11618 @section Attribute Universal_Literal_String
11621 @geindex Named numbers
11622 @geindex representation of
11624 @geindex Universal_Literal_String
11626 The prefix of @code{Universal_Literal_String} must be a named
11627 number.  The static result is the string consisting of the characters of
11628 the number as defined in the original source.  This allows the user
11629 program to access the actual text of named numbers without intermediate
11630 conversions and without the need to enclose the strings in quotes (which
11631 would preclude their use as numbers).
11633 For example, the following program prints the first 50 digits of pi:
11635 @example
11636 with Text_IO; use Text_IO;
11637 with Ada.Numerics;
11638 procedure Pi is
11639 begin
11640    Put (Ada.Numerics.Pi'Universal_Literal_String);
11641 end;
11642 @end example
11644 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11645 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1af}
11646 @section Attribute Unrestricted_Access
11649 @geindex Access
11650 @geindex unrestricted
11652 @geindex Unrestricted_Access
11654 The @code{Unrestricted_Access} attribute is similar to @code{Access}
11655 except that all accessibility and aliased view checks are omitted.  This
11656 is a user-beware attribute.
11658 For objects, it is similar to @code{Address}, for which it is a
11659 desirable replacement where the value desired is an access type.
11660 In other words, its effect is similar to first applying the
11661 @code{Address} attribute and then doing an unchecked conversion to a
11662 desired access type.
11664 For subprograms, @code{P'Unrestricted_Access} may be used where
11665 @code{P'Access} would be illegal, to construct a value of a
11666 less-nested named access type that designates a more-nested
11667 subprogram. This value may be used in indirect calls, so long as the
11668 more-nested subprogram still exists; once the subprogram containing it
11669 has returned, such calls are erroneous. For example:
11671 @example
11672 package body P is
11674    type Less_Nested is not null access procedure;
11675    Global : Less_Nested;
11677    procedure P1 is
11678    begin
11679       Global.all;
11680    end P1;
11682    procedure P2 is
11683       Local_Var : Integer;
11685       procedure More_Nested is
11686       begin
11687          ... Local_Var ...
11688       end More_Nested;
11689    begin
11690       Global := More_Nested'Unrestricted_Access;
11691       P1;
11692    end P2;
11694 end P;
11695 @end example
11697 When P1 is called from P2, the call via Global is OK, but if P1 were
11698 called after P2 returns, it would be an erroneous use of a dangling
11699 pointer.
11701 For objects, it is possible to use @code{Unrestricted_Access} for any
11702 type. However, if the result is of an access-to-unconstrained array
11703 subtype, then the resulting pointer has the same scope as the context
11704 of the attribute, and must not be returned to some enclosing scope.
11705 For instance, if a function uses @code{Unrestricted_Access} to create
11706 an access-to-unconstrained-array and returns that value to the caller,
11707 the result will involve dangling pointers. In addition, it is only
11708 valid to create pointers to unconstrained arrays using this attribute
11709 if the pointer has the normal default ‘fat’ representation where a
11710 pointer has two components, one points to the array and one points to
11711 the bounds. If a size clause is used to force ‘thin’ representation
11712 for a pointer to unconstrained where there is only space for a single
11713 pointer, then the resulting pointer is not usable.
11715 In the simple case where a direct use of Unrestricted_Access attempts
11716 to make a thin pointer for a non-aliased object, the compiler will
11717 reject the use as illegal, as shown in the following example:
11719 @example
11720 with System; use System;
11721 procedure SliceUA2 is
11722    type A is access all String;
11723    for A'Size use Standard'Address_Size;
11725    procedure P (Arg : A) is
11726    begin
11727       null;
11728    end P;
11730    X : String := "hello world!";
11731    X2 : aliased String := "hello world!";
11733    AV : A := X'Unrestricted_Access;    -- ERROR
11734              |
11735 >>> illegal use of Unrestricted_Access attribute
11736 >>> attempt to generate thin pointer to unaliased object
11738 begin
11739    P (X'Unrestricted_Access);          -- ERROR
11740       |
11741 >>> illegal use of Unrestricted_Access attribute
11742 >>> attempt to generate thin pointer to unaliased object
11744    P (X(7 .. 12)'Unrestricted_Access); -- ERROR
11745       |
11746 >>> illegal use of Unrestricted_Access attribute
11747 >>> attempt to generate thin pointer to unaliased object
11749    P (X2'Unrestricted_Access);         -- OK
11750 end;
11751 @end example
11753 but other cases cannot be detected by the compiler, and are
11754 considered to be erroneous. Consider the following example:
11756 @example
11757 with System; use System;
11758 with System; use System;
11759 procedure SliceUA is
11760    type AF is access all String;
11762    type A is access all String;
11763    for A'Size use Standard'Address_Size;
11765    procedure P (Arg : A) is
11766    begin
11767       if Arg'Length /= 6 then
11768          raise Program_Error;
11769       end if;
11770    end P;
11772    X : String := "hello world!";
11773    Y : AF := X (7 .. 12)'Unrestricted_Access;
11775 begin
11776    P (A (Y));
11777 end;
11778 @end example
11780 A normal unconstrained array value
11781 or a constrained array object marked as aliased has the bounds in memory
11782 just before the array, so a thin pointer can retrieve both the data and
11783 the bounds.  But in this case, the non-aliased object @code{X} does not have the
11784 bounds before the string.  If the size clause for type @code{A}
11785 were not present, then the pointer
11786 would be a fat pointer, where one component is a pointer to the bounds,
11787 and all would be well.  But with the size clause present, the conversion from
11788 fat pointer to thin pointer in the call loses the bounds, and so this
11789 is erroneous, and the program likely raises a @code{Program_Error} exception.
11791 In general, it is advisable to completely
11792 avoid mixing the use of thin pointers and the use of
11793 @code{Unrestricted_Access} where the designated type is an
11794 unconstrained array.  The use of thin pointers should be restricted to
11795 cases of porting legacy code that implicitly assumes the size of pointers,
11796 and such code should not in any case be using this attribute.
11798 Another erroneous situation arises if the attribute is
11799 applied to a constant. The resulting pointer can be used to access the
11800 constant, but the effect of trying to modify a constant in this manner
11801 is not well-defined. Consider this example:
11803 @example
11804 P : constant Integer := 4;
11805 type R is access all Integer;
11806 RV : R := P'Unrestricted_Access;
11808 RV.all := 3;
11809 @end example
11811 Here we attempt to modify the constant P from 4 to 3, but the compiler may
11812 or may not notice this attempt, and subsequent references to P may yield
11813 either the value 3 or the value 4 or the assignment may blow up if the
11814 compiler decides to put P in read-only memory. One particular case where
11815 @code{Unrestricted_Access} can be used in this way is to modify the
11816 value of an @code{in} parameter:
11818 @example
11819 procedure K (S : in String) is
11820    type R is access all Character;
11821    RV : R := S (3)'Unrestricted_Access;
11822 begin
11823    RV.all := 'a';
11824 end;
11825 @end example
11827 In general this is a risky approach. It may appear to “work” but such uses of
11828 @code{Unrestricted_Access} are potentially non-portable, even from one version
11829 of GNAT to another, so are best avoided if possible.
11831 @node Attribute Update,Attribute Valid_Value,Attribute Unrestricted_Access,Implementation Defined Attributes
11832 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1b0}
11833 @section Attribute Update
11836 @geindex Update
11838 The @code{Update} attribute creates a copy of an array or record value
11839 with one or more modified components. The syntax is:
11841 @example
11842 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
11843 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
11844 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
11845                 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
11847 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
11848 INDEX_EXPRESSION_LIST_LIST                   ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
11849 INDEX_EXPRESSION_LIST                        ::= ( EXPRESSION @{, EXPRESSION @} )
11850 @end example
11852 where @code{PREFIX} is the name of an array or record object, the
11853 association list in parentheses does not contain an @code{others}
11854 choice and the box symbol @code{<>} may not appear in any
11855 expression. The effect is to yield a copy of the array or record value
11856 which is unchanged apart from the components mentioned in the
11857 association list, which are changed to the indicated value. The
11858 original value of the array or record value is not affected. For
11859 example:
11861 @example
11862 type Arr is Array (1 .. 5) of Integer;
11864 Avar1 : Arr := (1,2,3,4,5);
11865 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
11866 @end example
11868 yields a value for @code{Avar2} of 1,10,20,20,5 with @code{Avar1}
11869 begin unmodified. Similarly:
11871 @example
11872 type Rec is A, B, C : Integer;
11874 Rvar1 : Rec := (A => 1, B => 2, C => 3);
11875 Rvar2 : Rec := Rvar1'Update (B => 20);
11876 @end example
11878 yields a value for @code{Rvar2} of (A => 1, B => 20, C => 3),
11879 with @code{Rvar1} being unmodifed.
11880 Note that the value of the attribute reference is computed
11881 completely before it is used. This means that if you write:
11883 @example
11884 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
11885 @end example
11887 then the value of @code{Avar1} is not modified if @code{Function_Call}
11888 raises an exception, unlike the effect of a series of direct assignments
11889 to elements of @code{Avar1}. In general this requires that
11890 two extra complete copies of the object are required, which should be
11891 kept in mind when considering efficiency.
11893 The @code{Update} attribute cannot be applied to prefixes of a limited
11894 type, and cannot reference discriminants in the case of a record type.
11895 The accessibility level of an Update attribute result object is defined
11896 as for an aggregate.
11898 In the record case, no component can be mentioned more than once. In
11899 the array case, two overlapping ranges can appear in the association list,
11900 in which case the modifications are processed left to right.
11902 Multi-dimensional arrays can be modified, as shown by this example:
11904 @example
11905 A : array (1 .. 10, 1 .. 10) of Integer;
11907 A := A'Update ((1, 2) => 20, (3, 4) => 30);
11908 @end example
11910 which changes element (1,2) to 20 and (3,4) to 30.
11912 @node Attribute Valid_Value,Attribute Valid_Scalars,Attribute Update,Implementation Defined Attributes
11913 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-value}@anchor{1b1}
11914 @section Attribute Valid_Value
11917 @geindex Valid_Value
11919 The @code{'Valid_Value} attribute is defined for enumeration types other than
11920 those in package Standard. This attribute is a function that takes
11921 a String, and returns Boolean. @code{T'Valid_Value (S)} returns True
11922 if and only if @code{T'Value (S)} would not raise Constraint_Error.
11924 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Valid_Value,Implementation Defined Attributes
11925 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1b2}
11926 @section Attribute Valid_Scalars
11929 @geindex Valid_Scalars
11931 The @code{'Valid_Scalars} attribute is intended to make it easier to check the
11932 validity of scalar subcomponents of composite objects. The attribute is defined
11933 for any prefix @code{P} which denotes an object. Prefix @code{P} can be any type
11934 except for tagged private or @code{Unchecked_Union} types. The value of the
11935 attribute is of type @code{Boolean}.
11937 @code{P'Valid_Scalars} yields @code{True} if and only if the evaluation of
11938 @code{C'Valid} yields @code{True} for every scalar subcomponent @code{C} of @code{P}, or if
11939 @code{P} has no scalar subcomponents. Attribute @code{'Valid_Scalars} is equivalent
11940 to attribute @code{'Valid} for scalar types.
11942 It is not specified in what order the subcomponents are checked, nor whether
11943 any more are checked after any one of them is determined to be invalid. If the
11944 prefix @code{P} is of a class-wide type @code{T'Class} (where @code{T} is the associated
11945 specific type), or if the prefix @code{P} is of a specific tagged type @code{T}, then
11946 only the subcomponents of @code{T} are checked; in other words, components of
11947 extensions of @code{T} are not checked even if @code{T'Class (P)'Tag /= T'Tag}.
11949 The compiler will issue a warning if it can be determined at compile time that
11950 the prefix of the attribute has no scalar subcomponents.
11952 Note: @code{Valid_Scalars} can generate a lot of code, especially in the case of
11953 a large variant record. If the attribute is called in many places in the same
11954 program applied to objects of the same type, it can reduce program size to
11955 write a function with a single use of the attribute, and then call that
11956 function from multiple places.
11958 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
11959 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1b3}
11960 @section Attribute VADS_Size
11963 @geindex Size
11964 @geindex VADS compatibility
11966 @geindex VADS_Size
11968 The @code{'VADS_Size} attribute is intended to make it easier to port
11969 legacy code which relies on the semantics of @code{'Size} as implemented
11970 by the VADS Ada 83 compiler.  GNAT makes a best effort at duplicating the
11971 same semantic interpretation.  In particular, @code{'VADS_Size} applied
11972 to a predefined or other primitive type with no Size clause yields the
11973 Object_Size (for example, @code{Natural'Size} is 32 rather than 31 on
11974 typical machines).  In addition @code{'VADS_Size} applied to an object
11975 gives the result that would be obtained by applying the attribute to
11976 the corresponding type.
11978 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
11979 @anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{161}@anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1b4}
11980 @section Attribute Value_Size
11983 @geindex Size
11984 @geindex setting for not-first subtype
11986 @geindex Value_Size
11988 @code{type'Value_Size} is the number of bits required to represent
11989 a value of the given subtype.  It is the same as @code{type'Size},
11990 but, unlike @code{Size}, may be set for non-first subtypes.
11992 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
11993 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1b5}
11994 @section Attribute Wchar_T_Size
11997 @geindex Wchar_T_Size
11999 @code{Standard'Wchar_T_Size} (@code{Standard} is the only allowed
12000 prefix) provides the size in bits of the C @code{wchar_t} type
12001 primarily for constructing the definition of this type in
12002 package @code{Interfaces.C}. The result is a static constant.
12004 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
12005 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1b6}
12006 @section Attribute Word_Size
12009 @geindex Word_Size
12011 @code{Standard'Word_Size} (@code{Standard} is the only allowed
12012 prefix) provides the value @code{System.Word_Size}. The result is
12013 a static constant.
12015 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
12016 @anchor{gnat_rm/standard_and_implementation_defined_restrictions doc}@anchor{1b7}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1b8}@anchor{gnat_rm/standard_and_implementation_defined_restrictions standard-and-implementation-defined-restrictions}@anchor{9}
12017 @chapter Standard and Implementation Defined Restrictions
12020 All Ada Reference Manual-defined Restriction identifiers are implemented:
12023 @itemize *
12025 @item 
12026 language-defined restrictions (see 13.12.1)
12028 @item 
12029 tasking restrictions (see D.7)
12031 @item 
12032 high integrity restrictions (see H.4)
12033 @end itemize
12035 GNAT implements additional restriction identifiers. All restrictions, whether
12036 language defined or GNAT-specific, are listed in the following.
12038 @menu
12039 * Partition-Wide Restrictions:: 
12040 * Program Unit Level Restrictions:: 
12042 @end menu
12044 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
12045 @anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1b9}@anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1ba}
12046 @section Partition-Wide Restrictions
12049 There are two separate lists of restriction identifiers. The first
12050 set requires consistency throughout a partition (in other words, if the
12051 restriction identifier is used for any compilation unit in the partition,
12052 then all compilation units in the partition must obey the restriction).
12054 @menu
12055 * Immediate_Reclamation:: 
12056 * Max_Asynchronous_Select_Nesting:: 
12057 * Max_Entry_Queue_Length:: 
12058 * Max_Protected_Entries:: 
12059 * Max_Select_Alternatives:: 
12060 * Max_Storage_At_Blocking:: 
12061 * Max_Task_Entries:: 
12062 * Max_Tasks:: 
12063 * No_Abort_Statements:: 
12064 * No_Access_Parameter_Allocators:: 
12065 * No_Access_Subprograms:: 
12066 * No_Allocators:: 
12067 * No_Anonymous_Allocators:: 
12068 * No_Asynchronous_Control:: 
12069 * No_Calendar:: 
12070 * No_Coextensions:: 
12071 * No_Default_Initialization:: 
12072 * No_Delay:: 
12073 * No_Dependence:: 
12074 * No_Direct_Boolean_Operators:: 
12075 * No_Dispatch:: 
12076 * No_Dispatching_Calls:: 
12077 * No_Dynamic_Attachment:: 
12078 * No_Dynamic_Priorities:: 
12079 * No_Entry_Calls_In_Elaboration_Code:: 
12080 * No_Enumeration_Maps:: 
12081 * No_Exception_Handlers:: 
12082 * No_Exception_Propagation:: 
12083 * No_Exception_Registration:: 
12084 * No_Exceptions:: 
12085 * No_Finalization:: 
12086 * No_Fixed_Point:: 
12087 * No_Floating_Point:: 
12088 * No_Implicit_Conditionals:: 
12089 * No_Implicit_Dynamic_Code:: 
12090 * No_Implicit_Heap_Allocations:: 
12091 * No_Implicit_Protected_Object_Allocations:: 
12092 * No_Implicit_Task_Allocations:: 
12093 * No_Initialize_Scalars:: 
12094 * No_IO:: 
12095 * No_Local_Allocators:: 
12096 * No_Local_Protected_Objects:: 
12097 * No_Local_Tagged_Types:: 
12098 * No_Local_Timing_Events:: 
12099 * No_Long_Long_Integers:: 
12100 * No_Multiple_Elaboration:: 
12101 * No_Nested_Finalization:: 
12102 * No_Protected_Type_Allocators:: 
12103 * No_Protected_Types:: 
12104 * No_Recursion:: 
12105 * No_Reentrancy:: 
12106 * No_Relative_Delay:: 
12107 * No_Requeue_Statements:: 
12108 * No_Secondary_Stack:: 
12109 * No_Select_Statements:: 
12110 * No_Specific_Termination_Handlers:: 
12111 * No_Specification_of_Aspect:: 
12112 * No_Standard_Allocators_After_Elaboration:: 
12113 * No_Standard_Storage_Pools:: 
12114 * No_Stream_Optimizations:: 
12115 * No_Streams:: 
12116 * No_Tagged_Type_Registration:: 
12117 * No_Task_Allocators:: 
12118 * No_Task_At_Interrupt_Priority:: 
12119 * No_Task_Attributes_Package:: 
12120 * No_Task_Hierarchy:: 
12121 * No_Task_Termination:: 
12122 * No_Tasking:: 
12123 * No_Terminate_Alternatives:: 
12124 * No_Unchecked_Access:: 
12125 * No_Unchecked_Conversion:: 
12126 * No_Unchecked_Deallocation:: 
12127 * No_Use_Of_Attribute:: 
12128 * No_Use_Of_Entity:: 
12129 * No_Use_Of_Pragma:: 
12130 * Pure_Barriers:: 
12131 * Simple_Barriers:: 
12132 * Static_Priorities:: 
12133 * Static_Storage_Size:: 
12135 @end menu
12137 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
12138 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1bb}
12139 @subsection Immediate_Reclamation
12142 @geindex Immediate_Reclamation
12144 [RM H.4] This restriction ensures that, except for storage occupied by
12145 objects created by allocators and not deallocated via unchecked
12146 deallocation, any storage reserved at run time for an object is
12147 immediately reclaimed when the object no longer exists.
12149 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
12150 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1bc}
12151 @subsection Max_Asynchronous_Select_Nesting
12154 @geindex Max_Asynchronous_Select_Nesting
12156 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
12157 selects. Violations of this restriction with a value of zero are
12158 detected at compile time. Violations of this restriction with values
12159 other than zero cause Storage_Error to be raised.
12161 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
12162 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1bd}
12163 @subsection Max_Entry_Queue_Length
12166 @geindex Max_Entry_Queue_Length
12168 [RM D.7] This restriction is a declaration that any protected entry compiled in
12169 the scope of the restriction has at most the specified number of
12170 tasks waiting on the entry at any one time, and so no queue is required.
12171 Note that this restriction is checked at run time. Violation of this
12172 restriction results in the raising of Program_Error exception at the point of
12173 the call.
12175 @geindex Max_Entry_Queue_Depth
12177 The restriction @code{Max_Entry_Queue_Depth} is recognized as a
12178 synonym for @code{Max_Entry_Queue_Length}. This is retained for historical
12179 compatibility purposes (and a warning will be generated for its use if
12180 warnings on obsolescent features are activated).
12182 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
12183 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1be}
12184 @subsection Max_Protected_Entries
12187 @geindex Max_Protected_Entries
12189 [RM D.7] Specifies the maximum number of entries per protected type. The
12190 bounds of every entry family of a protected unit shall be static, or shall be
12191 defined by a discriminant of a subtype whose corresponding bound is static.
12193 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
12194 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1bf}
12195 @subsection Max_Select_Alternatives
12198 @geindex Max_Select_Alternatives
12200 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
12202 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
12203 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1c0}
12204 @subsection Max_Storage_At_Blocking
12207 @geindex Max_Storage_At_Blocking
12209 [RM D.7] Specifies the maximum portion (in storage elements) of a task’s
12210 Storage_Size that can be retained by a blocked task. A violation of this
12211 restriction causes Storage_Error to be raised.
12213 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
12214 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1c1}
12215 @subsection Max_Task_Entries
12218 @geindex Max_Task_Entries
12220 [RM D.7] Specifies the maximum number of entries
12221 per task.  The bounds of every entry family
12222 of a task unit shall be static, or shall be
12223 defined by a discriminant of a subtype whose
12224 corresponding bound is static.
12226 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
12227 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1c2}
12228 @subsection Max_Tasks
12231 @geindex Max_Tasks
12233 [RM D.7] Specifies the maximum number of task that may be created, not
12234 counting the creation of the environment task.  Violations of this
12235 restriction with a value of zero are detected at compile
12236 time. Violations of this restriction with values other than zero cause
12237 Storage_Error to be raised.
12239 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
12240 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1c3}
12241 @subsection No_Abort_Statements
12244 @geindex No_Abort_Statements
12246 [RM D.7] There are no abort_statements, and there are
12247 no calls to Task_Identification.Abort_Task.
12249 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
12250 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1c4}
12251 @subsection No_Access_Parameter_Allocators
12254 @geindex No_Access_Parameter_Allocators
12256 [RM H.4] This restriction ensures at compile time that there are no
12257 occurrences of an allocator as the actual parameter to an access
12258 parameter.
12260 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
12261 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1c5}
12262 @subsection No_Access_Subprograms
12265 @geindex No_Access_Subprograms
12267 [RM H.4] This restriction ensures at compile time that there are no
12268 declarations of access-to-subprogram types.
12270 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
12271 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1c6}
12272 @subsection No_Allocators
12275 @geindex No_Allocators
12277 [RM H.4] This restriction ensures at compile time that there are no
12278 occurrences of an allocator.
12280 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
12281 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1c7}
12282 @subsection No_Anonymous_Allocators
12285 @geindex No_Anonymous_Allocators
12287 [RM H.4] This restriction ensures at compile time that there are no
12288 occurrences of an allocator of anonymous access type.
12290 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
12291 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1c8}
12292 @subsection No_Asynchronous_Control
12295 @geindex No_Asynchronous_Control
12297 [RM J.13] This restriction ensures at compile time that there are no semantic
12298 dependences on the predefined package Asynchronous_Task_Control.
12300 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
12301 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1c9}
12302 @subsection No_Calendar
12305 @geindex No_Calendar
12307 [GNAT] This restriction ensures at compile time that there are no semantic
12308 dependences on package Calendar.
12310 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
12311 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1ca}
12312 @subsection No_Coextensions
12315 @geindex No_Coextensions
12317 [RM H.4] This restriction ensures at compile time that there are no
12318 coextensions. See 3.10.2.
12320 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
12321 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1cb}
12322 @subsection No_Default_Initialization
12325 @geindex No_Default_Initialization
12327 [GNAT] This restriction prohibits any instance of default initialization
12328 of variables.  The binder implements a consistency rule which prevents
12329 any unit compiled without the restriction from with’ing a unit with the
12330 restriction (this allows the generation of initialization procedures to
12331 be skipped, since you can be sure that no call is ever generated to an
12332 initialization procedure in a unit with the restriction active). If used
12333 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
12334 is to prohibit all cases of variables declared without a specific
12335 initializer (including the case of OUT scalar parameters).
12337 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
12338 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1cc}
12339 @subsection No_Delay
12342 @geindex No_Delay
12344 [RM H.4] This restriction ensures at compile time that there are no
12345 delay statements and no semantic dependences on package Calendar.
12347 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
12348 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1cd}
12349 @subsection No_Dependence
12352 @geindex No_Dependence
12354 [RM 13.12.1] This restriction ensures at compile time that there are no
12355 dependences on a library unit. For GNAT, this includes implicit implementation
12356 dependences on units of the runtime library that are created by the compiler
12357 to support specific constructs of the language. Here are some examples:
12360 @itemize *
12362 @item 
12363 @code{System.Arith_64}: 64-bit arithmetics for 32-bit platforms,
12365 @item 
12366 @code{System.Arith_128}: 128-bit arithmetics for 64-bit platforms,
12368 @item 
12369 @code{System.Memory}: heap memory allocation routines,
12371 @item 
12372 @code{System.Memory_Compare}: memory comparison routine (aka @code{memcmp} for C),
12374 @item 
12375 @code{System.Memory_Copy}: memory copy routine (aka @code{memcpy} for C),
12377 @item 
12378 @code{System.Memory_Move}: memoy move routine (aka @code{memmove} for C),
12380 @item 
12381 @code{System.Memory_Set}: memory set routine (aka @code{memset} for C),
12383 @item 
12384 @code{System.Stack_Checking[.Operations]}: stack checking without MMU,
12386 @item 
12387 @code{System.GCC}: support routines from the GCC library.
12388 @end itemize
12390 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
12391 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1ce}
12392 @subsection No_Direct_Boolean_Operators
12395 @geindex No_Direct_Boolean_Operators
12397 [GNAT] This restriction ensures that no logical operators (and/or/xor)
12398 are used on operands of type Boolean (or any type derived from Boolean).
12399 This is intended for use in safety critical programs where the certification
12400 protocol requires the use of short-circuit (and then, or else) forms for all
12401 composite boolean operations.
12403 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
12404 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1cf}
12405 @subsection No_Dispatch
12408 @geindex No_Dispatch
12410 [RM H.4] This restriction ensures at compile time that there are no
12411 occurrences of @code{T'Class}, for any (tagged) subtype @code{T}.
12413 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
12414 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1d0}
12415 @subsection No_Dispatching_Calls
12418 @geindex No_Dispatching_Calls
12420 [GNAT] This restriction ensures at compile time that the code generated by the
12421 compiler involves no dispatching calls. The use of this restriction allows the
12422 safe use of record extensions, classwide membership tests and other classwide
12423 features not involving implicit dispatching. This restriction ensures that
12424 the code contains no indirect calls through a dispatching mechanism. Note that
12425 this includes internally-generated calls created by the compiler, for example
12426 in the implementation of class-wide objects assignments. The
12427 membership test is allowed in the presence of this restriction, because its
12428 implementation requires no dispatching.
12429 This restriction is comparable to the official Ada restriction
12430 @code{No_Dispatch} except that it is a bit less restrictive in that it allows
12431 all classwide constructs that do not imply dispatching.
12432 The following example indicates constructs that violate this restriction.
12434 @example
12435 package Pkg is
12436   type T is tagged record
12437     Data : Natural;
12438   end record;
12439   procedure P (X : T);
12441   type DT is new T with record
12442     More_Data : Natural;
12443   end record;
12444   procedure Q (X : DT);
12445 end Pkg;
12447 with Pkg; use Pkg;
12448 procedure Example is
12449   procedure Test (O : T'Class) is
12450     N : Natural := O'Size; --  Error: Dispatching call
12451     C : T'Class := O;      --  Error: implicit Dispatching Call
12452   begin
12453     if O in DT'Class then  --  OK   : Membership test
12454        Q (DT (O));         --  OK   : Type conversion plus direct call
12455     else
12456        P (O);              --  Error: Dispatching call
12457     end if;
12458   end Test;
12460   Obj : DT;
12461 begin
12462   P (Obj);                 --  OK   : Direct call
12463   P (T (Obj));             --  OK   : Type conversion plus direct call
12464   P (T'Class (Obj));       --  Error: Dispatching call
12466   Test (Obj);              --  OK   : Type conversion
12468   if Obj in T'Class then   --  OK   : Membership test
12469      null;
12470   end if;
12471 end Example;
12472 @end example
12474 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
12475 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1d1}
12476 @subsection No_Dynamic_Attachment
12479 @geindex No_Dynamic_Attachment
12481 [RM D.7] This restriction ensures that there is no call to any of the
12482 operations defined in package Ada.Interrupts
12483 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
12484 Detach_Handler, and Reference).
12486 @geindex No_Dynamic_Interrupts
12488 The restriction @code{No_Dynamic_Interrupts} is recognized as a
12489 synonym for @code{No_Dynamic_Attachment}. This is retained for historical
12490 compatibility purposes (and a warning will be generated for its use if
12491 warnings on obsolescent features are activated).
12493 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
12494 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1d2}
12495 @subsection No_Dynamic_Priorities
12498 @geindex No_Dynamic_Priorities
12500 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
12502 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
12503 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1d3}
12504 @subsection No_Entry_Calls_In_Elaboration_Code
12507 @geindex No_Entry_Calls_In_Elaboration_Code
12509 [GNAT] This restriction ensures at compile time that no task or protected entry
12510 calls are made during elaboration code.  As a result of the use of this
12511 restriction, the compiler can assume that no code past an accept statement
12512 in a task can be executed at elaboration time.
12514 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
12515 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1d4}
12516 @subsection No_Enumeration_Maps
12519 @geindex No_Enumeration_Maps
12521 [GNAT] This restriction ensures at compile time that no operations requiring
12522 enumeration maps are used (that is Image and Value attributes applied
12523 to enumeration types).
12525 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
12526 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1d5}
12527 @subsection No_Exception_Handlers
12530 @geindex No_Exception_Handlers
12532 [GNAT] This restriction ensures at compile time that there are no explicit
12533 exception handlers. It also indicates that no exception propagation will
12534 be provided. In this mode, exceptions may be raised but will result in
12535 an immediate call to the last chance handler, a routine that the user
12536 must define with the following profile:
12538 @example
12539 procedure Last_Chance_Handler
12540   (Source_Location : System.Address; Line : Integer);
12541 pragma Export (C, Last_Chance_Handler,
12542                "__gnat_last_chance_handler");
12543 @end example
12545 The parameter is a C null-terminated string representing a message to be
12546 associated with the exception (typically the source location of the raise
12547 statement generated by the compiler). The Line parameter when nonzero
12548 represents the line number in the source program where the raise occurs.
12550 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
12551 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1d6}
12552 @subsection No_Exception_Propagation
12555 @geindex No_Exception_Propagation
12557 [GNAT] This restriction guarantees that exceptions are never propagated
12558 to an outer subprogram scope. The only case in which an exception may
12559 be raised is when the handler is statically in the same subprogram, so
12560 that the effect of a raise is essentially like a goto statement. Any
12561 other raise statement (implicit or explicit) will be considered
12562 unhandled. Exception handlers are allowed, but may not contain an
12563 exception occurrence identifier (exception choice). In addition, use of
12564 the package GNAT.Current_Exception is not permitted, and reraise
12565 statements (raise with no operand) are not permitted.
12567 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
12568 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1d7}
12569 @subsection No_Exception_Registration
12572 @geindex No_Exception_Registration
12574 [GNAT] This restriction ensures at compile time that no stream operations for
12575 types Exception_Id or Exception_Occurrence are used. This also makes it
12576 impossible to pass exceptions to or from a partition with this restriction
12577 in a distributed environment. If this restriction is active, the generated
12578 code is simplified by omitting the otherwise-required global registration
12579 of exceptions when they are declared.
12581 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
12582 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1d8}
12583 @subsection No_Exceptions
12586 @geindex No_Exceptions
12588 [RM H.4] This restriction ensures at compile time that there are no
12589 raise statements and no exception handlers and also suppresses the
12590 generation of language-defined run-time checks.
12592 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
12593 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1d9}
12594 @subsection No_Finalization
12597 @geindex No_Finalization
12599 [GNAT] This restriction disables the language features described in
12600 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
12601 performed by the compiler to support these features. The following types
12602 are no longer considered controlled when this restriction is in effect:
12605 @itemize *
12607 @item 
12608 @code{Ada.Finalization.Controlled}
12610 @item 
12611 @code{Ada.Finalization.Limited_Controlled}
12613 @item 
12614 Derivations from @code{Controlled} or @code{Limited_Controlled}
12616 @item 
12617 Class-wide types
12619 @item 
12620 Protected types
12622 @item 
12623 Task types
12625 @item 
12626 Array and record types with controlled components
12627 @end itemize
12629 The compiler no longer generates code to initialize, finalize or adjust an
12630 object or a nested component, either declared on the stack or on the heap. The
12631 deallocation of a controlled object no longer finalizes its contents.
12633 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
12634 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1da}
12635 @subsection No_Fixed_Point
12638 @geindex No_Fixed_Point
12640 [RM H.4] This restriction ensures at compile time that there are no
12641 occurrences of fixed point types and operations.
12643 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
12644 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1db}
12645 @subsection No_Floating_Point
12648 @geindex No_Floating_Point
12650 [RM H.4] This restriction ensures at compile time that there are no
12651 occurrences of floating point types and operations.
12653 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
12654 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1dc}
12655 @subsection No_Implicit_Conditionals
12658 @geindex No_Implicit_Conditionals
12660 [GNAT] This restriction ensures that the generated code does not contain any
12661 implicit conditionals, either by modifying the generated code where possible,
12662 or by rejecting any construct that would otherwise generate an implicit
12663 conditional. Note that this check does not include run time constraint
12664 checks, which on some targets may generate implicit conditionals as
12665 well. To control the latter, constraint checks can be suppressed in the
12666 normal manner. Constructs generating implicit conditionals include comparisons
12667 of composite objects and the Max/Min attributes.
12669 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12670 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1dd}
12671 @subsection No_Implicit_Dynamic_Code
12674 @geindex No_Implicit_Dynamic_Code
12676 @geindex trampoline
12678 [GNAT] This restriction prevents the compiler from building ‘trampolines’.
12679 This is a structure that is built on the stack and contains dynamic
12680 code to be executed at run time. On some targets, a trampoline is
12681 built for the following features: @code{Access},
12682 @code{Unrestricted_Access}, or @code{Address} of a nested subprogram;
12683 nested task bodies; primitive operations of nested tagged types.
12684 Trampolines do not work on machines that prevent execution of stack
12685 data. For example, on windows systems, enabling DEP (data execution
12686 protection) will cause trampolines to raise an exception.
12687 Trampolines are also quite slow at run time.
12689 On many targets, trampolines have been largely eliminated. Look at the
12690 version of system.ads for your target — if it has
12691 Always_Compatible_Rep equal to False, then trampolines are largely
12692 eliminated. In particular, a trampoline is built for the following
12693 features: @code{Address} of a nested subprogram;
12694 @code{Access} or @code{Unrestricted_Access} of a nested subprogram,
12695 but only if pragma Favor_Top_Level applies, or the access type has a
12696 foreign-language convention; primitive operations of nested tagged
12697 types.
12699 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12700 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1de}
12701 @subsection No_Implicit_Heap_Allocations
12704 @geindex No_Implicit_Heap_Allocations
12706 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12708 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12709 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1df}
12710 @subsection No_Implicit_Protected_Object_Allocations
12713 @geindex No_Implicit_Protected_Object_Allocations
12715 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12716 protected object.
12718 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12719 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1e0}
12720 @subsection No_Implicit_Task_Allocations
12723 @geindex No_Implicit_Task_Allocations
12725 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12727 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12728 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1e1}
12729 @subsection No_Initialize_Scalars
12732 @geindex No_Initialize_Scalars
12734 [GNAT] This restriction ensures that no unit in the partition is compiled with
12735 pragma Initialize_Scalars. This allows the generation of more efficient
12736 code, and in particular eliminates dummy null initialization routines that
12737 are otherwise generated for some record and array types.
12739 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
12740 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1e2}
12741 @subsection No_IO
12744 @geindex No_IO
12746 [RM H.4] This restriction ensures at compile time that there are no
12747 dependences on any of the library units Sequential_IO, Direct_IO,
12748 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
12750 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
12751 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1e3}
12752 @subsection No_Local_Allocators
12755 @geindex No_Local_Allocators
12757 [RM H.4] This restriction ensures at compile time that there are no
12758 occurrences of an allocator in subprograms, generic subprograms, tasks,
12759 and entry bodies.
12761 @node No_Local_Protected_Objects,No_Local_Tagged_Types,No_Local_Allocators,Partition-Wide Restrictions
12762 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1e4}
12763 @subsection No_Local_Protected_Objects
12766 @geindex No_Local_Protected_Objects
12768 [RM D.7] This restriction ensures at compile time that protected objects are
12769 only declared at the library level.
12771 @node No_Local_Tagged_Types,No_Local_Timing_Events,No_Local_Protected_Objects,Partition-Wide Restrictions
12772 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-tagged-types}@anchor{1e5}
12773 @subsection No_Local_Tagged_Types
12776 @geindex No_Local_Tagged_Types
12778 [GNAT] This restriction ensures at compile time that tagged types are only
12779 declared at the library level.
12781 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Tagged_Types,Partition-Wide Restrictions
12782 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1e6}
12783 @subsection No_Local_Timing_Events
12786 @geindex No_Local_Timing_Events
12788 [RM D.7] All objects of type Ada.Real_Time.Timing_Events.Timing_Event are
12789 declared at the library level.
12791 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
12792 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1e7}
12793 @subsection No_Long_Long_Integers
12796 @geindex No_Long_Long_Integers
12798 [GNAT] This partition-wide restriction forbids any explicit reference to
12799 type Standard.Long_Long_Integer, and also forbids declaring range types whose
12800 implicit base type is Long_Long_Integer, and modular types whose size exceeds
12801 Long_Integer’Size.
12803 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
12804 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1e8}
12805 @subsection No_Multiple_Elaboration
12808 @geindex No_Multiple_Elaboration
12810 [GNAT] When this restriction is active and the static elaboration model is
12811 used, and -fpreserve-control-flow is not used, the compiler is allowed to
12812 suppress the elaboration counter normally associated with the unit, even if
12813 the unit has elaboration code. This counter is typically used to check for
12814 access before elaboration and to control multiple elaboration attempts. If the
12815 restriction is used, then the situations in which multiple elaboration is
12816 possible, including non-Ada main programs and Stand Alone libraries, are not
12817 permitted and will be diagnosed by the binder.
12819 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
12820 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1e9}
12821 @subsection No_Nested_Finalization
12824 @geindex No_Nested_Finalization
12826 [RM D.7] All objects requiring finalization are declared at the library level.
12828 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
12829 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1ea}
12830 @subsection No_Protected_Type_Allocators
12833 @geindex No_Protected_Type_Allocators
12835 [RM D.7] This restriction ensures at compile time that there are no allocator
12836 expressions that attempt to allocate protected objects.
12838 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
12839 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1eb}
12840 @subsection No_Protected_Types
12843 @geindex No_Protected_Types
12845 [RM H.4] This restriction ensures at compile time that there are no
12846 declarations of protected types or protected objects.
12848 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
12849 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1ec}
12850 @subsection No_Recursion
12853 @geindex No_Recursion
12855 [RM H.4] A program execution is erroneous if a subprogram is invoked as
12856 part of its execution.
12858 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
12859 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1ed}
12860 @subsection No_Reentrancy
12863 @geindex No_Reentrancy
12865 [RM H.4] A program execution is erroneous if a subprogram is executed by
12866 two tasks at the same time.
12868 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
12869 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1ee}
12870 @subsection No_Relative_Delay
12873 @geindex No_Relative_Delay
12875 [RM D.7] This restriction ensures at compile time that there are no delay
12876 relative statements and prevents expressions such as @code{delay 1.23;} from
12877 appearing in source code.
12879 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
12880 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1ef}
12881 @subsection No_Requeue_Statements
12884 @geindex No_Requeue_Statements
12886 [RM D.7] This restriction ensures at compile time that no requeue statements
12887 are permitted and prevents keyword @code{requeue} from being used in source
12888 code.
12890 @geindex No_Requeue
12892 The restriction @code{No_Requeue} is recognized as a
12893 synonym for @code{No_Requeue_Statements}. This is retained for historical
12894 compatibility purposes (and a warning will be generated for its use if
12895 warnings on oNobsolescent features are activated).
12897 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
12898 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1f0}
12899 @subsection No_Secondary_Stack
12902 @geindex No_Secondary_Stack
12904 [GNAT] This restriction ensures at compile time that the generated code
12905 does not contain any reference to the secondary stack.  The secondary
12906 stack is used to implement functions returning unconstrained objects
12907 (arrays or records) on some targets. Suppresses the allocation of
12908 secondary stacks for tasks (excluding the environment task) at run time.
12910 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
12911 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1f1}
12912 @subsection No_Select_Statements
12915 @geindex No_Select_Statements
12917 [RM D.7] This restriction ensures at compile time no select statements of any
12918 kind are permitted, that is the keyword @code{select} may not appear.
12920 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
12921 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1f2}
12922 @subsection No_Specific_Termination_Handlers
12925 @geindex No_Specific_Termination_Handlers
12927 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
12928 or to Ada.Task_Termination.Specific_Handler.
12930 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
12931 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1f3}
12932 @subsection No_Specification_of_Aspect
12935 @geindex No_Specification_of_Aspect
12937 [RM 13.12.1] This restriction checks at compile time that no aspect
12938 specification, attribute definition clause, or pragma is given for a
12939 given aspect.
12941 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
12942 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1f4}
12943 @subsection No_Standard_Allocators_After_Elaboration
12946 @geindex No_Standard_Allocators_After_Elaboration
12948 [RM D.7] Specifies that an allocator using a standard storage pool
12949 should never be evaluated at run time after the elaboration of the
12950 library items of the partition has completed. Otherwise, Storage_Error
12951 is raised.
12953 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
12954 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1f5}
12955 @subsection No_Standard_Storage_Pools
12958 @geindex No_Standard_Storage_Pools
12960 [GNAT] This restriction ensures at compile time that no access types
12961 use the standard default storage pool.  Any access type declared must
12962 have an explicit Storage_Pool attribute defined specifying a
12963 user-defined storage pool.
12965 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
12966 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1f6}
12967 @subsection No_Stream_Optimizations
12970 @geindex No_Stream_Optimizations
12972 [GNAT] This restriction affects the performance of stream operations on types
12973 @code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
12974 compiler uses block reads and writes when manipulating @code{String} objects
12975 due to their superior performance. When this restriction is in effect, the
12976 compiler performs all IO operations on a per-character basis.
12978 @node No_Streams,No_Tagged_Type_Registration,No_Stream_Optimizations,Partition-Wide Restrictions
12979 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1f7}
12980 @subsection No_Streams
12983 @geindex No_Streams
12985 [GNAT] This restriction ensures at compile/bind time that there are no
12986 stream objects created and no use of stream attributes.
12987 This restriction does not forbid dependences on the package
12988 @code{Ada.Streams}. So it is permissible to with
12989 @code{Ada.Streams} (or another package that does so itself)
12990 as long as no actual stream objects are created and no
12991 stream attributes are used.
12993 Note that the use of restriction allows optimization of tagged types,
12994 since they do not need to worry about dispatching stream operations.
12995 To take maximum advantage of this space-saving optimization, any
12996 unit declaring a tagged type should be compiled with the restriction,
12997 though this is not required.
12999 @node No_Tagged_Type_Registration,No_Task_Allocators,No_Streams,Partition-Wide Restrictions
13000 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tagged-type-registration}@anchor{1f8}
13001 @subsection No_Tagged_Type_Registration
13004 @geindex No_Tagged_Type_Registration
13006 [GNAT] If this restriction is active, then class-wide streaming
13007 attributes are not supported. In addition, the subprograms in
13008 Ada.Tags are not supported.
13009 If this restriction is active, the generated code is simplified by
13010 omitting the otherwise-required global registration of tagged types when they
13011 are declared. This restriction may be necessary in order to also apply
13012 the No_Elaboration_Code restriction.
13014 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Tagged_Type_Registration,Partition-Wide Restrictions
13015 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1f9}
13016 @subsection No_Task_Allocators
13019 @geindex No_Task_Allocators
13021 [RM D.7] There are no allocators for task types
13022 or types containing task subcomponents.
13024 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
13025 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1fa}
13026 @subsection No_Task_At_Interrupt_Priority
13029 @geindex No_Task_At_Interrupt_Priority
13031 [GNAT] This restriction ensures at compile time that there is no
13032 Interrupt_Priority aspect or pragma for a task or a task type. As
13033 a consequence, the tasks are always created with a priority below
13034 that an interrupt priority.
13036 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
13037 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1fb}
13038 @subsection No_Task_Attributes_Package
13041 @geindex No_Task_Attributes_Package
13043 [GNAT] This restriction ensures at compile time that there are no implicit or
13044 explicit dependencies on the package @code{Ada.Task_Attributes}.
13046 @geindex No_Task_Attributes
13048 The restriction @code{No_Task_Attributes} is recognized as a synonym
13049 for @code{No_Task_Attributes_Package}. This is retained for historical
13050 compatibility purposes (and a warning will be generated for its use if
13051 warnings on obsolescent features are activated).
13053 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
13054 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1fc}
13055 @subsection No_Task_Hierarchy
13058 @geindex No_Task_Hierarchy
13060 [RM D.7] All (non-environment) tasks depend
13061 directly on the environment task of the partition.
13063 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
13064 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1fd}
13065 @subsection No_Task_Termination
13068 @geindex No_Task_Termination
13070 [RM D.7] Tasks that terminate are erroneous.
13072 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
13073 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1fe}
13074 @subsection No_Tasking
13077 @geindex No_Tasking
13079 [GNAT] This restriction prevents the declaration of tasks or task types
13080 throughout the partition.  It is similar in effect to the use of
13081 @code{Max_Tasks => 0} except that violations are caught at compile time
13082 and cause an error message to be output either by the compiler or
13083 binder.
13085 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
13086 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1ff}
13087 @subsection No_Terminate_Alternatives
13090 @geindex No_Terminate_Alternatives
13092 [RM D.7] There are no selective accepts with terminate alternatives.
13094 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
13095 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{200}
13096 @subsection No_Unchecked_Access
13099 @geindex No_Unchecked_Access
13101 [RM H.4] This restriction ensures at compile time that there are no
13102 occurrences of the Unchecked_Access attribute.
13104 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
13105 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{201}
13106 @subsection No_Unchecked_Conversion
13109 @geindex No_Unchecked_Conversion
13111 [RM J.13] This restriction ensures at compile time that there are no semantic
13112 dependences on the predefined generic function Unchecked_Conversion.
13114 @node No_Unchecked_Deallocation,No_Use_Of_Attribute,No_Unchecked_Conversion,Partition-Wide Restrictions
13115 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{202}
13116 @subsection No_Unchecked_Deallocation
13119 @geindex No_Unchecked_Deallocation
13121 [RM J.13] This restriction ensures at compile time that there are no semantic
13122 dependences on the predefined generic procedure Unchecked_Deallocation.
13124 @node No_Use_Of_Attribute,No_Use_Of_Entity,No_Unchecked_Deallocation,Partition-Wide Restrictions
13125 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-attribute}@anchor{203}
13126 @subsection No_Use_Of_Attribute
13129 @geindex No_Use_Of_Attribute
13131 [RM 13.12.1] This is a standard Ada 2012 restriction that is GNAT defined in
13132 earlier versions of Ada.
13134 @node No_Use_Of_Entity,No_Use_Of_Pragma,No_Use_Of_Attribute,Partition-Wide Restrictions
13135 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{204}
13136 @subsection No_Use_Of_Entity
13139 @geindex No_Use_Of_Entity
13141 [GNAT] This restriction ensures at compile time that there are no references
13142 to the entity given in the form
13144 @example
13145 No_Use_Of_Entity => Name
13146 @end example
13148 where @code{Name} is the fully qualified entity, for example
13150 @example
13151 No_Use_Of_Entity => Ada.Text_IO.Put_Line
13152 @end example
13154 @node No_Use_Of_Pragma,Pure_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
13155 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-pragma}@anchor{205}
13156 @subsection No_Use_Of_Pragma
13159 @geindex No_Use_Of_Pragma
13161 [RM 13.12.1] This is a standard Ada 2012 restriction that is GNAT defined in
13162 earlier versions of Ada.
13164 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Pragma,Partition-Wide Restrictions
13165 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{206}
13166 @subsection Pure_Barriers
13169 @geindex Pure_Barriers
13171 [GNAT] This restriction ensures at compile time that protected entry
13172 barriers are restricted to:
13175 @itemize *
13177 @item 
13178 components of the protected object (excluding selection from dereferences),
13180 @item 
13181 constant declarations,
13183 @item 
13184 named numbers,
13186 @item 
13187 enumeration literals,
13189 @item 
13190 integer literals,
13192 @item 
13193 real literals,
13195 @item 
13196 character literals,
13198 @item 
13199 implicitly defined comparison operators,
13201 @item 
13202 uses of the Standard.”not” operator,
13204 @item 
13205 short-circuit operator,
13207 @item 
13208 the Count attribute
13209 @end itemize
13211 This restriction is a relaxation of the Simple_Barriers restriction,
13212 but still ensures absence of side effects, exceptions, and recursion
13213 during the evaluation of the barriers.
13215 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
13216 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{207}
13217 @subsection Simple_Barriers
13220 @geindex Simple_Barriers
13222 [RM D.7] This restriction ensures at compile time that barriers in entry
13223 declarations for protected types are restricted to either static boolean
13224 expressions or references to simple boolean variables defined in the private
13225 part of the protected type.  No other form of entry barriers is permitted.
13227 @geindex Boolean_Entry_Barriers
13229 The restriction @code{Boolean_Entry_Barriers} is recognized as a
13230 synonym for @code{Simple_Barriers}. This is retained for historical
13231 compatibility purposes (and a warning will be generated for its use if
13232 warnings on obsolescent features are activated).
13234 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
13235 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{208}
13236 @subsection Static_Priorities
13239 @geindex Static_Priorities
13241 [GNAT] This restriction ensures at compile time that all priority expressions
13242 are static, and that there are no dependences on the package
13243 @code{Ada.Dynamic_Priorities}.
13245 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
13246 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{209}
13247 @subsection Static_Storage_Size
13250 @geindex Static_Storage_Size
13252 [GNAT] This restriction ensures at compile time that any expression appearing
13253 in a Storage_Size pragma or attribute definition clause is static.
13255 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
13256 @anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{20a}@anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{20b}
13257 @section Program Unit Level Restrictions
13260 The second set of restriction identifiers
13261 does not require partition-wide consistency.
13262 The restriction may be enforced for a single
13263 compilation unit without any effect on any of the
13264 other compilation units in the partition.
13266 @menu
13267 * No_Elaboration_Code:: 
13268 * No_Dynamic_Accessibility_Checks:: 
13269 * No_Dynamic_Sized_Objects:: 
13270 * No_Entry_Queue:: 
13271 * No_Implementation_Aspect_Specifications:: 
13272 * No_Implementation_Attributes:: 
13273 * No_Implementation_Identifiers:: 
13274 * No_Implementation_Pragmas:: 
13275 * No_Implementation_Restrictions:: 
13276 * No_Implementation_Units:: 
13277 * No_Implicit_Aliasing:: 
13278 * No_Implicit_Loops:: 
13279 * No_Obsolescent_Features:: 
13280 * No_Wide_Characters:: 
13281 * Static_Dispatch_Tables:: 
13282 * SPARK_05:: 
13284 @end menu
13286 @node No_Elaboration_Code,No_Dynamic_Accessibility_Checks,,Program Unit Level Restrictions
13287 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{20c}
13288 @subsection No_Elaboration_Code
13291 @geindex No_Elaboration_Code
13293 [GNAT] This restriction ensures at compile time that no elaboration code is
13294 generated.  Note that this is not the same condition as is enforced
13295 by pragma @code{Preelaborate}.  There are cases in which pragma
13296 @code{Preelaborate} still permits code to be generated (e.g., code
13297 to initialize a large array to all zeroes), and there are cases of units
13298 which do not meet the requirements for pragma @code{Preelaborate},
13299 but for which no elaboration code is generated.  Generally, it is
13300 the case that preelaborable units will meet the restrictions, with
13301 the exception of large aggregates initialized with an others_clause,
13302 and exception declarations (which generate calls to a run-time
13303 registry procedure).  This restriction is enforced on
13304 a unit by unit basis, it need not be obeyed consistently
13305 throughout a partition.
13307 In the case of aggregates with others, if the aggregate has a dynamic
13308 size, there is no way to eliminate the elaboration code (such dynamic
13309 bounds would be incompatible with @code{Preelaborate} in any case). If
13310 the bounds are static, then use of this restriction actually modifies
13311 the code choice of the compiler to avoid generating a loop, and instead
13312 generate the aggregate statically if possible, no matter how many times
13313 the data for the others clause must be repeatedly generated.
13315 It is not possible to precisely document
13316 the constructs which are compatible with this restriction, since,
13317 unlike most other restrictions, this is not a restriction on the
13318 source code, but a restriction on the generated object code. For
13319 example, if the source contains a declaration:
13321 @example
13322 Val : constant Integer := X;
13323 @end example
13325 where X is not a static constant, it may be possible, depending
13326 on complex optimization circuitry, for the compiler to figure
13327 out the value of X at compile time, in which case this initialization
13328 can be done by the loader, and requires no initialization code. It
13329 is not possible to document the precise conditions under which the
13330 optimizer can figure this out.
13332 Note that this the implementation of this restriction requires full
13333 code generation. If it is used in conjunction with “semantics only”
13334 checking, then some cases of violations may be missed.
13336 When this restriction is active, we are not requesting control-flow
13337 preservation with -fpreserve-control-flow, and the static elaboration model is
13338 used, the compiler is allowed to suppress the elaboration counter normally
13339 associated with the unit. This counter is typically used to check for access
13340 before elaboration and to control multiple elaboration attempts.
13342 @node No_Dynamic_Accessibility_Checks,No_Dynamic_Sized_Objects,No_Elaboration_Code,Program Unit Level Restrictions
13343 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-accessibility-checks}@anchor{20d}
13344 @subsection No_Dynamic_Accessibility_Checks
13347 @geindex No_Dynamic_Accessibility_Checks
13349 [GNAT] No dynamic accessibility checks are generated when this restriction is
13350 in effect. Instead, dangling references are prevented via more conservative
13351 compile-time checking. More specifically, existing compile-time checks are
13352 enforced but with more conservative assumptions about the accessibility levels
13353 of the relevant entities. These conservative assumptions eliminate the need for
13354 dynamic accessibility checks.
13356 These new rules for computing (at compile-time) the accessibility level of an
13357 anonymous access type T are as follows:
13360 @itemize *
13362 @item 
13363 If T is a function result type then, from the caller’s perspective, its level
13364 is that of the innermost master enclosing the function call. From the callee’s
13365 perspective, the level of parameters and local variables of the callee is
13366 statically deeper than the level of T.
13368 For any other accessibility level L such that the level of parameters and local
13369 variables of the callee is statically deeper than L, the level of T (from the
13370 callee’s perspective) is also statically deeper than L.
13372 @item 
13373 If T is the type of a formal parameter then, from the caller’s perspective,
13374 its level is at least as deep as that of the type of the corresponding actual
13375 parameter (whatever that actual parameter might be). From the callee’s
13376 perspective, the level of parameters and local variables of the callee is
13377 statically deeper than the level of T.
13379 @item 
13380 If T is the type of a discriminant then its level is that of the discriminated
13381 type.
13383 @item 
13384 If T is the type of a stand-alone object then its level is the level of the
13385 object.
13387 @item 
13388 In all other cases, the level of T is as defined by the existing rules of Ada.
13389 @end itemize
13391 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Dynamic_Accessibility_Checks,Program Unit Level Restrictions
13392 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{20e}
13393 @subsection No_Dynamic_Sized_Objects
13396 @geindex No_Dynamic_Sized_Objects
13398 [GNAT] This restriction disallows certain constructs that might lead to the
13399 creation of dynamic-sized composite objects (or array or discriminated type).
13400 An array subtype indication is illegal if the bounds are not static
13401 or references to discriminants of an enclosing type.
13402 A discriminated subtype indication is illegal if the type has
13403 discriminant-dependent array components or a variant part, and the
13404 discriminants are not static. In addition, array and record aggregates are
13405 illegal in corresponding cases. Note that this restriction does not forbid
13406 access discriminants. It is often a good idea to combine this restriction
13407 with No_Secondary_Stack.
13409 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
13410 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{20f}
13411 @subsection No_Entry_Queue
13414 @geindex No_Entry_Queue
13416 [GNAT] This restriction is a declaration that any protected entry compiled in
13417 the scope of the restriction has at most one task waiting on the entry
13418 at any one time, and so no queue is required.  This restriction is not
13419 checked at compile time.  A program execution is erroneous if an attempt
13420 is made to queue a second task on such an entry.
13422 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
13423 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{210}
13424 @subsection No_Implementation_Aspect_Specifications
13427 @geindex No_Implementation_Aspect_Specifications
13429 [RM 13.12.1] This restriction checks at compile time that no
13430 GNAT-defined aspects are present.  With this restriction, the only
13431 aspects that can be used are those defined in the Ada Reference Manual.
13433 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
13434 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{211}
13435 @subsection No_Implementation_Attributes
13438 @geindex No_Implementation_Attributes
13440 [RM 13.12.1] This restriction checks at compile time that no
13441 GNAT-defined attributes are present.  With this restriction, the only
13442 attributes that can be used are those defined in the Ada Reference
13443 Manual.
13445 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
13446 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{212}
13447 @subsection No_Implementation_Identifiers
13450 @geindex No_Implementation_Identifiers
13452 [RM 13.12.1] This restriction checks at compile time that no
13453 implementation-defined identifiers (marked with pragma Implementation_Defined)
13454 occur within language-defined packages.
13456 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
13457 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{213}
13458 @subsection No_Implementation_Pragmas
13461 @geindex No_Implementation_Pragmas
13463 [RM 13.12.1] This restriction checks at compile time that no
13464 GNAT-defined pragmas are present.  With this restriction, the only
13465 pragmas that can be used are those defined in the Ada Reference Manual.
13467 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
13468 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{214}
13469 @subsection No_Implementation_Restrictions
13472 @geindex No_Implementation_Restrictions
13474 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
13475 identifiers (other than @code{No_Implementation_Restrictions} itself)
13476 are present.  With this restriction, the only other restriction identifiers
13477 that can be used are those defined in the Ada Reference Manual.
13479 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
13480 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{215}
13481 @subsection No_Implementation_Units
13484 @geindex No_Implementation_Units
13486 [RM 13.12.1] This restriction checks at compile time that there is no
13487 mention in the context clause of any implementation-defined descendants
13488 of packages Ada, Interfaces, or System.
13490 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
13491 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{216}
13492 @subsection No_Implicit_Aliasing
13495 @geindex No_Implicit_Aliasing
13497 [GNAT] This restriction, which is not required to be partition-wide consistent,
13498 requires an explicit aliased keyword for an object to which ‘Access,
13499 ‘Unchecked_Access, or ‘Address is applied, and forbids entirely the use of
13500 the ‘Unrestricted_Access attribute for objects. Note: the reason that
13501 Unrestricted_Access is forbidden is that it would require the prefix
13502 to be aliased, and in such cases, it can always be replaced by
13503 the standard attribute Unchecked_Access which is preferable.
13505 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
13506 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{217}
13507 @subsection No_Implicit_Loops
13510 @geindex No_Implicit_Loops
13512 [GNAT] This restriction ensures that the generated code of the unit marked
13513 with this restriction does not contain any implicit @code{for} loops, either by
13514 modifying the generated code where possible, or by rejecting any construct
13515 that would otherwise generate an implicit @code{for} loop. If this restriction is
13516 active, it is possible to build large array aggregates with all static
13517 components without generating an intermediate temporary, and without generating
13518 a loop to initialize individual components. Otherwise, a loop is created for
13519 arrays larger than about 5000 scalar components. Note that if this restriction
13520 is set in the spec of a package, it will not apply to its body.
13522 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
13523 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{218}
13524 @subsection No_Obsolescent_Features
13527 @geindex No_Obsolescent_Features
13529 [RM 13.12.1] This restriction checks at compile time that no obsolescent
13530 features are used, as defined in Annex J of the Ada Reference Manual.
13532 @node No_Wide_Characters,Static_Dispatch_Tables,No_Obsolescent_Features,Program Unit Level Restrictions
13533 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{219}
13534 @subsection No_Wide_Characters
13537 @geindex No_Wide_Characters
13539 [GNAT] This restriction ensures at compile time that no uses of the types
13540 @code{Wide_Character} or @code{Wide_String} or corresponding wide
13541 wide types
13542 appear, and that no wide or wide wide string or character literals
13543 appear in the program (that is literals representing characters not in
13544 type @code{Character}).
13546 @node Static_Dispatch_Tables,SPARK_05,No_Wide_Characters,Program Unit Level Restrictions
13547 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{21a}
13548 @subsection Static_Dispatch_Tables
13551 @geindex Static_Dispatch_Tables
13553 [GNAT] This restriction checks at compile time that all the artifacts
13554 associated with dispatch tables can be placed in read-only memory.
13556 @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions
13557 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{21b}
13558 @subsection SPARK_05
13561 @geindex SPARK_05
13563 [GNAT] This restriction no longer has any effect and is superseded by
13564 SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
13565 a codebase respects SPARK 2014 restrictions, mark the code with pragma or
13566 aspect @code{SPARK_Mode}, and run the tool GNATprove at Stone assurance level, as
13567 follows:
13569 @example
13570 gnatprove -P project.gpr --mode=stone
13571 @end example
13573 or equivalently:
13575 @example
13576 gnatprove -P project.gpr --mode=check_all
13577 @end example
13579 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13580 @anchor{gnat_rm/implementation_advice doc}@anchor{21c}@anchor{gnat_rm/implementation_advice id1}@anchor{21d}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}
13581 @chapter Implementation Advice
13584 The main text of the Ada Reference Manual describes the required
13585 behavior of all Ada compilers, and the GNAT compiler conforms to
13586 these requirements.
13588 In addition, there are sections throughout the Ada Reference Manual headed
13589 by the phrase ‘Implementation advice’.  These sections are not normative,
13590 i.e., they do not specify requirements that all compilers must
13591 follow.  Rather they provide advice on generally desirable behavior.
13592 They are not requirements, because they describe behavior that cannot
13593 be provided on all systems, or may be undesirable on some systems.
13595 As far as practical, GNAT follows the implementation advice in
13596 the Ada Reference Manual.  Each such RM section corresponds to a section
13597 in this chapter whose title specifies the
13598 RM section number and paragraph number and the subject of
13599 the advice.  The contents of each section consists of the RM text within
13600 quotation marks,
13601 followed by the GNAT interpretation of the advice.  Most often, this simply says
13602 ‘followed’, which means that GNAT follows the advice.  However, in a
13603 number of cases, GNAT deliberately deviates from this advice, in which
13604 case the text describes what GNAT does and why.
13606 @geindex Error detection
13608 @menu
13609 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
13610 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
13611 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
13612 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
13613 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
13614 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
13615 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
13616 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
13617 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
13618 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
13619 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
13620 * RM 9.6(30-31); Duration’Small: RM 9 6 30-31 Duration’Small. 
13621 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
13622 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
13623 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
13624 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
13625 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
13626 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
13627 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
13628 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
13629 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
13630 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
13631 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
13632 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
13633 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
13634 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
13635 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
13636 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
13637 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
13638 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
13639 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
13640 * RM 13.13.2(1.6); Stream Oriented Attributes: RM 13 13 2 1 6 Stream Oriented Attributes. 
13641 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
13642 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
13643 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
13644 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
13645 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
13646 * RM A.18; Containers: RM A 18 Containers. 
13647 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
13648 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
13649 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
13650 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
13651 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
13652 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
13653 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
13654 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
13655 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
13656 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
13657 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
13658 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
13659 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
13660 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
13661 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
13662 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
13663 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
13664 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
13665 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
13666 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
13667 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
13668 * RM G; Numerics: RM G Numerics. 
13669 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
13670 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
13671 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
13672 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
13673 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
13675 @end menu
13677 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13678 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{21e}
13679 @section RM 1.1.3(20): Error Detection
13682 @quotation
13684 “If an implementation detects the use of an unsupported Specialized Needs
13685 Annex feature at run time, it should raise @code{Program_Error} if
13686 feasible.”
13687 @end quotation
13689 Not relevant.  All specialized needs annex features are either supported,
13690 or diagnosed at compile time.
13692 @geindex Child Units
13694 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13695 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{21f}
13696 @section RM 1.1.3(31): Child Units
13699 @quotation
13701 “If an implementation wishes to provide implementation-defined
13702 extensions to the functionality of a language-defined library unit, it
13703 should normally do so by adding children to the library unit.”
13704 @end quotation
13706 Followed.
13708 @geindex Bounded errors
13710 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13711 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{220}
13712 @section RM 1.1.5(12): Bounded Errors
13715 @quotation
13717 “If an implementation detects a bounded error or erroneous
13718 execution, it should raise @code{Program_Error}.”
13719 @end quotation
13721 Followed in all cases in which the implementation detects a bounded
13722 error or erroneous execution.  Not all such situations are detected at
13723 runtime.
13725 @geindex Pragmas
13727 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
13728 @anchor{gnat_rm/implementation_advice id2}@anchor{221}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{222}
13729 @section RM 2.8(16): Pragmas
13732 @quotation
13734 “Normally, implementation-defined pragmas should have no semantic effect
13735 for error-free programs; that is, if the implementation-defined pragmas
13736 are removed from a working program, the program should still be legal,
13737 and should still have the same semantics.”
13738 @end quotation
13740 The following implementation defined pragmas are exceptions to this
13741 rule:
13744 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx} 
13745 @headitem
13747 Pragma
13749 @tab
13751 Explanation
13753 @item
13755 `Abort_Defer'
13757 @tab
13759 Affects semantics
13761 @item
13763 `Ada_83'
13765 @tab
13767 Affects legality
13769 @item
13771 `Assert'
13773 @tab
13775 Affects semantics
13777 @item
13779 `CPP_Class'
13781 @tab
13783 Affects semantics
13785 @item
13787 `CPP_Constructor'
13789 @tab
13791 Affects semantics
13793 @item
13795 `Debug'
13797 @tab
13799 Affects semantics
13801 @item
13803 `Interface_Name'
13805 @tab
13807 Affects semantics
13809 @item
13811 `Machine_Attribute'
13813 @tab
13815 Affects semantics
13817 @item
13819 `Unimplemented_Unit'
13821 @tab
13823 Affects legality
13825 @item
13827 `Unchecked_Union'
13829 @tab
13831 Affects semantics
13833 @end multitable
13836 In each of the above cases, it is essential to the purpose of the pragma
13837 that this advice not be followed.  For details see
13838 @ref{7,,Implementation Defined Pragmas}.
13840 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
13841 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{223}
13842 @section RM 2.8(17-19): Pragmas
13845 @quotation
13847 “Normally, an implementation should not define pragmas that can
13848 make an illegal program legal, except as follows:
13851 @itemize *
13853 @item 
13854 A pragma used to complete a declaration, such as a pragma @code{Import};
13856 @item 
13857 A pragma used to configure the environment by adding, removing, or
13858 replacing @code{library_items}.”
13859 @end itemize
13860 @end quotation
13862 See @ref{222,,RM 2.8(16); Pragmas}.
13864 @geindex Character Sets
13866 @geindex Alternative Character Sets
13868 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
13869 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{224}
13870 @section RM 3.5.2(5): Alternative Character Sets
13873 @quotation
13875 “If an implementation supports a mode with alternative interpretations
13876 for @code{Character} and @code{Wide_Character}, the set of graphic
13877 characters of @code{Character} should nevertheless remain a proper
13878 subset of the set of graphic characters of @code{Wide_Character}.  Any
13879 character set ‘localizations’ should be reflected in the results of
13880 the subprograms defined in the language-defined package
13881 @code{Characters.Handling} (see A.3) available in such a mode.  In a mode with
13882 an alternative interpretation of @code{Character}, the implementation should
13883 also support a corresponding change in what is a legal
13884 @code{identifier_letter}.”
13885 @end quotation
13887 Not all wide character modes follow this advice, in particular the JIS
13888 and IEC modes reflect standard usage in Japan, and in these encoding,
13889 the upper half of the Latin-1 set is not part of the wide-character
13890 subset, since the most significant bit is used for wide character
13891 encoding.  However, this only applies to the external forms.  Internally
13892 there is no such restriction.
13894 @geindex Integer types
13896 @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
13897 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{225}
13898 @section RM 3.5.4(28): Integer Types
13901 @quotation
13903 “An implementation should support @code{Long_Integer} in addition to
13904 @code{Integer} if the target machine supports 32-bit (or longer)
13905 arithmetic.  No other named integer subtypes are recommended for package
13906 @code{Standard}.  Instead, appropriate named integer subtypes should be
13907 provided in the library package @code{Interfaces} (see B.2).”
13908 @end quotation
13910 @code{Long_Integer} is supported.  Other standard integer types are supported
13911 so this advice is not fully followed.  These types
13912 are supported for convenient interface to C, and so that all hardware
13913 types of the machine are easily available.
13915 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
13916 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{226}
13917 @section RM 3.5.4(29): Integer Types
13920 @quotation
13922 “An implementation for a two’s complement machine should support
13923 modular types with a binary modulus up to @code{System.Max_Int*2+2}.  An
13924 implementation should support a non-binary modules up to @code{Integer'Last}.”
13925 @end quotation
13927 Followed.
13929 @geindex Enumeration values
13931 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
13932 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{227}
13933 @section RM 3.5.5(8): Enumeration Values
13936 @quotation
13938 “For the evaluation of a call on @code{S'Pos} for an enumeration
13939 subtype, if the value of the operand does not correspond to the internal
13940 code for any enumeration literal of its type (perhaps due to an
13941 un-initialized variable), then the implementation should raise
13942 @code{Program_Error}.  This is particularly important for enumeration
13943 types with noncontiguous internal codes specified by an
13944 enumeration_representation_clause.”
13945 @end quotation
13947 Followed.
13949 @geindex Float types
13951 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
13952 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{228}
13953 @section RM 3.5.7(17): Float Types
13956 @quotation
13958 “An implementation should support @code{Long_Float} in addition to
13959 @code{Float} if the target machine supports 11 or more digits of
13960 precision.  No other named floating point subtypes are recommended for
13961 package @code{Standard}.  Instead, appropriate named floating point subtypes
13962 should be provided in the library package @code{Interfaces} (see B.2).”
13963 @end quotation
13965 @code{Short_Float} and @code{Long_Long_Float} are also provided.  The
13966 former provides improved compatibility with other implementations
13967 supporting this type.  The latter corresponds to the highest precision
13968 floating-point type supported by the hardware.  On most machines, this
13969 will be the same as @code{Long_Float}, but on some machines, it will
13970 correspond to the IEEE extended form.  The notable case is all x86
13971 implementations, where @code{Long_Long_Float} corresponds to the 80-bit
13972 extended precision format supported in hardware on this processor.
13973 Note that the 128-bit format on SPARC is not supported, since this
13974 is a software rather than a hardware format.
13976 @geindex Multidimensional arrays
13978 @geindex Arrays
13979 @geindex multidimensional
13981 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration’Small,RM 3 5 7 17 Float Types,Implementation Advice
13982 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{229}
13983 @section RM 3.6.2(11): Multidimensional Arrays
13986 @quotation
13988 “An implementation should normally represent multidimensional arrays in
13989 row-major order, consistent with the notation used for multidimensional
13990 array aggregates (see 4.3.3).  However, if a pragma @code{Convention}
13991 (@code{Fortran}, …) applies to a multidimensional array type, then
13992 column-major order should be used instead (see B.5, `Interfacing with Fortran').”
13993 @end quotation
13995 Followed.
13997 @geindex Duration'Small
13999 @node RM 9 6 30-31 Duration’Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
14000 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{22a}
14001 @section RM 9.6(30-31): Duration’Small
14004 @quotation
14006 “Whenever possible in an implementation, the value of @code{Duration'Small}
14007 should be no greater than 100 microseconds.”
14008 @end quotation
14010 Followed.  (@code{Duration'Small} = 10**(-9)).
14012 @quotation
14014 “The time base for @code{delay_relative_statements} should be monotonic;
14015 it need not be the same time base as used for @code{Calendar.Clock}.”
14016 @end quotation
14018 Followed.
14020 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration’Small,Implementation Advice
14021 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{22b}
14022 @section RM 10.2.1(12): Consistent Representation
14025 @quotation
14027 “In an implementation, a type declared in a pre-elaborated package should
14028 have the same representation in every elaboration of a given version of
14029 the package, whether the elaborations occur in distinct executions of
14030 the same program, or in executions of distinct programs or partitions
14031 that include the given version.”
14032 @end quotation
14034 Followed, except in the case of tagged types.  Tagged types involve
14035 implicit pointers to a local copy of a dispatch table, and these pointers
14036 have representations which thus depend on a particular elaboration of the
14037 package.  It is not easy to see how it would be possible to follow this
14038 advice without severely impacting efficiency of execution.
14040 @geindex Exception information
14042 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
14043 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{22c}
14044 @section RM 11.4.1(19): Exception Information
14047 @quotation
14049 “@code{Exception_Message} by default and @code{Exception_Information}
14050 should produce information useful for
14051 debugging.  @code{Exception_Message} should be short, about one
14052 line.  @code{Exception_Information} can be long.  @code{Exception_Message}
14053 should not include the
14054 @code{Exception_Name}.  @code{Exception_Information} should include both
14055 the @code{Exception_Name} and the @code{Exception_Message}.”
14056 @end quotation
14058 Followed.  For each exception that doesn’t have a specified
14059 @code{Exception_Message}, the compiler generates one containing the location
14060 of the raise statement.  This location has the form ‘file_name:line’, where
14061 file_name is the short file name (without path information) and line is the line
14062 number in the file.  Note that in the case of the Zero Cost Exception
14063 mechanism, these messages become redundant with the Exception_Information that
14064 contains a full backtrace of the calling sequence, so they are disabled.
14065 To disable explicitly the generation of the source location message, use the
14066 Pragma @code{Discard_Names}.
14068 @geindex Suppression of checks
14070 @geindex Checks
14071 @geindex suppression of
14073 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
14074 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{22d}
14075 @section RM 11.5(28): Suppression of Checks
14078 @quotation
14080 “The implementation should minimize the code executed for checks that
14081 have been suppressed.”
14082 @end quotation
14084 Followed.
14086 @geindex Representation clauses
14088 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
14089 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{22e}
14090 @section RM 13.1 (21-24): Representation Clauses
14093 @quotation
14095 “The recommended level of support for all representation items is
14096 qualified as follows:
14098 An implementation need not support representation items containing
14099 nonstatic expressions, except that an implementation should support a
14100 representation item for a given entity if each nonstatic expression in
14101 the representation item is a name that statically denotes a constant
14102 declared before the entity.”
14103 @end quotation
14105 Followed.  In fact, GNAT goes beyond the recommended level of support
14106 by allowing nonstatic expressions in some representation clauses even
14107 without the need to declare constants initialized with the values of
14108 such expressions.
14109 For example:
14111 @example
14112   X : Integer;
14113   Y : Float;
14114   for Y'Address use X'Address;>>
14117 "An implementation need not support a specification for the `@w{`}Size`@w{`}
14118 for a given composite subtype, nor the size or storage place for an
14119 object (including a component) of a given composite subtype, unless the
14120 constraints on the subtype and its composite subcomponents (if any) are
14121 all static constraints."
14122 @end example
14124 Followed.  Size Clauses are not permitted on nonstatic components, as
14125 described above.
14127 @quotation
14129 “An aliased component, or a component whose type is by-reference, should
14130 always be allocated at an addressable location.”
14131 @end quotation
14133 Followed.
14135 @geindex Packed types
14137 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
14138 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{22f}
14139 @section RM 13.2(6-8): Packed Types
14142 @quotation
14144 “If a type is packed, then the implementation should try to minimize
14145 storage allocated to objects of the type, possibly at the expense of
14146 speed of accessing components, subject to reasonable complexity in
14147 addressing calculations.
14149 The recommended level of support pragma @code{Pack} is:
14151 For a packed record type, the components should be packed as tightly as
14152 possible subject to the Sizes of the component subtypes, and subject to
14153 any `record_representation_clause' that applies to the type; the
14154 implementation may, but need not, reorder components or cross aligned
14155 word boundaries to improve the packing.  A component whose @code{Size} is
14156 greater than the word size may be allocated an integral number of words.”
14157 @end quotation
14159 Followed.  Tight packing of arrays is supported for all component sizes
14160 up to 64-bits. If the array component size is 1 (that is to say, if
14161 the component is a boolean type or an enumeration type with two values)
14162 then values of the type are implicitly initialized to zero. This
14163 happens both for objects of the packed type, and for objects that have a
14164 subcomponent of the packed type.
14166 @geindex Address clauses
14168 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
14169 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{230}
14170 @section RM 13.3(14-19): Address Clauses
14173 @quotation
14175 “For an array @code{X}, @code{X'Address} should point at the first
14176 component of the array, and not at the array bounds.”
14177 @end quotation
14179 Followed.
14181 @quotation
14183 “The recommended level of support for the @code{Address} attribute is:
14185 @code{X'Address} should produce a useful result if @code{X} is an
14186 object that is aliased or of a by-reference type, or is an entity whose
14187 @code{Address} has been specified.”
14188 @end quotation
14190 Followed.  A valid address will be produced even if none of those
14191 conditions have been met.  If necessary, the object is forced into
14192 memory to ensure the address is valid.
14194 @quotation
14196 “An implementation should support @code{Address} clauses for imported
14197 subprograms.”
14198 @end quotation
14200 Followed.
14202 @quotation
14204 “Objects (including subcomponents) that are aliased or of a by-reference
14205 type should be allocated on storage element boundaries.”
14206 @end quotation
14208 Followed.
14210 @quotation
14212 “If the @code{Address} of an object is specified, or it is imported or exported,
14213 then the implementation should not perform optimizations based on
14214 assumptions of no aliases.”
14215 @end quotation
14217 Followed.
14219 @geindex Alignment clauses
14221 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
14222 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{231}
14223 @section RM 13.3(29-35): Alignment Clauses
14226 @quotation
14228 “The recommended level of support for the @code{Alignment} attribute for
14229 subtypes is:
14231 An implementation should support specified Alignments that are factors
14232 and multiples of the number of storage elements per word, subject to the
14233 following:”
14234 @end quotation
14236 Followed.
14238 @quotation
14240 “An implementation need not support specified Alignments for
14241 combinations of Sizes and Alignments that cannot be easily
14242 loaded and stored by available machine instructions.”
14243 @end quotation
14245 Followed.
14247 @quotation
14249 “An implementation need not support specified Alignments that are
14250 greater than the maximum @code{Alignment} the implementation ever returns by
14251 default.”
14252 @end quotation
14254 Followed.
14256 @quotation
14258 “The recommended level of support for the @code{Alignment} attribute for
14259 objects is:
14261 Same as above, for subtypes, but in addition:”
14262 @end quotation
14264 Followed.
14266 @quotation
14268 “For stand-alone library-level objects of statically constrained
14269 subtypes, the implementation should support all alignments
14270 supported by the target linker.  For example, page alignment is likely to
14271 be supported for such objects, but not for subtypes.”
14272 @end quotation
14274 Followed.
14276 @geindex Size clauses
14278 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
14279 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{232}
14280 @section RM 13.3(42-43): Size Clauses
14283 @quotation
14285 “The recommended level of support for the @code{Size} attribute of
14286 objects is:
14288 A @code{Size} clause should be supported for an object if the specified
14289 @code{Size} is at least as large as its subtype’s @code{Size}, and
14290 corresponds to a size in storage elements that is a multiple of the
14291 object’s @code{Alignment} (if the @code{Alignment} is nonzero).”
14292 @end quotation
14294 Followed.
14296 @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
14297 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{233}
14298 @section RM 13.3(50-56): Size Clauses
14301 @quotation
14303 “If the @code{Size} of a subtype is specified, and allows for efficient
14304 independent addressability (see 9.10) on the target architecture, then
14305 the @code{Size} of the following objects of the subtype should equal the
14306 @code{Size} of the subtype:
14308 Aliased objects (including components).”
14309 @end quotation
14311 Followed.
14313 @quotation
14315 “@cite{Size} clause on a composite subtype should not affect the
14316 internal layout of components.”
14317 @end quotation
14319 Followed. But note that this can be overridden by use of the implementation
14320 pragma Implicit_Packing in the case of packed arrays.
14322 @quotation
14324 “The recommended level of support for the @code{Size} attribute of subtypes is:
14326 The @code{Size} (if not specified) of a static discrete or fixed point
14327 subtype should be the number of bits needed to represent each value
14328 belonging to the subtype using an unbiased representation, leaving space
14329 for a sign bit only if the subtype contains negative values.  If such a
14330 subtype is a first subtype, then an implementation should support a
14331 specified @code{Size} for it that reflects this representation.”
14332 @end quotation
14334 Followed.
14336 @quotation
14338 “For a subtype implemented with levels of indirection, the @code{Size}
14339 should include the size of the pointers, but not the size of what they
14340 point at.”
14341 @end quotation
14343 Followed.
14345 @geindex Component_Size clauses
14347 @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
14348 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{234}
14349 @section RM 13.3(71-73): Component Size Clauses
14352 @quotation
14354 “The recommended level of support for the @code{Component_Size}
14355 attribute is:
14357 An implementation need not support specified @code{Component_Sizes} that are
14358 less than the @code{Size} of the component subtype.”
14359 @end quotation
14361 Followed.
14363 @quotation
14365 “An implementation should support specified Component_Sizes that
14366 are factors and multiples of the word size.  For such
14367 Component_Sizes, the array should contain no gaps between
14368 components.  For other Component_Sizes (if supported), the array
14369 should contain no gaps between components when packing is also
14370 specified; the implementation should forbid this combination in cases
14371 where it cannot support a no-gaps representation.”
14372 @end quotation
14374 Followed.
14376 @geindex Enumeration representation clauses
14378 @geindex Representation clauses
14379 @geindex enumeration
14381 @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
14382 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{235}
14383 @section RM 13.4(9-10): Enumeration Representation Clauses
14386 @quotation
14388 “The recommended level of support for enumeration representation clauses
14391 An implementation need not support enumeration representation clauses
14392 for boolean types, but should at minimum support the internal codes in
14393 the range @code{System.Min_Int .. System.Max_Int}.”
14394 @end quotation
14396 Followed.
14398 @geindex Record representation clauses
14400 @geindex Representation clauses
14401 @geindex records
14403 @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
14404 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{236}
14405 @section RM 13.5.1(17-22): Record Representation Clauses
14408 @quotation
14410 “The recommended level of support for
14411 `record_representation_clause's is:
14413 An implementation should support storage places that can be extracted
14414 with a load, mask, shift sequence of machine code, and set with a load,
14415 shift, mask, store sequence, given the available machine instructions
14416 and run-time model.”
14417 @end quotation
14419 Followed.
14421 @quotation
14423 “A storage place should be supported if its size is equal to the
14424 @code{Size} of the component subtype, and it starts and ends on a
14425 boundary that obeys the @code{Alignment} of the component subtype.”
14426 @end quotation
14428 Followed.
14430 @quotation
14432 “If the default bit ordering applies to the declaration of a given type,
14433 then for a component whose subtype’s @code{Size} is less than the word
14434 size, any storage place that does not cross an aligned word boundary
14435 should be supported.”
14436 @end quotation
14438 Followed.
14440 @quotation
14442 “An implementation may reserve a storage place for the tag field of a
14443 tagged type, and disallow other components from overlapping that place.”
14444 @end quotation
14446 Followed.  The storage place for the tag field is the beginning of the tagged
14447 record, and its size is Address’Size.  GNAT will reject an explicit component
14448 clause for the tag field.
14450 @quotation
14452 “An implementation need not support a `component_clause' for a
14453 component of an extension part if the storage place is not after the
14454 storage places of all components of the parent type, whether or not
14455 those storage places had been specified.”
14456 @end quotation
14458 Followed.  The above advice on record representation clauses is followed,
14459 and all mentioned features are implemented.
14461 @geindex Storage place attributes
14463 @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
14464 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{237}
14465 @section RM 13.5.2(5): Storage Place Attributes
14468 @quotation
14470 “If a component is represented using some form of pointer (such as an
14471 offset) to the actual data of the component, and this data is contiguous
14472 with the rest of the object, then the storage place attributes should
14473 reflect the place of the actual data, not the pointer.  If a component is
14474 allocated discontinuously from the rest of the object, then a warning
14475 should be generated upon reference to one of its storage place
14476 attributes.”
14477 @end quotation
14479 Followed.  There are no such components in GNAT.
14481 @geindex Bit ordering
14483 @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
14484 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{238}
14485 @section RM 13.5.3(7-8): Bit Ordering
14488 @quotation
14490 “The recommended level of support for the non-default bit ordering is:
14492 If @code{Word_Size} = @code{Storage_Unit}, then the implementation
14493 should support the non-default bit ordering in addition to the default
14494 bit ordering.”
14495 @end quotation
14497 Followed.  Word size does not equal storage size in this implementation.
14498 Thus non-default bit ordering is not supported.
14500 @geindex Address
14501 @geindex as private type
14503 @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
14504 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{239}
14505 @section RM 13.7(37): Address as Private
14508 @quotation
14510 “@cite{Address} should be of a private type.”
14511 @end quotation
14513 Followed.
14515 @geindex Operations
14516 @geindex on `@w{`}Address`@w{`}
14518 @geindex Address
14519 @geindex operations of
14521 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14522 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{23a}
14523 @section RM 13.7.1(16): Address Operations
14526 @quotation
14528 “Operations in @code{System} and its children should reflect the target
14529 environment semantics as closely as is reasonable.  For example, on most
14530 machines, it makes sense for address arithmetic to ‘wrap around’.
14531 Operations that do not make sense should raise @code{Program_Error}.”
14532 @end quotation
14534 Followed.  Address arithmetic is modular arithmetic that wraps around.  No
14535 operation raises @code{Program_Error}, since all operations make sense.
14537 @geindex Unchecked conversion
14539 @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
14540 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{23b}
14541 @section RM 13.9(14-17): Unchecked Conversion
14544 @quotation
14546 “The @code{Size} of an array object should not include its bounds; hence,
14547 the bounds should not be part of the converted data.”
14548 @end quotation
14550 Followed.
14552 @quotation
14554 “The implementation should not generate unnecessary run-time checks to
14555 ensure that the representation of @code{S} is a representation of the
14556 target type.  It should take advantage of the permission to return by
14557 reference when possible.  Restrictions on unchecked conversions should be
14558 avoided unless required by the target environment.”
14559 @end quotation
14561 Followed.  There are no restrictions on unchecked conversion.  A warning is
14562 generated if the source and target types do not have the same size since
14563 the semantics in this case may be target dependent.
14565 @quotation
14567 “The recommended level of support for unchecked conversions is:
14569 Unchecked conversions should be supported and should be reversible in
14570 the cases where this clause defines the result.  To enable meaningful use
14571 of unchecked conversion, a contiguous representation should be used for
14572 elementary subtypes, for statically constrained array subtypes whose
14573 component subtype is one of the subtypes described in this paragraph,
14574 and for record subtypes without discriminants whose component subtypes
14575 are described in this paragraph.”
14576 @end quotation
14578 Followed.
14580 @geindex Heap usage
14581 @geindex implicit
14583 @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
14584 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{23c}
14585 @section RM 13.11(23-25): Implicit Heap Usage
14588 @quotation
14590 “An implementation should document any cases in which it dynamically
14591 allocates heap storage for a purpose other than the evaluation of an
14592 allocator.”
14593 @end quotation
14595 Followed, the only other points at which heap storage is dynamically
14596 allocated are as follows:
14599 @itemize *
14601 @item 
14602 At initial elaboration time, to allocate dynamically sized global
14603 objects.
14605 @item 
14606 To allocate space for a task when a task is created.
14608 @item 
14609 To extend the secondary stack dynamically when needed.  The secondary
14610 stack is used for returning variable length results.
14611 @end itemize
14614 @quotation
14616 “A default (implementation-provided) storage pool for an
14617 access-to-constant type should not have overhead to support deallocation of
14618 individual objects.”
14619 @end quotation
14621 Followed.
14623 @quotation
14625 “A storage pool for an anonymous access type should be created at the
14626 point of an allocator for the type, and be reclaimed when the designated
14627 object becomes inaccessible.”
14628 @end quotation
14630 Followed.
14632 @geindex Unchecked deallocation
14634 @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
14635 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{23d}
14636 @section RM 13.11.2(17): Unchecked Deallocation
14639 @quotation
14641 “For a standard storage pool, @code{Free} should actually reclaim the
14642 storage.”
14643 @end quotation
14645 Followed.
14647 @geindex Stream oriented attributes
14649 @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
14650 @anchor{gnat_rm/implementation_advice rm-13-13-2-1-6-stream-oriented-attributes}@anchor{23e}
14651 @section RM 13.13.2(1.6): Stream Oriented Attributes
14654 @quotation
14656 “If not specified, the value of Stream_Size for an elementary type
14657 should be the number of bits that corresponds to the minimum number of
14658 stream elements required by the first subtype of the type, rounded up
14659 to the nearest factor or multiple of the word size that is also a
14660 multiple of the stream element size.”
14661 @end quotation
14663 Followed, except that the number of stream elements is 1, 2, 3, 4 or 8.
14664 The Stream_Size may be used to override the default choice.
14666 The default implementation is based on direct binary representations and is
14667 therefore target- and endianness-dependent.  To address this issue, GNAT also
14668 supplies an alternate implementation of the stream attributes @code{Read} and
14669 @code{Write}, which uses the target-independent XDR standard representation for
14670 scalar types. This XDR alternative can be enabled via the binder switch -xdr.
14672 @geindex XDR representation
14674 @geindex Read attribute
14676 @geindex Write attribute
14678 @geindex Stream oriented attributes
14680 @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
14681 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{23f}
14682 @section RM A.1(52): Names of Predefined Numeric Types
14685 @quotation
14687 “If an implementation provides additional named predefined integer types,
14688 then the names should end with @code{Integer} as in
14689 @code{Long_Integer}.  If an implementation provides additional named
14690 predefined floating point types, then the names should end with
14691 @code{Float} as in @code{Long_Float}.”
14692 @end quotation
14694 Followed.
14696 @geindex Ada.Characters.Handling
14698 @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
14699 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{240}
14700 @section RM A.3.2(49): @code{Ada.Characters.Handling}
14703 @quotation
14705 “If an implementation provides a localized definition of @code{Character}
14706 or @code{Wide_Character}, then the effects of the subprograms in
14707 @code{Characters.Handling} should reflect the localizations.
14708 See also 3.5.2.”
14709 @end quotation
14711 Followed.  GNAT provides no such localized definitions.
14713 @geindex Bounded-length strings
14715 @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
14716 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{241}
14717 @section RM A.4.4(106): Bounded-Length String Handling
14720 @quotation
14722 “Bounded string objects should not be implemented by implicit pointers
14723 and dynamic allocation.”
14724 @end quotation
14726 Followed.  No implicit pointers or dynamic allocation are used.
14728 @geindex Random number generation
14730 @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
14731 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{242}
14732 @section RM A.5.2(46-47): Random Number Generation
14735 @quotation
14737 “Any storage associated with an object of type @code{Generator} should be
14738 reclaimed on exit from the scope of the object.”
14739 @end quotation
14741 Followed.
14743 @quotation
14745 “If the generator period is sufficiently long in relation to the number
14746 of distinct initiator values, then each possible value of
14747 @code{Initiator} passed to @code{Reset} should initiate a sequence of
14748 random numbers that does not, in a practical sense, overlap the sequence
14749 initiated by any other value.  If this is not possible, then the mapping
14750 between initiator values and generator states should be a rapidly
14751 varying function of the initiator value.”
14752 @end quotation
14754 Followed.  The generator period is sufficiently long for the first
14755 condition here to hold true.
14757 @geindex Get_Immediate
14759 @node RM A 10 7 23 Get_Immediate,RM A 18 Containers,RM A 5 2 46-47 Random Number Generation,Implementation Advice
14760 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{243}
14761 @section RM A.10.7(23): @code{Get_Immediate}
14764 @quotation
14766 “The @code{Get_Immediate} procedures should be implemented with
14767 unbuffered input.  For a device such as a keyboard, input should be
14768 available if a key has already been typed, whereas for a disk
14769 file, input should always be available except at end of file.  For a file
14770 associated with a keyboard-like device, any line-editing features of the
14771 underlying operating system should be disabled during the execution of
14772 @code{Get_Immediate}.”
14773 @end quotation
14775 Followed on all targets except VxWorks. For VxWorks, there is no way to
14776 provide this functionality that does not result in the input buffer being
14777 flushed before the @code{Get_Immediate} call. A special unit
14778 @code{Interfaces.Vxworks.IO} is provided that contains routines to enable
14779 this functionality.
14781 @geindex Containers
14783 @node RM A 18 Containers,RM B 1 39-41 Pragma Export,RM A 10 7 23 Get_Immediate,Implementation Advice
14784 @anchor{gnat_rm/implementation_advice rm-a-18-containers}@anchor{244}
14785 @section RM A.18: @code{Containers}
14788 All implementation advice pertaining to Ada.Containers and its
14789 child units (that is, all implementation advice occurring within
14790 section A.18 and its subsections) is followed except for A.18.24(17):
14792 @quotation
14794 “Bounded ordered set objects should be implemented without implicit pointers or dynamic allocation. “
14795 @end quotation
14797 The implementations of the two Reference_Preserving_Key functions of
14798 the generic package Ada.Containers.Bounded_Ordered_Sets each currently make
14799 use of dynamic allocation; other operations on bounded ordered set objects
14800 follow the implementation advice.
14802 @geindex Export
14804 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 18 Containers,Implementation Advice
14805 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{245}
14806 @section RM B.1(39-41): Pragma @code{Export}
14809 @quotation
14811 “If an implementation supports pragma @code{Export} to a given language,
14812 then it should also allow the main subprogram to be written in that
14813 language.  It should support some mechanism for invoking the elaboration
14814 of the Ada library units included in the system, and for invoking the
14815 finalization of the environment task.  On typical systems, the
14816 recommended mechanism is to provide two subprograms whose link names are
14817 @code{adainit} and @code{adafinal}.  @code{adainit} should contain the
14818 elaboration code for library units.  @code{adafinal} should contain the
14819 finalization code.  These subprograms should have no effect the second
14820 and subsequent time they are called.”
14821 @end quotation
14823 Followed.
14825 @quotation
14827 “Automatic elaboration of pre-elaborated packages should be
14828 provided when pragma @code{Export} is supported.”
14829 @end quotation
14831 Followed when the main program is in Ada.  If the main program is in a
14832 foreign language, then
14833 @code{adainit} must be called to elaborate pre-elaborated
14834 packages.
14836 @quotation
14838 “For each supported convention `L' other than @code{Intrinsic}, an
14839 implementation should support @code{Import} and @code{Export} pragmas
14840 for objects of `L'-compatible types and for subprograms, and pragma
14841 @cite{Convention} for `L'-eligible types and for subprograms,
14842 presuming the other language has corresponding features.  Pragma
14843 @code{Convention} need not be supported for scalar types.”
14844 @end quotation
14846 Followed.
14848 @geindex Package Interfaces
14850 @geindex Interfaces
14852 @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
14853 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{246}
14854 @section RM B.2(12-13): Package @code{Interfaces}
14857 @quotation
14859 “For each implementation-defined convention identifier, there should be a
14860 child package of package Interfaces with the corresponding name.  This
14861 package should contain any declarations that would be useful for
14862 interfacing to the language (implementation) represented by the
14863 convention.  Any declarations useful for interfacing to any language on
14864 the given hardware architecture should be provided directly in
14865 @code{Interfaces}.”
14866 @end quotation
14868 Followed.
14870 @quotation
14872 “An implementation supporting an interface to C, COBOL, or Fortran should
14873 provide the corresponding package or packages described in the following
14874 clauses.”
14875 @end quotation
14877 Followed.  GNAT provides all the packages described in this section.
14879 @geindex C
14880 @geindex interfacing with
14882 @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
14883 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{247}
14884 @section RM B.3(63-71): Interfacing with C
14887 @quotation
14889 “An implementation should support the following interface correspondences
14890 between Ada and C.”
14891 @end quotation
14893 Followed.
14895 @quotation
14897 “An Ada procedure corresponds to a void-returning C function.”
14898 @end quotation
14900 Followed.
14902 @quotation
14904 “An Ada function corresponds to a non-void C function.”
14905 @end quotation
14907 Followed.
14909 @quotation
14911 “An Ada @code{in} scalar parameter is passed as a scalar argument to a C
14912 function.”
14913 @end quotation
14915 Followed.
14917 @quotation
14919 “An Ada @code{in} parameter of an access-to-object type with designated
14920 type @code{T} is passed as a @code{t*} argument to a C function,
14921 where @code{t} is the C type corresponding to the Ada type @code{T}.”
14922 @end quotation
14924 Followed.
14926 @quotation
14928 “An Ada access @code{T} parameter, or an Ada @code{out} or @code{in out}
14929 parameter of an elementary type @code{T}, is passed as a @code{t*}
14930 argument to a C function, where @code{t} is the C type corresponding to
14931 the Ada type @code{T}.  In the case of an elementary @code{out} or
14932 @code{in out} parameter, a pointer to a temporary copy is used to
14933 preserve by-copy semantics.”
14934 @end quotation
14936 Followed.
14938 @quotation
14940 “An Ada parameter of a record type @code{T}, of any mode, is passed as a
14941 @code{t*} argument to a C function, where @code{t} is the C
14942 structure corresponding to the Ada type @code{T}.”
14943 @end quotation
14945 Followed.  This convention may be overridden by the use of the C_Pass_By_Copy
14946 pragma, or Convention, or by explicitly specifying the mechanism for a given
14947 call using an extended import or export pragma.
14949 @quotation
14951 “An Ada parameter of an array type with component type @code{T}, of any
14952 mode, is passed as a @code{t*} argument to a C function, where
14953 @code{t} is the C type corresponding to the Ada type @code{T}.”
14954 @end quotation
14956 Followed.
14958 @quotation
14960 “An Ada parameter of an access-to-subprogram type is passed as a pointer
14961 to a C function whose prototype corresponds to the designated
14962 subprogram’s specification.”
14963 @end quotation
14965 Followed.
14967 @geindex COBOL
14968 @geindex interfacing with
14970 @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
14971 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{248}
14972 @section RM B.4(95-98): Interfacing with COBOL
14975 @quotation
14977 “An Ada implementation should support the following interface
14978 correspondences between Ada and COBOL.”
14979 @end quotation
14981 Followed.
14983 @quotation
14985 “An Ada access @code{T} parameter is passed as a @code{BY REFERENCE} data item of
14986 the COBOL type corresponding to @code{T}.”
14987 @end quotation
14989 Followed.
14991 @quotation
14993 “An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
14994 the corresponding COBOL type.”
14995 @end quotation
14997 Followed.
14999 @quotation
15001 “Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
15002 COBOL type corresponding to the Ada parameter type; for scalars, a local
15003 copy is used if necessary to ensure by-copy semantics.”
15004 @end quotation
15006 Followed.
15008 @geindex Fortran
15009 @geindex interfacing with
15011 @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
15012 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{249}
15013 @section RM B.5(22-26): Interfacing with Fortran
15016 @quotation
15018 “An Ada implementation should support the following interface
15019 correspondences between Ada and Fortran:”
15020 @end quotation
15022 Followed.
15024 @quotation
15026 “An Ada procedure corresponds to a Fortran subroutine.”
15027 @end quotation
15029 Followed.
15031 @quotation
15033 “An Ada function corresponds to a Fortran function.”
15034 @end quotation
15036 Followed.
15038 @quotation
15040 “An Ada parameter of an elementary, array, or record type @code{T} is
15041 passed as a @code{T} argument to a Fortran procedure, where @code{T} is
15042 the Fortran type corresponding to the Ada type @code{T}, and where the
15043 INTENT attribute of the corresponding dummy argument matches the Ada
15044 formal parameter mode; the Fortran implementation’s parameter passing
15045 conventions are used.  For elementary types, a local copy is used if
15046 necessary to ensure by-copy semantics.”
15047 @end quotation
15049 Followed.
15051 @quotation
15053 “An Ada parameter of an access-to-subprogram type is passed as a
15054 reference to a Fortran procedure whose interface corresponds to the
15055 designated subprogram’s specification.”
15056 @end quotation
15058 Followed.
15060 @geindex Machine operations
15062 @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
15063 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{24a}
15064 @section RM C.1(3-5): Access to Machine Operations
15067 @quotation
15069 “The machine code or intrinsic support should allow access to all
15070 operations normally available to assembly language programmers for the
15071 target environment, including privileged instructions, if any.”
15072 @end quotation
15074 Followed.
15076 @quotation
15078 “The interfacing pragmas (see Annex B) should support interface to
15079 assembler; the default assembler should be associated with the
15080 convention identifier @code{Assembler}.”
15081 @end quotation
15083 Followed.
15085 @quotation
15087 “If an entity is exported to assembly language, then the implementation
15088 should allocate it at an addressable location, and should ensure that it
15089 is retained by the linking process, even if not otherwise referenced
15090 from the Ada code.  The implementation should assume that any call to a
15091 machine code or assembler subprogram is allowed to read or update every
15092 object that is specified as exported.”
15093 @end quotation
15095 Followed.
15097 @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
15098 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{24b}
15099 @section RM C.1(10-16): Access to Machine Operations
15102 @quotation
15104 “The implementation should ensure that little or no overhead is
15105 associated with calling intrinsic and machine-code subprograms.”
15106 @end quotation
15108 Followed for both intrinsics and machine-code subprograms.
15110 @quotation
15112 “It is recommended that intrinsic subprograms be provided for convenient
15113 access to any machine operations that provide special capabilities or
15114 efficiency and that are not otherwise available through the language
15115 constructs.”
15116 @end quotation
15118 Followed.  A full set of machine operation intrinsic subprograms is provided.
15120 @quotation
15122 “Atomic read-modify-write operations—e.g., test and set, compare and
15123 swap, decrement and test, enqueue/dequeue.”
15124 @end quotation
15126 Followed on any target supporting such operations.
15128 @quotation
15130 “Standard numeric functions—e.g.:, sin, log.”
15131 @end quotation
15133 Followed on any target supporting such operations.
15135 @quotation
15137 “String manipulation operations—e.g.:, translate and test.”
15138 @end quotation
15140 Followed on any target supporting such operations.
15142 @quotation
15144 “Vector operations—e.g.:, compare vector against thresholds.”
15145 @end quotation
15147 Followed on any target supporting such operations.
15149 @quotation
15151 “Direct operations on I/O ports.”
15152 @end quotation
15154 Followed on any target supporting such operations.
15156 @geindex Interrupt support
15158 @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
15159 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{24c}
15160 @section RM C.3(28): Interrupt Support
15163 @quotation
15165 “If the @code{Ceiling_Locking} policy is not in effect, the
15166 implementation should provide means for the application to specify which
15167 interrupts are to be blocked during protected actions, if the underlying
15168 system allows for a finer-grain control of interrupt blocking.”
15169 @end quotation
15171 Followed.  The underlying system does not allow for finer-grain control
15172 of interrupt blocking.
15174 @geindex Protected procedure handlers
15176 @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
15177 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{24d}
15178 @section RM C.3.1(20-21): Protected Procedure Handlers
15181 @quotation
15183 “Whenever possible, the implementation should allow interrupt handlers to
15184 be called directly by the hardware.”
15185 @end quotation
15187 Followed on any target where the underlying operating system permits
15188 such direct calls.
15190 @quotation
15192 “Whenever practical, violations of any
15193 implementation-defined restrictions should be detected before run time.”
15194 @end quotation
15196 Followed.  Compile time warnings are given when possible.
15198 @geindex Package `@w{`}Interrupts`@w{`}
15200 @geindex Interrupts
15202 @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
15203 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{24e}
15204 @section RM C.3.2(25): Package @code{Interrupts}
15207 @quotation
15209 “If implementation-defined forms of interrupt handler procedures are
15210 supported, such as protected procedures with parameters, then for each
15211 such form of a handler, a type analogous to @code{Parameterless_Handler}
15212 should be specified in a child package of @code{Interrupts}, with the
15213 same operations as in the predefined package Interrupts.”
15214 @end quotation
15216 Followed.
15218 @geindex Pre-elaboration requirements
15220 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
15221 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{24f}
15222 @section RM C.4(14): Pre-elaboration Requirements
15225 @quotation
15227 “It is recommended that pre-elaborated packages be implemented in such a
15228 way that there should be little or no code executed at run time for the
15229 elaboration of entities not already covered by the Implementation
15230 Requirements.”
15231 @end quotation
15233 Followed.  Executable code is generated in some cases, e.g., loops
15234 to initialize large arrays.
15236 @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
15237 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{250}
15238 @section RM C.5(8): Pragma @code{Discard_Names}
15241 @quotation
15243 “If the pragma applies to an entity, then the implementation should
15244 reduce the amount of storage used for storing names associated with that
15245 entity.”
15246 @end quotation
15248 Followed.
15250 @geindex Package Task_Attributes
15252 @geindex Task_Attributes
15254 @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
15255 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{251}
15256 @section RM C.7.2(30): The Package Task_Attributes
15259 @quotation
15261 “Some implementations are targeted to domains in which memory use at run
15262 time must be completely deterministic.  For such implementations, it is
15263 recommended that the storage for task attributes will be pre-allocated
15264 statically and not from the heap.  This can be accomplished by either
15265 placing restrictions on the number and the size of the task’s
15266 attributes, or by using the pre-allocated storage for the first @code{N}
15267 attribute objects, and the heap for the others.  In the latter case,
15268 @code{N} should be documented.”
15269 @end quotation
15271 Not followed.  This implementation is not targeted to such a domain.
15273 @geindex Locking Policies
15275 @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
15276 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{252}
15277 @section RM D.3(17): Locking Policies
15280 @quotation
15282 “The implementation should use names that end with @code{_Locking} for
15283 locking policies defined by the implementation.”
15284 @end quotation
15286 Followed.  Two implementation-defined locking policies are defined,
15287 whose names (@code{Inheritance_Locking} and
15288 @code{Concurrent_Readers_Locking}) follow this suggestion.
15290 @geindex Entry queuing policies
15292 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
15293 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{253}
15294 @section RM D.4(16): Entry Queuing Policies
15297 @quotation
15299 “Names that end with @code{_Queuing} should be used
15300 for all implementation-defined queuing policies.”
15301 @end quotation
15303 Followed.  No such implementation-defined queuing policies exist.
15305 @geindex Preemptive abort
15307 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
15308 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{254}
15309 @section RM D.6(9-10): Preemptive Abort
15312 @quotation
15314 “Even though the `abort_statement' is included in the list of
15315 potentially blocking operations (see 9.5.1), it is recommended that this
15316 statement be implemented in a way that never requires the task executing
15317 the `abort_statement' to block.”
15318 @end quotation
15320 Followed.
15322 @quotation
15324 “On a multi-processor, the delay associated with aborting a task on
15325 another processor should be bounded; the implementation should use
15326 periodic polling, if necessary, to achieve this.”
15327 @end quotation
15329 Followed.
15331 @geindex Tasking restrictions
15333 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
15334 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{255}
15335 @section RM D.7(21): Tasking Restrictions
15338 @quotation
15340 “When feasible, the implementation should take advantage of the specified
15341 restrictions to produce a more efficient implementation.”
15342 @end quotation
15344 GNAT currently takes advantage of these restrictions by providing an optimized
15345 run time when the Ravenscar profile and the GNAT restricted run time set
15346 of restrictions are specified.  See pragma @code{Profile (Ravenscar)} and
15347 pragma @code{Profile (Restricted)} for more details.
15349 @geindex Time
15350 @geindex monotonic
15352 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
15353 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{256}
15354 @section RM D.8(47-49): Monotonic Time
15357 @quotation
15359 “When appropriate, implementations should provide configuration
15360 mechanisms to change the value of @code{Tick}.”
15361 @end quotation
15363 Such configuration mechanisms are not appropriate to this implementation
15364 and are thus not supported.
15366 @quotation
15368 “It is recommended that @code{Calendar.Clock} and @code{Real_Time.Clock}
15369 be implemented as transformations of the same time base.”
15370 @end quotation
15372 Followed.
15374 @quotation
15376 “It is recommended that the best time base which exists in
15377 the underlying system be available to the application through
15378 @code{Clock}.  @cite{Best} may mean highest accuracy or largest range.”
15379 @end quotation
15381 Followed.
15383 @geindex Partition communication subsystem
15385 @geindex PCS
15387 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
15388 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{257}
15389 @section RM E.5(28-29): Partition Communication Subsystem
15392 @quotation
15394 “Whenever possible, the PCS on the called partition should allow for
15395 multiple tasks to call the RPC-receiver with different messages and
15396 should allow them to block until the corresponding subprogram body
15397 returns.”
15398 @end quotation
15400 Followed by GLADE, a separately supplied PCS that can be used with
15401 GNAT.
15403 @quotation
15405 “The @code{Write} operation on a stream of type @code{Params_Stream_Type}
15406 should raise @code{Storage_Error} if it runs out of space trying to
15407 write the @code{Item} into the stream.”
15408 @end quotation
15410 Followed by GLADE, a separately supplied PCS that can be used with
15411 GNAT.
15413 @geindex COBOL support
15415 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
15416 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{258}
15417 @section RM F(7): COBOL Support
15420 @quotation
15422 “If COBOL (respectively, C) is widely supported in the target
15423 environment, implementations supporting the Information Systems Annex
15424 should provide the child package @code{Interfaces.COBOL} (respectively,
15425 @code{Interfaces.C}) specified in Annex B and should support a
15426 @code{convention_identifier} of COBOL (respectively, C) in the interfacing
15427 pragmas (see Annex B), thus allowing Ada programs to interface with
15428 programs written in that language.”
15429 @end quotation
15431 Followed.
15433 @geindex Decimal radix support
15435 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15436 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{259}
15437 @section RM F.1(2): Decimal Radix Support
15440 @quotation
15442 “Packed decimal should be used as the internal representation for objects
15443 of subtype @code{S} when @code{S}’Machine_Radix = 10.”
15444 @end quotation
15446 Not followed.  GNAT ignores @code{S}’Machine_Radix and always uses binary
15447 representations.
15449 @geindex Numerics
15451 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15452 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{25a}
15453 @section RM G: Numerics
15456 @quotation
15458 “If Fortran (respectively, C) is widely supported in the target
15459 environment, implementations supporting the Numerics Annex
15460 should provide the child package @code{Interfaces.Fortran} (respectively,
15461 @code{Interfaces.C}) specified in Annex B and should support a
15462 @code{convention_identifier} of Fortran (respectively, C) in the interfacing
15463 pragmas (see Annex B), thus allowing Ada programs to interface with
15464 programs written in that language.”
15465 @end quotation
15467 Followed.
15469 @geindex Complex types
15471 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15472 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{25b}
15473 @section RM G.1.1(56-58): Complex Types
15476 @quotation
15478 “Because the usual mathematical meaning of multiplication of a complex
15479 operand and a real operand is that of the scaling of both components of
15480 the former by the latter, an implementation should not perform this
15481 operation by first promoting the real operand to complex type and then
15482 performing a full complex multiplication.  In systems that, in the
15483 future, support an Ada binding to IEC 559:1989, the latter technique
15484 will not generate the required result when one of the components of the
15485 complex operand is infinite.  (Explicit multiplication of the infinite
15486 component by the zero component obtained during promotion yields a NaN
15487 that propagates into the final result.) Analogous advice applies in the
15488 case of multiplication of a complex operand and a pure-imaginary
15489 operand, and in the case of division of a complex operand by a real or
15490 pure-imaginary operand.”
15491 @end quotation
15493 Not followed.
15495 @quotation
15497 “Similarly, because the usual mathematical meaning of addition of a
15498 complex operand and a real operand is that the imaginary operand remains
15499 unchanged, an implementation should not perform this operation by first
15500 promoting the real operand to complex type and then performing a full
15501 complex addition.  In implementations in which the @code{Signed_Zeros}
15502 attribute of the component type is @code{True} (and which therefore
15503 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15504 predefined arithmetic operations), the latter technique will not
15505 generate the required result when the imaginary component of the complex
15506 operand is a negatively signed zero.  (Explicit addition of the negative
15507 zero to the zero obtained during promotion yields a positive zero.)
15508 Analogous advice applies in the case of addition of a complex operand
15509 and a pure-imaginary operand, and in the case of subtraction of a
15510 complex operand and a real or pure-imaginary operand.”
15511 @end quotation
15513 Not followed.
15515 @quotation
15517 “Implementations in which @code{Real'Signed_Zeros} is @code{True} should
15518 attempt to provide a rational treatment of the signs of zero results and
15519 result components.  As one example, the result of the @code{Argument}
15520 function should have the sign of the imaginary component of the
15521 parameter @code{X} when the point represented by that parameter lies on
15522 the positive real axis; as another, the sign of the imaginary component
15523 of the @code{Compose_From_Polar} function should be the same as
15524 (respectively, the opposite of) that of the @code{Argument} parameter when that
15525 parameter has a value of zero and the @code{Modulus} parameter has a
15526 nonnegative (respectively, negative) value.”
15527 @end quotation
15529 Followed.
15531 @geindex Complex elementary functions
15533 @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
15534 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{25c}
15535 @section RM G.1.2(49): Complex Elementary Functions
15538 @quotation
15540 “Implementations in which @code{Complex_Types.Real'Signed_Zeros} is
15541 @code{True} should attempt to provide a rational treatment of the signs
15542 of zero results and result components.  For example, many of the complex
15543 elementary functions have components that are odd functions of one of
15544 the parameter components; in these cases, the result component should
15545 have the sign of the parameter component at the origin.  Other complex
15546 elementary functions have zero components whose sign is opposite that of
15547 a parameter component at the origin, or is always positive or always
15548 negative.”
15549 @end quotation
15551 Followed.
15553 @geindex Accuracy requirements
15555 @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
15556 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{25d}
15557 @section RM G.2.4(19): Accuracy Requirements
15560 @quotation
15562 “The versions of the forward trigonometric functions without a
15563 @code{Cycle} parameter should not be implemented by calling the
15564 corresponding version with a @code{Cycle} parameter of
15565 @code{2.0*Numerics.Pi}, since this will not provide the required
15566 accuracy in some portions of the domain.  For the same reason, the
15567 version of @code{Log} without a @code{Base} parameter should not be
15568 implemented by calling the corresponding version with a @code{Base}
15569 parameter of @code{Numerics.e}.”
15570 @end quotation
15572 Followed.
15574 @geindex Complex arithmetic accuracy
15576 @geindex Accuracy
15577 @geindex complex arithmetic
15579 @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
15580 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{25e}
15581 @section RM G.2.6(15): Complex Arithmetic Accuracy
15584 @quotation
15586 “The version of the @code{Compose_From_Polar} function without a
15587 @code{Cycle} parameter should not be implemented by calling the
15588 corresponding version with a @code{Cycle} parameter of
15589 @code{2.0*Numerics.Pi}, since this will not provide the required
15590 accuracy in some portions of the domain.”
15591 @end quotation
15593 Followed.
15595 @geindex Sequential elaboration policy
15597 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15598 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{25f}
15599 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15602 @quotation
15604 “If the partition elaboration policy is @code{Sequential} and the
15605 Environment task becomes permanently blocked during elaboration then the
15606 partition is deadlocked and it is recommended that the partition be
15607 immediately terminated.”
15608 @end quotation
15610 Not followed.
15612 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15613 @anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{260}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{261}@anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}
15614 @chapter Implementation Defined Characteristics
15617 In addition to the implementation dependent pragmas and attributes, and the
15618 implementation advice, there are a number of other Ada features that are
15619 potentially implementation dependent and are designated as
15620 implementation-defined. These are mentioned throughout the Ada Reference
15621 Manual, and are summarized in Annex M.
15623 A requirement for conforming Ada compilers is that they provide
15624 documentation describing how the implementation deals with each of these
15625 issues.  In this chapter you will find each point in Annex M listed,
15626 followed by a description of how GNAT handles the implementation dependence.
15628 You can use this chapter as a guide to minimizing implementation
15629 dependent features in your programs if portability to other compilers
15630 and other operating systems is an important consideration.  The numbers
15631 in each entry below correspond to the paragraph numbers in the Ada
15632 Reference Manual.
15635 @itemize *
15637 @item 
15638 “Whether or not each recommendation given in Implementation
15639 Advice is followed.  See 1.1.2(37).”
15640 @end itemize
15642 See @ref{a,,Implementation Advice}.
15645 @itemize *
15647 @item 
15648 “Capacity limitations of the implementation.  See 1.1.3(3).”
15649 @end itemize
15651 The complexity of programs that can be processed is limited only by the
15652 total amount of available virtual memory, and disk space for the
15653 generated object files.
15656 @itemize *
15658 @item 
15659 “Variations from the standard that are impractical to avoid
15660 given the implementation’s execution environment.  See 1.1.3(6).”
15661 @end itemize
15663 There are no variations from the standard.
15666 @itemize *
15668 @item 
15669 “Which code_statements cause external
15670 interactions.  See 1.1.3(10).”
15671 @end itemize
15673 Any `code_statement' can potentially cause external interactions.
15676 @itemize *
15678 @item 
15679 “The coded representation for the text of an Ada
15680 program.  See 2.1(4).”
15681 @end itemize
15683 See separate section on source representation.
15686 @itemize *
15688 @item 
15689 “The semantics of an Ada program whose text is not in
15690 Normalization Form C.  See 2.1(4).”
15691 @end itemize
15693 See separate section on source representation.
15696 @itemize *
15698 @item 
15699 “The representation for an end of line.  See 2.2(2).”
15700 @end itemize
15702 See separate section on source representation.
15705 @itemize *
15707 @item 
15708 “Maximum supported line length and lexical element
15709 length.  See 2.2(15).”
15710 @end itemize
15712 The maximum line length is 255 characters and the maximum length of
15713 a lexical element is also 255 characters. This is the default setting
15714 if not overridden by the use of compiler switch `-gnaty' (which
15715 sets the maximum to 79) or `-gnatyMnn' which allows the maximum
15716 line length to be specified to be any value up to 32767. The maximum
15717 length of a lexical element is the same as the maximum line length.
15720 @itemize *
15722 @item 
15723 “Implementation defined pragmas.  See 2.8(14).”
15724 @end itemize
15726 See @ref{7,,Implementation Defined Pragmas}.
15729 @itemize *
15731 @item 
15732 “Effect of pragma @code{Optimize}.  See 2.8(27).”
15733 @end itemize
15735 Pragma @code{Optimize}, if given with a @code{Time} or @code{Space}
15736 parameter, checks that the optimization flag is set, and aborts if it is
15737 not.
15740 @itemize *
15742 @item 
15743 “The message string associated with the Assertion_Error exception raised
15744 by the failure of a predicate check if there is no applicable
15745 Predicate_Failure aspect.  See 3.2.4(31).”
15746 @end itemize
15748 In the case of a Dynamic_Predicate aspect, the string is
15749 “Dynamic_Predicate failed at <source position>”, where
15750 “<source position>” might be something like “foo.adb:123”.
15751 The Static_Predicate case is handled analogously.
15754 @itemize *
15756 @item 
15757 “The predefined integer types declared in
15758 @code{Standard}.  See 3.5.4(25).”
15759 @end itemize
15762 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15763 @headitem
15765 Type
15767 @tab
15769 Representation
15771 @item
15773 `Short_Short_Integer'
15775 @tab
15777 8-bit signed
15779 @item
15781 `Short_Integer'
15783 @tab
15785 16-bit signed
15787 @item
15789 `Integer'
15791 @tab
15793 32-bit signed
15795 @item
15797 `Long_Integer'
15799 @tab
15801 64-bit signed (on most 64-bit targets,
15802 depending on the C definition of long)
15803 32-bit signed (on all other targets)
15805 @item
15807 `Long_Long_Integer'
15809 @tab
15811 64-bit signed
15813 @item
15815 `Long_Long_Long_Integer'
15817 @tab
15819 128-bit signed (on 64-bit targets)
15820 64-bit signed (on 32-bit targets)
15822 @end multitable
15826 @itemize *
15828 @item 
15829 “Any nonstandard integer types and the operators defined
15830 for them.  See 3.5.4(26).”
15831 @end itemize
15833 There are no nonstandard integer types.
15836 @itemize *
15838 @item 
15839 “Any nonstandard real types and the operators defined for
15840 them.  See 3.5.6(8).”
15841 @end itemize
15843 There are no nonstandard real types.
15846 @itemize *
15848 @item 
15849 “What combinations of requested decimal precision and range
15850 are supported for floating point types.  See 3.5.7(7).”
15851 @end itemize
15853 The precision and range are defined by the IEEE Standard for Floating-Point
15854 Arithmetic (IEEE 754-2019).
15857 @itemize *
15859 @item 
15860 “The predefined floating point types declared in
15861 @code{Standard}.  See 3.5.7(16).”
15862 @end itemize
15865 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15866 @headitem
15868 Type
15870 @tab
15872 Representation
15874 @item
15876 `Short_Float'
15878 @tab
15880 IEEE Binary32 (Single)
15882 @item
15884 `Float'
15886 @tab
15888 IEEE Binary32 (Single)
15890 @item
15892 `Long_Float'
15894 @tab
15896 IEEE Binary64 (Double)
15898 @item
15900 `Long_Long_Float'
15902 @tab
15904 IEEE Binary64 (Double) on non-x86 architectures
15905 IEEE 80-bit Extended on x86 architecture
15907 @end multitable
15910 The default rounding mode specified by the IEEE 754 Standard is assumed both
15911 for static and dynamic computations (that is, round to nearest, ties to even).
15912 The input routines yield correctly rounded values for Short_Float, Float, and
15913 Long_Float at least. The output routines can compute up to twice as many exact
15914 digits as the value of @code{T'Digits} for any type, for example 30 digits for
15915 Long_Float; if more digits are requested, zeros are printed.
15918 @itemize *
15920 @item 
15921 “The small of an ordinary fixed point type.  See 3.5.9(8).”
15922 @end itemize
15924 The small is the largest power of two that does not exceed the delta.
15927 @itemize *
15929 @item 
15930 “What combinations of small, range, and digits are
15931 supported for fixed point types.  See 3.5.9(10).”
15932 @end itemize
15934 For an ordinary fixed point type, on 32-bit platforms, the small must lie in
15935 2.0**(-80) .. 2.0**80 and the range in -9.0E+36 .. 9.0E+36; any combination
15936 is permitted that does not result in a mantissa larger than 63 bits.
15938 On 64-bit platforms, the small must lie in 2.0**(-127) .. 2.0**127 and the
15939 range in -1.0E+76 .. 1.0E+76; any combination is permitted that does not
15940 result in a mantissa larger than 63 bits, and any combination is permitted
15941 that results in a mantissa between 64 and 127 bits if the small is the
15942 ratio of two integers that lie in 1 .. 2.0**127.
15944 If the small is the ratio of two integers with 64-bit magnitude on 32-bit
15945 platforms and 128-bit magnitude on 64-bit platforms, which is the case if
15946 no @code{small} clause is provided, then the operations of the fixed point
15947 type are entirely implemented by means of integer instructions.  In the
15948 other cases, some operations, in particular input and output, may be
15949 implemented by means of floating-point instructions and may be affected
15950 by accuracy issues on architectures other than x86.
15952 For a decimal fixed point type, on 32-bit platforms, the small must lie in
15953 1.0E-18 .. 1.0E+18 and the digits in 1 .. 18.  On 64-bit platforms, the
15954 small must lie in 1.0E-38 .. 1.0E+38 and the digits in 1 .. 38.
15957 @itemize *
15959 @item 
15960 “The result of @code{Tags.Expanded_Name} for types declared
15961 within an unnamed `block_statement'.  See 3.9(10).”
15962 @end itemize
15964 Block numbers of the form @code{B@var{nnn}}, where `nnn' is a
15965 decimal integer are allocated.
15968 @itemize *
15970 @item 
15971 “The sequence of characters of the value returned by Tags.Expanded_Name
15972 (respectively, Tags.Wide_Expanded_Name) when some of the graphic
15973 characters of Tags.Wide_Wide_Expanded_Name are not defined in Character
15974 (respectively, Wide_Character).  See 3.9(10.1).”
15975 @end itemize
15977 This is handled in the same way as the implementation-defined behavior
15978 referenced in A.4.12(34).
15981 @itemize *
15983 @item 
15984 “Implementation-defined attributes.  See 4.1.4(12).”
15985 @end itemize
15987 See @ref{8,,Implementation Defined Attributes}.
15990 @itemize *
15992 @item 
15993 “The value of the parameter to Empty for some container aggregates.
15994 See 4.3.5(40).”
15995 @end itemize
15997 As per the suggestion given in the Annotated Ada RM, the default value
15998 of the formal parameter is used if one exists and zero is used otherwise.
16001 @itemize *
16003 @item 
16004 “The maximum number of chunks for a parallel reduction expression without
16005 a chunk_specification.  See 4.5.10(21).”
16006 @end itemize
16008 Feature unimplemented.
16011 @itemize *
16013 @item 
16014 “Rounding of real static expressions which are exactly half-way between
16015 two machine numbers.  See 4.9(38).”
16016 @end itemize
16018 Round to even is used in all such cases.
16021 @itemize *
16023 @item 
16024 “The maximum number of chunks for a parallel generalized iterator without
16025 a chunk_specification.  See 5.5.2(10).”
16026 @end itemize
16028 Feature unimplemented.
16031 @itemize *
16033 @item 
16034 “The number of chunks for an array component iterator.  See 5.5.2(11).”
16035 @end itemize
16037 Feature unimplemented.
16040 @itemize *
16042 @item 
16043 “Any extensions of the Global aspect.  See 6.1.2(43).”
16044 @end itemize
16046 Feature unimplemented.
16049 @itemize *
16051 @item 
16052 “The circumstances the implementation passes in the null value for a view
16053 conversion of an access type used as an out parameter.  See 6.4.1(19).”
16054 @end itemize
16056 Difficult to characterize.
16059 @itemize *
16061 @item 
16062 “Any extensions of the Default_Initial_Condition aspect.  See 7.3.3(11).”
16063 @end itemize
16065 SPARK allows specifying `null' as the Default_Initial_Condition
16066 aspect of a type. See the SPARK reference manual for further details.
16069 @itemize *
16071 @item 
16072 “Any implementation-defined time types.  See 9.6(6).”
16073 @end itemize
16075 There are no implementation-defined time types.
16078 @itemize *
16080 @item 
16081 “The time base associated with relative delays.  See 9.6(20).”
16082 @end itemize
16084 See 9.6(20).  The time base used is that provided by the C library
16085 function @code{gettimeofday}.
16088 @itemize *
16090 @item 
16091 “The time base of the type @code{Calendar.Time}.  See 9.6(23).”
16092 @end itemize
16094 The time base used is that provided by the C library function
16095 @code{gettimeofday}.
16098 @itemize *
16100 @item 
16101 “The time zone used for package @code{Calendar}
16102 operations.  See 9.6(24).”
16103 @end itemize
16105 The time zone used by package @code{Calendar} is the current system time zone
16106 setting for local time, as accessed by the C library function
16107 @code{localtime}.
16110 @itemize *
16112 @item 
16113 “Any limit on `delay_until_statements' of
16114 `select_statements'.  See 9.6(29).”
16115 @end itemize
16117 There are no such limits.
16120 @itemize *
16122 @item 
16123 “The result of Calendar.Formatting.Image if its argument represents more
16124 than 100 hours.  See 9.6.1(86).”
16125 @end itemize
16127 Calendar.Time_Error is raised.
16130 @itemize *
16132 @item 
16133 “Implementation-defined conflict check policies.  See 9.10.1(5).”
16134 @end itemize
16136 There are no implementation-defined conflict check policies.
16139 @itemize *
16141 @item 
16142 “The representation for a compilation.  See 10.1(2).”
16143 @end itemize
16145 A compilation is represented by a sequence of files presented to the
16146 compiler in a single invocation of the `gcc' command.
16149 @itemize *
16151 @item 
16152 “Any restrictions on compilations that contain multiple
16153 compilation_units.  See 10.1(4).”
16154 @end itemize
16156 No single file can contain more than one compilation unit, but any
16157 sequence of files can be presented to the compiler as a single
16158 compilation.
16161 @itemize *
16163 @item 
16164 “The mechanisms for creating an environment and for adding
16165 and replacing compilation units.  See 10.1.4(3).”
16166 @end itemize
16168 See separate section on compilation model.
16171 @itemize *
16173 @item 
16174 “The manner of explicitly assigning library units to a
16175 partition.  See 10.2(2).”
16176 @end itemize
16178 If a unit contains an Ada main program, then the Ada units for the partition
16179 are determined by recursive application of the rules in the Ada Reference
16180 Manual section 10.2(2-6).  In other words, the Ada units will be those that
16181 are needed by the main program, and then this definition of need is applied
16182 recursively to those units, and the partition contains the transitive
16183 closure determined by this relationship.  In short, all the necessary units
16184 are included, with no need to explicitly specify the list.  If additional
16185 units are required, e.g., by foreign language units, then all units must be
16186 mentioned in the context clause of one of the needed Ada units.
16188 If the partition contains no main program, or if the main program is in
16189 a language other than Ada, then GNAT
16190 provides the binder options `-z' and `-n' respectively, and in
16191 this case a list of units can be explicitly supplied to the binder for
16192 inclusion in the partition (all units needed by these units will also
16193 be included automatically).  For full details on the use of these
16194 options, refer to `GNAT Make Program gnatmake' in the
16195 @cite{GNAT User’s Guide}.
16198 @itemize *
16200 @item 
16201 “The implementation-defined means, if any, of specifying which compilation
16202 units are needed by a given compilation unit.  See 10.2(2).”
16203 @end itemize
16205 The units needed by a given compilation unit are as defined in
16206 the Ada Reference Manual section 10.2(2-6).  There are no
16207 implementation-defined pragmas or other implementation-defined
16208 means for specifying needed units.
16211 @itemize *
16213 @item 
16214 “The manner of designating the main subprogram of a
16215 partition.  See 10.2(7).”
16216 @end itemize
16218 The main program is designated by providing the name of the
16219 corresponding @code{ALI} file as the input parameter to the binder.
16222 @itemize *
16224 @item 
16225 “The order of elaboration of `library_items'.  See 10.2(18).”
16226 @end itemize
16228 The first constraint on ordering is that it meets the requirements of
16229 Chapter 10 of the Ada Reference Manual.  This still leaves some
16230 implementation-dependent choices, which are resolved by analyzing
16231 the elaboration code of each unit and identifying implicit
16232 elaboration-order dependencies.
16235 @itemize *
16237 @item 
16238 “Parameter passing and function return for the main
16239 subprogram.  See 10.2(21).”
16240 @end itemize
16242 The main program has no parameters.  It may be a procedure, or a function
16243 returning an integer type.  In the latter case, the returned integer
16244 value is the return code of the program (overriding any value that
16245 may have been set by a call to @code{Ada.Command_Line.Set_Exit_Status}).
16248 @itemize *
16250 @item 
16251 “The mechanisms for building and running partitions.  See 10.2(24).”
16252 @end itemize
16254 GNAT itself supports programs with only a single partition. The GNATDIST
16255 tool provided with the GLADE package (which also includes an implementation
16256 of the PCS) provides a completely flexible method for building and running
16257 programs consisting of multiple partitions. See the separate GLADE manual
16258 for details.
16261 @itemize *
16263 @item 
16264 “The details of program execution, including program
16265 termination.  See 10.2(25).”
16266 @end itemize
16268 See separate section on compilation model.
16271 @itemize *
16273 @item 
16274 “The semantics of any non-active partitions supported by the
16275 implementation.  See 10.2(28).”
16276 @end itemize
16278 Passive partitions are supported on targets where shared memory is
16279 provided by the operating system. See the GLADE reference manual for
16280 further details.
16283 @itemize *
16285 @item 
16286 “The information returned by @code{Exception_Message}.  See 11.4.1(10).”
16287 @end itemize
16289 Exception message returns the null string unless a specific message has
16290 been passed by the program.
16293 @itemize *
16295 @item 
16296 “The result of @code{Exceptions.Exception_Name} for types
16297 declared within an unnamed `block_statement'.  See 11.4.1(12).”
16298 @end itemize
16300 Blocks have implementation defined names of the form @code{B@var{nnn}}
16301 where `nnn' is an integer.
16304 @itemize *
16306 @item 
16307 “The information returned by
16308 @code{Exception_Information}.  See 11.4.1(13).”
16309 @end itemize
16311 @code{Exception_Information} returns a string in the following format:
16313 @example
16314 *Exception_Name:* nnnnn
16315 *Message:* mmmmm
16316 *PID:* ppp
16317 *Load address:* 0xhhhh
16318 *Call stack traceback locations:*
16319 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
16320 @end example
16322 where
16324 @quotation
16327 @itemize *
16329 @item 
16330 @code{nnnn} is the fully qualified name of the exception in all upper
16331 case letters. This line is always present.
16333 @item 
16334 @code{mmmm} is the message (this line present only if message is non-null)
16336 @item 
16337 @code{ppp} is the Process Id value as a decimal integer (this line is
16338 present only if the Process Id is nonzero). Currently we are
16339 not making use of this field.
16341 @item 
16342 The Load address line, the Call stack traceback locations line and the
16343 following values are present only if at least one traceback location was
16344 recorded. The Load address indicates the address at which the main executable
16345 was loaded; this line may not be present if operating system hasn’t relocated
16346 the main executable. The values are given in C style format, with lower case
16347 letters for a-f, and only as many digits present as are necessary.
16348 The line terminator sequence at the end of each line, including
16349 the last line is a single @code{LF} character (@code{16#0A#}).
16350 @end itemize
16351 @end quotation
16354 @itemize *
16356 @item 
16357 “The sequence of characters of the value returned by
16358 Exceptions.Exception_Name (respectively, Exceptions.Wide_Exception_Name)
16359 when some of the graphic characters of Exceptions.Wide_Wide_Exception_Name
16360 are not defined in Character (respectively, Wide_Character).
16361 See 11.4.1(12.1).”
16362 @end itemize
16364 This is handled in the same way as the implementation-defined behavior
16365 referenced in A.4.12(34).
16368 @itemize *
16370 @item 
16371 “The information returned by Exception_Information.  See 11.4.1(13).”
16372 @end itemize
16374 The exception name and the source location at which the exception was
16375 raised are included.
16378 @itemize *
16380 @item 
16381 “Implementation-defined policy_identifiers and assertion_aspect_marks
16382 allowed in a pragma Assertion_Policy.  See 11.4.2(9).”
16383 @end itemize
16385 Implementation-defined assertion_aspect_marks include Assert_And_Cut,
16386 Assume, Contract_Cases, Debug, Ghost, Initial_Condition, Loop_Invariant,
16387 Loop_Variant, Postcondition, Precondition, Predicate, Refined_Post,
16388 Statement_Assertions, and Subprogram_Variant. Implementation-defined
16389 policy_identifiers include Ignore and Suppressible.
16392 @itemize *
16394 @item 
16395 “The default assertion policy.  See 11.4.2(10).”
16396 @end itemize
16398 The default assertion policy is Ignore, although this can be overridden
16399 via compiler switches such as “-gnata”.
16402 @itemize *
16404 @item 
16405 “Implementation-defined check names.  See 11.5(27).”
16406 @end itemize
16408 The implementation defined check names include Alignment_Check,
16409 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
16410 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
16411 program can add implementation-defined check names by means of the pragma
16412 Check_Name. See the description of pragma @code{Suppress} for full details.
16415 @itemize *
16417 @item 
16418 “Existence and meaning of second parameter of pragma Unsuppress.
16419 See 11.5(27.1).”
16420 @end itemize
16422 The legality rules for and semantics of the second parameter of pragma
16423 Unsuppress match those for the second argument of pragma Suppress.
16426 @itemize *
16428 @item 
16429 “The cases that cause conflicts between the representation of the
16430 ancestors of a type_declaration.  See 13.1(13.1).”
16431 @end itemize
16433 No such cases exist.
16436 @itemize *
16438 @item 
16439 “The interpretation of each representation aspect.  See 13.1(20).”
16440 @end itemize
16442 See separate section on data representations.
16445 @itemize *
16447 @item 
16448 “Any restrictions placed upon the specification of representation aspects.
16449 See 13.1(20).”
16450 @end itemize
16452 See separate section on data representations.
16455 @itemize *
16457 @item 
16458 “Implementation-defined aspects, including the syntax for specifying
16459 such aspects and the legality rules for such aspects.  See 13.1.1(38).”
16460 @end itemize
16462 See @ref{123,,Implementation Defined Aspects}.
16465 @itemize *
16467 @item 
16468 “The set of machine scalars.  See 13.3(8.1).”
16469 @end itemize
16471 See separate section on data representations.
16474 @itemize *
16476 @item 
16477 “The meaning of @code{Size} for indefinite subtypes.  See 13.3(48).”
16478 @end itemize
16480 The Size attribute of an indefinite subtype is not less than the Size
16481 attribute of any object of that type.
16484 @itemize *
16486 @item 
16487 “The meaning of Object_Size for indefinite subtypes.  See 13.3(58).”
16488 @end itemize
16490 The Object_Size attribute of an indefinite subtype is not less than the
16491 Object_Size attribute of any object of that type.
16494 @itemize *
16496 @item 
16497 “The default external representation for a type tag.  See 13.3(75).”
16498 @end itemize
16500 The default external representation for a type tag is the fully expanded
16501 name of the type in upper case letters.
16504 @itemize *
16506 @item 
16507 “What determines whether a compilation unit is the same in
16508 two different partitions.  See 13.3(76).”
16509 @end itemize
16511 A compilation unit is the same in two different partitions if and only
16512 if it derives from the same source file.
16515 @itemize *
16517 @item 
16518 “Implementation-defined components.  See 13.5.1(15).”
16519 @end itemize
16521 The only implementation defined component is the tag for a tagged type,
16522 which contains a pointer to the dispatching table.
16525 @itemize *
16527 @item 
16528 “If @code{Word_Size} = @code{Storage_Unit}, the default bit
16529 ordering.  See 13.5.3(5).”
16530 @end itemize
16532 @code{Word_Size} (32) is not the same as @code{Storage_Unit} (8) for this
16533 implementation, so no non-default bit ordering is supported.  The default
16534 bit ordering corresponds to the natural endianness of the target architecture.
16537 @itemize *
16539 @item 
16540 “The contents of the visible part of package @code{System}.  See 13.7(2).”
16541 @end itemize
16543 See the definition of package System in @code{system.ads}.
16544 Note that two declarations are added to package System.
16546 @example
16547 Max_Priority           : constant Positive := Priority'Last;
16548 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
16549 @end example
16552 @itemize *
16554 @item 
16555 “The range of Storage_Elements.Storage_Offset, the modulus of
16556 Storage_Elements.Storage_Element, and the declaration of
16557 Storage_Elements.Integer_Address.  See 13.7.1(11).”
16558 @end itemize
16560 See the definition of package System.Storage_Elements in @code{s-stoele.ads}.
16563 @itemize *
16565 @item 
16566 “The contents of the visible part of package @code{System.Machine_Code},
16567 and the meaning of `code_statements'.  See 13.8(7).”
16568 @end itemize
16570 See the definition and documentation in file @code{s-maccod.ads}.
16573 @itemize *
16575 @item 
16576 “The result of unchecked conversion for instances with scalar result
16577 types whose result is not defined by the language.  See 13.9(11).”
16578 @end itemize
16580 Unchecked conversion between types of the same size
16581 results in an uninterpreted transmission of the bits from one type
16582 to the other.  If the types are of unequal sizes, then in the case of
16583 discrete types, a shorter source is first zero or sign extended as
16584 necessary, and a shorter target is simply truncated on the left.
16585 For all non-discrete types, the source is first copied if necessary
16586 to ensure that the alignment requirements of the target are met, then
16587 a pointer is constructed to the source value, and the result is obtained
16588 by dereferencing this pointer after converting it to be a pointer to the
16589 target type. Unchecked conversions where the target subtype is an
16590 unconstrained array are not permitted. If the target alignment is
16591 greater than the source alignment, then a copy of the result is
16592 made with appropriate alignment
16595 @itemize *
16597 @item 
16598 “The result of unchecked conversion for instances with nonscalar result
16599 types whose result is not defined by the language.  See 13.9(11).”
16600 @end itemize
16602 See preceding definition for the scalar result case.
16605 @itemize *
16607 @item 
16608 “Whether or not the implementation provides user-accessible
16609 names for the standard pool type(s).  See 13.11(17).”
16610 @end itemize
16612 There are 3 different standard pools used by the compiler when
16613 @code{Storage_Pool} is not specified depending whether the type is local
16614 to a subprogram or defined at the library level and whether
16615 @code{Storage_Size`@w{`}is specified or not. See documentation in the runtime
16616 library units `@w{`}System.Pool_Global}, @code{System.Pool_Size} and
16617 @code{System.Pool_Local} in files @code{s-poosiz.ads},
16618 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
16619 default pools used.  All these pools are accessible by means of @cite{with}ing
16620 these units.
16623 @itemize *
16625 @item 
16626 “The meaning of @code{Storage_Size} when neither the Storage_Size nor the
16627 Storage_Pool is specified for an access type.  See 13.11(18).”
16628 @end itemize
16630 @code{Storage_Size} is measured in storage units, and refers to the
16631 total space available for an access type collection, or to the primary
16632 stack space for a task.
16635 @itemize *
16637 @item 
16638 “The effect of specifying aspect Default_Storage_Pool on an instance
16639 of a language-defined generic unit.  See 13.11.3(5).”
16640 @end itemize
16642 Instances of language-defined generic units are treated the same as other
16643 instances with respect to the Default_Storage_Pool aspect.
16646 @itemize *
16648 @item 
16649 “Implementation-defined restrictions allowed in a pragma
16650 @code{Restrictions}.  See 13.12(8.7).”
16651 @end itemize
16653 See @ref{9,,Standard and Implementation Defined Restrictions}.
16656 @itemize *
16658 @item 
16659 “The consequences of violating limitations on
16660 @code{Restrictions} pragmas.  See 13.12(9).”
16661 @end itemize
16663 Restrictions that can be checked at compile time are enforced at
16664 compile time; violations are illegal. For other restrictions, any
16665 violation during program execution results in erroneous execution.
16668 @itemize *
16670 @item 
16671 “Implementation-defined usage profiles allowed in a pragma Profile.
16672 See 13.12(15).”
16673 @end itemize
16675 See @ref{7,,Implementation Defined Pragmas}.
16678 @itemize *
16680 @item 
16681 “The contents of the stream elements read and written by the Read and
16682 Write attributes of elementary types.  See 13.13.2(9).”
16683 @end itemize
16685 The representation is the in-memory representation of the base type of
16686 the type, using the number of bits corresponding to the
16687 @code{type'Size} value, and the natural ordering of the machine.
16690 @itemize *
16692 @item 
16693 “The names and characteristics of the numeric subtypes
16694 declared in the visible part of package @code{Standard}.  See A.1(3).”
16695 @end itemize
16697 See items describing the integer and floating-point types supported.
16700 @itemize *
16702 @item 
16703 “The values returned by Strings.Hash.  See A.4.9(3).”
16704 @end itemize
16706 This hash function has predictable collisions and is subject to
16707 equivalent substring attacks. It is not suitable for construction of a
16708 hash table keyed on possibly malicious user input.
16711 @itemize *
16713 @item 
16714 “The value returned by a call to a Text_Buffer Get procedure if any
16715 character in the returned sequence is not defined in Character.
16716 See A.4.12(34).”
16717 @end itemize
16719 The contents of a buffer is represented internally as a UTF_8 string.
16720 The value return by Text_Buffer.Get is the result of passing that
16721 UTF_8 string to UTF_Encoding.Strings.Decode.
16724 @itemize *
16726 @item 
16727 “The value returned by a call to a Text_Buffer Wide_Get procedure if
16728 any character in the returned sequence is not defined in Wide_Character.
16729 See A.4.12(34).”
16730 @end itemize
16732 The contents of a buffer is represented internally as a UTF_8 string.
16733 The value return by Text_Buffer.Wide_Get is the result of passing that
16734 UTF_8 string to UTF_Encoding.Wide_Strings.Decode.
16737 @itemize *
16739 @item 
16740 “The accuracy actually achieved by the elementary
16741 functions.  See A.5.1(1).”
16742 @end itemize
16744 The elementary functions correspond to the functions available in the C
16745 library.  Only fast math mode is implemented.
16748 @itemize *
16750 @item 
16751 “The sign of a zero result from some of the operators or
16752 functions in @code{Numerics.Generic_Elementary_Functions}, when
16753 @code{Float_Type'Signed_Zeros} is @code{True}.  See A.5.1(46).”
16754 @end itemize
16756 The sign of zeroes follows the requirements of the IEEE 754 standard on
16757 floating-point.
16760 @itemize *
16762 @item 
16763 “The value of
16764 @code{Numerics.Float_Random.Max_Image_Width}.  See A.5.2(27).”
16765 @end itemize
16767 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16770 @itemize *
16772 @item 
16773 “The value of
16774 @code{Numerics.Discrete_Random.Max_Image_Width}.  See A.5.2(27).”
16775 @end itemize
16777 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16780 @itemize *
16782 @item 
16783 “The string representation of a random number generator’s
16784 state.  See A.5.2(38).”
16785 @end itemize
16787 The value returned by the Image function is the concatenation of
16788 the fixed-width decimal representations of the 624 32-bit integers
16789 of the state vector.
16792 @itemize *
16794 @item 
16795 “The values of the @code{Model_Mantissa},
16796 @code{Model_Emin}, @code{Model_Epsilon}, @code{Model},
16797 @code{Safe_First}, and @code{Safe_Last} attributes, if the Numerics
16798 Annex is not supported.  See A.5.3(72).”
16799 @end itemize
16801 Running the compiler with `-gnatS' to produce a listing of package
16802 @code{Standard} displays the values of these attributes.
16805 @itemize *
16807 @item 
16808 “The value of @code{Buffer_Size} in @code{Storage_IO}.  See A.9(10).”
16809 @end itemize
16811 All type representations are contiguous, and the @code{Buffer_Size} is
16812 the value of @code{type'Size} rounded up to the next storage unit
16813 boundary.
16816 @itemize *
16818 @item 
16819 “External files for standard input, standard output, and
16820 standard error See A.10(5).”
16821 @end itemize
16823 These files are mapped onto the files provided by the C streams
16824 libraries. See source file @code{i-cstrea.ads} for further details.
16827 @itemize *
16829 @item 
16830 “The accuracy of the value produced by @code{Put}.  See A.10.9(36).”
16831 @end itemize
16833 If more digits are requested in the output than are represented by the
16834 precision of the value, zeroes are output in the corresponding least
16835 significant digit positions.
16838 @itemize *
16840 @item 
16841 “Current size for a stream file for which positioning is not supported.
16842 See A.12.1(1.1).”
16843 @end itemize
16845 Positioning is supported.
16848 @itemize *
16850 @item 
16851 “The meaning of @code{Argument_Count}, @code{Argument}, and
16852 @code{Command_Name}.  See A.15(1).”
16853 @end itemize
16855 These are mapped onto the @code{argv} and @code{argc} parameters of the
16856 main program in the natural manner.
16859 @itemize *
16861 @item 
16862 “The interpretation of file names and directory names.  See A.16(46).”
16863 @end itemize
16865 These names are interpreted consistently with the underlying file system.
16868 @itemize *
16870 @item 
16871 “The maxium value for a file size in Directories.  See A.16(87).”
16872 @end itemize
16874 Directories.File_Size’Last is equal to Long_Long_Integer’Last .
16877 @itemize *
16879 @item 
16880 “The result for Directories.Size for a directory or special file.
16881 See A.16(93).”
16882 @end itemize
16884 Name_Error is raised.
16887 @itemize *
16889 @item 
16890 “The result for Directories.Modification_Time for a directory or special file.
16891 See A.16(93).”
16892 @end itemize
16894 Name_Error is raised.
16897 @itemize *
16899 @item 
16900 “The interpretation of a nonnull search pattern in Directories.
16901 See A.16(104).”
16902 @end itemize
16904 When the @code{Pattern} parameter is not the null string, it is interpreted
16905 according to the syntax of regular expressions as defined in the
16906 @code{GNAT.Regexp} package.
16908 See @ref{262,,GNAT.Regexp (g-regexp.ads)}.
16911 @itemize *
16913 @item 
16914 “The results of a Directories search if the contents of the directory are
16915 altered while a search is in progress.  See A.16(110).”
16916 @end itemize
16918 The effect of a call to Get_Next_Entry is determined by the current
16919 state of the directory.
16922 @itemize *
16924 @item 
16925 “The definition and meaning of an environment variable.  See A.17(1).”
16926 @end itemize
16928 This definition is determined by the underlying operating system.
16931 @itemize *
16933 @item 
16934 “The circumstances where an environment variable cannot be defined.
16935 See A.17(16).”
16936 @end itemize
16938 There are no such implementation-defined circumstances.
16941 @itemize *
16943 @item 
16944 “Environment names for which Set has the effect of Clear.  See A.17(17).”
16945 @end itemize
16947 There are no such names.
16950 @itemize *
16952 @item 
16953 “The value of Containers.Hash_Type’Modulus. The value of
16954 Containers.Count_Type’Last.  See A.18.1(7).”
16955 @end itemize
16957 Containers.Hash_Type’Modulus is 2**32.
16958 Containers.Count_Type’Last is 2**31 - 1.
16961 @itemize *
16963 @item 
16964 “Implementation-defined convention names.  See B.1(11).”
16965 @end itemize
16967 The following convention names are supported
16970 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16971 @headitem
16973 Convention Name
16975 @tab
16977 Interpretation
16979 @item
16981 `Ada'
16983 @tab
16987 @item
16989 `Ada_Pass_By_Copy'
16991 @tab
16993 Allowed for any types except by-reference types such as limited
16994 records. Compatible with convention Ada, but causes any parameters
16995 with this convention to be passed by copy.
16997 @item
16999 `Ada_Pass_By_Reference'
17001 @tab
17003 Allowed for any types except by-copy types such as scalars.
17004 Compatible with convention Ada, but causes any parameters
17005 with this convention to be passed by reference.
17007 @item
17009 `Assembler'
17011 @tab
17013 Assembly language
17015 @item
17017 `Asm'
17019 @tab
17021 Synonym for Assembler
17023 @item
17025 `Assembly'
17027 @tab
17029 Synonym for Assembler
17031 @item
17035 @tab
17039 @item
17041 `C_Pass_By_Copy'
17043 @tab
17045 Allowed only for record types, like C, but also notes that record
17046 is to be passed by copy rather than reference.
17048 @item
17050 `COBOL'
17052 @tab
17054 COBOL
17056 @item
17058 `C_Plus_Plus (or CPP)'
17060 @tab
17064 @item
17066 `Default'
17068 @tab
17070 Treated the same as C
17072 @item
17074 `External'
17076 @tab
17078 Treated the same as C
17080 @item
17082 `Fortran'
17084 @tab
17086 Fortran
17088 @item
17090 `Intrinsic'
17092 @tab
17094 For support of pragma @code{Import} with convention Intrinsic, see
17095 separate section on Intrinsic Subprograms.
17097 @item
17099 `Stdcall'
17101 @tab
17103 Stdcall (used for Windows implementations only).  This convention correspond
17104 to the WINAPI (previously called Pascal convention) C/C++ convention under
17105 Windows.  A routine with this convention cleans the stack before
17106 exit. This pragma cannot be applied to a dispatching call.
17108 @item
17110 `DLL'
17112 @tab
17114 Synonym for Stdcall
17116 @item
17118 `Win32'
17120 @tab
17122 Synonym for Stdcall
17124 @item
17126 `Stubbed'
17128 @tab
17130 Stubbed is a special convention used to indicate that the body of the
17131 subprogram will be entirely ignored.  Any call to the subprogram
17132 is converted into a raise of the @code{Program_Error} exception.  If a
17133 pragma @code{Import} specifies convention @code{stubbed} then no body need
17134 be present at all.  This convention is useful during development for the
17135 inclusion of subprograms whose body has not yet been written.
17136 In addition, all otherwise unrecognized convention names are also
17137 treated as being synonymous with convention C.  In all implementations,
17138 use of such other names results in a warning.
17140 @end multitable
17144 @itemize *
17146 @item 
17147 “The meaning of link names.  See B.1(36).”
17148 @end itemize
17150 Link names are the actual names used by the linker.
17153 @itemize *
17155 @item 
17156 “The manner of choosing link names when neither the link name nor the
17157 address of an imported or exported entity is specified.  See B.1(36).”
17158 @end itemize
17160 The default linker name is that which would be assigned by the relevant
17161 external language, interpreting the Ada name as being in all lower case
17162 letters.
17165 @itemize *
17167 @item 
17168 “The effect of pragma @code{Linker_Options}.  See B.1(37).”
17169 @end itemize
17171 The string passed to @code{Linker_Options} is presented uninterpreted as
17172 an argument to the link command, unless it contains ASCII.NUL characters.
17173 NUL characters if they appear act as argument separators, so for example
17175 @example
17176 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
17177 @end example
17179 causes two separate arguments @code{-labc} and @code{-ldef} to be passed to the
17180 linker. The order of linker options is preserved for a given unit. The final
17181 list of options passed to the linker is in reverse order of the elaboration
17182 order. For example, linker options for a body always appear before the options
17183 from the corresponding package spec.
17186 @itemize *
17188 @item 
17189 “The contents of the visible part of package
17190 @code{Interfaces} and its language-defined descendants.  See B.2(1).”
17191 @end itemize
17193 See files with prefix @code{i-} in the distributed library.
17196 @itemize *
17198 @item 
17199 “Implementation-defined children of package
17200 @code{Interfaces}.  The contents of the visible part of package
17201 @code{Interfaces}.  See B.2(11).”
17202 @end itemize
17204 See files with prefix @code{i-} in the distributed library.
17207 @itemize *
17209 @item 
17210 “The definitions of certain types and constants in Interfaces.C.
17211 See B.3(41).”
17212 @end itemize
17214 See source file @code{i-c.ads}.
17217 @itemize *
17219 @item 
17220 “The types @code{Floating}, @code{Long_Floating},
17221 @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and
17222 @code{COBOL_Character}; and the initialization of the variables
17223 @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in
17224 @code{Interfaces.COBOL}.  See B.4(50).”
17225 @end itemize
17228 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
17229 @headitem
17231 COBOL
17233 @tab
17237 @item
17239 `Floating'
17241 @tab
17243 Float
17245 @item
17247 `Long_Floating'
17249 @tab
17251 (Floating) Long_Float
17253 @item
17255 `Binary'
17257 @tab
17259 Integer
17261 @item
17263 `Long_Binary'
17265 @tab
17267 Long_Long_Integer
17269 @item
17271 `Decimal_Element'
17273 @tab
17275 Character
17277 @item
17279 `COBOL_Character'
17281 @tab
17283 Character
17285 @end multitable
17288 For initialization, see the file @code{i-cobol.ads} in the distributed library.
17291 @itemize *
17293 @item 
17294 “The types Fortran_Integer, Real, Double_Precision, and Character_Set
17295 in Interfaces.Fortran.  See B.5(17).”
17296 @end itemize
17298 See source file @code{i-fortra.ads}. These types are derived, respectively,
17299 from Integer, Float, Long_Float, and Character.
17302 @itemize *
17304 @item 
17305 “Implementation-defined intrinsic subprograms.  See C.1(1).”
17306 @end itemize
17308 See separate section on Intrinsic Subprograms.
17311 @itemize *
17313 @item 
17314 “Any restrictions on a protected procedure or its containing type when an
17315 aspect Attach_handler or Interrupt_Handler is specified.  See C.3.1(17).”
17316 @end itemize
17318 There are no such restrictions.
17321 @itemize *
17323 @item 
17324 “Any other forms of interrupt handler supported by the Attach_Handler and
17325 Interrupt_Handler aspects.  See C.3.1(19).”
17326 @end itemize
17328 There are no such forms.
17331 @itemize *
17333 @item 
17334 “The semantics of some attributes and functions of an entity for which
17335 aspect Discard_Names is True.  See C.5(7).”
17336 @end itemize
17338 If Discard_Names is True for an enumeration type, the Image attribute
17339 provides the image of the Pos of the literal, and Value accepts
17340 Pos values.
17342 If both of the aspects`@w{`}Discard_Names`@w{`} and @code{No_Tagged_Streams} are true
17343 for a tagged type, its Expanded_Name and External_Tag values are
17344 empty strings. This is useful to avoid exposing entity names at binary
17345 level.
17348 @itemize *
17350 @item 
17351 “The modulus and size of Test_and_Set_Flag.  See C.6.3(8).”
17352 @end itemize
17354 The modulus is 2**8. The size is 8.
17357 @itemize *
17359 @item 
17360 “The value used to represent the set value for Atomic_Test_and_Set.
17361 See C.6.3(10).”
17362 @end itemize
17364 The value is 1.
17367 @itemize *
17369 @item 
17370 “The result of the @code{Task_Identification.Image}
17371 attribute.  See C.7.1(7).”
17372 @end itemize
17374 The result of this attribute is a string that identifies
17375 the object or component that denotes a given task. If a variable @code{Var}
17376 has a task type, the image for this task will have the form @code{Var_@var{XXXXXXXX}},
17377 where the suffix `XXXXXXXX'
17378 is the hexadecimal representation of the virtual address of the corresponding
17379 task control block. If the variable is an array of tasks, the image of each
17380 task will have the form of an indexed component indicating the position of a
17381 given task in the array, e.g., @code{Group(5)_@var{XXXXXXX}}. If the task is a
17382 component of a record, the image of the task will have the form of a selected
17383 component. These rules are fully recursive, so that the image of a task that
17384 is a subcomponent of a composite object corresponds to the expression that
17385 designates this task.
17387 If a task is created by an allocator, its image depends on the context. If the
17388 allocator is part of an object declaration, the rules described above are used
17389 to construct its image, and this image is not affected by subsequent
17390 assignments. If the allocator appears within an expression, the image
17391 includes only the name of the task type.
17393 If the configuration pragma Discard_Names is present, or if the restriction
17394 No_Implicit_Heap_Allocation is in effect,  the image reduces to
17395 the numeric suffix, that is to say the hexadecimal representation of the
17396 virtual address of the control block of the task.
17399 @itemize *
17401 @item 
17402 “The value of @code{Current_Task} when in a protected entry
17403 or interrupt handler.  See C.7.1(17).”
17404 @end itemize
17406 Protected entries or interrupt handlers can be executed by any
17407 convenient thread, so the value of @code{Current_Task} is undefined.
17410 @itemize *
17412 @item 
17413 “Granularity of locking for Task_Attributes.  See C.7.2(16).”
17414 @end itemize
17416 No locking is needed if the formal type Attribute has the size and
17417 alignment of either Integer or System.Address and the bit representation
17418 of Initial_Value is all zeroes. Otherwise, locking is performed.
17421 @itemize *
17423 @item 
17424 “The declarations of @code{Any_Priority} and
17425 @code{Priority}.  See D.1(11).”
17426 @end itemize
17428 See declarations in file @code{system.ads}.
17431 @itemize *
17433 @item 
17434 “Implementation-defined execution resources.  See D.1(15).”
17435 @end itemize
17437 There are no implementation-defined execution resources.
17440 @itemize *
17442 @item 
17443 “Whether, on a multiprocessor, a task that is waiting for
17444 access to a protected object keeps its processor busy.  See D.2.1(3).”
17445 @end itemize
17447 On a multi-processor, a task that is waiting for access to a protected
17448 object does not keep its processor busy.
17451 @itemize *
17453 @item 
17454 “The affect of implementation defined execution resources
17455 on task dispatching.  See D.2.1(9).”
17456 @end itemize
17458 Tasks map to threads in the threads package used by GNAT.  Where possible
17459 and appropriate, these threads correspond to native threads of the
17460 underlying operating system.
17463 @itemize *
17465 @item 
17466 “Implementation-defined task dispatching policies.  See D.2.2(3).”
17467 @end itemize
17469 There are no implementation-defined task dispatching policies.
17472 @itemize *
17474 @item 
17475 “The value of Default_Quantum in Dispatching.Round_Robin.  See D.2.5(4).”
17476 @end itemize
17478 The value is 10 milliseconds.
17481 @itemize *
17483 @item 
17484 “Implementation-defined `policy_identifiers' allowed
17485 in a pragma @code{Locking_Policy}.  See D.3(4).”
17486 @end itemize
17488 The two implementation defined policies permitted in GNAT are
17489 @code{Inheritance_Locking} and  @code{Concurrent_Readers_Locking}. On
17490 targets that support the @code{Inheritance_Locking} policy, locking is
17491 implemented by inheritance, i.e., the task owning the lock operates
17492 at a priority equal to the highest priority of any task currently
17493 requesting the lock. On targets that support the
17494 @code{Concurrent_Readers_Locking} policy, locking is implemented with a
17495 read/write lock allowing multiple protected object functions to enter
17496 concurrently.
17499 @itemize *
17501 @item 
17502 “Default ceiling priorities.  See D.3(10).”
17503 @end itemize
17505 The ceiling priority of protected objects of the type
17506 @code{System.Interrupt_Priority'Last} as described in the Ada
17507 Reference Manual D.3(10),
17510 @itemize *
17512 @item 
17513 “The ceiling of any protected object used internally by
17514 the implementation.  See D.3(16).”
17515 @end itemize
17517 The ceiling priority of internal protected objects is
17518 @code{System.Priority'Last}.
17521 @itemize *
17523 @item 
17524 “Implementation-defined queuing policies.  See D.4(1).”
17525 @end itemize
17527 There are no implementation-defined queuing policies.
17530 @itemize *
17532 @item 
17533 “Implementation-defined admission policies.  See D.4.1(1).”
17534 @end itemize
17536 There are no implementation-defined admission policies.
17539 @itemize *
17541 @item 
17542 “Any operations that implicitly require heap storage
17543 allocation.  See D.7(8).”
17544 @end itemize
17546 The only operation that implicitly requires heap storage allocation is
17547 task creation.
17550 @itemize *
17552 @item 
17553 “When restriction No_Dynamic_CPU_Assignment applies to a partition, the
17554 processor on which a task with a CPU value of a Not_A_Specific_CPU will
17555 execute.  See D.7(10).”
17556 @end itemize
17558 Unknown.
17561 @itemize *
17563 @item 
17564 “When restriction No_Task_Termination applies to a partition, what happens
17565 when a task terminates.  See D.7(15.1).”
17566 @end itemize
17568 Execution is erroneous in that case.
17571 @itemize *
17573 @item 
17574 “The behavior when restriction Max_Storage_At_Blocking is violated.
17575 See D.7(17).”
17576 @end itemize
17578 Execution is erroneous in that case.
17581 @itemize *
17583 @item 
17584 “The behavior when restriction Max_Asynchronous_Select_Nesting is violated.
17585 See D.7(18).”
17586 @end itemize
17588 Execution is erroneous in that case.
17591 @itemize *
17593 @item 
17594 “The behavior when restriction Max_Tasks is violated.  See D.7(19).”
17595 @end itemize
17597 Execution is erroneous in that case.
17600 @itemize *
17602 @item 
17603 “Whether the use of pragma Restrictions results in a reduction in program
17604 code or data size or execution time.  See D.7(20).”
17605 @end itemize
17607 Yes it can, but the precise circumstances and properties of such reductions
17608 are difficult to characterize.
17611 @itemize *
17613 @item 
17614 “The value of Barrier_Limit’Last in Synchronous_Barriers.  See D.10.1(4).”
17615 @end itemize
17617 Synchronous_Barriers.Barrier_Limit’Last is Integer’Last .
17620 @itemize *
17622 @item 
17623 “When an aborted task that is waiting on a Synchronous_Barrier is aborted.
17624 See D.10.1(13).”
17625 @end itemize
17627 Difficult to characterize.
17630 @itemize *
17632 @item 
17633 “The value of Min_Handler_Ceiling in Execution_Time.Group_Budgets.
17634 See D.14.2(7).”
17635 @end itemize
17637 See source file @code{a-etgrbu.ads}.
17640 @itemize *
17642 @item 
17643 “The value of CPU_Range’Last in System.Multiprocessors.  See D.16(4).”
17644 @end itemize
17646 See source file @code{s-multip.ads}.
17649 @itemize *
17651 @item 
17652 “The processor on which the environment task executes in the absence
17653 of a value for the aspect CPU.  See D.16(13).”
17654 @end itemize
17656 Unknown.
17659 @itemize *
17661 @item 
17662 “The means for creating and executing distributed
17663 programs.  See E(5).”
17664 @end itemize
17666 The GLADE package provides a utility GNATDIST for creating and executing
17667 distributed programs. See the GLADE reference manual for further details.
17670 @itemize *
17672 @item 
17673 “Any events that can result in a partition becoming
17674 inaccessible.  See E.1(7).”
17675 @end itemize
17677 See the GLADE reference manual for full details on such events.
17680 @itemize *
17682 @item 
17683 “The scheduling policies, treatment of priorities, and management of
17684 shared resources between partitions in certain cases.  See E.1(11).”
17685 @end itemize
17687 See the GLADE reference manual for full details on these aspects of
17688 multi-partition execution.
17691 @itemize *
17693 @item 
17694 “Whether the execution of the remote subprogram is
17695 immediately aborted as a result of cancellation.  See E.4(13).”
17696 @end itemize
17698 See the GLADE reference manual for details on the effect of abort in
17699 a distributed application.
17702 @itemize *
17704 @item 
17705 “The range of type System.RPC.Partition_Id.  See E.5(14).”
17706 @end itemize
17708 System.RPC.Partition_ID’Last is Integer’Last. See source file @code{s-rpc.ads}.
17711 @itemize *
17713 @item 
17714 “Implementation-defined interfaces in the PCS.  See E.5(26).”
17715 @end itemize
17717 See the GLADE reference manual for a full description of all
17718 implementation defined interfaces.
17721 @itemize *
17723 @item 
17724 “The values of named numbers in the package
17725 @code{Decimal}.  See F.2(7).”
17726 @end itemize
17729 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx} 
17730 @headitem
17732 Named Number
17734 @tab
17736 Value
17738 @item
17740 `Max_Scale'
17742 @tab
17746 @item
17748 `Min_Scale'
17750 @tab
17754 @item
17756 `Min_Delta'
17758 @tab
17760 1.0E-18
17762 @item
17764 `Max_Delta'
17766 @tab
17768 1.0E+18
17770 @item
17772 `Max_Decimal_Digits'
17774 @tab
17778 @end multitable
17782 @itemize *
17784 @item 
17785 “The value of @code{Max_Picture_Length} in the package
17786 @code{Text_IO.Editing}.  See F.3.3(16).”
17790 @item 
17791 “The value of @code{Max_Picture_Length} in the package
17792 @code{Wide_Text_IO.Editing}.  See F.3.4(5).”
17796 @item 
17797 “The accuracy actually achieved by the complex elementary
17798 functions and by other complex arithmetic operations.  See G.1(1).”
17799 @end itemize
17801 Standard library functions are used for the complex arithmetic
17802 operations.  Only fast math mode is currently supported.
17805 @itemize *
17807 @item 
17808 “The sign of a zero result (or a component thereof) from
17809 any operator or function in @code{Numerics.Generic_Complex_Types}, when
17810 @code{Real'Signed_Zeros} is True.  See G.1.1(53).”
17811 @end itemize
17813 The signs of zero values are as recommended by the relevant
17814 implementation advice.
17817 @itemize *
17819 @item 
17820 “The sign of a zero result (or a component thereof) from
17821 any operator or function in
17822 @code{Numerics.Generic_Complex_Elementary_Functions}, when
17823 @code{Real'Signed_Zeros} is @code{True}.  See G.1.2(45).”
17824 @end itemize
17826 The signs of zero values are as recommended by the relevant
17827 implementation advice.
17830 @itemize *
17832 @item 
17833 “Whether the strict mode or the relaxed mode is the
17834 default.  See G.2(2).”
17835 @end itemize
17837 The strict mode is the default.  There is no separate relaxed mode.  GNAT
17838 provides a highly efficient implementation of strict mode.
17841 @itemize *
17843 @item 
17844 “The result interval in certain cases of fixed-to-float
17845 conversion.  See G.2.1(10).”
17846 @end itemize
17848 For cases where the result interval is implementation dependent, the
17849 accuracy is that provided by performing all operations in 64-bit IEEE
17850 floating-point format.
17853 @itemize *
17855 @item 
17856 “The result of a floating point arithmetic operation in
17857 overflow situations, when the @code{Machine_Overflows} attribute of the
17858 result type is @code{False}.  See G.2.1(13).”
17859 @end itemize
17861 Infinite and NaN values are produced as dictated by the IEEE
17862 floating-point standard.
17863 Note that on machines that are not fully compliant with the IEEE
17864 floating-point standard, such as Alpha, the `-mieee' compiler flag
17865 must be used for achieving IEEE conforming behavior (although at the cost
17866 of a significant performance penalty), so infinite and NaN values are
17867 properly generated.
17870 @itemize *
17872 @item 
17873 “The result interval for division (or exponentiation by a
17874 negative exponent), when the floating point hardware implements division
17875 as multiplication by a reciprocal.  See G.2.1(16).”
17876 @end itemize
17878 Not relevant, division is IEEE exact.
17881 @itemize *
17883 @item 
17884 “The definition of close result set, which determines the accuracy of
17885 certain fixed point multiplications and divisions.  See G.2.3(5).”
17886 @end itemize
17888 Operations in the close result set are performed using IEEE long format
17889 floating-point arithmetic.  The input operands are converted to
17890 floating-point, the operation is done in floating-point, and the result
17891 is converted to the target type.
17894 @itemize *
17896 @item 
17897 “Conditions on a `universal_real' operand of a fixed
17898 point multiplication or division for which the result shall be in the
17899 perfect result set.  See G.2.3(22).”
17900 @end itemize
17902 The result is only defined to be in the perfect result set if the result
17903 can be computed by a single scaling operation involving a scale factor
17904 representable in 64 bits.
17907 @itemize *
17909 @item 
17910 “The result of a fixed point arithmetic operation in
17911 overflow situations, when the @code{Machine_Overflows} attribute of the
17912 result type is @code{False}.  See G.2.3(27).”
17913 @end itemize
17915 Not relevant, @code{Machine_Overflows} is @code{True} for fixed-point
17916 types.
17919 @itemize *
17921 @item 
17922 “The result of an elementary function reference in
17923 overflow situations, when the @code{Machine_Overflows} attribute of the
17924 result type is @code{False}.  See G.2.4(4).”
17925 @end itemize
17927 IEEE infinite and Nan values are produced as appropriate.
17930 @itemize *
17932 @item 
17933 “The value of the angle threshold, within which certain
17934 elementary functions, complex arithmetic operations, and complex
17935 elementary functions yield results conforming to a maximum relative
17936 error bound.  See G.2.4(10).”
17937 @end itemize
17939 Information on this subject is not yet available.
17942 @itemize *
17944 @item 
17945 “The accuracy of certain elementary functions for
17946 parameters beyond the angle threshold.  See G.2.4(10).”
17947 @end itemize
17949 Information on this subject is not yet available.
17952 @itemize *
17954 @item 
17955 “The result of a complex arithmetic operation or complex
17956 elementary function reference in overflow situations, when the
17957 @code{Machine_Overflows} attribute of the corresponding real type is
17958 @code{False}.  See G.2.6(5).”
17959 @end itemize
17961 IEEE infinite and Nan values are produced as appropriate.
17964 @itemize *
17966 @item 
17967 “The accuracy of certain complex arithmetic operations and
17968 certain complex elementary functions for parameters (or components
17969 thereof) beyond the angle threshold.  See G.2.6(8).”
17970 @end itemize
17972 Information on those subjects is not yet available.
17975 @itemize *
17977 @item 
17978 “The accuracy requirements for the subprograms Solve, Inverse,
17979 Determinant, Eigenvalues and Eigensystem for type Real_Matrix.
17980 See G.3.1(81).”
17981 @end itemize
17983 Information on those subjects is not yet available.
17986 @itemize *
17988 @item 
17989 “The accuracy requirements for the subprograms Solve, Inverse,
17990 Determinant, Eigenvalues and Eigensystem for type Complex_Matrix.
17991 See G.3.2(149).”
17992 @end itemize
17994 Information on those subjects is not yet available.
17997 @itemize *
17999 @item 
18000 “The consequences of violating No_Hidden_Indirect_Globals.  See H.4(23.9).”
18001 @end itemize
18003 Execution is erroneous in that case.
18005 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
18006 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{263}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{264}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}
18007 @chapter Intrinsic Subprograms
18010 @geindex Intrinsic Subprograms
18012 GNAT allows a user application program to write the declaration:
18014 @example
18015 pragma Import (Intrinsic, name);
18016 @end example
18018 providing that the name corresponds to one of the implemented intrinsic
18019 subprograms in GNAT, and that the parameter profile of the referenced
18020 subprogram meets the requirements.  This chapter describes the set of
18021 implemented intrinsic subprograms, and the requirements on parameter profiles.
18022 Note that no body is supplied; as with other uses of pragma Import, the
18023 body is supplied elsewhere (in this case by the compiler itself).  Note
18024 that any use of this feature is potentially non-portable, since the
18025 Ada standard does not require Ada compilers to implement this feature.
18027 @menu
18028 * Intrinsic Operators:: 
18029 * Compilation_ISO_Date:: 
18030 * Compilation_Date:: 
18031 * Compilation_Time:: 
18032 * Enclosing_Entity:: 
18033 * Exception_Information:: 
18034 * Exception_Message:: 
18035 * Exception_Name:: 
18036 * File:: 
18037 * Line:: 
18038 * Shifts and Rotates:: 
18039 * Source_Location:: 
18041 @end menu
18043 @node Intrinsic Operators,Compilation_ISO_Date,,Intrinsic Subprograms
18044 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{265}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{266}
18045 @section Intrinsic Operators
18048 @geindex Intrinsic operator
18050 All the predefined numeric operators in package Standard
18051 in @code{pragma Import (Intrinsic,..)}
18052 declarations.  In the binary operator case, the operands must have the same
18053 size.  The operand or operands must also be appropriate for
18054 the operator.  For example, for addition, the operands must
18055 both be floating-point or both be fixed-point, and the
18056 right operand for @code{"**"} must have a root type of
18057 @code{Standard.Integer'Base}.
18058 You can use an intrinsic operator declaration as in the following example:
18060 @example
18061 type Int1 is new Integer;
18062 type Int2 is new Integer;
18064 function "+" (X1 : Int1; X2 : Int2) return Int1;
18065 function "+" (X1 : Int1; X2 : Int2) return Int2;
18066 pragma Import (Intrinsic, "+");
18067 @end example
18069 This declaration would permit ‘mixed mode’ arithmetic on items
18070 of the differing types @code{Int1} and @code{Int2}.
18071 It is also possible to specify such operators for private types, if the
18072 full views are appropriate arithmetic types.
18074 @node Compilation_ISO_Date,Compilation_Date,Intrinsic Operators,Intrinsic Subprograms
18075 @anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{267}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{268}
18076 @section Compilation_ISO_Date
18079 @geindex Compilation_ISO_Date
18081 This intrinsic subprogram is used in the implementation of the
18082 library package @code{GNAT.Source_Info}.  The only useful use of the
18083 intrinsic import in this case is the one in this unit, so an
18084 application program should simply call the function
18085 @code{GNAT.Source_Info.Compilation_ISO_Date} to obtain the date of
18086 the current compilation (in local time format YYYY-MM-DD).
18088 @node Compilation_Date,Compilation_Time,Compilation_ISO_Date,Intrinsic Subprograms
18089 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{269}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{26a}
18090 @section Compilation_Date
18093 @geindex Compilation_Date
18095 Same as Compilation_ISO_Date, except the string is in the form
18096 MMM DD YYYY.
18098 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
18099 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{26b}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{26c}
18100 @section Compilation_Time
18103 @geindex Compilation_Time
18105 This intrinsic subprogram is used in the implementation of the
18106 library package @code{GNAT.Source_Info}.  The only useful use of the
18107 intrinsic import in this case is the one in this unit, so an
18108 application program should simply call the function
18109 @code{GNAT.Source_Info.Compilation_Time} to obtain the time of
18110 the current compilation (in local time format HH:MM:SS).
18112 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
18113 @anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{26d}@anchor{gnat_rm/intrinsic_subprograms id6}@anchor{26e}
18114 @section Enclosing_Entity
18117 @geindex Enclosing_Entity
18119 This intrinsic subprogram is used in the implementation of the
18120 library package @code{GNAT.Source_Info}.  The only useful use of the
18121 intrinsic import in this case is the one in this unit, so an
18122 application program should simply call the function
18123 @code{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
18124 the current subprogram, package, task, entry, or protected subprogram.
18126 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
18127 @anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{26f}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{270}
18128 @section Exception_Information
18131 @geindex Exception_Information'
18133 This intrinsic subprogram is used in the implementation of the
18134 library package @code{GNAT.Current_Exception}.  The only useful
18135 use of the intrinsic import in this case is the one in this unit,
18136 so an application program should simply call the function
18137 @code{GNAT.Current_Exception.Exception_Information} to obtain
18138 the exception information associated with the current exception.
18140 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
18141 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{271}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{272}
18142 @section Exception_Message
18145 @geindex Exception_Message
18147 This intrinsic subprogram is used in the implementation of the
18148 library package @code{GNAT.Current_Exception}.  The only useful
18149 use of the intrinsic import in this case is the one in this unit,
18150 so an application program should simply call the function
18151 @code{GNAT.Current_Exception.Exception_Message} to obtain
18152 the message associated with the current exception.
18154 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
18155 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{273}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{274}
18156 @section Exception_Name
18159 @geindex Exception_Name
18161 This intrinsic subprogram is used in the implementation of the
18162 library package @code{GNAT.Current_Exception}.  The only useful
18163 use of the intrinsic import in this case is the one in this unit,
18164 so an application program should simply call the function
18165 @code{GNAT.Current_Exception.Exception_Name} to obtain
18166 the name of the current exception.
18168 @node File,Line,Exception_Name,Intrinsic Subprograms
18169 @anchor{gnat_rm/intrinsic_subprograms file}@anchor{275}@anchor{gnat_rm/intrinsic_subprograms id10}@anchor{276}
18170 @section File
18173 @geindex File
18175 This intrinsic subprogram is used in the implementation of the
18176 library package @code{GNAT.Source_Info}.  The only useful use of the
18177 intrinsic import in this case is the one in this unit, so an
18178 application program should simply call the function
18179 @code{GNAT.Source_Info.File} to obtain the name of the current
18180 file.
18182 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
18183 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{277}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{278}
18184 @section Line
18187 @geindex Line
18189 This intrinsic subprogram is used in the implementation of the
18190 library package @code{GNAT.Source_Info}.  The only useful use of the
18191 intrinsic import in this case is the one in this unit, so an
18192 application program should simply call the function
18193 @code{GNAT.Source_Info.Line} to obtain the number of the current
18194 source line.
18196 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
18197 @anchor{gnat_rm/intrinsic_subprograms id12}@anchor{279}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{27a}
18198 @section Shifts and Rotates
18201 @geindex Shift_Left
18203 @geindex Shift_Right
18205 @geindex Shift_Right_Arithmetic
18207 @geindex Rotate_Left
18209 @geindex Rotate_Right
18211 In standard Ada, the shift and rotate functions are available only
18212 for the predefined modular types in package @code{Interfaces}.  However, in
18213 GNAT it is possible to define these functions for any integer
18214 type (signed or modular), as in this example:
18216 @example
18217 function Shift_Left
18218   (Value  : T;
18219    Amount : Natural) return T
18220 with Import, Convention => Intrinsic;
18221 @end example
18223 The function name must be one of
18224 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
18225 Rotate_Right. T must be an integer type. T’Size must be
18226 8, 16, 32 or 64 bits; if T is modular, the modulus
18227 must be 2**8, 2**16, 2**32 or 2**64.
18228 The result type must be the same as the type of @code{Value}.
18229 The shift amount must be Natural.
18230 The formal parameter names can be anything.
18232 A more convenient way of providing these shift operators is to use the
18233 Provide_Shift_Operators pragma, which provides the function declarations and
18234 corresponding pragma Import’s for all five shift functions. For signed types
18235 the semantics of these operators is to interpret the bitwise result of the
18236 corresponding operator for modular type. In particular, shifting a negative
18237 number may change its sign bit to positive.
18239 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
18240 @anchor{gnat_rm/intrinsic_subprograms id13}@anchor{27b}@anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{27c}
18241 @section Source_Location
18244 @geindex Source_Location
18246 This intrinsic subprogram is used in the implementation of the
18247 library routine @code{GNAT.Source_Info}.  The only useful use of the
18248 intrinsic import in this case is the one in this unit, so an
18249 application program should simply call the function
18250 @code{GNAT.Source_Info.Source_Location} to obtain the current
18251 source file location.
18253 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
18254 @anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{27d}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{27e}@anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}
18255 @chapter Representation Clauses and Pragmas
18258 @geindex Representation Clauses
18260 @geindex Representation Clause
18262 @geindex Representation Pragma
18264 @geindex Pragma
18265 @geindex representation
18267 This section describes the representation clauses accepted by GNAT, and
18268 their effect on the representation of corresponding data objects.
18270 GNAT fully implements Annex C (Systems Programming).  This means that all
18271 the implementation advice sections in chapter 13 are fully implemented.
18272 However, these sections only require a minimal level of support for
18273 representation clauses.  GNAT provides much more extensive capabilities,
18274 and this section describes the additional capabilities provided.
18276 @menu
18277 * Alignment Clauses:: 
18278 * Size Clauses:: 
18279 * Storage_Size Clauses:: 
18280 * Size of Variant Record Objects:: 
18281 * Biased Representation:: 
18282 * Value_Size and Object_Size Clauses:: 
18283 * Component_Size Clauses:: 
18284 * Bit_Order Clauses:: 
18285 * Effect of Bit_Order on Byte Ordering:: 
18286 * Pragma Pack for Arrays:: 
18287 * Pragma Pack for Records:: 
18288 * Record Representation Clauses:: 
18289 * Handling of Records with Holes:: 
18290 * Enumeration Clauses:: 
18291 * Address Clauses:: 
18292 * Use of Address Clauses for Memory-Mapped I/O:: 
18293 * Effect of Convention on Representation:: 
18294 * Conventions and Anonymous Access Types:: 
18295 * Determining the Representations chosen by GNAT:: 
18297 @end menu
18299 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
18300 @anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{27f}@anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{280}
18301 @section Alignment Clauses
18304 @geindex Alignment Clause
18306 GNAT requires that all alignment clauses specify 0 or a power of 2, and
18307 all default alignments are always a power of 2. Specifying 0 is the
18308 same as specifying 1.
18310 The default alignment values are as follows:
18313 @itemize *
18315 @item 
18316 `Elementary Types'.
18318 For elementary types, the alignment is the minimum of the actual size of
18319 objects of the type divided by @code{Storage_Unit},
18320 and the maximum alignment supported by the target.
18321 (This maximum alignment is given by the GNAT-specific attribute
18322 @code{Standard'Maximum_Alignment}; see @ref{190,,Attribute Maximum_Alignment}.)
18324 @geindex Maximum_Alignment attribute
18326 For example, for type @code{Long_Float}, the object size is 8 bytes, and the
18327 default alignment will be 8 on any target that supports alignments
18328 this large, but on some targets, the maximum alignment may be smaller
18329 than 8, in which case objects of type @code{Long_Float} will be maximally
18330 aligned.
18332 @item 
18333 `Arrays'.
18335 For arrays, the alignment is equal to the alignment of the component type
18336 for the normal case where no packing or component size is given.  If the
18337 array is packed, and the packing is effective (see separate section on
18338 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
18339 arrays or arrays whose length is not known at compile time, depending on
18340 whether the component size is divisible by 4, 2, or is odd.  For short packed
18341 arrays, which are handled internally as modular types, the alignment
18342 will be as described for elementary types, e.g. a packed array of length
18343 31 bits will have an object size of four bytes, and an alignment of 4.
18345 @item 
18346 `Records'.
18348 For the normal unpacked case, the alignment of a record is equal to
18349 the maximum alignment of any of its components.  For tagged records, this
18350 includes the implicit access type used for the tag.  If a pragma @code{Pack}
18351 is used and all components are packable (see separate section on pragma
18352 @code{Pack}), then the resulting alignment is 1, unless the layout of the
18353 record makes it profitable to increase it.
18355 A special case is when:
18358 @itemize *
18360 @item 
18361 the size of the record is given explicitly, or a
18362 full record representation clause is given, and
18364 @item 
18365 the size of the record is 2, 4, or 8 bytes.
18366 @end itemize
18368 In this case, an alignment is chosen to match the
18369 size of the record. For example, if we have:
18371 @example
18372 type Small is record
18373    A, B : Character;
18374 end record;
18375 for Small'Size use 16;
18376 @end example
18378 then the default alignment of the record type @code{Small} is 2, not 1. This
18379 leads to more efficient code when the record is treated as a unit, and also
18380 allows the type to specified as @code{Atomic} on architectures requiring
18381 strict alignment.
18382 @end itemize
18384 An alignment clause may specify a larger alignment than the default value
18385 up to some maximum value dependent on the target (obtainable by using the
18386 attribute reference @code{Standard'Maximum_Alignment}). It may also specify
18387 a smaller alignment than the default value for enumeration, integer and
18388 fixed point types, as well as for record types, for example
18390 @example
18391 type V is record
18392    A : Integer;
18393 end record;
18395 for V'alignment use 1;
18396 @end example
18398 @geindex Alignment
18399 @geindex default
18401 The default alignment for the type @code{V} is 4, as a result of the
18402 Integer field in the record, but it is permissible, as shown, to
18403 override the default alignment of the record with a smaller value.
18405 @geindex Alignment
18406 @geindex subtypes
18408 Note that according to the Ada standard, an alignment clause applies only
18409 to the first named subtype. If additional subtypes are declared, then the
18410 compiler is allowed to choose any alignment it likes, and there is no way
18411 to control this choice. Consider:
18413 @example
18414 type R is range 1 .. 10_000;
18415 for R'Alignment use 1;
18416 subtype RS is R range 1 .. 1000;
18417 @end example
18419 The alignment clause specifies an alignment of 1 for the first named subtype
18420 @code{R} but this does not necessarily apply to @code{RS}. When writing
18421 portable Ada code, you should avoid writing code that explicitly or
18422 implicitly relies on the alignment of such subtypes.
18424 For the GNAT compiler, if an explicit alignment clause is given, this
18425 value is also used for any subsequent subtypes. So for GNAT, in the
18426 above example, you can count on the alignment of @code{RS} being 1. But this
18427 assumption is non-portable, and other compilers may choose different
18428 alignments for the subtype @code{RS}.
18430 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
18431 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{281}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{282}
18432 @section Size Clauses
18435 @geindex Size Clause
18437 The default size for a type @code{T} is obtainable through the
18438 language-defined attribute @code{T'Size} and also through the
18439 equivalent GNAT-defined attribute @code{T'Value_Size}.
18440 For objects of type @code{T}, GNAT will generally increase the type size
18441 so that the object size (obtainable through the GNAT-defined attribute
18442 @code{T'Object_Size})
18443 is a multiple of @code{T'Alignment * Storage_Unit}.
18445 For example:
18447 @example
18448 type Smallint is range 1 .. 6;
18450 type Rec is record
18451    Y1 : integer;
18452    Y2 : boolean;
18453 end record;
18454 @end example
18456 In this example, @code{Smallint'Size} = @code{Smallint'Value_Size} = 3,
18457 as specified by the RM rules,
18458 but objects of this type will have a size of 8
18459 (@code{Smallint'Object_Size} = 8),
18460 since objects by default occupy an integral number
18461 of storage units.  On some targets, notably older
18462 versions of the Digital Alpha, the size of stand
18463 alone objects of this type may be 32, reflecting
18464 the inability of the hardware to do byte load/stores.
18466 Similarly, the size of type @code{Rec} is 40 bits
18467 (@code{Rec'Size} = @code{Rec'Value_Size} = 40), but
18468 the alignment is 4, so objects of this type will have
18469 their size increased to 64 bits so that it is a multiple
18470 of the alignment (in bits).  This decision is
18471 in accordance with the specific Implementation Advice in RM 13.3(43):
18473 @quotation
18475 “A @code{Size} clause should be supported for an object if the specified
18476 @code{Size} is at least as large as its subtype’s @code{Size}, and corresponds
18477 to a size in storage elements that is a multiple of the object’s
18478 @code{Alignment} (if the @code{Alignment} is nonzero).”
18479 @end quotation
18481 An explicit size clause may be used to override the default size by
18482 increasing it.  For example, if we have:
18484 @example
18485 type My_Boolean is new Boolean;
18486 for My_Boolean'Size use 32;
18487 @end example
18489 then values of this type will always be 32-bit long.  In the case of discrete
18490 types, the size can be increased up to 64 bits on 32-bit targets and 128 bits
18491 on 64-bit targets, with the effect that the entire specified field is used to
18492 hold the value, sign- or zero-extended as appropriate.  If more than 64 bits
18493 or 128 bits resp. is specified, then padding space is allocated after the
18494 value, and a warning is issued that there are unused bits.
18496 Similarly the size of records and arrays may be increased, and the effect
18497 is to add padding bits after the value.  This also causes a warning message
18498 to be generated.
18500 The largest Size value permitted in GNAT is 2**31-1.  Since this is a
18501 Size in bits, this corresponds to an object of size 256 megabytes (minus
18502 one).  This limitation is true on all targets.  The reason for this
18503 limitation is that it improves the quality of the code in many cases
18504 if it is known that a Size value can be accommodated in an object of
18505 type Integer.
18507 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
18508 @anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{283}@anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{284}
18509 @section Storage_Size Clauses
18512 @geindex Storage_Size Clause
18514 For tasks, the @code{Storage_Size} clause specifies the amount of space
18515 to be allocated for the task stack.  This cannot be extended, and if the
18516 stack is exhausted, then @code{Storage_Error} will be raised (if stack
18517 checking is enabled).  Use a @code{Storage_Size} attribute definition clause,
18518 or a @code{Storage_Size} pragma in the task definition to set the
18519 appropriate required size.  A useful technique is to include in every
18520 task definition a pragma of the form:
18522 @example
18523 pragma Storage_Size (Default_Stack_Size);
18524 @end example
18526 Then @code{Default_Stack_Size} can be defined in a global package, and
18527 modified as required. Any tasks requiring stack sizes different from the
18528 default can have an appropriate alternative reference in the pragma.
18530 You can also use the `-d' binder switch to modify the default stack
18531 size.
18533 For access types, the @code{Storage_Size} clause specifies the maximum
18534 space available for allocation of objects of the type.  If this space is
18535 exceeded then @code{Storage_Error} will be raised by an allocation attempt.
18536 In the case where the access type is declared local to a subprogram, the
18537 use of a @code{Storage_Size} clause triggers automatic use of a special
18538 predefined storage pool (@code{System.Pool_Size}) that ensures that all
18539 space for the pool is automatically reclaimed on exit from the scope in
18540 which the type is declared.
18542 A special case recognized by the compiler is the specification of a
18543 @code{Storage_Size} of zero for an access type.  This means that no
18544 items can be allocated from the pool, and this is recognized at compile
18545 time, and all the overhead normally associated with maintaining a fixed
18546 size storage pool is eliminated.  Consider the following example:
18548 @example
18549 procedure p is
18550    type R is array (Natural) of Character;
18551    type P is access all R;
18552    for P'Storage_Size use 0;
18553    --  Above access type intended only for interfacing purposes
18555    y : P;
18557    procedure g (m : P);
18558    pragma Import (C, g);
18560    --  ...
18562 begin
18563    --  ...
18564    y := new R;
18565 end;
18566 @end example
18568 As indicated in this example, these dummy storage pools are often useful in
18569 connection with interfacing where no object will ever be allocated.  If you
18570 compile the above example, you get the warning:
18572 @example
18573 p.adb:16:09: warning: allocation from empty storage pool
18574 p.adb:16:09: warning: Storage_Error will be raised at run time
18575 @end example
18577 Of course in practice, there will not be any explicit allocators in the
18578 case of such an access declaration.
18580 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
18581 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{285}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{286}
18582 @section Size of Variant Record Objects
18585 @geindex Size
18586 @geindex variant record objects
18588 @geindex Variant record objects
18589 @geindex size
18591 In the case of variant record objects, there is a question whether Size gives
18592 information about a particular variant, or the maximum size required
18593 for any variant.  Consider the following program
18595 @example
18596 with Text_IO; use Text_IO;
18597 procedure q is
18598    type R1 (A : Boolean := False) is record
18599      case A is
18600        when True  => X : Character;
18601        when False => null;
18602      end case;
18603    end record;
18605    V1 : R1 (False);
18606    V2 : R1;
18608 begin
18609    Put_Line (Integer'Image (V1'Size));
18610    Put_Line (Integer'Image (V2'Size));
18611 end q;
18612 @end example
18614 Here we are dealing with a variant record, where the True variant
18615 requires 16 bits, and the False variant requires 8 bits.
18616 In the above example, both V1 and V2 contain the False variant,
18617 which is only 8 bits long.  However, the result of running the
18618 program is:
18620 @example
18623 @end example
18625 The reason for the difference here is that the discriminant value of
18626 V1 is fixed, and will always be False.  It is not possible to assign
18627 a True variant value to V1, therefore 8 bits is sufficient.  On the
18628 other hand, in the case of V2, the initial discriminant value is
18629 False (from the default), but it is possible to assign a True
18630 variant value to V2, therefore 16 bits must be allocated for V2
18631 in the general case, even fewer bits may be needed at any particular
18632 point during the program execution.
18634 As can be seen from the output of this program, the @code{'Size}
18635 attribute applied to such an object in GNAT gives the actual allocated
18636 size of the variable, which is the largest size of any of the variants.
18637 The Ada Reference Manual is not completely clear on what choice should
18638 be made here, but the GNAT behavior seems most consistent with the
18639 language in the RM.
18641 In some cases, it may be desirable to obtain the size of the current
18642 variant, rather than the size of the largest variant.  This can be
18643 achieved in GNAT by making use of the fact that in the case of a
18644 subprogram parameter, GNAT does indeed return the size of the current
18645 variant (because a subprogram has no way of knowing how much space
18646 is actually allocated for the actual).
18648 Consider the following modified version of the above program:
18650 @example
18651 with Text_IO; use Text_IO;
18652 procedure q is
18653    type R1 (A : Boolean := False) is record
18654      case A is
18655        when True  => X : Character;
18656        when False => null;
18657      end case;
18658    end record;
18660    V2 : R1;
18662    function Size (V : R1) return Integer is
18663    begin
18664       return V'Size;
18665    end Size;
18667 begin
18668    Put_Line (Integer'Image (V2'Size));
18669    Put_Line (Integer'Image (Size (V2)));
18670    V2 := (True, 'x');
18671    Put_Line (Integer'Image (V2'Size));
18672    Put_Line (Integer'Image (Size (V2)));
18673 end q;
18674 @end example
18676 The output from this program is
18678 @example
18683 @end example
18685 Here we see that while the @code{'Size} attribute always returns
18686 the maximum size, regardless of the current variant value, the
18687 @code{Size} function does indeed return the size of the current
18688 variant value.
18690 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18691 @anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{287}@anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{288}
18692 @section Biased Representation
18695 @geindex Size for biased representation
18697 @geindex Biased representation
18699 In the case of scalars with a range starting at other than zero, it is
18700 possible in some cases to specify a size smaller than the default minimum
18701 value, and in such cases, GNAT uses an unsigned biased representation,
18702 in which zero is used to represent the lower bound, and successive values
18703 represent successive values of the type.
18705 For example, suppose we have the declaration:
18707 @example
18708 type Small is range -7 .. -4;
18709 for Small'Size use 2;
18710 @end example
18712 Although the default size of type @code{Small} is 4, the @code{Size}
18713 clause is accepted by GNAT and results in the following representation
18714 scheme:
18716 @example
18717 -7 is represented as 2#00#
18718 -6 is represented as 2#01#
18719 -5 is represented as 2#10#
18720 -4 is represented as 2#11#
18721 @end example
18723 Biased representation is only used if the specified @code{Size} clause
18724 cannot be accepted in any other manner.  These reduced sizes that force
18725 biased representation can be used for all discrete types except for
18726 enumeration types for which a representation clause is given.
18728 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
18729 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{289}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{28a}
18730 @section Value_Size and Object_Size Clauses
18733 @geindex Value_Size
18735 @geindex Object_Size
18737 @geindex Size
18738 @geindex of objects
18740 In Ada 95 and Ada 2005, @code{T'Size} for a type @code{T} is the minimum
18741 number of bits required to hold values of type @code{T}.
18742 Although this interpretation was allowed in Ada 83, it was not required,
18743 and this requirement in practice can cause some significant difficulties.
18744 For example, in most Ada 83 compilers, @code{Natural'Size} was 32.
18745 However, in Ada 95 and Ada 2005,
18746 @code{Natural'Size} is
18747 typically 31.  This means that code may change in behavior when moving
18748 from Ada 83 to Ada 95 or Ada 2005.  For example, consider:
18750 @example
18751 type Rec is record
18752    A : Natural;
18753    B : Natural;
18754 end record;
18756 for Rec use record
18757    A at 0 range 0 .. Natural'Size - 1;
18758    B at 0 range Natural'Size .. 2 * Natural'Size - 1;
18759 end record;
18760 @end example
18762 In the above code, since the typical size of @code{Natural} objects
18763 is 32 bits and @code{Natural'Size} is 31, the above code can cause
18764 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
18765 there are cases where the fact that the object size can exceed the
18766 size of the type causes surprises.
18768 To help get around this problem GNAT provides two implementation
18769 defined attributes, @code{Value_Size} and @code{Object_Size}.  When
18770 applied to a type, these attributes yield the size of the type
18771 (corresponding to the RM defined size attribute), and the size of
18772 objects of the type respectively.
18774 The @code{Object_Size} is used for determining the default size of
18775 objects and components.  This size value can be referred to using the
18776 @code{Object_Size} attribute.  The phrase ‘is used’ here means that it is
18777 the basis of the determination of the size.  The backend is free to
18778 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
18779 character might be stored in 32 bits on a machine with no efficient
18780 byte access instructions such as the Alpha.
18782 The default rules for the value of @code{Object_Size} for
18783 discrete types are as follows:
18786 @itemize *
18788 @item 
18789 The @code{Object_Size} for base subtypes reflect the natural hardware
18790 size in bits (run the compiler with `-gnatS' to find those values
18791 for numeric types). Enumeration types and fixed-point base subtypes have
18792 8, 16, 32, or 64 bits for this size, depending on the range of values
18793 to be stored.
18795 @item 
18796 The @code{Object_Size} of a subtype is the same as the
18797 @code{Object_Size} of
18798 the type from which it is obtained.
18800 @item 
18801 The @code{Object_Size} of a derived base type is copied from the parent
18802 base type, and the @code{Object_Size} of a derived first subtype is copied
18803 from the parent first subtype.
18804 @end itemize
18806 The @code{Value_Size} attribute
18807 is the (minimum) number of bits required to store a value
18808 of the type.
18809 This value is used to determine how tightly to pack
18810 records or arrays with components of this type, and also affects
18811 the semantics of unchecked conversion (unchecked conversions where
18812 the @code{Value_Size} values differ generate a warning, and are potentially
18813 target dependent).
18815 The default rules for the value of @code{Value_Size} are as follows:
18818 @itemize *
18820 @item 
18821 The @code{Value_Size} for a base subtype is the minimum number of bits
18822 required to store all values of the type (including the sign bit
18823 only if negative values are possible).
18825 @item 
18826 If a subtype statically matches the first subtype of a given type, then it has
18827 by default the same @code{Value_Size} as the first subtype.  (This is a
18828 consequence of RM 13.1(14): “if two subtypes statically match,
18829 then their subtype-specific aspects are the same”.)
18831 @item 
18832 All other subtypes have a @code{Value_Size} corresponding to the minimum
18833 number of bits required to store all values of the subtype.  For
18834 dynamic bounds, it is assumed that the value can range down or up
18835 to the corresponding bound of the ancestor
18836 @end itemize
18838 The RM defined attribute @code{Size} corresponds to the
18839 @code{Value_Size} attribute.
18841 The @code{Size} attribute may be defined for a first-named subtype.  This sets
18842 the @code{Value_Size} of
18843 the first-named subtype to the given value, and the
18844 @code{Object_Size} of this first-named subtype to the given value padded up
18845 to an appropriate boundary.  It is a consequence of the default rules
18846 above that this @code{Object_Size} will apply to all further subtypes.  On the
18847 other hand, @code{Value_Size} is affected only for the first subtype, any
18848 dynamic subtypes obtained from it directly, and any statically matching
18849 subtypes.  The @code{Value_Size} of any other static subtypes is not affected.
18851 @code{Value_Size} and
18852 @code{Object_Size} may be explicitly set for any subtype using
18853 an attribute definition clause.  Note that the use of these attributes
18854 can cause the RM 13.1(14) rule to be violated.  If two access types
18855 reference aliased objects whose subtypes have differing @code{Object_Size}
18856 values as a result of explicit attribute definition clauses, then it
18857 is illegal to convert from one access subtype to the other. For a more
18858 complete description of this additional legality rule, see the
18859 description of the @code{Object_Size} attribute.
18861 To get a feel for the difference, consider the following examples (note
18862 that in each case the base is @code{Short_Short_Integer} with a size of 8):
18865 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} 
18866 @headitem
18868 Type or subtype declaration
18870 @tab
18872 Object_Size
18874 @tab
18876 Value_Size
18878 @item
18880 @code{type x1 is range 0 .. 5;}
18882 @tab
18886 @tab
18890 @item
18892 @code{type x2 is range 0 .. 5;}
18893 @code{for x2'size use 12;}
18895 @tab
18899 @tab
18903 @item
18905 @code{subtype x3 is x2 range 0 .. 3;}
18907 @tab
18911 @tab
18915 @item
18917 @code{subtype x4 is x2'base range 0 .. 10;}
18919 @tab
18923 @tab
18927 @item
18929 @code{dynamic : x2'Base range -64 .. +63;}
18931 @tab
18933 @tab
18935 @item
18937 @code{subtype x5 is x2 range 0 .. dynamic;}
18939 @tab
18943 @tab
18947 @item
18949 @code{subtype x6 is x2'base range 0 .. dynamic;}
18951 @tab
18955 @tab
18959 @end multitable
18962 Note: the entries marked ‘*’ are not actually specified by the Ada
18963 Reference Manual, which has nothing to say about size in the dynamic
18964 case. What GNAT does is to allocate sufficient bits to accommodate any
18965 possible dynamic values for the bounds at run-time.
18967 So far, so good, but GNAT has to obey the RM rules, so the question is
18968 under what conditions must the RM @code{Size} be used.
18969 The following is a list
18970 of the occasions on which the RM @code{Size} must be used:
18973 @itemize *
18975 @item 
18976 Component size for packed arrays or records
18978 @item 
18979 Value of the attribute @code{Size} for a type
18981 @item 
18982 Warning about sizes not matching for unchecked conversion
18983 @end itemize
18985 For record types, the @code{Object_Size} is always a multiple of the
18986 alignment of the type (this is true for all types). In some cases the
18987 @code{Value_Size} can be smaller. Consider:
18989 @example
18990 type R is record
18991   X : Integer;
18992   Y : Character;
18993 end record;
18994 @end example
18996 On a typical 32-bit architecture, the X component will occupy four bytes
18997 and the Y component will occupy one byte, for a total of 5 bytes. As a
18998 result @code{R'Value_Size} will be 40 (bits) since this is the minimum size
18999 required to store a value of this type. For example, it is permissible
19000 to have a component of type R in an array whose component size is
19001 specified to be 40 bits.
19003 However, @code{R'Object_Size} will be 64 (bits). The difference is due to
19004 the alignment requirement for objects of the record type. The X
19005 component will require four-byte alignment because that is what type
19006 Integer requires, whereas the Y component, a Character, will only
19007 require 1-byte alignment. Since the alignment required for X is the
19008 greatest of all the components’ alignments, that is the alignment
19009 required for the enclosing record type, i.e., 4 bytes or 32 bits. As
19010 indicated above, the actual object size must be rounded up so that it is
19011 a multiple of the alignment value. Therefore, 40 bits rounded up to the
19012 next multiple of 32 yields 64 bits.
19014 For all other types, the @code{Object_Size}
19015 and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}).
19016 Only @code{Size} may be specified for such types.
19018 Note that @code{Value_Size} can be used to force biased representation
19019 for a particular subtype. Consider this example:
19021 @example
19022 type R is (A, B, C, D, E, F);
19023 subtype RAB is R range A .. B;
19024 subtype REF is R range E .. F;
19025 @end example
19027 By default, @code{RAB}
19028 has a size of 1 (sufficient to accommodate the representation
19029 of @code{A} and @code{B}, 0 and 1), and @code{REF}
19030 has a size of 3 (sufficient to accommodate the representation
19031 of @code{E} and @code{F}, 4 and 5). But if we add the
19032 following @code{Value_Size} attribute definition clause:
19034 @example
19035 for REF'Value_Size use 1;
19036 @end example
19038 then biased representation is forced for @code{REF},
19039 and 0 will represent @code{E} and 1 will represent @code{F}.
19040 A warning is issued when a @code{Value_Size} attribute
19041 definition clause forces biased representation. This
19042 warning can be turned off using @code{-gnatw.B}.
19044 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
19045 @anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{28b}@anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{28c}
19046 @section Component_Size Clauses
19049 @geindex Component_Size Clause
19051 Normally, the value specified in a component size clause must be consistent
19052 with the subtype of the array component with regard to size and alignment.
19053 In other words, the value specified must be at least equal to the size
19054 of this subtype, and must be a multiple of the alignment value.
19056 In addition, component size clauses are allowed which cause the array
19057 to be packed, by specifying a smaller value.  A first case is for
19058 component size values in the range 1 through 63 on 32-bit targets,
19059 and 1 through 127 on 64-bit targets.  The value specified may not
19060 be smaller than the Size of the subtype.  GNAT will accurately
19061 honor all packing requests in this range.  For example, if we have:
19063 @example
19064 type r is array (1 .. 8) of Natural;
19065 for r'Component_Size use 31;
19066 @end example
19068 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
19069 Of course access to the components of such an array is considerably
19070 less efficient than if the natural component size of 32 is used.
19071 A second case is when the subtype of the component is a record type
19072 padded because of its default alignment.  For example, if we have:
19074 @example
19075 type r is record
19076   i : Integer;
19077   j : Integer;
19078   b : Boolean;
19079 end record;
19081 type a is array (1 .. 8) of r;
19082 for a'Component_Size use 72;
19083 @end example
19085 then the resulting array has a length of 72 bytes, instead of 96 bytes
19086 if the alignment of the record (4) was obeyed.
19088 Note that there is no point in giving both a component size clause
19089 and a pragma Pack for the same array type. if such duplicate
19090 clauses are given, the pragma Pack will be ignored.
19092 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
19093 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{28d}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{28e}
19094 @section Bit_Order Clauses
19097 @geindex Bit_Order Clause
19099 @geindex bit ordering
19101 @geindex ordering
19102 @geindex of bits
19104 For record subtypes, GNAT permits the specification of the @code{Bit_Order}
19105 attribute.  The specification may either correspond to the default bit
19106 order for the target, in which case the specification has no effect and
19107 places no additional restrictions, or it may be for the non-standard
19108 setting (that is the opposite of the default).
19110 In the case where the non-standard value is specified, the effect is
19111 to renumber bits within each byte, but the ordering of bytes is not
19112 affected.  There are certain
19113 restrictions placed on component clauses as follows:
19116 @itemize *
19118 @item 
19119 Components fitting within a single storage unit.
19121 These are unrestricted, and the effect is merely to renumber bits.  For
19122 example if we are on a little-endian machine with @code{Low_Order_First}
19123 being the default, then the following two declarations have exactly
19124 the same effect:
19126 @example
19127 type R1 is record
19128    A : Boolean;
19129    B : Integer range 1 .. 120;
19130 end record;
19132 for R1 use record
19133    A at 0 range 0 .. 0;
19134    B at 0 range 1 .. 7;
19135 end record;
19137 type R2 is record
19138    A : Boolean;
19139    B : Integer range 1 .. 120;
19140 end record;
19142 for R2'Bit_Order use High_Order_First;
19144 for R2 use record
19145    A at 0 range 7 .. 7;
19146    B at 0 range 0 .. 6;
19147 end record;
19148 @end example
19150 The useful application here is to write the second declaration with the
19151 @code{Bit_Order} attribute definition clause, and know that it will be treated
19152 the same, regardless of whether the target is little-endian or big-endian.
19154 @item 
19155 Components occupying an integral number of bytes.
19157 These are components that exactly fit in two or more bytes.  Such component
19158 declarations are allowed, but have no effect, since it is important to realize
19159 that the @code{Bit_Order} specification does not affect the ordering of bytes.
19160 In particular, the following attempt at getting an endian-independent integer
19161 does not work:
19163 @example
19164 type R2 is record
19165    A : Integer;
19166 end record;
19168 for R2'Bit_Order use High_Order_First;
19170 for R2 use record
19171    A at 0 range 0 .. 31;
19172 end record;
19173 @end example
19175 This declaration will result in a little-endian integer on a
19176 little-endian machine, and a big-endian integer on a big-endian machine.
19177 If byte flipping is required for interoperability between big- and
19178 little-endian machines, this must be explicitly programmed.  This capability
19179 is not provided by @code{Bit_Order}.
19181 @item 
19182 Components that are positioned across byte boundaries.
19184 but do not occupy an integral number of bytes.  Given that bytes are not
19185 reordered, such fields would occupy a non-contiguous sequence of bits
19186 in memory, requiring non-trivial code to reassemble.  They are for this
19187 reason not permitted, and any component clause specifying such a layout
19188 will be flagged as illegal by GNAT.
19189 @end itemize
19191 Since the misconception that Bit_Order automatically deals with all
19192 endian-related incompatibilities is a common one, the specification of
19193 a component field that is an integral number of bytes will always
19194 generate a warning.  This warning may be suppressed using @code{pragma Warnings (Off)}
19195 if desired.  The following section contains additional
19196 details regarding the issue of byte ordering.
19198 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
19199 @anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{28f}@anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{290}
19200 @section Effect of Bit_Order on Byte Ordering
19203 @geindex byte ordering
19205 @geindex ordering
19206 @geindex of bytes
19208 In this section we will review the effect of the @code{Bit_Order} attribute
19209 definition clause on byte ordering.  Briefly, it has no effect at all, but
19210 a detailed example will be helpful.  Before giving this
19211 example, let us review the precise
19212 definition of the effect of defining @code{Bit_Order}.  The effect of a
19213 non-standard bit order is described in section 13.5.3 of the Ada
19214 Reference Manual:
19216 @quotation
19218 “2   A bit ordering is a method of interpreting the meaning of
19219 the storage place attributes.”
19220 @end quotation
19222 To understand the precise definition of storage place attributes in
19223 this context, we visit section 13.5.1 of the manual:
19225 @quotation
19227 “13   A record_representation_clause (without the mod_clause)
19228 specifies the layout.  The storage place attributes (see 13.5.2)
19229 are taken from the values of the position, first_bit, and last_bit
19230 expressions after normalizing those values so that first_bit is
19231 less than Storage_Unit.”
19232 @end quotation
19234 The critical point here is that storage places are taken from
19235 the values after normalization, not before.  So the @code{Bit_Order}
19236 interpretation applies to normalized values.  The interpretation
19237 is described in the later part of the 13.5.3 paragraph:
19239 @quotation
19241 “2   A bit ordering is a method of interpreting the meaning of
19242 the storage place attributes.  High_Order_First (known in the
19243 vernacular as ‘big endian’) means that the first bit of a
19244 storage element (bit 0) is the most significant bit (interpreting
19245 the sequence of bits that represent a component as an unsigned
19246 integer value).  Low_Order_First (known in the vernacular as
19247 ‘little endian’) means the opposite: the first bit is the
19248 least significant.”
19249 @end quotation
19251 Note that the numbering is with respect to the bits of a storage
19252 unit.  In other words, the specification affects only the numbering
19253 of bits within a single storage unit.
19255 We can make the effect clearer by giving an example.
19257 Suppose that we have an external device which presents two bytes, the first
19258 byte presented, which is the first (low addressed byte) of the two byte
19259 record is called Master, and the second byte is called Slave.
19261 The left most (most significant) bit is called Control for each byte, and
19262 the remaining 7 bits are called V1, V2, … V7, where V7 is the rightmost
19263 (least significant) bit.
19265 On a big-endian machine, we can write the following representation clause
19267 @example
19268 type Data is record
19269    Master_Control : Bit;
19270    Master_V1      : Bit;
19271    Master_V2      : Bit;
19272    Master_V3      : Bit;
19273    Master_V4      : Bit;
19274    Master_V5      : Bit;
19275    Master_V6      : Bit;
19276    Master_V7      : Bit;
19277    Slave_Control  : Bit;
19278    Slave_V1       : Bit;
19279    Slave_V2       : Bit;
19280    Slave_V3       : Bit;
19281    Slave_V4       : Bit;
19282    Slave_V5       : Bit;
19283    Slave_V6       : Bit;
19284    Slave_V7       : Bit;
19285 end record;
19287 for Data use record
19288    Master_Control at 0 range 0 .. 0;
19289    Master_V1      at 0 range 1 .. 1;
19290    Master_V2      at 0 range 2 .. 2;
19291    Master_V3      at 0 range 3 .. 3;
19292    Master_V4      at 0 range 4 .. 4;
19293    Master_V5      at 0 range 5 .. 5;
19294    Master_V6      at 0 range 6 .. 6;
19295    Master_V7      at 0 range 7 .. 7;
19296    Slave_Control  at 1 range 0 .. 0;
19297    Slave_V1       at 1 range 1 .. 1;
19298    Slave_V2       at 1 range 2 .. 2;
19299    Slave_V3       at 1 range 3 .. 3;
19300    Slave_V4       at 1 range 4 .. 4;
19301    Slave_V5       at 1 range 5 .. 5;
19302    Slave_V6       at 1 range 6 .. 6;
19303    Slave_V7       at 1 range 7 .. 7;
19304 end record;
19305 @end example
19307 Now if we move this to a little endian machine, then the bit ordering within
19308 the byte is backwards, so we have to rewrite the record rep clause as:
19310 @example
19311 for Data use record
19312    Master_Control at 0 range 7 .. 7;
19313    Master_V1      at 0 range 6 .. 6;
19314    Master_V2      at 0 range 5 .. 5;
19315    Master_V3      at 0 range 4 .. 4;
19316    Master_V4      at 0 range 3 .. 3;
19317    Master_V5      at 0 range 2 .. 2;
19318    Master_V6      at 0 range 1 .. 1;
19319    Master_V7      at 0 range 0 .. 0;
19320    Slave_Control  at 1 range 7 .. 7;
19321    Slave_V1       at 1 range 6 .. 6;
19322    Slave_V2       at 1 range 5 .. 5;
19323    Slave_V3       at 1 range 4 .. 4;
19324    Slave_V4       at 1 range 3 .. 3;
19325    Slave_V5       at 1 range 2 .. 2;
19326    Slave_V6       at 1 range 1 .. 1;
19327    Slave_V7       at 1 range 0 .. 0;
19328 end record;
19329 @end example
19331 It is a nuisance to have to rewrite the clause, especially if
19332 the code has to be maintained on both machines.  However,
19333 this is a case that we can handle with the
19334 @code{Bit_Order} attribute if it is implemented.
19335 Note that the implementation is not required on byte addressed
19336 machines, but it is indeed implemented in GNAT.
19337 This means that we can simply use the
19338 first record clause, together with the declaration
19340 @example
19341 for Data'Bit_Order use High_Order_First;
19342 @end example
19344 and the effect is what is desired, namely the layout is exactly the same,
19345 independent of whether the code is compiled on a big-endian or little-endian
19346 machine.
19348 The important point to understand is that byte ordering is not affected.
19349 A @code{Bit_Order} attribute definition never affects which byte a field
19350 ends up in, only where it ends up in that byte.
19351 To make this clear, let us rewrite the record rep clause of the previous
19352 example as:
19354 @example
19355 for Data'Bit_Order use High_Order_First;
19356 for Data use record
19357    Master_Control at 0 range  0 .. 0;
19358    Master_V1      at 0 range  1 .. 1;
19359    Master_V2      at 0 range  2 .. 2;
19360    Master_V3      at 0 range  3 .. 3;
19361    Master_V4      at 0 range  4 .. 4;
19362    Master_V5      at 0 range  5 .. 5;
19363    Master_V6      at 0 range  6 .. 6;
19364    Master_V7      at 0 range  7 .. 7;
19365    Slave_Control  at 0 range  8 .. 8;
19366    Slave_V1       at 0 range  9 .. 9;
19367    Slave_V2       at 0 range 10 .. 10;
19368    Slave_V3       at 0 range 11 .. 11;
19369    Slave_V4       at 0 range 12 .. 12;
19370    Slave_V5       at 0 range 13 .. 13;
19371    Slave_V6       at 0 range 14 .. 14;
19372    Slave_V7       at 0 range 15 .. 15;
19373 end record;
19374 @end example
19376 This is exactly equivalent to saying (a repeat of the first example):
19378 @example
19379 for Data'Bit_Order use High_Order_First;
19380 for Data use record
19381    Master_Control at 0 range 0 .. 0;
19382    Master_V1      at 0 range 1 .. 1;
19383    Master_V2      at 0 range 2 .. 2;
19384    Master_V3      at 0 range 3 .. 3;
19385    Master_V4      at 0 range 4 .. 4;
19386    Master_V5      at 0 range 5 .. 5;
19387    Master_V6      at 0 range 6 .. 6;
19388    Master_V7      at 0 range 7 .. 7;
19389    Slave_Control  at 1 range 0 .. 0;
19390    Slave_V1       at 1 range 1 .. 1;
19391    Slave_V2       at 1 range 2 .. 2;
19392    Slave_V3       at 1 range 3 .. 3;
19393    Slave_V4       at 1 range 4 .. 4;
19394    Slave_V5       at 1 range 5 .. 5;
19395    Slave_V6       at 1 range 6 .. 6;
19396    Slave_V7       at 1 range 7 .. 7;
19397 end record;
19398 @end example
19400 Why are they equivalent? Well take a specific field, the @code{Slave_V2}
19401 field.  The storage place attributes are obtained by normalizing the
19402 values given so that the @code{First_Bit} value is less than 8.  After
19403 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
19404 we specified in the other case.
19406 Now one might expect that the @code{Bit_Order} attribute might affect
19407 bit numbering within the entire record component (two bytes in this
19408 case, thus affecting which byte fields end up in), but that is not
19409 the way this feature is defined, it only affects numbering of bits,
19410 not which byte they end up in.
19412 Consequently it never makes sense to specify a starting bit number
19413 greater than 7 (for a byte addressable field) if an attribute
19414 definition for @code{Bit_Order} has been given, and indeed it
19415 may be actively confusing to specify such a value, so the compiler
19416 generates a warning for such usage.
19418 If you do need to control byte ordering then appropriate conditional
19419 values must be used.  If in our example, the slave byte came first on
19420 some machines we might write:
19422 @example
19423 Master_Byte_First constant Boolean := ...;
19425 Master_Byte : constant Natural :=
19426                 1 - Boolean'Pos (Master_Byte_First);
19427 Slave_Byte  : constant Natural :=
19428                 Boolean'Pos (Master_Byte_First);
19430 for Data'Bit_Order use High_Order_First;
19431 for Data use record
19432    Master_Control at Master_Byte range 0 .. 0;
19433    Master_V1      at Master_Byte range 1 .. 1;
19434    Master_V2      at Master_Byte range 2 .. 2;
19435    Master_V3      at Master_Byte range 3 .. 3;
19436    Master_V4      at Master_Byte range 4 .. 4;
19437    Master_V5      at Master_Byte range 5 .. 5;
19438    Master_V6      at Master_Byte range 6 .. 6;
19439    Master_V7      at Master_Byte range 7 .. 7;
19440    Slave_Control  at Slave_Byte  range 0 .. 0;
19441    Slave_V1       at Slave_Byte  range 1 .. 1;
19442    Slave_V2       at Slave_Byte  range 2 .. 2;
19443    Slave_V3       at Slave_Byte  range 3 .. 3;
19444    Slave_V4       at Slave_Byte  range 4 .. 4;
19445    Slave_V5       at Slave_Byte  range 5 .. 5;
19446    Slave_V6       at Slave_Byte  range 6 .. 6;
19447    Slave_V7       at Slave_Byte  range 7 .. 7;
19448 end record;
19449 @end example
19451 Now to switch between machines, all that is necessary is
19452 to set the boolean constant @code{Master_Byte_First} in
19453 an appropriate manner.
19455 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
19456 @anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{291}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{292}
19457 @section Pragma Pack for Arrays
19460 @geindex Pragma Pack (for arrays)
19462 Pragma @code{Pack} applied to an array has an effect that depends upon whether the
19463 component type is `packable'.  For a component type to be `packable', it must
19464 be one of the following cases:
19467 @itemize *
19469 @item 
19470 Any elementary type.
19472 @item 
19473 Any small packed array type with a static size.
19475 @item 
19476 Any small simple record type with a static size.
19477 @end itemize
19479 For all these cases, if the component subtype size is in the range
19480 1 through 63 on 32-bit targets, and 1 through 127 on 64-bit targets,
19481 then the effect of the pragma @code{Pack} is exactly as though a
19482 component size were specified giving the component subtype size.
19484 All other types are non-packable, they occupy an integral number of storage
19485 units and the only effect of pragma Pack is to remove alignment gaps.
19487 For example if we have:
19489 @example
19490 type r is range 0 .. 17;
19492 type ar is array (1 .. 8) of r;
19493 pragma Pack (ar);
19494 @end example
19496 Then the component size of @code{ar} will be set to 5 (i.e., to @code{r'size},
19497 and the size of the array @code{ar} will be exactly 40 bits).
19499 Note that in some cases this rather fierce approach to packing can produce
19500 unexpected effects.  For example, in Ada 95 and Ada 2005,
19501 subtype @code{Natural} typically has a size of 31, meaning that if you
19502 pack an array of @code{Natural}, you get 31-bit
19503 close packing, which saves a few bits, but results in far less efficient
19504 access.  Since many other Ada compilers will ignore such a packing request,
19505 GNAT will generate a warning on some uses of pragma @code{Pack} that it guesses
19506 might not be what is intended.  You can easily remove this warning by
19507 using an explicit @code{Component_Size} setting instead, which never generates
19508 a warning, since the intention of the programmer is clear in this case.
19510 GNAT treats packed arrays in one of two ways.  If the size of the array is
19511 known at compile time and is at most 64 bits on 32-bit targets, and at most
19512 128 bits on 64-bit targets, then internally the array is represented as a
19513 single modular type, of exactly the appropriate number of bits.  If the
19514 length is greater than 64 bits on 32-bit targets, and greater than 128
19515 bits on 64-bit targets, or is not known at compile time, then the packed
19516 array is represented as an array of bytes, and its length is always a
19517 multiple of 8 bits.
19519 Note that to represent a packed array as a modular type, the alignment must
19520 be suitable for the modular type involved. For example, on typical machines
19521 a 32-bit packed array will be represented by a 32-bit modular integer with
19522 an alignment of four bytes. If you explicitly override the default alignment
19523 with an alignment clause that is too small, the modular representation
19524 cannot be used. For example, consider the following set of declarations:
19526 @example
19527 type R is range 1 .. 3;
19528 type S is array (1 .. 31) of R;
19529 for S'Component_Size use 2;
19530 for S'Size use 62;
19531 for S'Alignment use 1;
19532 @end example
19534 If the alignment clause were not present, then a 62-bit modular
19535 representation would be chosen (typically with an alignment of 4 or 8
19536 bytes depending on the target). But the default alignment is overridden
19537 with the explicit alignment clause. This means that the modular
19538 representation cannot be used, and instead the array of bytes
19539 representation must be used, meaning that the length must be a multiple
19540 of 8. Thus the above set of declarations will result in a diagnostic
19541 rejecting the size clause and noting that the minimum size allowed is 64.
19543 @geindex Pragma Pack (for type Natural)
19545 @geindex Pragma Pack warning
19547 One special case that is worth noting occurs when the base type of the
19548 component size is 8/16/32 and the subtype is one bit less. Notably this
19549 occurs with subtype @code{Natural}. Consider:
19551 @example
19552 type Arr is array (1 .. 32) of Natural;
19553 pragma Pack (Arr);
19554 @end example
19556 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
19557 since typically @code{Natural'Size} is 32 in Ada 83, and in any case most
19558 Ada 83 compilers did not attempt 31 bit packing.
19560 In Ada 95 and Ada 2005, @code{Natural'Size} is required to be 31. Furthermore,
19561 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
19562 substantial unintended performance penalty when porting legacy Ada 83 code.
19563 To help prevent this, GNAT generates a warning in such cases. If you really
19564 want 31 bit packing in a case like this, you can set the component size
19565 explicitly:
19567 @example
19568 type Arr is array (1 .. 32) of Natural;
19569 for Arr'Component_Size use 31;
19570 @end example
19572 Here 31-bit packing is achieved as required, and no warning is generated,
19573 since in this case the programmer intention is clear.
19575 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
19576 @anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{293}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{294}
19577 @section Pragma Pack for Records
19580 @geindex Pragma Pack (for records)
19582 Pragma @code{Pack} applied to a record will pack the components to reduce
19583 wasted space from alignment gaps and by reducing the amount of space
19584 taken by components.  We distinguish between `packable' components and
19585 `non-packable' components.
19586 Components of the following types are considered packable:
19589 @itemize *
19591 @item 
19592 Components of an elementary type are packable unless they are aliased,
19593 independent or atomic.
19595 @item 
19596 Small packed arrays, where the size is statically known, are represented
19597 internally as modular integers, and so they are also packable.
19599 @item 
19600 Small simple records, where the size is statically known, are also packable.
19601 @end itemize
19603 For all these cases, if the @code{'Size} value is in the range 1 through 64 on
19604 32-bit targets, and 1 through 128 on 64-bit targets, the components occupy
19605 the exact number of bits corresponding to this value and are packed with no
19606 padding bits, i.e. they can start on an arbitrary bit boundary.
19608 All other types are non-packable, they occupy an integral number of storage
19609 units and the only effect of pragma @code{Pack} is to remove alignment gaps.
19611 For example, consider the record
19613 @example
19614 type Rb1 is array (1 .. 13) of Boolean;
19615 pragma Pack (Rb1);
19617 type Rb2 is array (1 .. 65) of Boolean;
19618 pragma Pack (Rb2);
19620 type AF is new Float with Atomic;
19622 type X2 is record
19623    L1 : Boolean;
19624    L2 : Duration;
19625    L3 : AF;
19626    L4 : Boolean;
19627    L5 : Rb1;
19628    L6 : Rb2;
19629 end record;
19630 pragma Pack (X2);
19631 @end example
19633 The representation for the record @code{X2} is as follows on 32-bit targets:
19635 @example
19636 for X2'Size use 224;
19637 for X2 use record
19638    L1 at  0 range  0 .. 0;
19639    L2 at  0 range  1 .. 64;
19640    L3 at 12 range  0 .. 31;
19641    L4 at 16 range  0 .. 0;
19642    L5 at 16 range  1 .. 13;
19643    L6 at 18 range  0 .. 71;
19644 end record;
19645 @end example
19647 Studying this example, we see that the packable fields @code{L1}
19648 and @code{L2} are of length equal to their sizes, and placed at
19649 specific bit boundaries (and not byte boundaries) to eliminate
19650 padding.  But @code{L3} is of a non-packable float type (because
19651 it is aliased), so it is on the next appropriate alignment boundary.
19653 The next two fields are fully packable, so @code{L4} and @code{L5} are
19654 minimally packed with no gaps.  However, type @code{Rb2} is a packed
19655 array that is longer than 64 bits, so it is itself non-packable on
19656 32-bit targets.  Thus the @code{L6} field is aligned to the next byte
19657 boundary, and takes an integral number of bytes, i.e., 72 bits.
19659 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19660 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{295}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{296}
19661 @section Record Representation Clauses
19664 @geindex Record Representation Clause
19666 Record representation clauses may be given for all record types, including
19667 types obtained by record extension.  Component clauses are allowed for any
19668 static component.  The restrictions on component clauses depend on the type
19669 of the component.
19671 @geindex Component Clause
19673 For all components of an elementary type, the only restriction on component
19674 clauses is that the size must be at least the @code{'Size} value of the type
19675 (actually the Value_Size).  There are no restrictions due to alignment,
19676 and such components may freely cross storage boundaries.
19678 Packed arrays with a size up to and including 64 bits on 32-bit targets,
19679 and up to and including 128 bits on 64-bit targets, are represented
19680 internally using a modular type with the appropriate number of bits, and
19681 thus the same lack of restriction applies.  For example, if you declare:
19683 @example
19684 type R is array (1 .. 49) of Boolean;
19685 pragma Pack (R);
19686 for R'Size use 49;
19687 @end example
19689 then a component clause for a component of type @code{R} may start on any
19690 specified bit boundary, and may specify a value of 49 bits or greater.
19692 For packed bit arrays that are longer than 64 bits on 32-bit targets,
19693 and longer than 128 bits on 64-bit targets, there are two cases. If the
19694 component size is a power of 2 (1,2,4,8,16,32,64 bits), including the
19695 important case of single bits or boolean values, then there are no
19696 limitations on placement of such components, and they may start and
19697 end at arbitrary bit boundaries.
19699 If the component size is not a power of 2 (e.g., 3 or 5), then an array
19700 of this type must always be placed on on a storage unit (byte) boundary
19701 and occupy an integral number of storage units (bytes). Any component
19702 clause that does not meet this requirement will be rejected.
19704 Any aliased component, or component of an aliased type, must have its
19705 normal alignment and size. A component clause that does not meet this
19706 requirement will be rejected.
19708 The tag field of a tagged type always occupies an address sized field at
19709 the start of the record.  No component clause may attempt to overlay this
19710 tag. When a tagged type appears as a component, the tag field must have
19711 proper alignment
19713 In the case of a record extension @code{T1}, of a type @code{T}, no component
19714 clause applied to the type @code{T1} can specify a storage location that
19715 would overlap the first @code{T'Object_Size} bits of the record.
19717 For all other component types, including non-bit-packed arrays,
19718 the component can be placed at an arbitrary bit boundary,
19719 so for example, the following is permitted:
19721 @example
19722 type R is array (1 .. 10) of Boolean;
19723 for R'Size use 80;
19725 type Q is record
19726    G, H : Boolean;
19727    L, M : R;
19728 end record;
19730 for Q use record
19731    G at 0 range  0 ..   0;
19732    H at 0 range  1 ..   1;
19733    L at 0 range  2 ..  81;
19734    R at 0 range 82 .. 161;
19735 end record;
19736 @end example
19738 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
19739 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{297}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{298}
19740 @section Handling of Records with Holes
19743 @geindex Handling of Records with Holes
19745 As a result of alignment considerations, records may contain “holes”
19746 or gaps which do not correspond to the data bits of any of the components.
19747 Record representation clauses can also result in holes in records.
19749 GNAT does not attempt to clear these holes, so in record objects,
19750 they should be considered to hold undefined rubbish. The generated
19751 equality routine just tests components so does not access these
19752 undefined bits, and assignment and copy operations may or may not
19753 preserve the contents of these holes (for assignments, the holes
19754 in the target will in practice contain either the bits that are
19755 present in the holes in the source, or the bits that were present
19756 in the target before the assignment).
19758 If it is necessary to ensure that holes in records have all zero
19759 bits, then record objects for which this initialization is desired
19760 should be explicitly set to all zero values using Unchecked_Conversion
19761 or address overlays. For example
19763 @example
19764 type HRec is record
19765    C : Character;
19766    I : Integer;
19767 end record;
19768 @end example
19770 On typical machines, integers need to be aligned on a four-byte
19771 boundary, resulting in three bytes of undefined rubbish following
19772 the 8-bit field for C. To ensure that the hole in a variable of
19773 type HRec is set to all zero bits,
19774 you could for example do:
19776 @example
19777 type Base is record
19778    Dummy1, Dummy2 : Integer := 0;
19779 end record;
19781 BaseVar : Base;
19782 RealVar : Hrec;
19783 for RealVar'Address use BaseVar'Address;
19784 @end example
19786 Now the 8-bytes of the value of RealVar start out containing all zero
19787 bits. A safer approach is to just define dummy fields, avoiding the
19788 holes, as in:
19790 @example
19791 type HRec is record
19792    C      : Character;
19793    Dummy1 : Short_Short_Integer := 0;
19794    Dummy2 : Short_Short_Integer := 0;
19795    Dummy3 : Short_Short_Integer := 0;
19796    I      : Integer;
19797 end record;
19798 @end example
19800 And to make absolutely sure that the intent of this is followed, you
19801 can use representation clauses:
19803 @example
19804 for Hrec use record
19805    C      at 0 range 0 .. 7;
19806    Dummy1 at 1 range 0 .. 7;
19807    Dummy2 at 2 range 0 .. 7;
19808    Dummy3 at 3 range 0 .. 7;
19809    I      at 4 range 0 .. 31;
19810 end record;
19811 for Hrec'Size use 64;
19812 @end example
19814 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
19815 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{299}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{29a}
19816 @section Enumeration Clauses
19819 The only restriction on enumeration clauses is that the range of values
19820 must be representable.  For the signed case, if one or more of the
19821 representation values are negative, all values must be in the range:
19823 @example
19824 System.Min_Int .. System.Max_Int
19825 @end example
19827 For the unsigned case, where all values are nonnegative, the values must
19828 be in the range:
19830 @example
19831 0 .. System.Max_Binary_Modulus;
19832 @end example
19834 A `confirming' representation clause is one in which the values range
19835 from 0 in sequence, i.e., a clause that confirms the default representation
19836 for an enumeration type.
19837 Such a confirming representation
19838 is permitted by these rules, and is specially recognized by the compiler so
19839 that no extra overhead results from the use of such a clause.
19841 If an array has an index type which is an enumeration type to which an
19842 enumeration clause has been applied, then the array is stored in a compact
19843 manner.  Consider the declarations:
19845 @example
19846 type r is (A, B, C);
19847 for r use (A => 1, B => 5, C => 10);
19848 type t is array (r) of Character;
19849 @end example
19851 The array type t corresponds to a vector with exactly three elements and
19852 has a default size equal to @code{3*Character'Size}.  This ensures efficient
19853 use of space, but means that accesses to elements of the array will incur
19854 the overhead of converting representation values to the corresponding
19855 positional values, (i.e., the value delivered by the @code{Pos} attribute).
19857 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
19858 @anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{29b}@anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{29c}
19859 @section Address Clauses
19862 @geindex Address Clause
19864 The reference manual allows a general restriction on representation clauses,
19865 as found in RM 13.1(22):
19867 @quotation
19869 “An implementation need not support representation
19870 items containing nonstatic expressions, except that
19871 an implementation should support a representation item
19872 for a given entity if each nonstatic expression in the
19873 representation item is a name that statically denotes
19874 a constant declared before the entity.”
19875 @end quotation
19877 In practice this is applicable only to address clauses, since this is the
19878 only case in which a nonstatic expression is permitted by the syntax.  As
19879 the AARM notes in sections 13.1 (22.a-22.h):
19881 @quotation
19883 22.a   Reason: This is to avoid the following sort of thing:
19885 22.b        X : Integer := F(…);
19886 Y : Address := G(…);
19887 for X’Address use Y;
19889 22.c   In the above, we have to evaluate the
19890 initialization expression for X before we
19891 know where to put the result.  This seems
19892 like an unreasonable implementation burden.
19894 22.d   The above code should instead be written
19895 like this:
19897 22.e        Y : constant Address := G(…);
19898 X : Integer := F(…);
19899 for X’Address use Y;
19901 22.f   This allows the expression ‘Y’ to be safely
19902 evaluated before X is created.
19904 22.g   The constant could be a formal parameter of mode in.
19906 22.h   An implementation can support other nonstatic
19907 expressions if it wants to.  Expressions of type
19908 Address are hardly ever static, but their value
19909 might be known at compile time anyway in many
19910 cases.
19911 @end quotation
19913 GNAT does indeed permit many additional cases of nonstatic expressions.  In
19914 particular, if the type involved is elementary there are no restrictions
19915 (since in this case, holding a temporary copy of the initialization value,
19916 if one is present, is inexpensive).  In addition, if there is no implicit or
19917 explicit initialization, then there are no restrictions.  GNAT will reject
19918 only the case where all three of these conditions hold:
19921 @itemize *
19923 @item 
19924 The type of the item is non-elementary (e.g., a record or array).
19926 @item 
19927 There is explicit or implicit initialization required for the object.
19928 Note that access values are always implicitly initialized.
19930 @item 
19931 The address value is nonstatic.  Here GNAT is more permissive than the
19932 RM, and allows the address value to be the address of a previously declared
19933 stand-alone variable, as long as it does not itself have an address clause.
19935 @example
19936 Anchor  : Some_Initialized_Type;
19937 Overlay : Some_Initialized_Type;
19938 for Overlay'Address use Anchor'Address;
19939 @end example
19941 However, the prefix of the address clause cannot be an array component, or
19942 a component of a discriminated record.
19943 @end itemize
19945 As noted above in section 22.h, address values are typically nonstatic.  In
19946 particular the To_Address function, even if applied to a literal value, is
19947 a nonstatic function call.  To avoid this minor annoyance, GNAT provides
19948 the implementation defined attribute ‘To_Address.  The following two
19949 expressions have identical values:
19951 @geindex Attribute
19953 @geindex To_Address
19955 @example
19956 To_Address (16#1234_0000#)
19957 System'To_Address (16#1234_0000#);
19958 @end example
19960 except that the second form is considered to be a static expression, and
19961 thus when used as an address clause value is always permitted.
19963 Additionally, GNAT treats as static an address clause that is an
19964 unchecked_conversion of a static integer value.  This simplifies the porting
19965 of legacy code, and provides a portable equivalent to the GNAT attribute
19966 @code{To_Address}.
19968 Another issue with address clauses is the interaction with alignment
19969 requirements.  When an address clause is given for an object, the address
19970 value must be consistent with the alignment of the object (which is usually
19971 the same as the alignment of the type of the object).  If an address clause
19972 is given that specifies an inappropriately aligned address value, then the
19973 program execution is erroneous.
19975 Since this source of erroneous behavior can have unfortunate effects on
19976 machines with strict alignment requirements, GNAT
19977 checks (at compile time if possible, generating a warning, or at execution
19978 time with a run-time check) that the alignment is appropriate.  If the
19979 run-time check fails, then @code{Program_Error} is raised.  This run-time
19980 check is suppressed if range checks are suppressed, or if the special GNAT
19981 check Alignment_Check is suppressed, or if
19982 @code{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
19983 suppressed by default on non-strict alignment machines (such as the x86).
19985 In some cases, GNAT does not support an address specification (using either
19986 form of aspect specification syntax) for the declaration of an object that has
19987 an indefinite nominal subtype. An object declaration has an indefinite
19988 nominal subtype if it takes its bounds (for an array type), discriminant
19989 values (for a discriminated type whose discriminants lack defaults), or tag
19990 (for a class-wide type) from its initial value, as in
19992 @example
19993 X : String := Some_Function_Call;
19994 -- String has no constraint, so bounds for X come from function call
19995 @end example
19997 This restriction does not apply if the size of the object’s initial value is
19998 known at compile time and the type of the object is not class-wide.
20000 @geindex Export
20002 An address clause cannot be given for an exported object.  More
20003 understandably the real restriction is that objects with an address
20004 clause cannot be exported.  This is because such variables are not
20005 defined by the Ada program, so there is no external object to export.
20007 @geindex Import
20009 It is permissible to give an address clause and a pragma Import for the
20010 same object.  In this case, the variable is not really defined by the
20011 Ada program, so there is no external symbol to be linked.  The link name
20012 and the external name are ignored in this case.  The reason that we allow this
20013 combination is that it provides a useful idiom to avoid unwanted
20014 initializations on objects with address clauses.
20016 When an address clause is given for an object that has implicit or
20017 explicit initialization, then by default initialization takes place.  This
20018 means that the effect of the object declaration is to overwrite the
20019 memory at the specified address.  This is almost always not what the
20020 programmer wants, so GNAT will output a warning:
20022 @example
20023 with System;
20024 package G is
20025    type R is record
20026       M : Integer := 0;
20027    end record;
20029    Ext : R;
20030    for Ext'Address use System'To_Address (16#1234_1234#);
20031        |
20032 >>> warning: implicit initialization of "Ext" may
20033     modify overlaid storage
20034 >>> warning: use pragma Import for "Ext" to suppress
20035     initialization (RM B(24))
20037 end G;
20038 @end example
20040 As indicated by the warning message, the solution is to use a (dummy) pragma
20041 Import to suppress this initialization.  The pragma tell the compiler that the
20042 object is declared and initialized elsewhere.  The following package compiles
20043 without warnings (and the initialization is suppressed):
20045 @example
20046 with System;
20047 package G is
20048    type R is record
20049       M : Integer := 0;
20050    end record;
20052    Ext : R;
20053    for Ext'Address use System'To_Address (16#1234_1234#);
20054    pragma Import (Ada, Ext);
20055 end G;
20056 @end example
20058 A final issue with address clauses involves their use for overlaying
20059 variables, as in the following example:
20061 @geindex Overlaying of objects
20063 @example
20064 A : Integer;
20065 B : Integer;
20066 for B'Address use A'Address;
20067 @end example
20069 or alternatively, using the form recommended by the RM:
20071 @example
20072 A    : Integer;
20073 Addr : constant Address := A'Address;
20074 B    : Integer;
20075 for B'Address use Addr;
20076 @end example
20078 In both of these cases, @code{A} and @code{B} become aliased to one another
20079 via the address clause. This use of address clauses to overlay
20080 variables, achieving an effect similar to unchecked conversion
20081 was erroneous in Ada 83, but in Ada 95 and Ada 2005
20082 the effect is implementation defined. Furthermore, the
20083 Ada RM specifically recommends that in a situation
20084 like this, @code{B} should be subject to the following
20085 implementation advice (RM 13.3(19)):
20087 @quotation
20089 “19  If the Address of an object is specified, or it is imported
20090 or exported, then the implementation should not perform
20091 optimizations based on assumptions of no aliases.”
20092 @end quotation
20094 GNAT follows this recommendation, and goes further by also applying
20095 this recommendation to the overlaid variable (@code{A} in the above example)
20096 in this case. This means that the overlay works “as expected”, in that
20097 a modification to one of the variables will affect the value of the other.
20099 More generally, GNAT interprets this recommendation conservatively for
20100 address clauses: in the cases other than overlays, it considers that the
20101 object is effectively subject to pragma @code{Volatile} and implements the
20102 associated semantics.
20104 Note that when address clause overlays are used in this way, there is an
20105 issue of unintentional initialization, as shown by this example:
20107 @example
20108 package Overwrite_Record is
20109    type R is record
20110       A : Character := 'C';
20111       B : Character := 'A';
20112    end record;
20113    X : Short_Integer := 3;
20114    Y : R;
20115    for Y'Address use X'Address;
20116        |
20117 >>> warning: default initialization of "Y" may
20118     modify "X", use pragma Import for "Y" to
20119     suppress initialization (RM B.1(24))
20121 end Overwrite_Record;
20122 @end example
20124 Here the default initialization of @code{Y} will clobber the value
20125 of @code{X}, which justifies the warning. The warning notes that
20126 this effect can be eliminated by adding a @code{pragma Import}
20127 which suppresses the initialization:
20129 @example
20130 package Overwrite_Record is
20131    type R is record
20132       A : Character := 'C';
20133       B : Character := 'A';
20134    end record;
20135    X : Short_Integer := 3;
20136    Y : R;
20137    for Y'Address use X'Address;
20138    pragma Import (Ada, Y);
20139 end Overwrite_Record;
20140 @end example
20142 Note that the use of @code{pragma Initialize_Scalars} may cause variables to
20143 be initialized when they would not otherwise have been in the absence
20144 of the use of this pragma. This may cause an overlay to have this
20145 unintended clobbering effect. The compiler avoids this for scalar
20146 types, but not for composite objects (where in general the effect
20147 of @code{Initialize_Scalars} is part of the initialization routine
20148 for the composite object):
20150 @example
20151 pragma Initialize_Scalars;
20152 with Ada.Text_IO;  use Ada.Text_IO;
20153 procedure Overwrite_Array is
20154    type Arr is array (1 .. 5) of Integer;
20155    X : Arr := (others => 1);
20156    A : Arr;
20157    for A'Address use X'Address;
20158        |
20159 >>> warning: default initialization of "A" may
20160     modify "X", use pragma Import for "A" to
20161     suppress initialization (RM B.1(24))
20163 begin
20164    if X /= Arr'(others => 1) then
20165       Put_Line ("X was clobbered");
20166    else
20167       Put_Line ("X was not clobbered");
20168    end if;
20169 end Overwrite_Array;
20170 @end example
20172 The above program generates the warning as shown, and at execution
20173 time, prints @code{X was clobbered}. If the @code{pragma Import} is
20174 added as suggested:
20176 @example
20177 pragma Initialize_Scalars;
20178 with Ada.Text_IO;  use Ada.Text_IO;
20179 procedure Overwrite_Array is
20180    type Arr is array (1 .. 5) of Integer;
20181    X : Arr := (others => 1);
20182    A : Arr;
20183    for A'Address use X'Address;
20184    pragma Import (Ada, A);
20185 begin
20186    if X /= Arr'(others => 1) then
20187       Put_Line ("X was clobbered");
20188    else
20189       Put_Line ("X was not clobbered");
20190    end if;
20191 end Overwrite_Array;
20192 @end example
20194 then the program compiles without the warning and when run will generate
20195 the output @code{X was not clobbered}.
20197 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
20198 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{29d}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{29e}
20199 @section Use of Address Clauses for Memory-Mapped I/O
20202 @geindex Memory-mapped I/O
20204 A common pattern is to use an address clause to map an atomic variable to
20205 a location in memory that corresponds to a memory-mapped I/O operation or
20206 operations, for example:
20208 @example
20209 type Mem_Word is record
20210    A,B,C,D : Byte;
20211 end record;
20212 pragma Atomic (Mem_Word);
20213 for Mem_Word_Size use 32;
20215 Mem : Mem_Word;
20216 for Mem'Address use some-address;
20218 Temp := Mem;
20219 Temp.A := 32;
20220 Mem := Temp;
20221 @end example
20223 For a full access (reference or modification) of the variable (Mem) in this
20224 case, as in the above examples, GNAT guarantees that the entire atomic word
20225 will be accessed, in accordance with the RM C.6(15) clause.
20227 A problem arises with a component access such as:
20229 @example
20230 Mem.A := 32;
20231 @end example
20233 Note that the component A is not declared as atomic. This means that it is
20234 not clear what this assignment means. It could correspond to full word read
20235 and write as given in the first example, or on architectures that supported
20236 such an operation it might be a single byte store instruction. The RM does
20237 not have anything to say in this situation, and GNAT does not make any
20238 guarantee. The code generated may vary from target to target. GNAT will issue
20239 a warning in such a case:
20241 @example
20242 Mem.A := 32;
20244 >>> warning: access to non-atomic component of atomic array,
20245     may cause unexpected accesses to atomic object
20246 @end example
20248 It is best to be explicit in this situation, by either declaring the
20249 components to be atomic if you want the byte store, or explicitly writing
20250 the full word access sequence if that is what the hardware requires.
20251 Alternatively, if the full word access sequence is required, GNAT also
20252 provides the pragma @code{Volatile_Full_Access} which can be used in lieu of
20253 pragma @code{Atomic} and will give the additional guarantee.
20255 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
20256 @anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{29f}@anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{2a0}
20257 @section Effect of Convention on Representation
20260 @geindex Convention
20261 @geindex effect on representation
20263 Normally the specification of a foreign language convention for a type or
20264 an object has no effect on the chosen representation.  In particular, the
20265 representation chosen for data in GNAT generally meets the standard system
20266 conventions, and for example records are laid out in a manner that is
20267 consistent with C.  This means that specifying convention C (for example)
20268 has no effect.
20270 There are four exceptions to this general rule:
20273 @itemize *
20275 @item 
20276 `Convention Fortran and array subtypes'.
20278 If pragma Convention Fortran is specified for an array subtype, then in
20279 accordance with the implementation advice in section 3.6.2(11) of the
20280 Ada Reference Manual, the array will be stored in a Fortran-compatible
20281 column-major manner, instead of the normal default row-major order.
20283 @item 
20284 `Convention C and enumeration types'
20286 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
20287 to accommodate all values of the type.  For example, for the enumeration
20288 type declared by:
20290 @example
20291 type Color is (Red, Green, Blue);
20292 @end example
20294 8 bits is sufficient to store all values of the type, so by default, objects
20295 of type @code{Color} will be represented using 8 bits.  However, normal C
20296 convention is to use 32 bits for all enum values in C, since enum values
20297 are essentially of type int.  If pragma @code{Convention C} is specified for an
20298 Ada enumeration type, then the size is modified as necessary (usually to
20299 32 bits) to be consistent with the C convention for enum values.
20301 Note that this treatment applies only to types. If Convention C is given for
20302 an enumeration object, where the enumeration type is not Convention C, then
20303 Object_Size bits are allocated. For example, for a normal enumeration type,
20304 with less than 256 elements, only 8 bits will be allocated for the object.
20305 Since this may be a surprise in terms of what C expects, GNAT will issue a
20306 warning in this situation. The warning can be suppressed by giving an explicit
20307 size clause specifying the desired size.
20309 @item 
20310 `Convention C/Fortran and Boolean types'
20312 In C, the usual convention for boolean values, that is values used for
20313 conditions, is that zero represents false, and nonzero values represent
20314 true.  In Ada, the normal convention is that two specific values, typically
20315 0/1, are used to represent false/true respectively.
20317 Fortran has a similar convention for @code{LOGICAL} values (any nonzero
20318 value represents true).
20320 To accommodate the Fortran and C conventions, if a pragma Convention specifies
20321 C or Fortran convention for a derived Boolean, as in the following example:
20323 @example
20324 type C_Switch is new Boolean;
20325 pragma Convention (C, C_Switch);
20326 @end example
20328 then the GNAT generated code will treat any nonzero value as true.  For truth
20329 values generated by GNAT, the conventional value 1 will be used for True, but
20330 when one of these values is read, any nonzero value is treated as True.
20331 @end itemize
20333 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
20334 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{2a1}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{2a2}
20335 @section Conventions and Anonymous Access Types
20338 @geindex Anonymous access types
20340 @geindex Convention for anonymous access types
20342 The RM is not entirely clear on convention handling in a number of cases,
20343 and in particular, it is not clear on the convention to be given to
20344 anonymous access types in general, and in particular what is to be
20345 done for the case of anonymous access-to-subprogram.
20347 In GNAT, we decide that if an explicit Convention is applied
20348 to an object or component, and its type is such an anonymous type,
20349 then the convention will apply to this anonymous type as well. This
20350 seems to make sense since it is anomolous in any case to have a
20351 different convention for an object and its type, and there is clearly
20352 no way to explicitly specify a convention for an anonymous type, since
20353 it doesn’t have a name to specify!
20355 Furthermore, we decide that if a convention is applied to a record type,
20356 then this convention is inherited by any of its components that are of an
20357 anonymous access type which do not have an explicitly specified convention.
20359 The following program shows these conventions in action:
20361 @example
20362 package ConvComp is
20363    type Foo is range 1 .. 10;
20364    type T1 is record
20365       A : access function (X : Foo) return Integer;
20366       B : Integer;
20367    end record;
20368    pragma Convention (C, T1);
20370    type T2 is record
20371       A : access function (X : Foo) return Integer;
20372       pragma Convention  (C, A);
20373       B : Integer;
20374    end record;
20375    pragma Convention (COBOL, T2);
20377    type T3 is record
20378       A : access function (X : Foo) return Integer;
20379       pragma Convention  (COBOL, A);
20380       B : Integer;
20381    end record;
20382    pragma Convention (C, T3);
20384    type T4 is record
20385       A : access function (X : Foo) return Integer;
20386       B : Integer;
20387    end record;
20388    pragma Convention (COBOL, T4);
20390    function F (X : Foo) return Integer;
20391    pragma Convention (C, F);
20393    function F (X : Foo) return Integer is (13);
20395    TV1 : T1 := (F'Access, 12);  -- OK
20396    TV2 : T2 := (F'Access, 13);  -- OK
20398    TV3 : T3 := (F'Access, 13);  -- ERROR
20399                 |
20400 >>> subprogram "F" has wrong convention
20401 >>> does not match access to subprogram declared at line 17
20402      38.    TV4 : T4 := (F'Access, 13);  -- ERROR
20403                 |
20404 >>> subprogram "F" has wrong convention
20405 >>> does not match access to subprogram declared at line 24
20406      39. end ConvComp;
20407 @end example
20409 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
20410 @anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{2a3}@anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{2a4}
20411 @section Determining the Representations chosen by GNAT
20414 @geindex Representation
20415 @geindex determination of
20417 @geindex -gnatR (gcc)
20419 Although the descriptions in this section are intended to be complete, it is
20420 often easier to simply experiment to see what GNAT accepts and what the
20421 effect is on the layout of types and objects.
20423 As required by the Ada RM, if a representation clause is not accepted, then
20424 it must be rejected as illegal by the compiler.  However, when a
20425 representation clause or pragma is accepted, there can still be questions
20426 of what the compiler actually does.  For example, if a partial record
20427 representation clause specifies the location of some components and not
20428 others, then where are the non-specified components placed? Or if pragma
20429 @code{Pack} is used on a record, then exactly where are the resulting
20430 fields placed? The section on pragma @code{Pack} in this chapter can be
20431 used to answer the second question, but it is often easier to just see
20432 what the compiler does.
20434 For this purpose, GNAT provides the option `-gnatR'.  If you compile
20435 with this option, then the compiler will output information on the actual
20436 representations chosen, in a format similar to source representation
20437 clauses.  For example, if we compile the package:
20439 @example
20440 package q is
20441    type r (x : boolean) is tagged record
20442       case x is
20443          when True => S : String (1 .. 100);
20444          when False => null;
20445       end case;
20446    end record;
20448    type r2 is new r (false) with record
20449       y2 : integer;
20450    end record;
20452    for r2 use record
20453       y2 at 16 range 0 .. 31;
20454    end record;
20456    type x is record
20457       y : character;
20458    end record;
20460    type x1 is array (1 .. 10) of x;
20461    for x1'component_size use 11;
20463    type ia is access integer;
20465    type Rb1 is array (1 .. 13) of Boolean;
20466    pragma Pack (rb1);
20468    type Rb2 is array (1 .. 65) of Boolean;
20469    pragma Pack (rb2);
20471    type x2 is record
20472       l1 : Boolean;
20473       l2 : Duration;
20474       l3 : Float;
20475       l4 : Boolean;
20476       l5 : Rb1;
20477       l6 : Rb2;
20478    end record;
20479    pragma Pack (x2);
20480 end q;
20481 @end example
20483 using the switch `-gnatR' we obtain the following output:
20485 @example
20486 Representation information for unit q
20487 -------------------------------------
20489 for r'Size use ??;
20490 for r'Alignment use 4;
20491 for r use record
20492    x    at 4 range  0 .. 7;
20493    _tag at 0 range  0 .. 31;
20494    s    at 5 range  0 .. 799;
20495 end record;
20497 for r2'Size use 160;
20498 for r2'Alignment use 4;
20499 for r2 use record
20500    x       at  4 range  0 .. 7;
20501    _tag    at  0 range  0 .. 31;
20502    _parent at  0 range  0 .. 63;
20503    y2      at 16 range  0 .. 31;
20504 end record;
20506 for x'Size use 8;
20507 for x'Alignment use 1;
20508 for x use record
20509    y at 0 range  0 .. 7;
20510 end record;
20512 for x1'Size use 112;
20513 for x1'Alignment use 1;
20514 for x1'Component_Size use 11;
20516 for rb1'Size use 13;
20517 for rb1'Alignment use 2;
20518 for rb1'Component_Size use 1;
20520 for rb2'Size use 72;
20521 for rb2'Alignment use 1;
20522 for rb2'Component_Size use 1;
20524 for x2'Size use 224;
20525 for x2'Alignment use 4;
20526 for x2 use record
20527    l1 at  0 range  0 .. 0;
20528    l2 at  0 range  1 .. 64;
20529    l3 at 12 range  0 .. 31;
20530    l4 at 16 range  0 .. 0;
20531    l5 at 16 range  1 .. 13;
20532    l6 at 18 range  0 .. 71;
20533 end record;
20534 @end example
20536 The Size values are actually the Object_Size, i.e., the default size that
20537 will be allocated for objects of the type.
20538 The @code{??} size for type r indicates that we have a variant record, and the
20539 actual size of objects will depend on the discriminant value.
20541 The Alignment values show the actual alignment chosen by the compiler
20542 for each record or array type.
20544 The record representation clause for type r shows where all fields
20545 are placed, including the compiler generated tag field (whose location
20546 cannot be controlled by the programmer).
20548 The record representation clause for the type extension r2 shows all the
20549 fields present, including the parent field, which is a copy of the fields
20550 of the parent type of r2, i.e., r1.
20552 The component size and size clauses for types rb1 and rb2 show
20553 the exact effect of pragma @code{Pack} on these arrays, and the record
20554 representation clause for type x2 shows how pragma @cite{Pack} affects
20555 this record type.
20557 In some cases, it may be useful to cut and paste the representation clauses
20558 generated by the compiler into the original source to fix and guarantee
20559 the actual representation to be used.
20561 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
20562 @anchor{gnat_rm/standard_library_routines doc}@anchor{2a5}@anchor{gnat_rm/standard_library_routines id1}@anchor{2a6}@anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}
20563 @chapter Standard Library Routines
20566 The Ada Reference Manual contains in Annex A a full description of an
20567 extensive set of standard library routines that can be used in any Ada
20568 program, and which must be provided by all Ada compilers.  They are
20569 analogous to the standard C library used by C programs.
20571 GNAT implements all of the facilities described in annex A, and for most
20572 purposes the description in the Ada Reference Manual, or appropriate Ada
20573 text book, will be sufficient for making use of these facilities.
20575 In the case of the input-output facilities,
20576 @ref{f,,The Implementation of Standard I/O},
20577 gives details on exactly how GNAT interfaces to the
20578 file system.  For the remaining packages, the Ada Reference Manual
20579 should be sufficient.  The following is a list of the packages included,
20580 together with a brief description of the functionality that is provided.
20582 For completeness, references are included to other predefined library
20583 routines defined in other sections of the Ada Reference Manual (these are
20584 cross-indexed from Annex A). For further details see the relevant
20585 package declarations in the run-time library. In particular, a few units
20586 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
20587 and in this case the package declaration contains comments explaining why
20588 the unit is not implemented.
20591 @table @asis
20593 @item @code{Ada} `(A.2)'
20595 This is a parent package for all the standard library packages.  It is
20596 usually included implicitly in your program, and itself contains no
20597 useful data or routines.
20599 @item @code{Ada.Assertions} `(11.4.2)'
20601 @code{Assertions} provides the @code{Assert} subprograms, and also
20602 the declaration of the @code{Assertion_Error} exception.
20604 @item @code{Ada.Asynchronous_Task_Control} `(D.11)'
20606 @code{Asynchronous_Task_Control} provides low level facilities for task
20607 synchronization. It is typically not implemented. See package spec for details.
20609 @item @code{Ada.Calendar} `(9.6)'
20611 @code{Calendar} provides time of day access, and routines for
20612 manipulating times and durations.
20614 @item @code{Ada.Calendar.Arithmetic} `(9.6.1)'
20616 This package provides additional arithmetic
20617 operations for @code{Calendar}.
20619 @item @code{Ada.Calendar.Formatting} `(9.6.1)'
20621 This package provides formatting operations for @code{Calendar}.
20623 @item @code{Ada.Calendar.Time_Zones} `(9.6.1)'
20625 This package provides additional @code{Calendar} facilities
20626 for handling time zones.
20628 @item @code{Ada.Characters} `(A.3.1)'
20630 This is a dummy parent package that contains no useful entities
20632 @item @code{Ada.Characters.Conversions} `(A.3.2)'
20634 This package provides character conversion functions.
20636 @item @code{Ada.Characters.Handling} `(A.3.2)'
20638 This package provides some basic character handling capabilities,
20639 including classification functions for classes of characters (e.g., test
20640 for letters, or digits).
20642 @item @code{Ada.Characters.Latin_1} `(A.3.3)'
20644 This package includes a complete set of definitions of the characters
20645 that appear in type CHARACTER.  It is useful for writing programs that
20646 will run in international environments.  For example, if you want an
20647 upper case E with an acute accent in a string, it is often better to use
20648 the definition of @code{UC_E_Acute} in this package.  Then your program
20649 will print in an understandable manner even if your environment does not
20650 support these extended characters.
20652 @item @code{Ada.Command_Line} `(A.15)'
20654 This package provides access to the command line parameters and the name
20655 of the current program (analogous to the use of @code{argc} and @code{argv}
20656 in C), and also allows the exit status for the program to be set in a
20657 system-independent manner.
20659 @item @code{Ada.Complex_Text_IO} `(G.1.3)'
20661 This package provides text input and output of complex numbers.
20663 @item @code{Ada.Containers} `(A.18.1)'
20665 A top level package providing a few basic definitions used by all the
20666 following specific child packages that provide specific kinds of
20667 containers.
20668 @end table
20670 @code{Ada.Containers.Bounded_Priority_Queues} `(A.18.31)'
20672 @code{Ada.Containers.Bounded_Synchronized_Queues} `(A.18.29)'
20674 @code{Ada.Containers.Doubly_Linked_Lists} `(A.18.3)'
20676 @code{Ada.Containers.Generic_Array_Sort} `(A.18.26)'
20678 @code{Ada.Containers.Generic_Constrained_Array_Sort} `(A.18.26)'
20680 @code{Ada.Containers.Generic_Sort} `(A.18.26)'
20682 @code{Ada.Containers.Hashed_Maps} `(A.18.5)'
20684 @code{Ada.Containers.Hashed_Sets} `(A.18.8)'
20686 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} `(A.18.12)'
20688 @code{Ada.Containers.Indefinite_Hashed_Maps} `(A.18.13)'
20690 @code{Ada.Containers.Indefinite_Hashed_Sets} `(A.18.15)'
20692 @code{Ada.Containers.Indefinite_Holders} `(A.18.18)'
20694 @code{Ada.Containers.Indefinite_Multiway_Trees} `(A.18.17)'
20696 @code{Ada.Containers.Indefinite_Ordered_Maps} `(A.18.14)'
20698 @code{Ada.Containers.Indefinite_Ordered_Sets} `(A.18.16)'
20700 @code{Ada.Containers.Indefinite_Vectors} `(A.18.11)'
20702 @code{Ada.Containers.Multiway_Trees} `(A.18.10)'
20704 @code{Ada.Containers.Ordered_Maps} `(A.18.6)'
20706 @code{Ada.Containers.Ordered_Sets} `(A.18.9)'
20708 @code{Ada.Containers.Synchronized_Queue_Interfaces} `(A.18.27)'
20710 @code{Ada.Containers.Unbounded_Priority_Queues} `(A.18.30)'
20712 @code{Ada.Containers.Unbounded_Synchronized_Queues} `(A.18.28)'
20714 @code{Ada.Containers.Vectors} `(A.18.2)'
20717 @table @asis
20719 @item @code{Ada.Directories} `(A.16)'
20721 This package provides operations on directories.
20723 @item @code{Ada.Directories.Hierarchical_File_Names} `(A.16.1)'
20725 This package provides additional directory operations handling
20726 hierarchical file names.
20728 @item @code{Ada.Directories.Information} `(A.16)'
20730 This is an implementation defined package for additional directory
20731 operations, which is not implemented in GNAT.
20733 @item @code{Ada.Decimal} `(F.2)'
20735 This package provides constants describing the range of decimal numbers
20736 implemented, and also a decimal divide routine (analogous to the COBOL
20737 verb DIVIDE … GIVING … REMAINDER …)
20739 @item @code{Ada.Direct_IO} `(A.8.4)'
20741 This package provides input-output using a model of a set of records of
20742 fixed-length, containing an arbitrary definite Ada type, indexed by an
20743 integer record number.
20745 @item @code{Ada.Dispatching} `(D.2.1)'
20747 A parent package containing definitions for task dispatching operations.
20749 @item @code{Ada.Dispatching.EDF} `(D.2.6)'
20751 Not implemented in GNAT.
20753 @item @code{Ada.Dispatching.Non_Preemptive} `(D.2.4)'
20755 Not implemented in GNAT.
20757 @item @code{Ada.Dispatching.Round_Robin} `(D.2.5)'
20759 Not implemented in GNAT.
20761 @item @code{Ada.Dynamic_Priorities} `(D.5)'
20763 This package allows the priorities of a task to be adjusted dynamically
20764 as the task is running.
20766 @item @code{Ada.Environment_Variables} `(A.17)'
20768 This package provides facilities for accessing environment variables.
20770 @item @code{Ada.Exceptions} `(11.4.1)'
20772 This package provides additional information on exceptions, and also
20773 contains facilities for treating exceptions as data objects, and raising
20774 exceptions with associated messages.
20776 @item @code{Ada.Execution_Time} `(D.14)'
20778 This package provides CPU clock functionalities. It is not implemented on
20779 all targets (see package spec for details).
20781 @item @code{Ada.Execution_Time.Group_Budgets} `(D.14.2)'
20783 Not implemented in GNAT.
20785 @item @code{Ada.Execution_Time.Timers} `(D.14.1)’'
20787 Not implemented in GNAT.
20789 @item @code{Ada.Finalization} `(7.6)'
20791 This package contains the declarations and subprograms to support the
20792 use of controlled types, providing for automatic initialization and
20793 finalization (analogous to the constructors and destructors of C++).
20795 @item @code{Ada.Float_Text_IO} `(A.10.9)'
20797 A library level instantiation of Text_IO.Float_IO for type Float.
20799 @item @code{Ada.Float_Wide_Text_IO} `(A.10.9)'
20801 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
20803 @item @code{Ada.Float_Wide_Wide_Text_IO} `(A.10.9)'
20805 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
20807 @item @code{Ada.Integer_Text_IO} `(A.10.9)'
20809 A library level instantiation of Text_IO.Integer_IO for type Integer.
20811 @item @code{Ada.Integer_Wide_Text_IO} `(A.10.9)'
20813 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
20815 @item @code{Ada.Integer_Wide_Wide_Text_IO} `(A.10.9)'
20817 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
20819 @item @code{Ada.Interrupts} `(C.3.2)'
20821 This package provides facilities for interfacing to interrupts, which
20822 includes the set of signals or conditions that can be raised and
20823 recognized as interrupts.
20825 @item @code{Ada.Interrupts.Names} `(C.3.2)'
20827 This package provides the set of interrupt names (actually signal
20828 or condition names) that can be handled by GNAT.
20830 @item @code{Ada.IO_Exceptions} `(A.13)'
20832 This package defines the set of exceptions that can be raised by use of
20833 the standard IO packages.
20835 @item @code{Ada.Iterator_Interfaces} `(5.5.1)'
20837 This package provides a generic interface to generalized iterators.
20839 @item @code{Ada.Locales} `(A.19)'
20841 This package provides declarations providing information (Language
20842 and Country) about the current locale.
20844 @item @code{Ada.Numerics}
20846 This package contains some standard constants and exceptions used
20847 throughout the numerics packages.  Note that the constants pi and e are
20848 defined here, and it is better to use these definitions than rolling
20849 your own.
20851 @item @code{Ada.Numerics.Complex_Arrays} `(G.3.2)'
20853 Provides operations on arrays of complex numbers.
20855 @item @code{Ada.Numerics.Complex_Elementary_Functions}
20857 Provides the implementation of standard elementary functions (such as
20858 log and trigonometric functions) operating on complex numbers using the
20859 standard @code{Float} and the @code{Complex} and @code{Imaginary} types
20860 created by the package @code{Numerics.Complex_Types}.
20862 @item @code{Ada.Numerics.Complex_Types}
20864 This is a predefined instantiation of
20865 @code{Numerics.Generic_Complex_Types} using @code{Standard.Float} to
20866 build the type @code{Complex} and @code{Imaginary}.
20868 @item @code{Ada.Numerics.Discrete_Random}
20870 This generic package provides a random number generator suitable for generating
20871 uniformly distributed values of a specified discrete subtype.
20873 @item @code{Ada.Numerics.Float_Random}
20875 This package provides a random number generator suitable for generating
20876 uniformly distributed floating point values in the unit interval.
20878 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
20880 This is a generic version of the package that provides the
20881 implementation of standard elementary functions (such as log and
20882 trigonometric functions) for an arbitrary complex type.
20884 The following predefined instantiations of this package are provided:
20887 @itemize *
20889 @item 
20890 @code{Short_Float}
20892 @code{Ada.Numerics.Short_Complex_Elementary_Functions}
20894 @item 
20895 @code{Float}
20897 @code{Ada.Numerics.Complex_Elementary_Functions}
20899 @item 
20900 @code{Long_Float}
20902 @code{Ada.Numerics.Long_Complex_Elementary_Functions}
20903 @end itemize
20905 @item @code{Ada.Numerics.Generic_Complex_Types}
20907 This is a generic package that allows the creation of complex types,
20908 with associated complex arithmetic operations.
20910 The following predefined instantiations of this package exist
20913 @itemize *
20915 @item 
20916 @code{Short_Float}
20918 @code{Ada.Numerics.Short_Complex_Complex_Types}
20920 @item 
20921 @code{Float}
20923 @code{Ada.Numerics.Complex_Complex_Types}
20925 @item 
20926 @code{Long_Float}
20928 @code{Ada.Numerics.Long_Complex_Complex_Types}
20929 @end itemize
20931 @item @code{Ada.Numerics.Generic_Elementary_Functions}
20933 This is a generic package that provides the implementation of standard
20934 elementary functions (such as log an trigonometric functions) for an
20935 arbitrary float type.
20937 The following predefined instantiations of this package exist
20940 @itemize *
20942 @item 
20943 @code{Short_Float}
20945 @code{Ada.Numerics.Short_Elementary_Functions}
20947 @item 
20948 @code{Float}
20950 @code{Ada.Numerics.Elementary_Functions}
20952 @item 
20953 @code{Long_Float}
20955 @code{Ada.Numerics.Long_Elementary_Functions}
20956 @end itemize
20958 @item @code{Ada.Numerics.Generic_Real_Arrays} `(G.3.1)'
20960 Generic operations on arrays of reals
20962 @item @code{Ada.Numerics.Real_Arrays} `(G.3.1)'
20964 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
20966 @item @code{Ada.Real_Time} `(D.8)'
20968 This package provides facilities similar to those of @code{Calendar}, but
20969 operating with a finer clock suitable for real time control. Note that
20970 annex D requires that there be no backward clock jumps, and GNAT generally
20971 guarantees this behavior, but of course if the external clock on which
20972 the GNAT runtime depends is deliberately reset by some external event,
20973 then such a backward jump may occur.
20975 @item @code{Ada.Real_Time.Timing_Events} `(D.15)'
20977 Not implemented in GNAT.
20979 @item @code{Ada.Sequential_IO} `(A.8.1)'
20981 This package provides input-output facilities for sequential files,
20982 which can contain a sequence of values of a single type, which can be
20983 any Ada type, including indefinite (unconstrained) types.
20985 @item @code{Ada.Storage_IO} `(A.9)'
20987 This package provides a facility for mapping arbitrary Ada types to and
20988 from a storage buffer.  It is primarily intended for the creation of new
20989 IO packages.
20991 @item @code{Ada.Streams} `(13.13.1)'
20993 This is a generic package that provides the basic support for the
20994 concept of streams as used by the stream attributes (@code{Input},
20995 @code{Output}, @code{Read} and @code{Write}).
20997 @item @code{Ada.Streams.Stream_IO} `(A.12.1)'
20999 This package is a specialization of the type @code{Streams} defined in
21000 package @code{Streams} together with a set of operations providing
21001 Stream_IO capability.  The Stream_IO model permits both random and
21002 sequential access to a file which can contain an arbitrary set of values
21003 of one or more Ada types.
21005 @item @code{Ada.Strings} `(A.4.1)'
21007 This package provides some basic constants used by the string handling
21008 packages.
21010 @item @code{Ada.Strings.Bounded} `(A.4.4)'
21012 This package provides facilities for handling variable length
21013 strings.  The bounded model requires a maximum length.  It is thus
21014 somewhat more limited than the unbounded model, but avoids the use of
21015 dynamic allocation or finalization.
21017 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} `(A.4.10)'
21019 Provides case-insensitive comparisons of bounded strings
21021 @item @code{Ada.Strings.Bounded.Hash} `(A.4.9)'
21023 This package provides a generic hash function for bounded strings
21025 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} `(A.4.9)'
21027 This package provides a generic hash function for bounded strings that
21028 converts the string to be hashed to lower case.
21030 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} `(A.4.10)'
21032 This package provides a comparison function for bounded strings that works
21033 in a case insensitive manner by converting to lower case before the comparison.
21035 @item @code{Ada.Strings.Fixed} `(A.4.3)'
21037 This package provides facilities for handling fixed length strings.
21039 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} `(A.4.10)'
21041 This package provides an equality function for fixed strings that compares
21042 the strings after converting both to lower case.
21044 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} `(A.4.9)'
21046 This package provides a case insensitive hash function for fixed strings that
21047 converts the string to lower case before computing the hash.
21049 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} `(A.4.10)'
21051 This package provides a comparison function for fixed strings that works
21052 in a case insensitive manner by converting to lower case before the comparison.
21054 @item @code{Ada.Strings.Hash} `(A.4.9)'
21056 This package provides a hash function for strings.
21058 @item @code{Ada.Strings.Hash_Case_Insensitive} `(A.4.9)'
21060 This package provides a hash function for strings that is case insensitive.
21061 The string is converted to lower case before computing the hash.
21063 @item @code{Ada.Strings.Less_Case_Insensitive} `(A.4.10)'
21065 This package provides a comparison function for\strings that works
21066 in a case insensitive manner by converting to lower case before the comparison.
21068 @item @code{Ada.Strings.Maps} `(A.4.2)'
21070 This package provides facilities for handling character mappings and
21071 arbitrarily defined subsets of characters.  For instance it is useful in
21072 defining specialized translation tables.
21074 @item @code{Ada.Strings.Maps.Constants} `(A.4.6)'
21076 This package provides a standard set of predefined mappings and
21077 predefined character sets.  For example, the standard upper to lower case
21078 conversion table is found in this package.  Note that upper to lower case
21079 conversion is non-trivial if you want to take the entire set of
21080 characters, including extended characters like E with an acute accent,
21081 into account.  You should use the mappings in this package (rather than
21082 adding 32 yourself) to do case mappings.
21084 @item @code{Ada.Strings.Unbounded} `(A.4.5)'
21086 This package provides facilities for handling variable length
21087 strings.  The unbounded model allows arbitrary length strings, but
21088 requires the use of dynamic allocation and finalization.
21090 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} `(A.4.10)'
21092 Provides case-insensitive comparisons of unbounded strings
21094 @item @code{Ada.Strings.Unbounded.Hash} `(A.4.9)'
21096 This package provides a generic hash function for unbounded strings
21098 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} `(A.4.9)'
21100 This package provides a generic hash function for unbounded strings that
21101 converts the string to be hashed to lower case.
21103 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} `(A.4.10)'
21105 This package provides a comparison function for unbounded strings that works
21106 in a case insensitive manner by converting to lower case before the comparison.
21108 @item @code{Ada.Strings.UTF_Encoding} `(A.4.11)'
21110 This package provides basic definitions for dealing with UTF-encoded strings.
21112 @item @code{Ada.Strings.UTF_Encoding.Conversions} `(A.4.11)'
21114 This package provides conversion functions for UTF-encoded strings.
21115 @end table
21117 @code{Ada.Strings.UTF_Encoding.Strings} `(A.4.11)'
21119 @code{Ada.Strings.UTF_Encoding.Wide_Strings} `(A.4.11)'
21122 @table @asis
21124 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} `(A.4.11)'
21126 These packages provide facilities for handling UTF encodings for
21127 Strings, Wide_Strings and Wide_Wide_Strings.
21128 @end table
21130 @code{Ada.Strings.Wide_Bounded} `(A.4.7)'
21132 @code{Ada.Strings.Wide_Fixed} `(A.4.7)'
21134 @code{Ada.Strings.Wide_Maps} `(A.4.7)'
21137 @table @asis
21139 @item @code{Ada.Strings.Wide_Unbounded} `(A.4.7)'
21141 These packages provide analogous capabilities to the corresponding
21142 packages without @code{Wide_} in the name, but operate with the types
21143 @code{Wide_String} and @code{Wide_Character} instead of @code{String}
21144 and @code{Character}. Versions of all the child packages are available.
21145 @end table
21147 @code{Ada.Strings.Wide_Wide_Bounded} `(A.4.7)'
21149 @code{Ada.Strings.Wide_Wide_Fixed} `(A.4.7)'
21151 @code{Ada.Strings.Wide_Wide_Maps} `(A.4.7)'
21154 @table @asis
21156 @item @code{Ada.Strings.Wide_Wide_Unbounded} `(A.4.7)'
21158 These packages provide analogous capabilities to the corresponding
21159 packages without @code{Wide_} in the name, but operate with the types
21160 @code{Wide_Wide_String} and @code{Wide_Wide_Character} instead
21161 of @code{String} and @code{Character}.
21163 @item @code{Ada.Synchronous_Barriers} `(D.10.1)'
21165 This package provides facilities for synchronizing tasks at a low level
21166 with barriers.
21168 @item @code{Ada.Synchronous_Task_Control} `(D.10)'
21170 This package provides some standard facilities for controlling task
21171 communication in a synchronous manner.
21173 @item @code{Ada.Synchronous_Task_Control.EDF} `(D.10)'
21175 Not implemented in GNAT.
21177 @item @code{Ada.Tags}
21179 This package contains definitions for manipulation of the tags of tagged
21180 values.
21182 @item @code{Ada.Tags.Generic_Dispatching_Constructor} `(3.9)'
21184 This package provides a way of constructing tagged class-wide values given
21185 only the tag value.
21187 @item @code{Ada.Task_Attributes} `(C.7.2)'
21189 This package provides the capability of associating arbitrary
21190 task-specific data with separate tasks.
21192 @item @code{Ada.Task_Identification} `(C.7.1)'
21194 This package provides capabilities for task identification.
21196 @item @code{Ada.Task_Termination} `(C.7.3)'
21198 This package provides control over task termination.
21200 @item @code{Ada.Text_IO}
21202 This package provides basic text input-output capabilities for
21203 character, string and numeric data.  The subpackages of this
21204 package are listed next. Note that although these are defined
21205 as subpackages in the RM, they are actually transparently
21206 implemented as child packages in GNAT, meaning that they
21207 are only loaded if needed.
21209 @item @code{Ada.Text_IO.Decimal_IO}
21211 Provides input-output facilities for decimal fixed-point types
21213 @item @code{Ada.Text_IO.Enumeration_IO}
21215 Provides input-output facilities for enumeration types.
21217 @item @code{Ada.Text_IO.Fixed_IO}
21219 Provides input-output facilities for ordinary fixed-point types.
21221 @item @code{Ada.Text_IO.Float_IO}
21223 Provides input-output facilities for float types.  The following
21224 predefined instantiations of this generic package are available:
21227 @itemize *
21229 @item 
21230 @code{Short_Float}
21232 @code{Short_Float_Text_IO}
21234 @item 
21235 @code{Float}
21237 @code{Float_Text_IO}
21239 @item 
21240 @code{Long_Float}
21242 @code{Long_Float_Text_IO}
21243 @end itemize
21245 @item @code{Ada.Text_IO.Integer_IO}
21247 Provides input-output facilities for integer types.  The following
21248 predefined instantiations of this generic package are available:
21251 @itemize *
21253 @item 
21254 @code{Short_Short_Integer}
21256 @code{Ada.Short_Short_Integer_Text_IO}
21258 @item 
21259 @code{Short_Integer}
21261 @code{Ada.Short_Integer_Text_IO}
21263 @item 
21264 @code{Integer}
21266 @code{Ada.Integer_Text_IO}
21268 @item 
21269 @code{Long_Integer}
21271 @code{Ada.Long_Integer_Text_IO}
21273 @item 
21274 @code{Long_Long_Integer}
21276 @code{Ada.Long_Long_Integer_Text_IO}
21277 @end itemize
21279 @item @code{Ada.Text_IO.Modular_IO}
21281 Provides input-output facilities for modular (unsigned) types.
21283 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
21285 Provides input-output facilities for bounded strings.
21287 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
21289 This package provides basic text input-output capabilities for complex
21290 data.
21292 @item @code{Ada.Text_IO.Editing (F.3.3)}
21294 This package contains routines for edited output, analogous to the use
21295 of pictures in COBOL.  The picture formats used by this package are a
21296 close copy of the facility in COBOL.
21298 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
21300 This package provides a facility that allows Text_IO files to be treated
21301 as streams, so that the stream attributes can be used for writing
21302 arbitrary data, including binary data, to Text_IO files.
21304 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
21306 This package provides input-output facilities for unbounded strings.
21308 @item @code{Ada.Unchecked_Conversion (13.9)}
21310 This generic package allows arbitrary conversion from one type to
21311 another of the same size, providing for breaking the type safety in
21312 special circumstances.
21314 If the types have the same Size (more accurately the same Value_Size),
21315 then the effect is simply to transfer the bits from the source to the
21316 target type without any modification.  This usage is well defined, and
21317 for simple types whose representation is typically the same across
21318 all implementations, gives a portable method of performing such
21319 conversions.
21321 If the types do not have the same size, then the result is implementation
21322 defined, and thus may be non-portable.  The following describes how GNAT
21323 handles such unchecked conversion cases.
21325 If the types are of different sizes, and are both discrete types, then
21326 the effect is of a normal type conversion without any constraint checking.
21327 In particular if the result type has a larger size, the result will be
21328 zero or sign extended.  If the result type has a smaller size, the result
21329 will be truncated by ignoring high order bits.
21331 If the types are of different sizes, and are not both discrete types,
21332 then the conversion works as though pointers were created to the source
21333 and target, and the pointer value is converted.  The effect is that bits
21334 are copied from successive low order storage units and bits of the source
21335 up to the length of the target type.
21337 A warning is issued if the lengths differ, since the effect in this
21338 case is implementation dependent, and the above behavior may not match
21339 that of some other compiler.
21341 A pointer to one type may be converted to a pointer to another type using
21342 unchecked conversion.  The only case in which the effect is undefined is
21343 when one or both pointers are pointers to unconstrained array types.  In
21344 this case, the bounds information may get incorrectly transferred, and in
21345 particular, GNAT uses double size pointers for such types, and it is
21346 meaningless to convert between such pointer types.  GNAT will issue a
21347 warning if the alignment of the target designated type is more strict
21348 than the alignment of the source designated type (since the result may
21349 be unaligned in this case).
21351 A pointer other than a pointer to an unconstrained array type may be
21352 converted to and from System.Address.  Such usage is common in Ada 83
21353 programs, but note that Ada.Address_To_Access_Conversions is the
21354 preferred method of performing such conversions in Ada 95 and Ada 2005.
21355 Neither
21356 unchecked conversion nor Ada.Address_To_Access_Conversions should be
21357 used in conjunction with pointers to unconstrained objects, since
21358 the bounds information cannot be handled correctly in this case.
21360 @item @code{Ada.Unchecked_Deallocation} `(13.11.2)'
21362 This generic package allows explicit freeing of storage previously
21363 allocated by use of an allocator.
21365 @item @code{Ada.Wide_Text_IO} `(A.11)'
21367 This package is similar to @code{Ada.Text_IO}, except that the external
21368 file supports wide character representations, and the internal types are
21369 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21370 and @code{String}. The corresponding set of nested packages and child
21371 packages are defined.
21373 @item @code{Ada.Wide_Wide_Text_IO} `(A.11)'
21375 This package is similar to @code{Ada.Text_IO}, except that the external
21376 file supports wide character representations, and the internal types are
21377 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21378 and @code{String}. The corresponding set of nested packages and child
21379 packages are defined.
21380 @end table
21382 For packages in Interfaces and System, all the RM defined packages are
21383 available in GNAT, see the Ada 2012 RM for full details.
21385 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
21386 @anchor{gnat_rm/the_implementation_of_standard_i_o doc}@anchor{2a7}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{2a8}@anchor{gnat_rm/the_implementation_of_standard_i_o the-implementation-of-standard-i-o}@anchor{f}
21387 @chapter The Implementation of Standard I/O
21390 GNAT implements all the required input-output facilities described in
21391 A.6 through A.14.  These sections of the Ada Reference Manual describe the
21392 required behavior of these packages from the Ada point of view, and if
21393 you are writing a portable Ada program that does not need to know the
21394 exact manner in which Ada maps to the outside world when it comes to
21395 reading or writing external files, then you do not need to read this
21396 chapter.  As long as your files are all regular files (not pipes or
21397 devices), and as long as you write and read the files only from Ada, the
21398 description in the Ada Reference Manual is sufficient.
21400 However, if you want to do input-output to pipes or other devices, such
21401 as the keyboard or screen, or if the files you are dealing with are
21402 either generated by some other language, or to be read by some other
21403 language, then you need to know more about the details of how the GNAT
21404 implementation of these input-output facilities behaves.
21406 In this chapter we give a detailed description of exactly how GNAT
21407 interfaces to the file system.  As always, the sources of the system are
21408 available to you for answering questions at an even more detailed level,
21409 but for most purposes the information in this chapter will suffice.
21411 Another reason that you may need to know more about how input-output is
21412 implemented arises when you have a program written in mixed languages
21413 where, for example, files are shared between the C and Ada sections of
21414 the same program.  GNAT provides some additional facilities, in the form
21415 of additional child library packages, that facilitate this sharing, and
21416 these additional facilities are also described in this chapter.
21418 @menu
21419 * Standard I/O Packages:: 
21420 * FORM Strings:: 
21421 * Direct_IO:: 
21422 * Sequential_IO:: 
21423 * Text_IO:: 
21424 * Wide_Text_IO:: 
21425 * Wide_Wide_Text_IO:: 
21426 * Stream_IO:: 
21427 * Text Translation:: 
21428 * Shared Files:: 
21429 * Filenames encoding:: 
21430 * File content encoding:: 
21431 * Open Modes:: 
21432 * Operations on C Streams:: 
21433 * Interfacing to C Streams:: 
21435 @end menu
21437 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
21438 @anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{2a9}@anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{2aa}
21439 @section Standard I/O Packages
21442 The Standard I/O packages described in Annex A for
21445 @itemize *
21447 @item 
21448 Ada.Text_IO
21450 @item 
21451 Ada.Text_IO.Complex_IO
21453 @item 
21454 Ada.Text_IO.Text_Streams
21456 @item 
21457 Ada.Wide_Text_IO
21459 @item 
21460 Ada.Wide_Text_IO.Complex_IO
21462 @item 
21463 Ada.Wide_Text_IO.Text_Streams
21465 @item 
21466 Ada.Wide_Wide_Text_IO
21468 @item 
21469 Ada.Wide_Wide_Text_IO.Complex_IO
21471 @item 
21472 Ada.Wide_Wide_Text_IO.Text_Streams
21474 @item 
21475 Ada.Stream_IO
21477 @item 
21478 Ada.Sequential_IO
21480 @item 
21481 Ada.Direct_IO
21482 @end itemize
21484 are implemented using the C
21485 library streams facility; where
21488 @itemize *
21490 @item 
21491 All files are opened using @code{fopen}.
21493 @item 
21494 All input/output operations use @code{fread}/@cite{fwrite}.
21495 @end itemize
21497 There is no internal buffering of any kind at the Ada library level. The only
21498 buffering is that provided at the system level in the implementation of the
21499 library routines that support streams. This facilitates shared use of these
21500 streams by mixed language programs. Note though that system level buffering is
21501 explicitly enabled at elaboration of the standard I/O packages and that can
21502 have an impact on mixed language programs, in particular those using I/O before
21503 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
21504 the Ada elaboration routine before performing any I/O or when impractical,
21505 flush the common I/O streams and in particular Standard_Output before
21506 elaborating the Ada code.
21508 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
21509 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{2ab}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{2ac}
21510 @section FORM Strings
21513 The format of a FORM string in GNAT is:
21515 @example
21516 "keyword=value,keyword=value,...,keyword=value"
21517 @end example
21519 where letters may be in upper or lower case, and there are no spaces
21520 between values.  The order of the entries is not important.  Currently
21521 the following keywords defined.
21523 @example
21524 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
21525 SHARED=[YES|NO]
21526 WCEM=[n|h|u|s|e|8|b]
21527 ENCODING=[UTF8|8BITS]
21528 @end example
21530 The use of these parameters is described later in this section. If an
21531 unrecognized keyword appears in a form string, it is silently ignored
21532 and not considered invalid.
21534 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
21535 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{2ad}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{2ae}
21536 @section Direct_IO
21539 Direct_IO can only be instantiated for definite types.  This is a
21540 restriction of the Ada language, which means that the records are fixed
21541 length (the length being determined by @code{type'Size}, rounded
21542 up to the next storage unit boundary if necessary).
21544 The records of a Direct_IO file are simply written to the file in index
21545 sequence, with the first record starting at offset zero, and subsequent
21546 records following.  There is no control information of any kind.  For
21547 example, if 32-bit integers are being written, each record takes
21548 4-bytes, so the record at index @code{K} starts at offset
21549 (@code{K}-1)*4.
21551 There is no limit on the size of Direct_IO files, they are expanded as
21552 necessary to accommodate whatever records are written to the file.
21554 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
21555 @anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{2af}@anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{2b0}
21556 @section Sequential_IO
21559 Sequential_IO may be instantiated with either a definite (constrained)
21560 or indefinite (unconstrained) type.
21562 For the definite type case, the elements written to the file are simply
21563 the memory images of the data values with no control information of any
21564 kind.  The resulting file should be read using the same type, no validity
21565 checking is performed on input.
21567 For the indefinite type case, the elements written consist of two
21568 parts.  First is the size of the data item, written as the memory image
21569 of a @code{Interfaces.C.size_t} value, followed by the memory image of
21570 the data value.  The resulting file can only be read using the same
21571 (unconstrained) type.  Normal assignment checks are performed on these
21572 read operations, and if these checks fail, @code{Data_Error} is
21573 raised.  In particular, in the array case, the lengths must match, and in
21574 the variant record case, if the variable for a particular read operation
21575 is constrained, the discriminants must match.
21577 Note that it is not possible to use Sequential_IO to write variable
21578 length array items, and then read the data back into different length
21579 arrays.  For example, the following will raise @code{Data_Error}:
21581 @example
21582 package IO is new Sequential_IO (String);
21583 F : IO.File_Type;
21584 S : String (1..4);
21586 IO.Create (F)
21587 IO.Write (F, "hello!")
21588 IO.Reset (F, Mode=>In_File);
21589 IO.Read (F, S);
21590 Put_Line (S);
21591 @end example
21593 On some Ada implementations, this will print @code{hell}, but the program is
21594 clearly incorrect, since there is only one element in the file, and that
21595 element is the string @code{hello!}.
21597 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
21598 using Stream_IO, and this is the preferred mechanism.  In particular, the
21599 above program fragment rewritten to use Stream_IO will work correctly.
21601 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
21602 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{2b1}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{2b2}
21603 @section Text_IO
21606 Text_IO files consist of a stream of characters containing the following
21607 special control characters:
21609 @example
21610 LF (line feed, 16#0A#) Line Mark
21611 FF (form feed, 16#0C#) Page Mark
21612 @end example
21614 A canonical Text_IO file is defined as one in which the following
21615 conditions are met:
21618 @itemize *
21620 @item 
21621 The character @code{LF} is used only as a line mark, i.e., to mark the end
21622 of the line.
21624 @item 
21625 The character @code{FF} is used only as a page mark, i.e., to mark the
21626 end of a page and consequently can appear only immediately following a
21627 @code{LF} (line mark) character.
21629 @item 
21630 The file ends with either @code{LF} (line mark) or @code{LF}-@cite{FF}
21631 (line mark, page mark).  In the former case, the page mark is implicitly
21632 assumed to be present.
21633 @end itemize
21635 A file written using Text_IO will be in canonical form provided that no
21636 explicit @code{LF} or @code{FF} characters are written using @code{Put}
21637 or @code{Put_Line}.  There will be no @code{FF} character at the end of
21638 the file unless an explicit @code{New_Page} operation was performed
21639 before closing the file.
21641 A canonical Text_IO file that is a regular file (i.e., not a device or a
21642 pipe) can be read using any of the routines in Text_IO.  The
21643 semantics in this case will be exactly as defined in the Ada Reference
21644 Manual, and all the routines in Text_IO are fully implemented.
21646 A text file that does not meet the requirements for a canonical Text_IO
21647 file has one of the following:
21650 @itemize *
21652 @item 
21653 The file contains @code{FF} characters not immediately following a
21654 @code{LF} character.
21656 @item 
21657 The file contains @code{LF} or @code{FF} characters written by
21658 @code{Put} or @code{Put_Line}, which are not logically considered to be
21659 line marks or page marks.
21661 @item 
21662 The file ends in a character other than @code{LF} or @code{FF},
21663 i.e., there is no explicit line mark or page mark at the end of the file.
21664 @end itemize
21666 Text_IO can be used to read such non-standard text files but subprograms
21667 to do with line or page numbers do not have defined meanings.  In
21668 particular, a @code{FF} character that does not follow a @code{LF}
21669 character may or may not be treated as a page mark from the point of
21670 view of page and line numbering.  Every @code{LF} character is considered
21671 to end a line, and there is an implied @code{LF} character at the end of
21672 the file.
21674 @menu
21675 * Stream Pointer Positioning:: 
21676 * Reading and Writing Non-Regular Files:: 
21677 * Get_Immediate:: 
21678 * Treating Text_IO Files as Streams:: 
21679 * Text_IO Extensions:: 
21680 * Text_IO Facilities for Unbounded Strings:: 
21682 @end menu
21684 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21685 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{2b3}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{2b4}
21686 @subsection Stream Pointer Positioning
21689 @code{Ada.Text_IO} has a definition of current position for a file that
21690 is being read.  No internal buffering occurs in Text_IO, and usually the
21691 physical position in the stream used to implement the file corresponds
21692 to this logical position defined by Text_IO.  There are two exceptions:
21695 @itemize *
21697 @item 
21698 After a call to @code{End_Of_Page} that returns @code{True}, the stream
21699 is positioned past the @code{LF} (line mark) that precedes the page
21700 mark.  Text_IO maintains an internal flag so that subsequent read
21701 operations properly handle the logical position which is unchanged by
21702 the @code{End_Of_Page} call.
21704 @item 
21705 After a call to @code{End_Of_File} that returns @code{True}, if the
21706 Text_IO file was positioned before the line mark at the end of file
21707 before the call, then the logical position is unchanged, but the stream
21708 is physically positioned right at the end of file (past the line mark,
21709 and past a possible page mark following the line mark.  Again Text_IO
21710 maintains internal flags so that subsequent read operations properly
21711 handle the logical position.
21712 @end itemize
21714 These discrepancies have no effect on the observable behavior of
21715 Text_IO, but if a single Ada stream is shared between a C program and
21716 Ada program, or shared (using @code{shared=yes} in the form string)
21717 between two Ada files, then the difference may be observable in some
21718 situations.
21720 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21721 @anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{2b5}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{2b6}
21722 @subsection Reading and Writing Non-Regular Files
21725 A non-regular file is a device (such as a keyboard), or a pipe.  Text_IO
21726 can be used for reading and writing.  Writing is not affected and the
21727 sequence of characters output is identical to the normal file case, but
21728 for reading, the behavior of Text_IO is modified to avoid undesirable
21729 look-ahead as follows:
21731 An input file that is not a regular file is considered to have no page
21732 marks.  Any @code{Ascii.FF} characters (the character normally used for a
21733 page mark) appearing in the file are considered to be data
21734 characters.  In particular:
21737 @itemize *
21739 @item 
21740 @code{Get_Line} and @code{Skip_Line} do not test for a page mark
21741 following a line mark.  If a page mark appears, it will be treated as a
21742 data character.
21744 @item 
21745 This avoids the need to wait for an extra character to be typed or
21746 entered from the pipe to complete one of these operations.
21748 @item 
21749 @code{End_Of_Page} always returns @code{False}
21751 @item 
21752 @code{End_Of_File} will return @code{False} if there is a page mark at
21753 the end of the file.
21754 @end itemize
21756 Output to non-regular files is the same as for regular files.  Page marks
21757 may be written to non-regular files using @code{New_Page}, but as noted
21758 above they will not be treated as page marks on input if the output is
21759 piped to another Ada program.
21761 Another important discrepancy when reading non-regular files is that the end
21762 of file indication is not ‘sticky’.  If an end of file is entered, e.g., by
21763 pressing the @code{EOT} key,
21764 then end of file
21765 is signaled once (i.e., the test @code{End_Of_File}
21766 will yield @code{True}, or a read will
21767 raise @code{End_Error}), but then reading can resume
21768 to read data past that end of
21769 file indication, until another end of file indication is entered.
21771 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
21772 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{2b7}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2b8}
21773 @subsection Get_Immediate
21776 @geindex Get_Immediate
21778 Get_Immediate returns the next character (including control characters)
21779 from the input file.  In particular, Get_Immediate will return LF or FF
21780 characters used as line marks or page marks.  Such operations leave the
21781 file positioned past the control character, and it is thus not treated
21782 as having its normal function.  This means that page, line and column
21783 counts after this kind of Get_Immediate call are set as though the mark
21784 did not occur.  In the case where a Get_Immediate leaves the file
21785 positioned between the line mark and page mark (which is not normally
21786 possible), it is undefined whether the FF character will be treated as a
21787 page mark.
21789 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
21790 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2b9}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2ba}
21791 @subsection Treating Text_IO Files as Streams
21794 @geindex Stream files
21796 The package @code{Text_IO.Streams} allows a @code{Text_IO} file to be treated
21797 as a stream.  Data written to a @code{Text_IO} file in this stream mode is
21798 binary data.  If this binary data contains bytes 16#0A# (@code{LF}) or
21799 16#0C# (@code{FF}), the resulting file may have non-standard
21800 format.  Similarly if read operations are used to read from a Text_IO
21801 file treated as a stream, then @code{LF} and @code{FF} characters may be
21802 skipped and the effect is similar to that described above for
21803 @code{Get_Immediate}.
21805 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
21806 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2bb}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2bc}
21807 @subsection Text_IO Extensions
21810 @geindex Text_IO extensions
21812 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
21813 to the standard @code{Text_IO} package:
21816 @itemize *
21818 @item 
21819 function File_Exists (Name : String) return Boolean;
21820 Determines if a file of the given name exists.
21822 @item 
21823 function Get_Line return String;
21824 Reads a string from the standard input file.  The value returned is exactly
21825 the length of the line that was read.
21827 @item 
21828 function Get_Line (File : Ada.Text_IO.File_Type) return String;
21829 Similar, except that the parameter File specifies the file from which
21830 the string is to be read.
21831 @end itemize
21833 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
21834 @anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2bd}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2be}
21835 @subsection Text_IO Facilities for Unbounded Strings
21838 @geindex Text_IO for unbounded strings
21840 @geindex Unbounded_String
21841 @geindex Text_IO operations
21843 The package @code{Ada.Strings.Unbounded.Text_IO}
21844 in library files @code{a-suteio.ads/adb} contains some GNAT-specific
21845 subprograms useful for Text_IO operations on unbounded strings:
21848 @itemize *
21850 @item 
21851 function Get_Line (File : File_Type) return Unbounded_String;
21852 Reads a line from the specified file
21853 and returns the result as an unbounded string.
21855 @item 
21856 procedure Put (File : File_Type; U : Unbounded_String);
21857 Writes the value of the given unbounded string to the specified file
21858 Similar to the effect of
21859 @code{Put (To_String (U))} except that an extra copy is avoided.
21861 @item 
21862 procedure Put_Line (File : File_Type; U : Unbounded_String);
21863 Writes the value of the given unbounded string to the specified file,
21864 followed by a @code{New_Line}.
21865 Similar to the effect of @code{Put_Line (To_String (U))} except
21866 that an extra copy is avoided.
21867 @end itemize
21869 In the above procedures, @code{File} is of type @code{Ada.Text_IO.File_Type}
21870 and is optional.  If the parameter is omitted, then the standard input or
21871 output file is referenced as appropriate.
21873 The package @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
21874 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
21875 @code{Wide_Text_IO} functionality for unbounded wide strings.
21877 The package @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
21878 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
21879 @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
21881 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
21882 @anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2bf}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2c0}
21883 @section Wide_Text_IO
21886 @code{Wide_Text_IO} is similar in most respects to Text_IO, except that
21887 both input and output files may contain special sequences that represent
21888 wide character values.  The encoding scheme for a given file may be
21889 specified using a FORM parameter:
21891 @example
21892 WCEM=`x`
21893 @end example
21895 as part of the FORM string (WCEM = wide character encoding method),
21896 where @code{x} is one of the following characters
21899 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
21900 @headitem
21902 Character
21904 @tab
21906 Encoding
21908 @item
21912 @tab
21914 Hex ESC encoding
21916 @item
21920 @tab
21922 Upper half encoding
21924 @item
21928 @tab
21930 Shift-JIS encoding
21932 @item
21936 @tab
21938 EUC Encoding
21940 @item
21944 @tab
21946 UTF-8 encoding
21948 @item
21952 @tab
21954 Brackets encoding
21956 @end multitable
21959 The encoding methods match those that
21960 can be used in a source
21961 program, but there is no requirement that the encoding method used for
21962 the source program be the same as the encoding method used for files,
21963 and different files may use different encoding methods.
21965 The default encoding method for the standard files, and for opened files
21966 for which no WCEM parameter is given in the FORM string matches the
21967 wide character encoding specified for the main program (the default
21968 being brackets encoding if no coding method was specified with -gnatW).
21971 @table @asis
21973 @item `Hex Coding'
21975 In this encoding, a wide character is represented by a five character
21976 sequence:
21977 @end table
21979 @example
21980 ESC a b c d
21981 @end example
21984 @quotation
21986 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
21987 characters (using upper case letters) of the wide character code.  For
21988 example, ESC A345 is used to represent the wide character with code
21989 16#A345#.  This scheme is compatible with use of the full
21990 @code{Wide_Character} set.
21991 @end quotation
21994 @table @asis
21996 @item `Upper Half Coding'
21998 The wide character with encoding 16#abcd#, where the upper bit is on
21999 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
22000 16#cd#.  The second byte may never be a format control character, but is
22001 not required to be in the upper half.  This method can be also used for
22002 shift-JIS or EUC where the internal coding matches the external coding.
22004 @item `Shift JIS Coding'
22006 A wide character is represented by a two character sequence 16#ab# and
22007 16#cd#, with the restrictions described for upper half encoding as
22008 described above.  The internal character code is the corresponding JIS
22009 character according to the standard algorithm for Shift-JIS
22010 conversion.  Only characters defined in the JIS code set table can be
22011 used with this encoding method.
22013 @item `EUC Coding'
22015 A wide character is represented by a two character sequence 16#ab# and
22016 16#cd#, with both characters being in the upper half.  The internal
22017 character code is the corresponding JIS character according to the EUC
22018 encoding algorithm.  Only characters defined in the JIS code set table
22019 can be used with this encoding method.
22021 @item `UTF-8 Coding'
22023 A wide character is represented using
22024 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22025 10646-1/Am.2.  Depending on the character value, the representation
22026 is a one, two, or three byte sequence:
22027 @end table
22029 @example
22030 16#0000#-16#007f#: 2#0xxxxxxx#
22031 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
22032 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22033 @end example
22036 @quotation
22038 where the @code{xxx} bits correspond to the left-padded bits of the
22039 16-bit character value.  Note that all lower half ASCII characters
22040 are represented as ASCII bytes and all upper half characters and
22041 other wide characters are represented as sequences of upper-half
22042 (The full UTF-8 scheme allows for encoding 31-bit characters as
22043 6-byte sequences, but in this implementation, all UTF-8 sequences
22044 of four or more bytes length will raise a Constraint_Error, as
22045 will all invalid UTF-8 sequences.)
22046 @end quotation
22049 @table @asis
22051 @item `Brackets Coding'
22053 In this encoding, a wide character is represented by the following eight
22054 character sequence:
22055 @end table
22057 @example
22058 [ " a b c d " ]
22059 @end example
22062 @quotation
22064 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22065 characters (using uppercase letters) of the wide character code.  For
22066 example, @code{["A345"]} is used to represent the wide character with code
22067 @code{16#A345#}.
22068 This scheme is compatible with use of the full Wide_Character set.
22069 On input, brackets coding can also be used for upper half characters,
22070 e.g., @code{["C1"]} for lower case a.  However, on output, brackets notation
22071 is only used for wide characters with a code greater than @code{16#FF#}.
22073 Note that brackets coding is not normally used in the context of
22074 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
22075 a portable way of encoding source files. In the context of Wide_Text_IO
22076 or Wide_Wide_Text_IO, it can only be used if the file does not contain
22077 any instance of the left bracket character other than to encode wide
22078 character values using the brackets encoding method. In practice it is
22079 expected that some standard wide character encoding method such
22080 as UTF-8 will be used for text input output.
22082 If brackets notation is used, then any occurrence of a left bracket
22083 in the input file which is not the start of a valid wide character
22084 sequence will cause Constraint_Error to be raised. It is possible to
22085 encode a left bracket as [“5B”] and Wide_Text_IO and Wide_Wide_Text_IO
22086 input will interpret this as a left bracket.
22088 However, when a left bracket is output, it will be output as a left bracket
22089 and not as [“5B”]. We make this decision because for normal use of
22090 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
22091 brackets. For example, if we write:
22093 @example
22094 Put_Line ("Start of output [first run]");
22095 @end example
22097 we really do not want to have the left bracket in this message clobbered so
22098 that the output reads:
22099 @end quotation
22101 @example
22102 Start of output ["5B"]first run]
22103 @end example
22106 @quotation
22108 In practice brackets encoding is reasonably useful for normal Put_Line use
22109 since we won’t get confused between left brackets and wide character
22110 sequences in the output. But for input, or when files are written out
22111 and read back in, it really makes better sense to use one of the standard
22112 encoding methods such as UTF-8.
22113 @end quotation
22115 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
22116 not all wide character
22117 values can be represented.  An attempt to output a character that cannot
22118 be represented using the encoding scheme for the file causes
22119 Constraint_Error to be raised.  An invalid wide character sequence on
22120 input also causes Constraint_Error to be raised.
22122 @menu
22123 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
22124 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
22126 @end menu
22128 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
22129 @anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2c1}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2c2}
22130 @subsection Stream Pointer Positioning
22133 @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22134 of stream pointer positioning (@ref{2b2,,Text_IO}).  There is one additional
22135 case:
22137 If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
22138 normal lower ASCII set, i.e. a character in the range:
22140 @example
22141 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
22142 @end example
22144 then although the logical position of the file pointer is unchanged by
22145 the @code{Look_Ahead} call, the stream is physically positioned past the
22146 wide character sequence.  Again this is to avoid the need for buffering
22147 or backup, and all @code{Wide_Text_IO} routines check the internal
22148 indication that this situation has occurred so that this is not visible
22149 to a normal program using @code{Wide_Text_IO}.  However, this discrepancy
22150 can be observed if the wide text file shares a stream with another file.
22152 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
22153 @anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2c3}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2c4}
22154 @subsection Reading and Writing Non-Regular Files
22157 As in the case of Text_IO, when a non-regular file is read, it is
22158 assumed that the file contains no page marks (any form characters are
22159 treated as data characters), and @code{End_Of_Page} always returns
22160 @code{False}.  Similarly, the end of file indication is not sticky, so
22161 it is possible to read beyond an end of file.
22163 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
22164 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2c5}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2c6}
22165 @section Wide_Wide_Text_IO
22168 @code{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
22169 both input and output files may contain special sequences that represent
22170 wide wide character values.  The encoding scheme for a given file may be
22171 specified using a FORM parameter:
22173 @example
22174 WCEM=`x`
22175 @end example
22177 as part of the FORM string (WCEM = wide character encoding method),
22178 where @code{x} is one of the following characters
22181 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
22182 @headitem
22184 Character
22186 @tab
22188 Encoding
22190 @item
22194 @tab
22196 Hex ESC encoding
22198 @item
22202 @tab
22204 Upper half encoding
22206 @item
22210 @tab
22212 Shift-JIS encoding
22214 @item
22218 @tab
22220 EUC Encoding
22222 @item
22226 @tab
22228 UTF-8 encoding
22230 @item
22234 @tab
22236 Brackets encoding
22238 @end multitable
22241 The encoding methods match those that
22242 can be used in a source
22243 program, but there is no requirement that the encoding method used for
22244 the source program be the same as the encoding method used for files,
22245 and different files may use different encoding methods.
22247 The default encoding method for the standard files, and for opened files
22248 for which no WCEM parameter is given in the FORM string matches the
22249 wide character encoding specified for the main program (the default
22250 being brackets encoding if no coding method was specified with -gnatW).
22253 @table @asis
22255 @item `UTF-8 Coding'
22257 A wide character is represented using
22258 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22259 10646-1/Am.2.  Depending on the character value, the representation
22260 is a one, two, three, or four byte sequence:
22261 @end table
22263 @example
22264 16#000000#-16#00007f#: 2#0xxxxxxx#
22265 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
22266 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22267 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
22268 @end example
22271 @quotation
22273 where the @code{xxx} bits correspond to the left-padded bits of the
22274 21-bit character value.  Note that all lower half ASCII characters
22275 are represented as ASCII bytes and all upper half characters and
22276 other wide characters are represented as sequences of upper-half
22277 characters.
22278 @end quotation
22281 @table @asis
22283 @item `Brackets Coding'
22285 In this encoding, a wide wide character is represented by the following eight
22286 character sequence if is in wide character range
22287 @end table
22289 @example
22290 [ " a b c d " ]
22291 @end example
22294 @quotation
22296 and by the following ten character sequence if not
22297 @end quotation
22299 @example
22300 [ " a b c d e f " ]
22301 @end example
22304 @quotation
22306 where @code{a}, @code{b}, @code{c}, @code{d}, @code{e}, and @code{f}
22307 are the four or six hexadecimal
22308 characters (using uppercase letters) of the wide wide character code.  For
22309 example, @code{["01A345"]} is used to represent the wide wide character
22310 with code @code{16#01A345#}.
22312 This scheme is compatible with use of the full Wide_Wide_Character set.
22313 On input, brackets coding can also be used for upper half characters,
22314 e.g., @code{["C1"]} for lower case a.  However, on output, brackets notation
22315 is only used for wide characters with a code greater than @code{16#FF#}.
22316 @end quotation
22318 If is also possible to use the other Wide_Character encoding methods,
22319 such as Shift-JIS, but the other schemes cannot support the full range
22320 of wide wide characters.
22321 An attempt to output a character that cannot
22322 be represented using the encoding scheme for the file causes
22323 Constraint_Error to be raised.  An invalid wide character sequence on
22324 input also causes Constraint_Error to be raised.
22326 @menu
22327 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
22328 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
22330 @end menu
22332 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
22333 @anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2c7}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2c8}
22334 @subsection Stream Pointer Positioning
22337 @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22338 of stream pointer positioning (@ref{2b2,,Text_IO}).  There is one additional
22339 case:
22341 If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
22342 normal lower ASCII set, i.e. a character in the range:
22344 @example
22345 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
22346 @end example
22348 then although the logical position of the file pointer is unchanged by
22349 the @code{Look_Ahead} call, the stream is physically positioned past the
22350 wide character sequence.  Again this is to avoid the need for buffering
22351 or backup, and all @code{Wide_Wide_Text_IO} routines check the internal
22352 indication that this situation has occurred so that this is not visible
22353 to a normal program using @code{Wide_Wide_Text_IO}.  However, this discrepancy
22354 can be observed if the wide text file shares a stream with another file.
22356 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
22357 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2c9}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2ca}
22358 @subsection Reading and Writing Non-Regular Files
22361 As in the case of Text_IO, when a non-regular file is read, it is
22362 assumed that the file contains no page marks (any form characters are
22363 treated as data characters), and @code{End_Of_Page} always returns
22364 @code{False}.  Similarly, the end of file indication is not sticky, so
22365 it is possible to read beyond an end of file.
22367 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
22368 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2cb}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2cc}
22369 @section Stream_IO
22372 A stream file is a sequence of bytes, where individual elements are
22373 written to the file as described in the Ada Reference Manual.  The type
22374 @code{Stream_Element} is simply a byte.  There are two ways to read or
22375 write a stream file.
22378 @itemize *
22380 @item 
22381 The operations @code{Read} and @code{Write} directly read or write a
22382 sequence of stream elements with no control information.
22384 @item 
22385 The stream attributes applied to a stream file transfer data in the
22386 manner described for stream attributes.
22387 @end itemize
22389 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
22390 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2cd}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2ce}
22391 @section Text Translation
22394 @code{Text_Translation=xxx} may be used as the Form parameter
22395 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
22396 has no effect on Unix systems. Possible values are:
22399 @itemize *
22401 @item 
22402 @code{Yes} or @code{Text} is the default, which means to
22403 translate LF to/from CR/LF on Windows systems.
22405 @code{No} disables this translation; i.e. it
22406 uses binary mode. For output files, @code{Text_Translation=No}
22407 may be used to create Unix-style files on
22408 Windows.
22410 @item 
22411 @code{wtext} translation enabled in Unicode mode.
22412 (corresponds to _O_WTEXT).
22414 @item 
22415 @code{u8text} translation enabled in Unicode UTF-8 mode.
22416 (corresponds to O_U8TEXT).
22418 @item 
22419 @code{u16text} translation enabled in Unicode UTF-16
22420 mode. (corresponds to_O_U16TEXT).
22421 @end itemize
22423 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
22424 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2cf}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2d0}
22425 @section Shared Files
22428 Section A.14 of the Ada Reference Manual allows implementations to
22429 provide a wide variety of behavior if an attempt is made to access the
22430 same external file with two or more internal files.
22432 To provide a full range of functionality, while at the same time
22433 minimizing the problems of portability caused by this implementation
22434 dependence, GNAT handles file sharing as follows:
22437 @itemize *
22439 @item 
22440 In the absence of a @code{shared=xxx} form parameter, an attempt
22441 to open two or more files with the same full name is considered an error
22442 and is not supported.  The exception @code{Use_Error} will be
22443 raised.  Note that a file that is not explicitly closed by the program
22444 remains open until the program terminates.
22446 @item 
22447 If the form parameter @code{shared=no} appears in the form string, the
22448 file can be opened or created with its own separate stream identifier,
22449 regardless of whether other files sharing the same external file are
22450 opened.  The exact effect depends on how the C stream routines handle
22451 multiple accesses to the same external files using separate streams.
22453 @item 
22454 If the form parameter @code{shared=yes} appears in the form string for
22455 each of two or more files opened using the same full name, the same
22456 stream is shared between these files, and the semantics are as described
22457 in Ada Reference Manual, Section A.14.
22458 @end itemize
22460 When a program that opens multiple files with the same name is ported
22461 from another Ada compiler to GNAT, the effect will be that
22462 @code{Use_Error} is raised.
22464 The documentation of the original compiler and the documentation of the
22465 program should then be examined to determine if file sharing was
22466 expected, and @code{shared=xxx} parameters added to @code{Open}
22467 and @code{Create} calls as required.
22469 When a program is ported from GNAT to some other Ada compiler, no
22470 special attention is required unless the @code{shared=xxx} form
22471 parameter is used in the program.  In this case, you must examine the
22472 documentation of the new compiler to see if it supports the required
22473 file sharing semantics, and form strings modified appropriately.  Of
22474 course it may be the case that the program cannot be ported if the
22475 target compiler does not support the required functionality.  The best
22476 approach in writing portable code is to avoid file sharing (and hence
22477 the use of the @code{shared=xxx} parameter in the form string)
22478 completely.
22480 One common use of file sharing in Ada 83 is the use of instantiations of
22481 Sequential_IO on the same file with different types, to achieve
22482 heterogeneous input-output.  Although this approach will work in GNAT if
22483 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
22484 for this purpose (using the stream attributes)
22486 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
22487 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2d1}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2d2}
22488 @section Filenames encoding
22491 An encoding form parameter can be used to specify the filename
22492 encoding @code{encoding=xxx}.
22495 @itemize *
22497 @item 
22498 If the form parameter @code{encoding=utf8} appears in the form string, the
22499 filename must be encoded in UTF-8.
22501 @item 
22502 If the form parameter @code{encoding=8bits} appears in the form
22503 string, the filename must be a standard 8bits string.
22504 @end itemize
22506 In the absence of a @code{encoding=xxx} form parameter, the
22507 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
22508 variable. And if not set @code{utf8} is assumed.
22511 @table @asis
22513 @item `CP_ACP'
22515 The current system Windows ANSI code page.
22517 @item `CP_UTF8'
22519 UTF-8 encoding
22520 @end table
22522 This encoding form parameter is only supported on the Windows
22523 platform. On the other Operating Systems the run-time is supporting
22524 UTF-8 natively.
22526 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
22527 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2d3}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2d4}
22528 @section File content encoding
22531 For text files it is possible to specify the encoding to use. This is
22532 controlled by the by the @code{GNAT_CCS_ENCODING} environment
22533 variable. And if not set @code{TEXT} is assumed.
22535 The possible values are those supported on Windows:
22538 @table @asis
22540 @item `TEXT'
22542 Translated text mode
22544 @item `WTEXT'
22546 Translated unicode encoding
22548 @item `U16TEXT'
22550 Unicode 16-bit encoding
22552 @item `U8TEXT'
22554 Unicode 8-bit encoding
22555 @end table
22557 This encoding is only supported on the Windows platform.
22559 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
22560 @anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2d5}@anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2d6}
22561 @section Open Modes
22564 @code{Open} and @code{Create} calls result in a call to @code{fopen}
22565 using the mode shown in the following table:
22568 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx} 
22569 @headitem
22571 @code{Open} and @code{Create} Call Modes
22573 @tab
22575 @tab
22577 @item
22579 @tab
22581 `OPEN'
22583 @tab
22585 `CREATE'
22587 @item
22589 Append_File
22591 @tab
22593 “r+”
22595 @tab
22597 “w+”
22599 @item
22601 In_File
22603 @tab
22605 “r”
22607 @tab
22609 “w+”
22611 @item
22613 Out_File (Direct_IO)
22615 @tab
22617 “r+”
22619 @tab
22621 “w”
22623 @item
22625 Out_File (all other cases)
22627 @tab
22629 “w”
22631 @tab
22633 “w”
22635 @item
22637 Inout_File
22639 @tab
22641 “r+”
22643 @tab
22645 “w+”
22647 @end multitable
22650 If text file translation is required, then either @code{b} or @code{t}
22651 is added to the mode, depending on the setting of Text.  Text file
22652 translation refers to the mapping of CR/LF sequences in an external file
22653 to LF characters internally.  This mapping only occurs in DOS and
22654 DOS-like systems, and is not relevant to other systems.
22656 A special case occurs with Stream_IO.  As shown in the above table, the
22657 file is initially opened in @code{r} or @code{w} mode for the
22658 @code{In_File} and @code{Out_File} cases.  If a @code{Set_Mode} operation
22659 subsequently requires switching from reading to writing or vice-versa,
22660 then the file is reopened in @code{r+} mode to permit the required operation.
22662 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22663 @anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2d7}@anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2d8}
22664 @section Operations on C Streams
22667 The package @code{Interfaces.C_Streams} provides an Ada program with direct
22668 access to the C library functions for operations on C streams:
22670 @example
22671 package Interfaces.C_Streams is
22672   -- Note: the reason we do not use the types that are in
22673   -- Interfaces.C is that we want to avoid dragging in the
22674   -- code in this unit if possible.
22675   subtype chars is System.Address;
22676   -- Pointer to null-terminated array of characters
22677   subtype FILEs is System.Address;
22678   -- Corresponds to the C type FILE*
22679   subtype voids is System.Address;
22680   -- Corresponds to the C type void*
22681   subtype int is Integer;
22682   subtype long is Long_Integer;
22683   -- Note: the above types are subtypes deliberately, and it
22684   -- is part of this spec that the above correspondences are
22685   -- guaranteed.  This means that it is legitimate to, for
22686   -- example, use Integer instead of int.  We provide these
22687   -- synonyms for clarity, but in some cases it may be
22688   -- convenient to use the underlying types (for example to
22689   -- avoid an unnecessary dependency of a spec on the spec
22690   -- of this unit).
22691   type size_t is mod 2 ** Standard'Address_Size;
22692   NULL_Stream : constant FILEs;
22693   -- Value returned (NULL in C) to indicate an
22694   -- fdopen/fopen/tmpfile error
22695   ----------------------------------
22696   -- Constants Defined in stdio.h --
22697   ----------------------------------
22698   EOF : constant int;
22699   -- Used by a number of routines to indicate error or
22700   -- end of file
22701   IOFBF : constant int;
22702   IOLBF : constant int;
22703   IONBF : constant int;
22704   -- Used to indicate buffering mode for setvbuf call
22705   SEEK_CUR : constant int;
22706   SEEK_END : constant int;
22707   SEEK_SET : constant int;
22708   -- Used to indicate origin for fseek call
22709   function stdin return FILEs;
22710   function stdout return FILEs;
22711   function stderr return FILEs;
22712   -- Streams associated with standard files
22713   --------------------------
22714   -- Standard C functions --
22715   --------------------------
22716   -- The functions selected below are ones that are
22717   -- available in UNIX (but not necessarily in ANSI C).
22718   -- These are very thin interfaces
22719   -- which copy exactly the C headers.  For more
22720   -- documentation on these functions, see the Microsoft C
22721   -- "Run-Time Library Reference" (Microsoft Press, 1990,
22722   -- ISBN 1-55615-225-6), which includes useful information
22723   -- on system compatibility.
22724   procedure clearerr (stream : FILEs);
22725   function fclose (stream : FILEs) return int;
22726   function fdopen (handle : int; mode : chars) return FILEs;
22727   function feof (stream : FILEs) return int;
22728   function ferror (stream : FILEs) return int;
22729   function fflush (stream : FILEs) return int;
22730   function fgetc (stream : FILEs) return int;
22731   function fgets (strng : chars; n : int; stream : FILEs)
22732       return chars;
22733   function fileno (stream : FILEs) return int;
22734   function fopen (filename : chars; Mode : chars)
22735       return FILEs;
22736   -- Note: to maintain target independence, use
22737   -- text_translation_required, a boolean variable defined in
22738   -- a-sysdep.c to deal with the target dependent text
22739   -- translation requirement.  If this variable is set,
22740   -- then  b/t should be appended to the standard mode
22741   -- argument to set the text translation mode off or on
22742   -- as required.
22743   function fputc (C : int; stream : FILEs) return int;
22744   function fputs (Strng : chars; Stream : FILEs) return int;
22745   function fread
22746      (buffer : voids;
22747       size : size_t;
22748       count : size_t;
22749       stream : FILEs)
22750       return size_t;
22751   function freopen
22752      (filename : chars;
22753       mode : chars;
22754       stream : FILEs)
22755       return FILEs;
22756   function fseek
22757      (stream : FILEs;
22758       offset : long;
22759       origin : int)
22760       return int;
22761   function ftell (stream : FILEs) return long;
22762   function fwrite
22763      (buffer : voids;
22764       size : size_t;
22765       count : size_t;
22766       stream : FILEs)
22767       return size_t;
22768   function isatty (handle : int) return int;
22769   procedure mktemp (template : chars);
22770   -- The return value (which is just a pointer to template)
22771   -- is discarded
22772   procedure rewind (stream : FILEs);
22773   function rmtmp return int;
22774   function setvbuf
22775      (stream : FILEs;
22776       buffer : chars;
22777       mode : int;
22778       size : size_t)
22779       return int;
22781   function tmpfile return FILEs;
22782   function ungetc (c : int; stream : FILEs) return int;
22783   function unlink (filename : chars) return int;
22784   ---------------------
22785   -- Extra functions --
22786   ---------------------
22787   -- These functions supply slightly thicker bindings than
22788   -- those above.  They are derived from functions in the
22789   -- C Run-Time Library, but may do a bit more work than
22790   -- just directly calling one of the Library functions.
22791   function is_regular_file (handle : int) return int;
22792   -- Tests if given handle is for a regular file (result 1)
22793   -- or for a non-regular file (pipe or device, result 0).
22794   ---------------------------------
22795   -- Control of Text/Binary Mode --
22796   ---------------------------------
22797   -- If text_translation_required is true, then the following
22798   -- functions may be used to dynamically switch a file from
22799   -- binary to text mode or vice versa.  These functions have
22800   -- no effect if text_translation_required is false (i.e., in
22801   -- normal UNIX mode).  Use fileno to get a stream handle.
22802   procedure set_binary_mode (handle : int);
22803   procedure set_text_mode (handle : int);
22804   ----------------------------
22805   -- Full Path Name support --
22806   ----------------------------
22807   procedure full_name (nam : chars; buffer : chars);
22808   -- Given a NUL terminated string representing a file
22809   -- name, returns in buffer a NUL terminated string
22810   -- representing the full path name for the file name.
22811   -- On systems where it is relevant the   drive is also
22812   -- part of the full path name.  It is the responsibility
22813   -- of the caller to pass an actual parameter for buffer
22814   -- that is big enough for any full path name.  Use
22815   -- max_path_len given below as the size of buffer.
22816   max_path_len : integer;
22817   -- Maximum length of an allowable full path name on the
22818   -- system, including a terminating NUL character.
22819 end Interfaces.C_Streams;
22820 @end example
22822 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
22823 @anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2d9}@anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2da}
22824 @section Interfacing to C Streams
22827 The packages in this section permit interfacing Ada files to C Stream
22828 operations.
22830 @example
22831 with Interfaces.C_Streams;
22832 package Ada.Sequential_IO.C_Streams is
22833    function C_Stream (F : File_Type)
22834       return Interfaces.C_Streams.FILEs;
22835    procedure Open
22836      (File : in out File_Type;
22837       Mode : in File_Mode;
22838       C_Stream : in Interfaces.C_Streams.FILEs;
22839       Form : in String := "");
22840 end Ada.Sequential_IO.C_Streams;
22842  with Interfaces.C_Streams;
22843  package Ada.Direct_IO.C_Streams is
22844     function C_Stream (F : File_Type)
22845        return Interfaces.C_Streams.FILEs;
22846     procedure Open
22847       (File : in out File_Type;
22848        Mode : in File_Mode;
22849        C_Stream : in Interfaces.C_Streams.FILEs;
22850        Form : in String := "");
22851  end Ada.Direct_IO.C_Streams;
22853  with Interfaces.C_Streams;
22854  package Ada.Text_IO.C_Streams is
22855     function C_Stream (F : File_Type)
22856        return Interfaces.C_Streams.FILEs;
22857     procedure Open
22858       (File : in out File_Type;
22859        Mode : in File_Mode;
22860        C_Stream : in Interfaces.C_Streams.FILEs;
22861        Form : in String := "");
22862  end Ada.Text_IO.C_Streams;
22864  with Interfaces.C_Streams;
22865  package Ada.Wide_Text_IO.C_Streams is
22866     function C_Stream (F : File_Type)
22867        return Interfaces.C_Streams.FILEs;
22868     procedure Open
22869       (File : in out File_Type;
22870        Mode : in File_Mode;
22871        C_Stream : in Interfaces.C_Streams.FILEs;
22872        Form : in String := "");
22873 end Ada.Wide_Text_IO.C_Streams;
22875  with Interfaces.C_Streams;
22876  package Ada.Wide_Wide_Text_IO.C_Streams is
22877     function C_Stream (F : File_Type)
22878        return Interfaces.C_Streams.FILEs;
22879     procedure Open
22880       (File : in out File_Type;
22881        Mode : in File_Mode;
22882        C_Stream : in Interfaces.C_Streams.FILEs;
22883        Form : in String := "");
22884 end Ada.Wide_Wide_Text_IO.C_Streams;
22886 with Interfaces.C_Streams;
22887 package Ada.Stream_IO.C_Streams is
22888    function C_Stream (F : File_Type)
22889       return Interfaces.C_Streams.FILEs;
22890    procedure Open
22891      (File : in out File_Type;
22892       Mode : in File_Mode;
22893       C_Stream : in Interfaces.C_Streams.FILEs;
22894       Form : in String := "");
22895 end Ada.Stream_IO.C_Streams;
22896 @end example
22898 In each of these six packages, the @code{C_Stream} function obtains the
22899 @code{FILE} pointer from a currently opened Ada file.  It is then
22900 possible to use the @code{Interfaces.C_Streams} package to operate on
22901 this stream, or the stream can be passed to a C program which can
22902 operate on it directly.  Of course the program is responsible for
22903 ensuring that only appropriate sequences of operations are executed.
22905 One particular use of relevance to an Ada program is that the
22906 @code{setvbuf} function can be used to control the buffering of the
22907 stream used by an Ada file.  In the absence of such a call the standard
22908 default buffering is used.
22910 The @code{Open} procedures in these packages open a file giving an
22911 existing C Stream instead of a file name.  Typically this stream is
22912 imported from a C program, allowing an Ada file to operate on an
22913 existing C file.
22915 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
22916 @anchor{gnat_rm/the_gnat_library doc}@anchor{2db}@anchor{gnat_rm/the_gnat_library id1}@anchor{2dc}@anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}
22917 @chapter The GNAT Library
22920 The GNAT library contains a number of general and special purpose packages.
22921 It represents functionality that the GNAT developers have found useful, and
22922 which is made available to GNAT users.  The packages described here are fully
22923 supported, and upwards compatibility will be maintained in future releases,
22924 so you can use these facilities with the confidence that the same functionality
22925 will be available in future releases.
22927 The chapter here simply gives a brief summary of the facilities available.
22928 The full documentation is found in the spec file for the package.  The full
22929 sources of these library packages, including both spec and body, are provided
22930 with all GNAT releases.  For example, to find out the full specifications of
22931 the SPITBOL pattern matching capability, including a full tutorial and
22932 extensive examples, look in the @code{g-spipat.ads} file in the library.
22934 For each entry here, the package name (as it would appear in a @code{with}
22935 clause) is given, followed by the name of the corresponding spec file in
22936 parentheses.  The packages are children in four hierarchies, @code{Ada},
22937 @code{Interfaces}, @code{System}, and @code{GNAT}, the latter being a
22938 GNAT-specific hierarchy.
22940 Note that an application program should only use packages in one of these
22941 four hierarchies if the package is defined in the Ada Reference Manual,
22942 or is listed in this section of the GNAT Programmers Reference Manual.
22943 All other units should be considered internal implementation units and
22944 should not be directly @code{with}ed by application code.  The use of
22945 a @code{with} clause that references one of these internal implementation
22946 units makes an application potentially dependent on changes in versions
22947 of GNAT, and will generate a warning message.
22949 @menu
22950 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
22951 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
22952 * Ada.Characters.Wide_Latin_9 (a-cwila9.ads): Ada Characters Wide_Latin_9 a-cwila9 ads. 
22953 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
22954 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
22955 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
22956 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
22957 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
22958 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
22959 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
22960 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
22961 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
22962 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
22963 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
22964 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
22965 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
22966 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
22967 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
22968 * Ada.Task_Initialization (a-tasini.ads): Ada Task_Initialization a-tasini ads. 
22969 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
22970 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
22971 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
22972 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
22973 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
22974 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
22975 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
22976 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
22977 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
22978 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
22979 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
22980 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
22981 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
22982 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
22983 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
22984 * GNAT.Binary_Search (g-binsea.ads): GNAT Binary_Search g-binsea ads. 
22985 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
22986 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads. 
22987 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
22988 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
22989 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
22990 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
22991 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
22992 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
22993 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
22994 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
22995 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
22996 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
22997 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
22998 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
22999 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
23000 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
23001 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
23002 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
23003 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
23004 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
23005 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
23006 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
23007 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
23008 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
23009 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
23010 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
23011 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
23012 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
23013 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
23014 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
23015 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
23016 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
23017 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads. 
23018 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
23019 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
23020 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
23021 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
23022 * GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads): GNAT Generic_Fast_Math_Functions g-gfmafu ads. 
23023 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
23024 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
23025 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
23026 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
23027 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
23028 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
23029 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
23030 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
23031 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
23032 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
23033 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
23034 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
23035 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
23036 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
23037 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
23038 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
23039 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
23040 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
23041 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
23042 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
23043 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
23044 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
23045 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
23046 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
23047 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
23048 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
23049 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
23050 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
23051 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
23052 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
23053 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
23054 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
23055 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
23056 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
23057 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
23058 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
23059 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
23060 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
23061 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
23062 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
23063 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
23064 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
23065 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
23066 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
23067 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
23068 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
23069 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
23070 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
23071 * GNAT.UTF_32 (g-utf_32.ads): GNAT UTF_32 g-utf_32 ads. 
23072 * GNAT.UTF_32_Spelling_Checker (g-u3spch.ads): GNAT UTF_32_Spelling_Checker g-u3spch ads. 
23073 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
23074 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
23075 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
23076 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
23077 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
23078 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
23079 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
23080 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
23081 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads. 
23082 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
23083 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
23084 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
23085 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
23086 * System.Memory (s-memory.ads): System Memory s-memory ads. 
23087 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
23088 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
23089 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
23090 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
23091 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
23092 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
23093 * System.Rident (s-rident.ads): System Rident s-rident ads. 
23094 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
23095 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
23096 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
23097 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
23099 @end menu
23101 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
23102 @anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2dd}@anchor{gnat_rm/the_gnat_library id2}@anchor{2de}
23103 @section @code{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
23106 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
23108 @geindex Latin_9 constants for Character
23110 This child of @code{Ada.Characters}
23111 provides a set of definitions corresponding to those in the
23112 RM-defined package @code{Ada.Characters.Latin_1} but with the
23113 few modifications required for @code{Latin-9}.
23114 The provision of such a package
23115 is specifically authorized by the Ada Reference Manual
23116 (RM A.3.3(27)).
23118 @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
23119 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2df}@anchor{gnat_rm/the_gnat_library id3}@anchor{2e0}
23120 @section @code{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
23123 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
23125 @geindex Latin_1 constants for Wide_Character
23127 This child of @code{Ada.Characters}
23128 provides a set of definitions corresponding to those in the
23129 RM-defined package @code{Ada.Characters.Latin_1} but with the
23130 types of the constants being @code{Wide_Character}
23131 instead of @code{Character}.  The provision of such a package
23132 is specifically authorized by the Ada Reference Manual
23133 (RM A.3.3(27)).
23135 @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
23136 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila9-ads}@anchor{2e1}@anchor{gnat_rm/the_gnat_library id4}@anchor{2e2}
23137 @section @code{Ada.Characters.Wide_Latin_9} (@code{a-cwila9.ads})
23140 @geindex Ada.Characters.Wide_Latin_9 (a-cwila9.ads)
23142 @geindex Latin_9 constants for Wide_Character
23144 This child of @code{Ada.Characters}
23145 provides a set of definitions corresponding to those in the
23146 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23147 types of the constants being @code{Wide_Character}
23148 instead of @code{Character}.  The provision of such a package
23149 is specifically authorized by the Ada Reference Manual
23150 (RM A.3.3(27)).
23152 @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
23153 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2e3}@anchor{gnat_rm/the_gnat_library id5}@anchor{2e4}
23154 @section @code{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
23157 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
23159 @geindex Latin_1 constants for Wide_Wide_Character
23161 This child of @code{Ada.Characters}
23162 provides a set of definitions corresponding to those in the
23163 RM-defined package @code{Ada.Characters.Latin_1} but with the
23164 types of the constants being @code{Wide_Wide_Character}
23165 instead of @code{Character}.  The provision of such a package
23166 is specifically authorized by the Ada Reference Manual
23167 (RM A.3.3(27)).
23169 @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
23170 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2e5}@anchor{gnat_rm/the_gnat_library id6}@anchor{2e6}
23171 @section @code{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
23174 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
23176 @geindex Latin_9 constants for Wide_Wide_Character
23178 This child of @code{Ada.Characters}
23179 provides a set of definitions corresponding to those in the
23180 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23181 types of the constants being @code{Wide_Wide_Character}
23182 instead of @code{Character}.  The provision of such a package
23183 is specifically authorized by the Ada Reference Manual
23184 (RM A.3.3(27)).
23186 @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
23187 @anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2e7}@anchor{gnat_rm/the_gnat_library id7}@anchor{2e8}
23188 @section @code{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
23191 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
23193 @geindex Formal container for vectors
23195 This child of @code{Ada.Containers} defines a modified version of
23196 Indefinite_Holders that avoids heap allocation.
23198 @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
23199 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2e9}@anchor{gnat_rm/the_gnat_library id8}@anchor{2ea}
23200 @section @code{Ada.Command_Line.Environment} (@code{a-colien.ads})
23203 @geindex Ada.Command_Line.Environment (a-colien.ads)
23205 @geindex Environment entries
23207 This child of @code{Ada.Command_Line}
23208 provides a mechanism for obtaining environment values on systems
23209 where this concept makes sense.
23211 @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
23212 @anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2eb}@anchor{gnat_rm/the_gnat_library id9}@anchor{2ec}
23213 @section @code{Ada.Command_Line.Remove} (@code{a-colire.ads})
23216 @geindex Ada.Command_Line.Remove (a-colire.ads)
23218 @geindex Removing command line arguments
23220 @geindex Command line
23221 @geindex argument removal
23223 This child of @code{Ada.Command_Line}
23224 provides a mechanism for logically removing
23225 arguments from the argument list.  Once removed, an argument is not visible
23226 to further calls to the subprograms in @code{Ada.Command_Line}. These calls
23227 will not see the removed argument.
23229 @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
23230 @anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2ed}@anchor{gnat_rm/the_gnat_library id10}@anchor{2ee}
23231 @section @code{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
23234 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
23236 @geindex Response file for command line
23238 @geindex Command line
23239 @geindex response file
23241 @geindex Command line
23242 @geindex handling long command lines
23244 This child of @code{Ada.Command_Line} provides a mechanism facilities for
23245 getting command line arguments from a text file, called a “response file”.
23246 Using a response file allow passing a set of arguments to an executable longer
23247 than the maximum allowed by the system on the command line.
23249 @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
23250 @anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2ef}@anchor{gnat_rm/the_gnat_library id11}@anchor{2f0}
23251 @section @code{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
23254 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
23256 @geindex C Streams
23257 @geindex Interfacing with Direct_IO
23259 This package provides subprograms that allow interfacing between
23260 C streams and @code{Direct_IO}.  The stream identifier can be
23261 extracted from a file opened on the Ada side, and an Ada file
23262 can be constructed from a stream opened on the C side.
23264 @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
23265 @anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2f1}@anchor{gnat_rm/the_gnat_library id12}@anchor{2f2}
23266 @section @code{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
23269 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
23271 @geindex Null_Occurrence
23272 @geindex testing for
23274 This child subprogram provides a way of testing for the null
23275 exception occurrence (@code{Null_Occurrence}) without raising
23276 an exception.
23278 @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
23279 @anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{2f3}@anchor{gnat_rm/the_gnat_library id13}@anchor{2f4}
23280 @section @code{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
23283 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
23285 @geindex Null_Occurrence
23286 @geindex testing for
23288 This child subprogram is used for handling otherwise unhandled
23289 exceptions (hence the name last chance), and perform clean ups before
23290 terminating the program. Note that this subprogram never returns.
23292 @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
23293 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{2f5}@anchor{gnat_rm/the_gnat_library id14}@anchor{2f6}
23294 @section @code{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
23297 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
23299 @geindex Traceback for Exception Occurrence
23301 This child package provides the subprogram (@code{Tracebacks}) to
23302 give a traceback array of addresses based on an exception
23303 occurrence.
23305 @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
23306 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{2f7}@anchor{gnat_rm/the_gnat_library id15}@anchor{2f8}
23307 @section @code{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
23310 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
23312 @geindex C Streams
23313 @geindex Interfacing with Sequential_IO
23315 This package provides subprograms that allow interfacing between
23316 C streams and @code{Sequential_IO}.  The stream identifier can be
23317 extracted from a file opened on the Ada side, and an Ada file
23318 can be constructed from a stream opened on the C side.
23320 @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
23321 @anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{2f9}@anchor{gnat_rm/the_gnat_library id16}@anchor{2fa}
23322 @section @code{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
23325 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
23327 @geindex C Streams
23328 @geindex Interfacing with Stream_IO
23330 This package provides subprograms that allow interfacing between
23331 C streams and @code{Stream_IO}.  The stream identifier can be
23332 extracted from a file opened on the Ada side, and an Ada file
23333 can be constructed from a stream opened on the C side.
23335 @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
23336 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{2fb}@anchor{gnat_rm/the_gnat_library id17}@anchor{2fc}
23337 @section @code{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
23340 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
23342 @geindex Unbounded_String
23343 @geindex IO support
23345 @geindex Text_IO
23346 @geindex extensions for unbounded strings
23348 This package provides subprograms for Text_IO for unbounded
23349 strings, avoiding the necessity for an intermediate operation
23350 with ordinary strings.
23352 @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
23353 @anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{2fd}@anchor{gnat_rm/the_gnat_library id18}@anchor{2fe}
23354 @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
23357 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
23359 @geindex Unbounded_Wide_String
23360 @geindex IO support
23362 @geindex Text_IO
23363 @geindex extensions for unbounded wide strings
23365 This package provides subprograms for Text_IO for unbounded
23366 wide strings, avoiding the necessity for an intermediate operation
23367 with ordinary wide strings.
23369 @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
23370 @anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{2ff}@anchor{gnat_rm/the_gnat_library id19}@anchor{300}
23371 @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
23374 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
23376 @geindex Unbounded_Wide_Wide_String
23377 @geindex IO support
23379 @geindex Text_IO
23380 @geindex extensions for unbounded wide wide strings
23382 This package provides subprograms for Text_IO for unbounded
23383 wide wide strings, avoiding the necessity for an intermediate operation
23384 with ordinary wide wide strings.
23386 @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
23387 @anchor{gnat_rm/the_gnat_library ada-task-initialization-a-tasini-ads}@anchor{301}@anchor{gnat_rm/the_gnat_library id20}@anchor{302}
23388 @section @code{Ada.Task_Initialization} (@code{a-tasini.ads})
23391 @geindex Ada.Task_Initialization (a-tasini.ads)
23393 This package provides a way to set a global initialization handler that
23394 is automatically invoked whenever a task is activated. Handlers are
23395 parameterless procedures. Note that such a handler is only invoked for
23396 those tasks activated after the handler is set.
23398 @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
23399 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{303}@anchor{gnat_rm/the_gnat_library id21}@anchor{304}
23400 @section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
23403 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
23405 @geindex C Streams
23406 @geindex Interfacing with `@w{`}Text_IO`@w{`}
23408 This package provides subprograms that allow interfacing between
23409 C streams and @code{Text_IO}.  The stream identifier can be
23410 extracted from a file opened on the Ada side, and an Ada file
23411 can be constructed from a stream opened on the C side.
23413 @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
23414 @anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{305}@anchor{gnat_rm/the_gnat_library id22}@anchor{306}
23415 @section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
23418 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
23420 @geindex Text_IO resetting standard files
23422 This procedure is used to reset the status of the standard files used
23423 by Ada.Text_IO.  This is useful in a situation (such as a restart in an
23424 embedded application) where the status of the files may change during
23425 execution (for example a standard input file may be redefined to be
23426 interactive).
23428 @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
23429 @anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{307}@anchor{gnat_rm/the_gnat_library id23}@anchor{308}
23430 @section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
23433 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
23435 @geindex Unicode categorization
23436 @geindex Wide_Character
23438 This package provides subprograms that allow categorization of
23439 Wide_Character values according to Unicode categories.
23441 @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
23442 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{309}@anchor{gnat_rm/the_gnat_library id24}@anchor{30a}
23443 @section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
23446 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
23448 @geindex C Streams
23449 @geindex Interfacing with `@w{`}Wide_Text_IO`@w{`}
23451 This package provides subprograms that allow interfacing between
23452 C streams and @code{Wide_Text_IO}.  The stream identifier can be
23453 extracted from a file opened on the Ada side, and an Ada file
23454 can be constructed from a stream opened on the C side.
23456 @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
23457 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{30b}@anchor{gnat_rm/the_gnat_library id25}@anchor{30c}
23458 @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
23461 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
23463 @geindex Wide_Text_IO resetting standard files
23465 This procedure is used to reset the status of the standard files used
23466 by Ada.Wide_Text_IO.  This is useful in a situation (such as a restart in an
23467 embedded application) where the status of the files may change during
23468 execution (for example a standard input file may be redefined to be
23469 interactive).
23471 @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
23472 @anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{30d}@anchor{gnat_rm/the_gnat_library id26}@anchor{30e}
23473 @section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
23476 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
23478 @geindex Unicode categorization
23479 @geindex Wide_Wide_Character
23481 This package provides subprograms that allow categorization of
23482 Wide_Wide_Character values according to Unicode categories.
23484 @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
23485 @anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{30f}@anchor{gnat_rm/the_gnat_library id27}@anchor{310}
23486 @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
23489 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
23491 @geindex C Streams
23492 @geindex Interfacing with `@w{`}Wide_Wide_Text_IO`@w{`}
23494 This package provides subprograms that allow interfacing between
23495 C streams and @code{Wide_Wide_Text_IO}.  The stream identifier can be
23496 extracted from a file opened on the Ada side, and an Ada file
23497 can be constructed from a stream opened on the C side.
23499 @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
23500 @anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{311}@anchor{gnat_rm/the_gnat_library id28}@anchor{312}
23501 @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23504 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23506 @geindex Wide_Wide_Text_IO resetting standard files
23508 This procedure is used to reset the status of the standard files used
23509 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23510 restart in an embedded application) where the status of the files may
23511 change during execution (for example a standard input file may be
23512 redefined to be interactive).
23514 @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
23515 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{313}@anchor{gnat_rm/the_gnat_library id29}@anchor{314}
23516 @section @code{GNAT.Altivec} (@code{g-altive.ads})
23519 @geindex GNAT.Altivec (g-altive.ads)
23521 @geindex AltiVec
23523 This is the root package of the GNAT AltiVec binding. It provides
23524 definitions of constants and types common to all the versions of the
23525 binding.
23527 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23528 @anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{315}@anchor{gnat_rm/the_gnat_library id30}@anchor{316}
23529 @section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23532 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23534 @geindex AltiVec
23536 This package provides the Vector/View conversion routines.
23538 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23539 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{317}@anchor{gnat_rm/the_gnat_library id31}@anchor{318}
23540 @section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23543 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23545 @geindex AltiVec
23547 This package exposes the Ada interface to the AltiVec operations on
23548 vector objects. A soft emulation is included by default in the GNAT
23549 library. The hard binding is provided as a separate package. This unit
23550 is common to both bindings.
23552 @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
23553 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{319}@anchor{gnat_rm/the_gnat_library id32}@anchor{31a}
23554 @section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23557 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23559 @geindex AltiVec
23561 This package exposes the various vector types part of the Ada binding
23562 to AltiVec facilities.
23564 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23565 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{31b}@anchor{gnat_rm/the_gnat_library id33}@anchor{31c}
23566 @section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23569 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23571 @geindex AltiVec
23573 This package provides public ‘View’ data types from/to which private
23574 vector representations can be converted via
23575 GNAT.Altivec.Conversions. This allows convenient access to individual
23576 vector elements and provides a simple way to initialize vector
23577 objects.
23579 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23580 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{31d}@anchor{gnat_rm/the_gnat_library id34}@anchor{31e}
23581 @section @code{GNAT.Array_Split} (@code{g-arrspl.ads})
23584 @geindex GNAT.Array_Split (g-arrspl.ads)
23586 @geindex Array splitter
23588 Useful array-manipulation routines: given a set of separators, split
23589 an array wherever the separators appear, and provide direct access
23590 to the resulting slices.
23592 @node GNAT AWK g-awk ads,GNAT Binary_Search g-binsea ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23593 @anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{31f}@anchor{gnat_rm/the_gnat_library id35}@anchor{320}
23594 @section @code{GNAT.AWK} (@code{g-awk.ads})
23597 @geindex GNAT.AWK (g-awk.ads)
23599 @geindex Parsing
23601 @geindex AWK
23603 Provides AWK-like parsing functions, with an easy interface for parsing one
23604 or more files containing formatted data.  The file is viewed as a database
23605 where each record is a line and a field is a data element in this line.
23607 @node GNAT Binary_Search g-binsea ads,GNAT Bind_Environment g-binenv ads,GNAT AWK g-awk ads,The GNAT Library
23608 @anchor{gnat_rm/the_gnat_library gnat-binary-search-g-binsea-ads}@anchor{321}@anchor{gnat_rm/the_gnat_library id36}@anchor{322}
23609 @section @code{GNAT.Binary_Search} (@code{g-binsea.ads})
23612 @geindex GNAT.Binary_Search (g-binsea.ads)
23614 @geindex Binary search
23616 Allow binary search of a sorted array (or of an array-like container;
23617 the generic does not reference the array directly).
23619 @node GNAT Bind_Environment g-binenv ads,GNAT Branch_Prediction g-brapre ads,GNAT Binary_Search g-binsea ads,The GNAT Library
23620 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{323}@anchor{gnat_rm/the_gnat_library id37}@anchor{324}
23621 @section @code{GNAT.Bind_Environment} (@code{g-binenv.ads})
23624 @geindex GNAT.Bind_Environment (g-binenv.ads)
23626 @geindex Bind environment
23628 Provides access to key=value associations captured at bind time.
23629 These associations can be specified using the @code{-V} binder command
23630 line switch.
23632 @node GNAT Branch_Prediction g-brapre ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
23633 @anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{325}@anchor{gnat_rm/the_gnat_library id38}@anchor{326}
23634 @section @code{GNAT.Branch_Prediction} (@code{g-brapre.ads})
23637 @geindex GNAT.Branch_Prediction (g-brapre.ads)
23639 @geindex Branch Prediction
23641 Provides routines giving hints to the branch predictor of the code generator.
23643 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Branch_Prediction g-brapre ads,The GNAT Library
23644 @anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{327}@anchor{gnat_rm/the_gnat_library id39}@anchor{328}
23645 @section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
23648 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
23650 @geindex Parsing
23652 @geindex Bounded Buffers
23654 Provides a concurrent generic bounded buffer abstraction.  Instances are
23655 useful directly or as parts of the implementations of other abstractions,
23656 such as mailboxes.
23658 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
23659 @anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{329}@anchor{gnat_rm/the_gnat_library id40}@anchor{32a}
23660 @section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
23663 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
23665 @geindex Parsing
23667 @geindex Mailboxes
23669 Provides a thread-safe asynchronous intertask mailbox communication facility.
23671 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
23672 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{32b}@anchor{gnat_rm/the_gnat_library id41}@anchor{32c}
23673 @section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
23676 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
23678 @geindex Sorting
23680 @geindex Bubble sort
23682 Provides a general implementation of bubble sort usable for sorting arbitrary
23683 data items.  Exchange and comparison procedures are provided by passing
23684 access-to-procedure values.
23686 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
23687 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{32d}@anchor{gnat_rm/the_gnat_library id42}@anchor{32e}
23688 @section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
23691 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
23693 @geindex Sorting
23695 @geindex Bubble sort
23697 Provides a general implementation of bubble sort usable for sorting arbitrary
23698 data items.  Move and comparison procedures are provided by passing
23699 access-to-procedure values. This is an older version, retained for
23700 compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
23702 @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
23703 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{32f}@anchor{gnat_rm/the_gnat_library id43}@anchor{330}
23704 @section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
23707 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
23709 @geindex Sorting
23711 @geindex Bubble sort
23713 Similar to @code{Bubble_Sort_A} except that the move and sorting procedures
23714 are provided as generic parameters, this improves efficiency, especially
23715 if the procedures can be inlined, at the expense of duplicating code for
23716 multiple instantiations.
23718 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
23719 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{331}@anchor{gnat_rm/the_gnat_library id44}@anchor{332}
23720 @section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
23723 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
23725 @geindex UTF-8 representation
23727 @geindex Wide characte representations
23729 Provides a routine which given a string, reads the start of the string to
23730 see whether it is one of the standard byte order marks (BOM’s) which signal
23731 the encoding of the string. The routine includes detection of special XML
23732 sequences for various UCS input formats.
23734 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
23735 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{333}@anchor{gnat_rm/the_gnat_library id45}@anchor{334}
23736 @section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
23739 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
23741 @geindex Byte swapping
23743 @geindex Endianness
23745 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
23746 Machine-specific implementations are available in some cases.
23748 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
23749 @anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{335}@anchor{gnat_rm/the_gnat_library id46}@anchor{336}
23750 @section @code{GNAT.Calendar} (@code{g-calend.ads})
23753 @geindex GNAT.Calendar (g-calend.ads)
23755 @geindex Calendar
23757 Extends the facilities provided by @code{Ada.Calendar} to include handling
23758 of days of the week, an extended @code{Split} and @code{Time_Of} capability.
23759 Also provides conversion of @code{Ada.Calendar.Time} values to and from the
23760 C @code{timeval} format.
23762 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
23763 @anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{337}@anchor{gnat_rm/the_gnat_library id47}@anchor{338}
23764 @section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
23767 @geindex Calendar
23769 @geindex Time
23771 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
23773 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
23774 @anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{339}@anchor{gnat_rm/the_gnat_library id48}@anchor{33a}
23775 @section @code{GNAT.CRC32} (@code{g-crc32.ads})
23778 @geindex GNAT.CRC32 (g-crc32.ads)
23780 @geindex CRC32
23782 @geindex Cyclic Redundancy Check
23784 This package implements the CRC-32 algorithm.  For a full description
23785 of this algorithm see
23786 `Computation of Cyclic Redundancy Checks via Table Look-Up',
23787 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
23788 Aug. 1988.  Sarwate, D.V.
23790 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
23791 @anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{33b}@anchor{gnat_rm/the_gnat_library id49}@anchor{33c}
23792 @section @code{GNAT.Case_Util} (@code{g-casuti.ads})
23795 @geindex GNAT.Case_Util (g-casuti.ads)
23797 @geindex Casing utilities
23799 @geindex Character handling (`@w{`}GNAT.Case_Util`@w{`})
23801 A set of simple routines for handling upper and lower casing of strings
23802 without the overhead of the full casing tables
23803 in @code{Ada.Characters.Handling}.
23805 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
23806 @anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{33d}@anchor{gnat_rm/the_gnat_library id50}@anchor{33e}
23807 @section @code{GNAT.CGI} (@code{g-cgi.ads})
23810 @geindex GNAT.CGI (g-cgi.ads)
23812 @geindex CGI (Common Gateway Interface)
23814 This is a package for interfacing a GNAT program with a Web server via the
23815 Common Gateway Interface (CGI).  Basically this package parses the CGI
23816 parameters, which are a set of key/value pairs sent by the Web server.  It
23817 builds a table whose index is the key and provides some services to deal
23818 with this table.
23820 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
23821 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{33f}@anchor{gnat_rm/the_gnat_library id51}@anchor{340}
23822 @section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
23825 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
23827 @geindex CGI (Common Gateway Interface) cookie support
23829 @geindex Cookie support in CGI
23831 This is a package to interface a GNAT program with a Web server via the
23832 Common Gateway Interface (CGI).  It exports services to deal with Web
23833 cookies (piece of information kept in the Web client software).
23835 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
23836 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{341}@anchor{gnat_rm/the_gnat_library id52}@anchor{342}
23837 @section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads})
23840 @geindex GNAT.CGI.Debug (g-cgideb.ads)
23842 @geindex CGI (Common Gateway Interface) debugging
23844 This is a package to help debugging CGI (Common Gateway Interface)
23845 programs written in Ada.
23847 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
23848 @anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{343}@anchor{gnat_rm/the_gnat_library id53}@anchor{344}
23849 @section @code{GNAT.Command_Line} (@code{g-comlin.ads})
23852 @geindex GNAT.Command_Line (g-comlin.ads)
23854 @geindex Command line
23856 Provides a high level interface to @code{Ada.Command_Line} facilities,
23857 including the ability to scan for named switches with optional parameters
23858 and expand file names using wildcard notations.
23860 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
23861 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{345}@anchor{gnat_rm/the_gnat_library id54}@anchor{346}
23862 @section @code{GNAT.Compiler_Version} (@code{g-comver.ads})
23865 @geindex GNAT.Compiler_Version (g-comver.ads)
23867 @geindex Compiler Version
23869 @geindex Version
23870 @geindex of compiler
23872 Provides a routine for obtaining the version of the compiler used to
23873 compile the program. More accurately this is the version of the binder
23874 used to bind the program (this will normally be the same as the version
23875 of the compiler if a consistent tool set is used to compile all units
23876 of a partition).
23878 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
23879 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{347}@anchor{gnat_rm/the_gnat_library id55}@anchor{348}
23880 @section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
23883 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
23885 @geindex Interrupt
23887 Provides a simple interface to handle Ctrl-C keyboard events.
23889 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
23890 @anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{349}@anchor{gnat_rm/the_gnat_library id56}@anchor{34a}
23891 @section @code{GNAT.Current_Exception} (@code{g-curexc.ads})
23894 @geindex GNAT.Current_Exception (g-curexc.ads)
23896 @geindex Current exception
23898 @geindex Exception retrieval
23900 Provides access to information on the current exception that has been raised
23901 without the need for using the Ada 95 / Ada 2005 exception choice parameter
23902 specification syntax.
23903 This is particularly useful in simulating typical facilities for
23904 obtaining information about exceptions provided by Ada 83 compilers.
23906 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
23907 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{34b}@anchor{gnat_rm/the_gnat_library id57}@anchor{34c}
23908 @section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads})
23911 @geindex GNAT.Debug_Pools (g-debpoo.ads)
23913 @geindex Debugging
23915 @geindex Debug pools
23917 @geindex Memory corruption debugging
23919 Provides a debugging storage pools that helps tracking memory corruption
23920 problems.
23921 See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User’s Guide}.
23923 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
23924 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{34d}@anchor{gnat_rm/the_gnat_library id58}@anchor{34e}
23925 @section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads})
23928 @geindex GNAT.Debug_Utilities (g-debuti.ads)
23930 @geindex Debugging
23932 Provides a few useful utilities for debugging purposes, including conversion
23933 to and from string images of address values. Supports both C and Ada formats
23934 for hexadecimal literals.
23936 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
23937 @anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{34f}@anchor{gnat_rm/the_gnat_library id59}@anchor{350}
23938 @section @code{GNAT.Decode_String} (@code{g-decstr.ads})
23941 @geindex GNAT.Decode_String (g-decstr.ads)
23943 @geindex Decoding strings
23945 @geindex String decoding
23947 @geindex Wide character encoding
23949 @geindex UTF-8
23951 @geindex Unicode
23953 A generic package providing routines for decoding wide character and wide wide
23954 character strings encoded as sequences of 8-bit characters using a specified
23955 encoding method. Includes validation routines, and also routines for stepping
23956 to next or previous encoded character in an encoded string.
23957 Useful in conjunction with Unicode character coding. Note there is a
23958 preinstantiation for UTF-8. See next entry.
23960 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
23961 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{351}@anchor{gnat_rm/the_gnat_library id60}@anchor{352}
23962 @section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
23965 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
23967 @geindex Decoding strings
23969 @geindex Decoding UTF-8 strings
23971 @geindex UTF-8 string decoding
23973 @geindex Wide character decoding
23975 @geindex UTF-8
23977 @geindex Unicode
23979 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
23981 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
23982 @anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{353}@anchor{gnat_rm/the_gnat_library id61}@anchor{354}
23983 @section @code{GNAT.Directory_Operations} (@code{g-dirope.ads})
23986 @geindex GNAT.Directory_Operations (g-dirope.ads)
23988 @geindex Directory operations
23990 Provides a set of routines for manipulating directories, including changing
23991 the current directory, making new directories, and scanning the files in a
23992 directory.
23994 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
23995 @anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{355}@anchor{gnat_rm/the_gnat_library id62}@anchor{356}
23996 @section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
23999 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
24001 @geindex Directory operations iteration
24003 A child unit of GNAT.Directory_Operations providing additional operations
24004 for iterating through directories.
24006 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
24007 @anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{357}@anchor{gnat_rm/the_gnat_library id63}@anchor{358}
24008 @section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
24011 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
24013 @geindex Hash tables
24015 A generic implementation of hash tables that can be used to hash arbitrary
24016 data.  Provided in two forms, a simple form with built in hash functions,
24017 and a more complex form in which the hash function is supplied.
24019 This package provides a facility similar to that of @code{GNAT.HTable},
24020 except that this package declares a type that can be used to define
24021 dynamic instances of the hash table, while an instantiation of
24022 @code{GNAT.HTable} creates a single instance of the hash table.
24024 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
24025 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{359}@anchor{gnat_rm/the_gnat_library id64}@anchor{35a}
24026 @section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
24029 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
24031 @geindex Table implementation
24033 @geindex Arrays
24034 @geindex extendable
24036 A generic package providing a single dimension array abstraction where the
24037 length of the array can be dynamically modified.
24039 This package provides a facility similar to that of @code{GNAT.Table},
24040 except that this package declares a type that can be used to define
24041 dynamic instances of the table, while an instantiation of
24042 @code{GNAT.Table} creates a single instance of the table type.
24044 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
24045 @anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{35b}@anchor{gnat_rm/the_gnat_library id65}@anchor{35c}
24046 @section @code{GNAT.Encode_String} (@code{g-encstr.ads})
24049 @geindex GNAT.Encode_String (g-encstr.ads)
24051 @geindex Encoding strings
24053 @geindex String encoding
24055 @geindex Wide character encoding
24057 @geindex UTF-8
24059 @geindex Unicode
24061 A generic package providing routines for encoding wide character and wide
24062 wide character strings as sequences of 8-bit characters using a specified
24063 encoding method. Useful in conjunction with Unicode character coding.
24064 Note there is a preinstantiation for UTF-8. See next entry.
24066 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
24067 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{35d}@anchor{gnat_rm/the_gnat_library id66}@anchor{35e}
24068 @section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
24071 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
24073 @geindex Encoding strings
24075 @geindex Encoding UTF-8 strings
24077 @geindex UTF-8 string encoding
24079 @geindex Wide character encoding
24081 @geindex UTF-8
24083 @geindex Unicode
24085 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
24087 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
24088 @anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{35f}@anchor{gnat_rm/the_gnat_library id67}@anchor{360}
24089 @section @code{GNAT.Exception_Actions} (@code{g-excact.ads})
24092 @geindex GNAT.Exception_Actions (g-excact.ads)
24094 @geindex Exception actions
24096 Provides callbacks when an exception is raised. Callbacks can be registered
24097 for specific exceptions, or when any exception is raised. This
24098 can be used for instance to force a core dump to ease debugging.
24100 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library
24101 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{361}@anchor{gnat_rm/the_gnat_library id68}@anchor{362}
24102 @section @code{GNAT.Exception_Traces} (@code{g-exctra.ads})
24105 @geindex GNAT.Exception_Traces (g-exctra.ads)
24107 @geindex Exception traces
24109 @geindex Debugging
24111 Provides an interface allowing to control automatic output upon exception
24112 occurrences.
24114 @node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
24115 @anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{363}@anchor{gnat_rm/the_gnat_library id69}@anchor{364}
24116 @section @code{GNAT.Exceptions} (@code{g-except.ads})
24119 @geindex GNAT.Exceptions (g-except.ads)
24121 @geindex Exceptions
24122 @geindex Pure
24124 @geindex Pure packages
24125 @geindex exceptions
24127 Normally it is not possible to raise an exception with
24128 a message from a subprogram in a pure package, since the
24129 necessary types and subprograms are in @code{Ada.Exceptions}
24130 which is not a pure unit. @code{GNAT.Exceptions} provides a
24131 facility for getting around this limitation for a few
24132 predefined exceptions, and for example allows raising
24133 @code{Constraint_Error} with a message from a pure subprogram.
24135 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library
24136 @anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{365}@anchor{gnat_rm/the_gnat_library id70}@anchor{366}
24137 @section @code{GNAT.Expect} (@code{g-expect.ads})
24140 @geindex GNAT.Expect (g-expect.ads)
24142 Provides a set of subprograms similar to what is available
24143 with the standard Tcl Expect tool.
24144 It allows you to easily spawn and communicate with an external process.
24145 You can send commands or inputs to the process, and compare the output
24146 with some expected regular expression. Currently @code{GNAT.Expect}
24147 is implemented on all native GNAT ports.
24148 It is not implemented for cross ports, and in particular is not
24149 implemented for VxWorks or LynxOS.
24151 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
24152 @anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{367}@anchor{gnat_rm/the_gnat_library id71}@anchor{368}
24153 @section @code{GNAT.Expect.TTY} (@code{g-exptty.ads})
24156 @geindex GNAT.Expect.TTY (g-exptty.ads)
24158 As GNAT.Expect but using pseudo-terminal.
24159 Currently @code{GNAT.Expect.TTY} is implemented on all native GNAT
24160 ports. It is not implemented for cross ports, and
24161 in particular is not implemented for VxWorks or LynxOS.
24163 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
24164 @anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{369}@anchor{gnat_rm/the_gnat_library id72}@anchor{36a}
24165 @section @code{GNAT.Float_Control} (@code{g-flocon.ads})
24168 @geindex GNAT.Float_Control (g-flocon.ads)
24170 @geindex Floating-Point Processor
24172 Provides an interface for resetting the floating-point processor into the
24173 mode required for correct semantic operation in Ada.  Some third party
24174 library calls may cause this mode to be modified, and the Reset procedure
24175 in this package can be used to reestablish the required mode.
24177 @node GNAT Formatted_String g-forstr ads,GNAT Generic_Fast_Math_Functions g-gfmafu ads,GNAT Float_Control g-flocon ads,The GNAT Library
24178 @anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{36b}@anchor{gnat_rm/the_gnat_library id73}@anchor{36c}
24179 @section @code{GNAT.Formatted_String} (@code{g-forstr.ads})
24182 @geindex GNAT.Formatted_String (g-forstr.ads)
24184 @geindex Formatted String
24186 Provides support for C/C++ printf() formatted strings. The format is
24187 copied from the printf() routine and should therefore give identical
24188 output. Some generic routines are provided to be able to use types
24189 derived from Integer, Float or enumerations as values for the
24190 formatted string.
24192 @node GNAT Generic_Fast_Math_Functions g-gfmafu ads,GNAT Heap_Sort g-heasor ads,GNAT Formatted_String g-forstr ads,The GNAT Library
24193 @anchor{gnat_rm/the_gnat_library gnat-generic-fast-math-functions-g-gfmafu-ads}@anchor{36d}@anchor{gnat_rm/the_gnat_library id74}@anchor{36e}
24194 @section @code{GNAT.Generic_Fast_Math_Functions} (@code{g-gfmafu.ads})
24197 @geindex GNAT.Generic_Fast_Math_Functions (g-gfmafu.ads)
24199 @geindex Mathematical functions
24201 Provides direct access to the underlying implementation of the common
24202 mathematical functions, generally from the system mathematical library.
24203 This differs from @code{Ada.Numerics.Generic_Elementary_Functions} in that
24204 the implementation may deviate from the semantics specified for these
24205 functions in the Reference Manual, for example @code{Numerics.Argument_Error}
24206 is not raised. On selected platforms, some of these functions may also
24207 have a vector implementation that can be automatically used by the
24208 compiler when auto-vectorization is enabled.
24210 @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
24211 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{36f}@anchor{gnat_rm/the_gnat_library id75}@anchor{370}
24212 @section @code{GNAT.Heap_Sort} (@code{g-heasor.ads})
24215 @geindex GNAT.Heap_Sort (g-heasor.ads)
24217 @geindex Sorting
24219 Provides a general implementation of heap sort usable for sorting arbitrary
24220 data items. Exchange and comparison procedures are provided by passing
24221 access-to-procedure values.  The algorithm used is a modified heap sort
24222 that performs approximately N*log(N) comparisons in the worst case.
24224 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
24225 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{371}@anchor{gnat_rm/the_gnat_library id76}@anchor{372}
24226 @section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
24229 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
24231 @geindex Sorting
24233 Provides a general implementation of heap sort usable for sorting arbitrary
24234 data items. Move and comparison procedures are provided by passing
24235 access-to-procedure values.  The algorithm used is a modified heap sort
24236 that performs approximately N*log(N) comparisons in the worst case.
24237 This differs from @code{GNAT.Heap_Sort} in having a less convenient
24238 interface, but may be slightly more efficient.
24240 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
24241 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{373}@anchor{gnat_rm/the_gnat_library id77}@anchor{374}
24242 @section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
24245 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
24247 @geindex Sorting
24249 Similar to @code{Heap_Sort_A} except that the move and sorting procedures
24250 are provided as generic parameters, this improves efficiency, especially
24251 if the procedures can be inlined, at the expense of duplicating code for
24252 multiple instantiations.
24254 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
24255 @anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{375}@anchor{gnat_rm/the_gnat_library id78}@anchor{376}
24256 @section @code{GNAT.HTable} (@code{g-htable.ads})
24259 @geindex GNAT.HTable (g-htable.ads)
24261 @geindex Hash tables
24263 A generic implementation of hash tables that can be used to hash arbitrary
24264 data.  Provides two approaches, one a simple static approach, and the other
24265 allowing arbitrary dynamic hash tables.
24267 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
24268 @anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{377}@anchor{gnat_rm/the_gnat_library id79}@anchor{378}
24269 @section @code{GNAT.IO} (@code{g-io.ads})
24272 @geindex GNAT.IO (g-io.ads)
24274 @geindex Simple I/O
24276 @geindex Input/Output facilities
24278 A simple preelaborable input-output package that provides a subset of
24279 simple Text_IO functions for reading characters and strings from
24280 Standard_Input, and writing characters, strings and integers to either
24281 Standard_Output or Standard_Error.
24283 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
24284 @anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{379}@anchor{gnat_rm/the_gnat_library id80}@anchor{37a}
24285 @section @code{GNAT.IO_Aux} (@code{g-io_aux.ads})
24288 @geindex GNAT.IO_Aux (g-io_aux.ads)
24290 @geindex Text_IO
24292 @geindex Input/Output facilities
24294 Provides some auxiliary functions for use with Text_IO, including a test
24295 for whether a file exists, and functions for reading a line of text.
24297 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
24298 @anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{37b}@anchor{gnat_rm/the_gnat_library id81}@anchor{37c}
24299 @section @code{GNAT.Lock_Files} (@code{g-locfil.ads})
24302 @geindex GNAT.Lock_Files (g-locfil.ads)
24304 @geindex File locking
24306 @geindex Locking using files
24308 Provides a general interface for using files as locks.  Can be used for
24309 providing program level synchronization.
24311 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
24312 @anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{37d}@anchor{gnat_rm/the_gnat_library id82}@anchor{37e}
24313 @section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
24316 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
24318 @geindex Random number generation
24320 The original implementation of @code{Ada.Numerics.Discrete_Random}.  Uses
24321 a modified version of the Blum-Blum-Shub generator.
24323 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
24324 @anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{37f}@anchor{gnat_rm/the_gnat_library id83}@anchor{380}
24325 @section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
24328 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
24330 @geindex Random number generation
24332 The original implementation of @code{Ada.Numerics.Float_Random}.  Uses
24333 a modified version of the Blum-Blum-Shub generator.
24335 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
24336 @anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{381}@anchor{gnat_rm/the_gnat_library id84}@anchor{382}
24337 @section @code{GNAT.MD5} (@code{g-md5.ads})
24340 @geindex GNAT.MD5 (g-md5.ads)
24342 @geindex Message Digest MD5
24344 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
24345 the HMAC-MD5 message authentication function as described in RFC 2104 and
24346 FIPS PUB 198.
24348 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
24349 @anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{383}@anchor{gnat_rm/the_gnat_library id85}@anchor{384}
24350 @section @code{GNAT.Memory_Dump} (@code{g-memdum.ads})
24353 @geindex GNAT.Memory_Dump (g-memdum.ads)
24355 @geindex Dump Memory
24357 Provides a convenient routine for dumping raw memory to either the
24358 standard output or standard error files. Uses GNAT.IO for actual
24359 output.
24361 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
24362 @anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{385}@anchor{gnat_rm/the_gnat_library id86}@anchor{386}
24363 @section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
24366 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
24368 @geindex Exception
24369 @geindex obtaining most recent
24371 Provides access to the most recently raised exception.  Can be used for
24372 various logging purposes, including duplicating functionality of some
24373 Ada 83 implementation dependent extensions.
24375 @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
24376 @anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{387}@anchor{gnat_rm/the_gnat_library id87}@anchor{388}
24377 @section @code{GNAT.OS_Lib} (@code{g-os_lib.ads})
24380 @geindex GNAT.OS_Lib (g-os_lib.ads)
24382 @geindex Operating System interface
24384 @geindex Spawn capability
24386 Provides a range of target independent operating system interface functions,
24387 including time/date management, file operations, subprocess management,
24388 including a portable spawn procedure, and access to environment variables
24389 and error return codes.
24391 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
24392 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{389}@anchor{gnat_rm/the_gnat_library id88}@anchor{38a}
24393 @section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
24396 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
24398 @geindex Hash functions
24400 Provides a generator of static minimal perfect hash functions. No
24401 collisions occur and each item can be retrieved from the table in one
24402 probe (perfect property). The hash table size corresponds to the exact
24403 size of the key set and no larger (minimal property). The key set has to
24404 be known in advance (static property). The hash functions are also order
24405 preserving. If w2 is inserted after w1 in the generator, their
24406 hashcode are in the same order. These hashing functions are very
24407 convenient for use with realtime applications.
24409 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
24410 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{38b}@anchor{gnat_rm/the_gnat_library id89}@anchor{38c}
24411 @section @code{GNAT.Random_Numbers} (@code{g-rannum.ads})
24414 @geindex GNAT.Random_Numbers (g-rannum.ads)
24416 @geindex Random number generation
24418 Provides random number capabilities which extend those available in the
24419 standard Ada library and are more convenient to use.
24421 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
24422 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{262}@anchor{gnat_rm/the_gnat_library id90}@anchor{38d}
24423 @section @code{GNAT.Regexp} (@code{g-regexp.ads})
24426 @geindex GNAT.Regexp (g-regexp.ads)
24428 @geindex Regular expressions
24430 @geindex Pattern matching
24432 A simple implementation of regular expressions, using a subset of regular
24433 expression syntax copied from familiar Unix style utilities.  This is the
24434 simplest of the three pattern matching packages provided, and is particularly
24435 suitable for ‘file globbing’ applications.
24437 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
24438 @anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{38e}@anchor{gnat_rm/the_gnat_library id91}@anchor{38f}
24439 @section @code{GNAT.Registry} (@code{g-regist.ads})
24442 @geindex GNAT.Registry (g-regist.ads)
24444 @geindex Windows Registry
24446 This is a high level binding to the Windows registry.  It is possible to
24447 do simple things like reading a key value, creating a new key.  For full
24448 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
24449 package provided with the Win32Ada binding
24451 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
24452 @anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{390}@anchor{gnat_rm/the_gnat_library id92}@anchor{391}
24453 @section @code{GNAT.Regpat} (@code{g-regpat.ads})
24456 @geindex GNAT.Regpat (g-regpat.ads)
24458 @geindex Regular expressions
24460 @geindex Pattern matching
24462 A complete implementation of Unix-style regular expression matching, copied
24463 from the original V7 style regular expression library written in C by
24464 Henry Spencer (and binary compatible with this C library).
24466 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
24467 @anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{392}@anchor{gnat_rm/the_gnat_library id93}@anchor{393}
24468 @section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
24471 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
24473 @geindex Rewrite data
24475 A unit to rewrite on-the-fly string occurrences in a stream of
24476 data. The implementation has a very minimal memory footprint as the
24477 full content to be processed is not loaded into memory all at once. This makes
24478 this interface usable for large files or socket streams.
24480 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
24481 @anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{394}@anchor{gnat_rm/the_gnat_library id94}@anchor{395}
24482 @section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
24485 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
24487 @geindex Secondary Stack Info
24489 Provides the capability to query the high water mark of the current task’s
24490 secondary stack.
24492 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
24493 @anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{396}@anchor{gnat_rm/the_gnat_library id95}@anchor{397}
24494 @section @code{GNAT.Semaphores} (@code{g-semaph.ads})
24497 @geindex GNAT.Semaphores (g-semaph.ads)
24499 @geindex Semaphores
24501 Provides classic counting and binary semaphores using protected types.
24503 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
24504 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{398}@anchor{gnat_rm/the_gnat_library id96}@anchor{399}
24505 @section @code{GNAT.Serial_Communications} (@code{g-sercom.ads})
24508 @geindex GNAT.Serial_Communications (g-sercom.ads)
24510 @geindex Serial_Communications
24512 Provides a simple interface to send and receive data over a serial
24513 port. This is only supported on GNU/Linux and Windows.
24515 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
24516 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{39a}@anchor{gnat_rm/the_gnat_library id97}@anchor{39b}
24517 @section @code{GNAT.SHA1} (@code{g-sha1.ads})
24520 @geindex GNAT.SHA1 (g-sha1.ads)
24522 @geindex Secure Hash Algorithm SHA-1
24524 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
24525 and RFC 3174, and the HMAC-SHA1 message authentication function as described
24526 in RFC 2104 and FIPS PUB 198.
24528 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
24529 @anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{39c}@anchor{gnat_rm/the_gnat_library id98}@anchor{39d}
24530 @section @code{GNAT.SHA224} (@code{g-sha224.ads})
24533 @geindex GNAT.SHA224 (g-sha224.ads)
24535 @geindex Secure Hash Algorithm SHA-224
24537 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24538 and the HMAC-SHA224 message authentication function as described
24539 in RFC 2104 and FIPS PUB 198.
24541 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24542 @anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{39e}@anchor{gnat_rm/the_gnat_library id99}@anchor{39f}
24543 @section @code{GNAT.SHA256} (@code{g-sha256.ads})
24546 @geindex GNAT.SHA256 (g-sha256.ads)
24548 @geindex Secure Hash Algorithm SHA-256
24550 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24551 and the HMAC-SHA256 message authentication function as described
24552 in RFC 2104 and FIPS PUB 198.
24554 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24555 @anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{3a0}@anchor{gnat_rm/the_gnat_library id100}@anchor{3a1}
24556 @section @code{GNAT.SHA384} (@code{g-sha384.ads})
24559 @geindex GNAT.SHA384 (g-sha384.ads)
24561 @geindex Secure Hash Algorithm SHA-384
24563 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24564 and the HMAC-SHA384 message authentication function as described
24565 in RFC 2104 and FIPS PUB 198.
24567 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24568 @anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3a2}@anchor{gnat_rm/the_gnat_library id101}@anchor{3a3}
24569 @section @code{GNAT.SHA512} (@code{g-sha512.ads})
24572 @geindex GNAT.SHA512 (g-sha512.ads)
24574 @geindex Secure Hash Algorithm SHA-512
24576 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24577 and the HMAC-SHA512 message authentication function as described
24578 in RFC 2104 and FIPS PUB 198.
24580 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24581 @anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3a4}@anchor{gnat_rm/the_gnat_library id102}@anchor{3a5}
24582 @section @code{GNAT.Signals} (@code{g-signal.ads})
24585 @geindex GNAT.Signals (g-signal.ads)
24587 @geindex Signals
24589 Provides the ability to manipulate the blocked status of signals on supported
24590 targets.
24592 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24593 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3a6}@anchor{gnat_rm/the_gnat_library id103}@anchor{3a7}
24594 @section @code{GNAT.Sockets} (@code{g-socket.ads})
24597 @geindex GNAT.Sockets (g-socket.ads)
24599 @geindex Sockets
24601 A high level and portable interface to develop sockets based applications.
24602 This package is based on the sockets thin binding found in
24603 @code{GNAT.Sockets.Thin}. Currently @code{GNAT.Sockets} is implemented
24604 on all native GNAT ports and on VxWorks cross ports.  It is not implemented for
24605 the LynxOS cross port.
24607 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
24608 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3a8}@anchor{gnat_rm/the_gnat_library id104}@anchor{3a9}
24609 @section @code{GNAT.Source_Info} (@code{g-souinf.ads})
24612 @geindex GNAT.Source_Info (g-souinf.ads)
24614 @geindex Source Information
24616 Provides subprograms that give access to source code information known at
24617 compile time, such as the current file name and line number. Also provides
24618 subprograms yielding the date and time of the current compilation (like the
24619 C macros @code{__DATE__} and @code{__TIME__})
24621 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
24622 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3aa}@anchor{gnat_rm/the_gnat_library id105}@anchor{3ab}
24623 @section @code{GNAT.Spelling_Checker} (@code{g-speche.ads})
24626 @geindex GNAT.Spelling_Checker (g-speche.ads)
24628 @geindex Spell checking
24630 Provides a function for determining whether one string is a plausible
24631 near misspelling of another string.
24633 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
24634 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3ac}@anchor{gnat_rm/the_gnat_library id106}@anchor{3ad}
24635 @section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
24638 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
24640 @geindex Spell checking
24642 Provides a generic function that can be instantiated with a string type for
24643 determining whether one string is a plausible near misspelling of another
24644 string.
24646 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
24647 @anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3ae}@anchor{gnat_rm/the_gnat_library id107}@anchor{3af}
24648 @section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
24651 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
24653 @geindex SPITBOL pattern matching
24655 @geindex Pattern matching
24657 A complete implementation of SNOBOL4 style pattern matching.  This is the
24658 most elaborate of the pattern matching packages provided.  It fully duplicates
24659 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
24660 efficient algorithm developed by Robert Dewar for the SPITBOL system.
24662 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
24663 @anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3b0}@anchor{gnat_rm/the_gnat_library id108}@anchor{3b1}
24664 @section @code{GNAT.Spitbol} (@code{g-spitbo.ads})
24667 @geindex GNAT.Spitbol (g-spitbo.ads)
24669 @geindex SPITBOL interface
24671 The top level package of the collection of SPITBOL-style functionality, this
24672 package provides basic SNOBOL4 string manipulation functions, such as
24673 Pad, Reverse, Trim, Substr capability, as well as a generic table function
24674 useful for constructing arbitrary mappings from strings in the style of
24675 the SNOBOL4 TABLE function.
24677 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
24678 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3b2}@anchor{gnat_rm/the_gnat_library id109}@anchor{3b3}
24679 @section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
24682 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
24684 @geindex Sets of strings
24686 @geindex SPITBOL Tables
24688 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24689 for type @code{Standard.Boolean}, giving an implementation of sets of
24690 string values.
24692 @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
24693 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3b4}@anchor{gnat_rm/the_gnat_library id110}@anchor{3b5}
24694 @section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
24697 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
24699 @geindex Integer maps
24701 @geindex Maps
24703 @geindex SPITBOL Tables
24705 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24706 for type @code{Standard.Integer}, giving an implementation of maps
24707 from string to integer values.
24709 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
24710 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3b6}@anchor{gnat_rm/the_gnat_library id111}@anchor{3b7}
24711 @section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
24714 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
24716 @geindex String maps
24718 @geindex Maps
24720 @geindex SPITBOL Tables
24722 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table} for
24723 a variable length string type, giving an implementation of general
24724 maps from strings to strings.
24726 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
24727 @anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3b8}@anchor{gnat_rm/the_gnat_library id112}@anchor{3b9}
24728 @section @code{GNAT.SSE} (@code{g-sse.ads})
24731 @geindex GNAT.SSE (g-sse.ads)
24733 Root of a set of units aimed at offering Ada bindings to a subset of
24734 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
24735 targets.  It exposes vector component types together with a general
24736 introduction to the binding contents and use.
24738 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
24739 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3ba}@anchor{gnat_rm/the_gnat_library id113}@anchor{3bb}
24740 @section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
24743 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
24745 SSE vector types for use with SSE related intrinsics.
24747 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
24748 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3bc}@anchor{gnat_rm/the_gnat_library id114}@anchor{3bd}
24749 @section @code{GNAT.String_Hash} (@code{g-strhas.ads})
24752 @geindex GNAT.String_Hash (g-strhas.ads)
24754 @geindex Hash functions
24756 Provides a generic hash function working on arrays of scalars. Both the scalar
24757 type and the hash result type are parameters.
24759 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
24760 @anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3be}@anchor{gnat_rm/the_gnat_library id115}@anchor{3bf}
24761 @section @code{GNAT.Strings} (@code{g-string.ads})
24764 @geindex GNAT.Strings (g-string.ads)
24766 Common String access types and related subprograms. Basically it
24767 defines a string access and an array of string access types.
24769 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
24770 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3c0}@anchor{gnat_rm/the_gnat_library id116}@anchor{3c1}
24771 @section @code{GNAT.String_Split} (@code{g-strspl.ads})
24774 @geindex GNAT.String_Split (g-strspl.ads)
24776 @geindex String splitter
24778 Useful string manipulation routines: given a set of separators, split
24779 a string wherever the separators appear, and provide direct access
24780 to the resulting slices. This package is instantiated from
24781 @code{GNAT.Array_Split}.
24783 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
24784 @anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3c2}@anchor{gnat_rm/the_gnat_library id117}@anchor{3c3}
24785 @section @code{GNAT.Table} (@code{g-table.ads})
24788 @geindex GNAT.Table (g-table.ads)
24790 @geindex Table implementation
24792 @geindex Arrays
24793 @geindex extendable
24795 A generic package providing a single dimension array abstraction where the
24796 length of the array can be dynamically modified.
24798 This package provides a facility similar to that of @code{GNAT.Dynamic_Tables},
24799 except that this package declares a single instance of the table type,
24800 while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
24801 used to define dynamic instances of the table.
24803 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
24804 @anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3c4}@anchor{gnat_rm/the_gnat_library id118}@anchor{3c5}
24805 @section @code{GNAT.Task_Lock} (@code{g-tasloc.ads})
24808 @geindex GNAT.Task_Lock (g-tasloc.ads)
24810 @geindex Task synchronization
24812 @geindex Task locking
24814 @geindex Locking
24816 A very simple facility for locking and unlocking sections of code using a
24817 single global task lock.  Appropriate for use in situations where contention
24818 between tasks is very rarely expected.
24820 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
24821 @anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3c6}@anchor{gnat_rm/the_gnat_library id119}@anchor{3c7}
24822 @section @code{GNAT.Time_Stamp} (@code{g-timsta.ads})
24825 @geindex GNAT.Time_Stamp (g-timsta.ads)
24827 @geindex Time stamp
24829 @geindex Current time
24831 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
24832 represents the current date and time in ISO 8601 format. This is a very simple
24833 routine with minimal code and there are no dependencies on any other unit.
24835 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
24836 @anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3c8}@anchor{gnat_rm/the_gnat_library id120}@anchor{3c9}
24837 @section @code{GNAT.Threads} (@code{g-thread.ads})
24840 @geindex GNAT.Threads (g-thread.ads)
24842 @geindex Foreign threads
24844 @geindex Threads
24845 @geindex foreign
24847 Provides facilities for dealing with foreign threads which need to be known
24848 by the GNAT run-time system. Consult the documentation of this package for
24849 further details if your program has threads that are created by a non-Ada
24850 environment which then accesses Ada code.
24852 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
24853 @anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3ca}@anchor{gnat_rm/the_gnat_library id121}@anchor{3cb}
24854 @section @code{GNAT.Traceback} (@code{g-traceb.ads})
24857 @geindex GNAT.Traceback (g-traceb.ads)
24859 @geindex Trace back facilities
24861 Provides a facility for obtaining non-symbolic traceback information, useful
24862 in various debugging situations.
24864 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-utf_32 ads,GNAT Traceback g-traceb ads,The GNAT Library
24865 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3cc}@anchor{gnat_rm/the_gnat_library id122}@anchor{3cd}
24866 @section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
24869 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
24871 @geindex Trace back facilities
24873 @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
24874 @anchor{gnat_rm/the_gnat_library gnat-utf-32-g-utf-32-ads}@anchor{3ce}@anchor{gnat_rm/the_gnat_library id123}@anchor{3cf}
24875 @section @code{GNAT.UTF_32} (@code{g-utf_32.ads})
24878 @geindex GNAT.UTF_32 (g-utf_32.ads)
24880 @geindex Wide character codes
24882 This is a package intended to be used in conjunction with the
24883 @code{Wide_Character} type in Ada 95 and the
24884 @code{Wide_Wide_Character} type in Ada 2005 (available
24885 in @code{GNAT} in Ada 2005 mode). This package contains
24886 Unicode categorization routines, as well as lexical
24887 categorization routines corresponding to the Ada 2005
24888 lexical rules for identifiers and strings, and also a
24889 lower case to upper case fold routine corresponding to
24890 the Ada 2005 rules for identifier equivalence.
24892 @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
24893 @anchor{gnat_rm/the_gnat_library gnat-utf-32-spelling-checker-g-u3spch-ads}@anchor{3d0}@anchor{gnat_rm/the_gnat_library id124}@anchor{3d1}
24894 @section @code{GNAT.UTF_32_Spelling_Checker} (@code{g-u3spch.ads})
24897 @geindex GNAT.UTF_32_Spelling_Checker (g-u3spch.ads)
24899 @geindex Spell checking
24901 Provides a function for determining whether one wide wide string is a plausible
24902 near misspelling of another wide wide string, where the strings are represented
24903 using the UTF_32_String type defined in System.Wch_Cnv.
24905 @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
24906 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3d2}@anchor{gnat_rm/the_gnat_library id125}@anchor{3d3}
24907 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
24910 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
24912 @geindex Spell checking
24914 Provides a function for determining whether one wide string is a plausible
24915 near misspelling of another wide string.
24917 @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
24918 @anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3d4}@anchor{gnat_rm/the_gnat_library id126}@anchor{3d5}
24919 @section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
24922 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
24924 @geindex Wide_String splitter
24926 Useful wide string manipulation routines: given a set of separators, split
24927 a wide string wherever the separators appear, and provide direct access
24928 to the resulting slices. This package is instantiated from
24929 @code{GNAT.Array_Split}.
24931 @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
24932 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3d6}@anchor{gnat_rm/the_gnat_library id127}@anchor{3d7}
24933 @section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
24936 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
24938 @geindex Spell checking
24940 Provides a function for determining whether one wide wide string is a plausible
24941 near misspelling of another wide wide string.
24943 @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
24944 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3d8}@anchor{gnat_rm/the_gnat_library id128}@anchor{3d9}
24945 @section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
24948 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
24950 @geindex Wide_Wide_String splitter
24952 Useful wide wide string manipulation routines: given a set of separators, split
24953 a wide wide string wherever the separators appear, and provide direct access
24954 to the resulting slices. This package is instantiated from
24955 @code{GNAT.Array_Split}.
24957 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
24958 @anchor{gnat_rm/the_gnat_library id129}@anchor{3da}@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3db}
24959 @section @code{Interfaces.C.Extensions} (@code{i-cexten.ads})
24962 @geindex Interfaces.C.Extensions (i-cexten.ads)
24964 This package contains additional C-related definitions, intended
24965 for use with either manually or automatically generated bindings
24966 to C libraries.
24968 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
24969 @anchor{gnat_rm/the_gnat_library id130}@anchor{3dc}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3dd}
24970 @section @code{Interfaces.C.Streams} (@code{i-cstrea.ads})
24973 @geindex Interfaces.C.Streams (i-cstrea.ads)
24975 @geindex C streams
24976 @geindex interfacing
24978 This package is a binding for the most commonly used operations
24979 on C streams.
24981 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
24982 @anchor{gnat_rm/the_gnat_library id131}@anchor{3de}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3df}
24983 @section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
24986 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
24988 @geindex IBM Packed Format
24990 @geindex Packed Decimal
24992 This package provides a set of routines for conversions to and
24993 from a packed decimal format compatible with that used on IBM
24994 mainframes.
24996 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
24997 @anchor{gnat_rm/the_gnat_library id132}@anchor{3e0}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3e1}
24998 @section @code{Interfaces.VxWorks} (@code{i-vxwork.ads})
25001 @geindex Interfaces.VxWorks (i-vxwork.ads)
25003 @geindex Interfacing to VxWorks
25005 @geindex VxWorks
25006 @geindex interfacing
25008 This package provides a limited binding to the VxWorks API.
25009 In particular, it interfaces with the
25010 VxWorks hardware interrupt facilities.
25012 @node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
25013 @anchor{gnat_rm/the_gnat_library id133}@anchor{3e2}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3e3}
25014 @section @code{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads})
25017 @geindex Interfaces.VxWorks.Int_Connection (i-vxinco.ads)
25019 @geindex Interfacing to VxWorks
25021 @geindex VxWorks
25022 @geindex interfacing
25024 This package provides a way for users to replace the use of
25025 intConnect() with a custom routine for installing interrupt
25026 handlers.
25028 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library
25029 @anchor{gnat_rm/the_gnat_library id134}@anchor{3e4}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3e5}
25030 @section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
25033 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
25035 @geindex Interfacing to VxWorks' I/O
25037 @geindex VxWorks
25038 @geindex I/O interfacing
25040 @geindex VxWorks
25041 @geindex Get_Immediate
25043 @geindex Get_Immediate
25044 @geindex VxWorks
25046 This package provides a binding to the ioctl (IO/Control)
25047 function of VxWorks, defining a set of option values and
25048 function codes. A particular use of this package is
25049 to enable the use of Get_Immediate under VxWorks.
25051 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
25052 @anchor{gnat_rm/the_gnat_library id135}@anchor{3e6}@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3e7}
25053 @section @code{System.Address_Image} (@code{s-addima.ads})
25056 @geindex System.Address_Image (s-addima.ads)
25058 @geindex Address image
25060 @geindex Image
25061 @geindex of an address
25063 This function provides a useful debugging
25064 function that gives an (implementation dependent)
25065 string which identifies an address.
25067 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
25068 @anchor{gnat_rm/the_gnat_library id136}@anchor{3e8}@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3e9}
25069 @section @code{System.Assertions} (@code{s-assert.ads})
25072 @geindex System.Assertions (s-assert.ads)
25074 @geindex Assertions
25076 @geindex Assert_Failure
25077 @geindex exception
25079 This package provides the declaration of the exception raised
25080 by an run-time assertion failure, as well as the routine that
25081 is used internally to raise this assertion.
25083 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
25084 @anchor{gnat_rm/the_gnat_library id137}@anchor{3ea}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3eb}
25085 @section @code{System.Atomic_Counters} (@code{s-atocou.ads})
25088 @geindex System.Atomic_Counters (s-atocou.ads)
25090 This package provides the declaration of an atomic counter type,
25091 together with efficient routines (using hardware
25092 synchronization primitives) for incrementing, decrementing,
25093 and testing of these counters. This package is implemented
25094 on most targets, including all Alpha, AARCH64, ARM, ia64, PowerPC, SPARC V9,
25095 x86, and x86_64 platforms.
25097 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
25098 @anchor{gnat_rm/the_gnat_library id138}@anchor{3ec}@anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3ed}
25099 @section @code{System.Memory} (@code{s-memory.ads})
25102 @geindex System.Memory (s-memory.ads)
25104 @geindex Memory allocation
25106 This package provides the interface to the low level routines used
25107 by the generated code for allocation and freeing storage for the
25108 default storage pool (analogous to the C routines malloc and free).
25109 It also provides a reallocation interface analogous to the C routine
25110 realloc. The body of this unit may be modified to provide alternative
25111 allocation mechanisms for the default pool, and in addition, direct
25112 calls to this unit may be made for low level allocation uses (for
25113 example see the body of @code{GNAT.Tables}).
25115 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
25116 @anchor{gnat_rm/the_gnat_library id139}@anchor{3ee}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3ef}
25117 @section @code{System.Multiprocessors} (@code{s-multip.ads})
25120 @geindex System.Multiprocessors (s-multip.ads)
25122 @geindex Multiprocessor interface
25124 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25125 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25126 technically an implementation-defined addition).
25128 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
25129 @anchor{gnat_rm/the_gnat_library id140}@anchor{3f0}@anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3f1}
25130 @section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
25133 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
25135 @geindex Multiprocessor interface
25137 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25138 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25139 technically an implementation-defined addition).
25141 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
25142 @anchor{gnat_rm/the_gnat_library id141}@anchor{3f2}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3f3}
25143 @section @code{System.Partition_Interface} (@code{s-parint.ads})
25146 @geindex System.Partition_Interface (s-parint.ads)
25148 @geindex Partition interfacing functions
25150 This package provides facilities for partition interfacing.  It
25151 is used primarily in a distribution context when using Annex E
25152 with @code{GLADE}.
25154 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
25155 @anchor{gnat_rm/the_gnat_library id142}@anchor{3f4}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3f5}
25156 @section @code{System.Pool_Global} (@code{s-pooglo.ads})
25159 @geindex System.Pool_Global (s-pooglo.ads)
25161 @geindex Storage pool
25162 @geindex global
25164 @geindex Global storage pool
25166 This package provides a storage pool that is equivalent to the default
25167 storage pool used for access types for which no pool is specifically
25168 declared. It uses malloc/free to allocate/free and does not attempt to
25169 do any automatic reclamation.
25171 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
25172 @anchor{gnat_rm/the_gnat_library id143}@anchor{3f6}@anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3f7}
25173 @section @code{System.Pool_Local} (@code{s-pooloc.ads})
25176 @geindex System.Pool_Local (s-pooloc.ads)
25178 @geindex Storage pool
25179 @geindex local
25181 @geindex Local storage pool
25183 This package provides a storage pool that is intended for use with locally
25184 defined access types. It uses malloc/free for allocate/free, and maintains
25185 a list of allocated blocks, so that all storage allocated for the pool can
25186 be freed automatically when the pool is finalized.
25188 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
25189 @anchor{gnat_rm/the_gnat_library id144}@anchor{3f8}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3f9}
25190 @section @code{System.Restrictions} (@code{s-restri.ads})
25193 @geindex System.Restrictions (s-restri.ads)
25195 @geindex Run-time restrictions access
25197 This package provides facilities for accessing at run time
25198 the status of restrictions specified at compile time for
25199 the partition. Information is available both with regard
25200 to actual restrictions specified, and with regard to
25201 compiler determined information on which restrictions
25202 are violated by one or more packages in the partition.
25204 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
25205 @anchor{gnat_rm/the_gnat_library id145}@anchor{3fa}@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3fb}
25206 @section @code{System.Rident} (@code{s-rident.ads})
25209 @geindex System.Rident (s-rident.ads)
25211 @geindex Restrictions definitions
25213 This package provides definitions of the restrictions
25214 identifiers supported by GNAT, and also the format of
25215 the restrictions provided in package System.Restrictions.
25216 It is not normally necessary to @code{with} this generic package
25217 since the necessary instantiation is included in
25218 package System.Restrictions.
25220 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
25221 @anchor{gnat_rm/the_gnat_library id146}@anchor{3fc}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{3fd}
25222 @section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads})
25225 @geindex System.Strings.Stream_Ops (s-ststop.ads)
25227 @geindex Stream operations
25229 @geindex String stream operations
25231 This package provides a set of stream subprograms for standard string types.
25232 It is intended primarily to support implicit use of such subprograms when
25233 stream attributes are applied to string types, but the subprograms in this
25234 package can be used directly by application programs.
25236 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
25237 @anchor{gnat_rm/the_gnat_library id147}@anchor{3fe}@anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{3ff}
25238 @section @code{System.Unsigned_Types} (@code{s-unstyp.ads})
25241 @geindex System.Unsigned_Types (s-unstyp.ads)
25243 This package contains definitions of standard unsigned types that
25244 correspond in size to the standard signed types declared in Standard,
25245 and (unlike the types in Interfaces) have corresponding names. It
25246 also contains some related definitions for other specialized types
25247 used by the compiler in connection with packed array types.
25249 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
25250 @anchor{gnat_rm/the_gnat_library id148}@anchor{400}@anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{401}
25251 @section @code{System.Wch_Cnv} (@code{s-wchcnv.ads})
25254 @geindex System.Wch_Cnv (s-wchcnv.ads)
25256 @geindex Wide Character
25257 @geindex Representation
25259 @geindex Wide String
25260 @geindex Conversion
25262 @geindex Representation of wide characters
25264 This package provides routines for converting between
25265 wide and wide wide characters and a representation as a value of type
25266 @code{Standard.String}, using a specified wide character
25267 encoding method.  It uses definitions in
25268 package @code{System.Wch_Con}.
25270 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
25271 @anchor{gnat_rm/the_gnat_library id149}@anchor{402}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{403}
25272 @section @code{System.Wch_Con} (@code{s-wchcon.ads})
25275 @geindex System.Wch_Con (s-wchcon.ads)
25277 This package provides definitions and descriptions of
25278 the various methods used for encoding wide characters
25279 in ordinary strings.  These definitions are used by
25280 the package @code{System.Wch_Cnv}.
25282 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
25283 @anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{404}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{405}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}
25284 @chapter Interfacing to Other Languages
25287 The facilities in Annex B of the Ada Reference Manual are fully
25288 implemented in GNAT, and in addition, a full interface to C++ is
25289 provided.
25291 @menu
25292 * Interfacing to C:: 
25293 * Interfacing to C++:: 
25294 * Interfacing to COBOL:: 
25295 * Interfacing to Fortran:: 
25296 * Interfacing to non-GNAT Ada code:: 
25298 @end menu
25300 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
25301 @anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{406}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{407}
25302 @section Interfacing to C
25305 Interfacing to C with GNAT can use one of two approaches:
25308 @itemize *
25310 @item 
25311 The types in the package @code{Interfaces.C} may be used.
25313 @item 
25314 Standard Ada types may be used directly.  This may be less portable to
25315 other compilers, but will work on all GNAT compilers, which guarantee
25316 correspondence between the C and Ada types.
25317 @end itemize
25319 Pragma @code{Convention C} may be applied to Ada types, but mostly has no
25320 effect, since this is the default.  The following table shows the
25321 correspondence between Ada scalar types and the corresponding C types.
25324 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
25325 @headitem
25327 Ada Type
25329 @tab
25331 C Type
25333 @item
25335 @code{Integer}
25337 @tab
25339 @code{int}
25341 @item
25343 @code{Short_Integer}
25345 @tab
25347 @code{short}
25349 @item
25351 @code{Short_Short_Integer}
25353 @tab
25355 @code{signed char}
25357 @item
25359 @code{Long_Integer}
25361 @tab
25363 @code{long}
25365 @item
25367 @code{Long_Long_Integer}
25369 @tab
25371 @code{long long}
25373 @item
25375 @code{Short_Float}
25377 @tab
25379 @code{float}
25381 @item
25383 @code{Float}
25385 @tab
25387 @code{float}
25389 @item
25391 @code{Long_Float}
25393 @tab
25395 @code{double}
25397 @item
25399 @code{Long_Long_Float}
25401 @tab
25403 This is the longest floating-point type supported by the hardware.
25405 @end multitable
25408 Additionally, there are the following general correspondences between Ada
25409 and C types:
25412 @itemize *
25414 @item 
25415 Ada enumeration types map to C enumeration types directly if pragma
25416 @code{Convention C} is specified, which causes them to have a length of
25417 32 bits, except for boolean types which map to C99 @code{bool} and for
25418 which the length is 8 bits.
25419 Without pragma @code{Convention C}, Ada enumeration types map to
25420 8, 16, or 32 bits (i.e., C types @code{signed char}, @code{short},
25421 @code{int}, respectively) depending on the number of values passed.
25422 This is the only case in which pragma @code{Convention C} affects the
25423 representation of an Ada type.
25425 @item 
25426 Ada access types map to C pointers, except for the case of pointers to
25427 unconstrained types in Ada, which have no direct C equivalent.
25429 @item 
25430 Ada arrays map directly to C arrays.
25432 @item 
25433 Ada records map directly to C structures.
25435 @item 
25436 Packed Ada records map to C structures where all members are bit fields
25437 of the length corresponding to the @code{type'Size} value in Ada.
25438 @end itemize
25440 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
25441 @anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{47}@anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{408}
25442 @section Interfacing to C++
25445 The interface to C++ makes use of the following pragmas, which are
25446 primarily intended to be constructed automatically using a binding generator
25447 tool, although it is possible to construct them by hand.
25449 Using these pragmas it is possible to achieve complete
25450 inter-operability between Ada tagged types and C++ class definitions.
25451 See @ref{7,,Implementation Defined Pragmas}, for more details.
25454 @table @asis
25456 @item @code{pragma CPP_Class ([Entity =>] @var{LOCAL_NAME})}
25458 The argument denotes an entity in the current declarative region that is
25459 declared as a tagged or untagged record type. It indicates that the type
25460 corresponds to an externally declared C++ class type, and is to be laid
25461 out the same way that C++ would lay out the type.
25463 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
25464 for backward compatibility but its functionality is available
25465 using pragma @code{Import} with @code{Convention} = @code{CPP}.
25467 @item @code{pragma CPP_Constructor ([Entity =>] @var{LOCAL_NAME})}
25469 This pragma identifies an imported function (imported in the usual way
25470 with pragma @code{Import}) as corresponding to a C++ constructor.
25471 @end table
25473 A few restrictions are placed on the use of the @code{Access} attribute
25474 in conjunction with subprograms subject to convention @code{CPP}: the
25475 attribute may be used neither on primitive operations of a tagged
25476 record type with convention @code{CPP}, imported or not, nor on
25477 subprograms imported with pragma @code{CPP_Constructor}.
25479 In addition, C++ exceptions are propagated and can be handled in an
25480 @code{others} choice of an exception handler. The corresponding Ada
25481 occurrence has no message, and the simple name of the exception identity
25482 contains @code{Foreign_Exception}. Finalization and awaiting dependent
25483 tasks works properly when such foreign exceptions are propagated.
25485 It is also possible to import a C++ exception using the following syntax:
25487 @example
25488 LOCAL_NAME : exception;
25489 pragma Import (Cpp,
25490   [Entity =>] LOCAL_NAME,
25491   [External_Name =>] static_string_EXPRESSION);
25492 @end example
25494 The @code{External_Name} is the name of the C++ RTTI symbol. You can then
25495 cover a specific C++ exception in an exception handler.
25497 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
25498 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{409}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{40a}
25499 @section Interfacing to COBOL
25502 Interfacing to COBOL is achieved as described in section B.4 of
25503 the Ada Reference Manual.
25505 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
25506 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{40b}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{40c}
25507 @section Interfacing to Fortran
25510 Interfacing to Fortran is achieved as described in section B.5 of the
25511 Ada Reference Manual.  The pragma @code{Convention Fortran}, applied to a
25512 multi-dimensional array causes the array to be stored in column-major
25513 order as required for convenient interface to Fortran.
25515 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
25516 @anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{40d}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{40e}
25517 @section Interfacing to non-GNAT Ada code
25520 It is possible to specify the convention @code{Ada} in a pragma
25521 @code{Import} or pragma @code{Export}.  However this refers to
25522 the calling conventions used by GNAT, which may or may not be
25523 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
25524 compiler to allow interoperation.
25526 If arguments types are kept simple, and if the foreign compiler generally
25527 follows system calling conventions, then it may be possible to integrate
25528 files compiled by other Ada compilers, provided that the elaboration
25529 issues are adequately addressed (for example by eliminating the
25530 need for any load time elaboration).
25532 In particular, GNAT running on VMS is designed to
25533 be highly compatible with the DEC Ada 83 compiler, so this is one
25534 case in which it is possible to import foreign units of this type,
25535 provided that the data items passed are restricted to simple scalar
25536 values or simple record types without variants, or simple array
25537 types with fixed bounds.
25539 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
25540 @anchor{gnat_rm/specialized_needs_annexes doc}@anchor{40f}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{410}@anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}
25541 @chapter Specialized Needs Annexes
25544 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
25545 required in all implementations.  However, as described in this chapter,
25546 GNAT implements all of these annexes:
25549 @table @asis
25551 @item `Systems Programming (Annex C)'
25553 The Systems Programming Annex is fully implemented.
25555 @item `Real-Time Systems (Annex D)'
25557 The Real-Time Systems Annex is fully implemented.
25559 @item `Distributed Systems (Annex E)'
25561 Stub generation is fully implemented in the GNAT compiler.  In addition,
25562 a complete compatible PCS is available as part of the GLADE system,
25563 a separate product.  When the two
25564 products are used in conjunction, this annex is fully implemented.
25566 @item `Information Systems (Annex F)'
25568 The Information Systems annex is fully implemented.
25570 @item `Numerics (Annex G)'
25572 The Numerics Annex is fully implemented.
25574 @item `Safety and Security / High-Integrity Systems (Annex H)'
25576 The Safety and Security Annex (termed the High-Integrity Systems Annex
25577 in Ada 2005) is fully implemented.
25578 @end table
25580 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25581 @anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{411}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{412}@anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13}
25582 @chapter Implementation of Specific Ada Features
25585 This chapter describes the GNAT implementation of several Ada language
25586 facilities.
25588 @menu
25589 * Machine Code Insertions:: 
25590 * GNAT Implementation of Tasking:: 
25591 * GNAT Implementation of Shared Passive Packages:: 
25592 * Code Generation for Array Aggregates:: 
25593 * The Size of Discriminated Records with Default Discriminants:: 
25594 * Image Values For Nonscalar Types:: 
25595 * Strict Conformance to the Ada Reference Manual:: 
25597 @end menu
25599 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25600 @anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{413}@anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{16a}
25601 @section Machine Code Insertions
25604 @geindex Machine Code insertions
25606 Package @code{Machine_Code} provides machine code support as described
25607 in the Ada Reference Manual in two separate forms:
25610 @itemize *
25612 @item 
25613 Machine code statements, consisting of qualified expressions that
25614 fit the requirements of RM section 13.8.
25616 @item 
25617 An intrinsic callable procedure, providing an alternative mechanism of
25618 including machine instructions in a subprogram.
25619 @end itemize
25621 The two features are similar, and both are closely related to the mechanism
25622 provided by the asm instruction in the GNU C compiler.  Full understanding
25623 and use of the facilities in this package requires understanding the asm
25624 instruction, see the section on Extended Asm in
25625 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
25627 Calls to the function @code{Asm} and the procedure @code{Asm} have identical
25628 semantic restrictions and effects as described below.  Both are provided so
25629 that the procedure call can be used as a statement, and the function call
25630 can be used to form a code_statement.
25632 Consider this C @code{asm} instruction:
25634 @example
25635 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
25636 @end example
25638 The equivalent can be written for GNAT as:
25640 @example
25641 Asm ("fsinx %1 %0",
25642      My_Float'Asm_Output ("=f", result),
25643      My_Float'Asm_Input  ("f",  angle));
25644 @end example
25646 The first argument to @code{Asm} is the assembler template, and is
25647 identical to what is used in GNU C.  This string must be a static
25648 expression.  The second argument is the output operand list.  It is
25649 either a single @code{Asm_Output} attribute reference, or a list of such
25650 references enclosed in parentheses (technically an array aggregate of
25651 such references).
25653 The @code{Asm_Output} attribute denotes a function that takes two
25654 parameters.  The first is a string, the second is the name of a variable
25655 of the type designated by the attribute prefix.  The first (string)
25656 argument is required to be a static expression and designates the
25657 constraint (see the section on Constraints in
25658 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
25659 for the parameter; e.g., what kind of register is required.  The second
25660 argument is the variable to be written or updated with the
25661 result.  The possible values for constraint are the same as those used in
25662 the RTL, and are dependent on the configuration file used to build the
25663 GCC back end.  If there are no output operands, then this argument may
25664 either be omitted, or explicitly given as @code{No_Output_Operands}.
25665 No support is provided for GNU C’s symbolic names for output parameters.
25667 The second argument of @code{my_float'Asm_Output} functions as
25668 though it were an @code{out} parameter, which is a little curious, but
25669 all names have the form of expressions, so there is no syntactic
25670 irregularity, even though normally functions would not be permitted
25671 @code{out} parameters.  The third argument is the list of input
25672 operands.  It is either a single @code{Asm_Input} attribute reference, or
25673 a list of such references enclosed in parentheses (technically an array
25674 aggregate of such references).
25676 The @code{Asm_Input} attribute denotes a function that takes two
25677 parameters.  The first is a string, the second is an expression of the
25678 type designated by the prefix.  The first (string) argument is required
25679 to be a static expression, and is the constraint for the parameter,
25680 (e.g., what kind of register is required).  The second argument is the
25681 value to be used as the input argument.  The possible values for the
25682 constraint are the same as those used in the RTL, and are dependent on
25683 the configuration file used to built the GCC back end.
25684 No support is provided for GNU C’s symbolic names for input parameters.
25686 If there are no input operands, this argument may either be omitted, or
25687 explicitly given as @code{No_Input_Operands}.  The fourth argument, not
25688 present in the above example, is a list of register names, called the
25689 `clobber' argument.  This argument, if given, must be a static string
25690 expression, and is a space or comma separated list of names of registers
25691 that must be considered destroyed as a result of the @code{Asm} call.  If
25692 this argument is the null string (the default value), then the code
25693 generator assumes that no additional registers are destroyed.
25694 In addition to registers, the special clobbers @code{memory} and
25695 @code{cc} as described in the GNU C docs are both supported.
25697 The fifth argument, not present in the above example, called the
25698 `volatile' argument, is by default @code{False}.  It can be set to
25699 the literal value @code{True} to indicate to the code generator that all
25700 optimizations with respect to the instruction specified should be
25701 suppressed, and in particular an instruction that has outputs
25702 will still be generated, even if none of the outputs are
25703 used.  See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
25704 for the full description.
25705 Generally it is strongly advisable to use Volatile for any ASM statement
25706 that is missing either input or output operands or to avoid unwanted
25707 optimizations. A warning is generated if this advice is not followed.
25709 No support is provided for GNU C’s @code{asm goto} feature.
25711 The @code{Asm} subprograms may be used in two ways.  First the procedure
25712 forms can be used anywhere a procedure call would be valid, and
25713 correspond to what the RM calls ‘intrinsic’ routines.  Such calls can
25714 be used to intersperse machine instructions with other Ada statements.
25715 Second, the function forms, which return a dummy value of the limited
25716 private type @code{Asm_Insn}, can be used in code statements, and indeed
25717 this is the only context where such calls are allowed.  Code statements
25718 appear as aggregates of the form:
25720 @example
25721 Asm_Insn'(Asm (...));
25722 Asm_Insn'(Asm_Volatile (...));
25723 @end example
25725 In accordance with RM rules, such code statements are allowed only
25726 within subprograms whose entire body consists of such statements.  It is
25727 not permissible to intermix such statements with other Ada statements.
25729 Typically the form using intrinsic procedure calls is more convenient
25730 and more flexible.  The code statement form is provided to meet the RM
25731 suggestion that such a facility should be made available.  The following
25732 is the exact syntax of the call to @code{Asm}. As usual, if named notation
25733 is used, the arguments may be given in arbitrary order, following the
25734 normal rules for use of positional and named arguments:
25736 @example
25737 ASM_CALL ::= Asm (
25738                  [Template =>] static_string_EXPRESSION
25739                [,[Outputs  =>] OUTPUT_OPERAND_LIST      ]
25740                [,[Inputs   =>] INPUT_OPERAND_LIST       ]
25741                [,[Clobber  =>] static_string_EXPRESSION ]
25742                [,[Volatile =>] static_boolean_EXPRESSION] )
25744 OUTPUT_OPERAND_LIST ::=
25745   [PREFIX.]No_Output_Operands
25746 | OUTPUT_OPERAND_ATTRIBUTE
25747 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
25749 OUTPUT_OPERAND_ATTRIBUTE ::=
25750   SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
25752 INPUT_OPERAND_LIST ::=
25753   [PREFIX.]No_Input_Operands
25754 | INPUT_OPERAND_ATTRIBUTE
25755 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
25757 INPUT_OPERAND_ATTRIBUTE ::=
25758   SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
25759 @end example
25761 The identifiers @code{No_Input_Operands} and @code{No_Output_Operands}
25762 are declared in the package @code{Machine_Code} and must be referenced
25763 according to normal visibility rules. In particular if there is no
25764 @code{use} clause for this package, then appropriate package name
25765 qualification is required.
25767 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
25768 @anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{414}@anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{415}
25769 @section GNAT Implementation of Tasking
25772 This chapter outlines the basic GNAT approach to tasking (in particular,
25773 a multi-layered library for portability) and discusses issues related
25774 to compliance with the Real-Time Systems Annex.
25776 @menu
25777 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
25778 * Ensuring Compliance with the Real-Time Annex:: 
25779 * Support for Locking Policies:: 
25781 @end menu
25783 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
25784 @anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{416}@anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{417}
25785 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
25788 GNAT’s run-time support comprises two layers:
25791 @itemize *
25793 @item 
25794 GNARL (GNAT Run-time Layer)
25796 @item 
25797 GNULL (GNAT Low-level Library)
25798 @end itemize
25800 In GNAT, Ada’s tasking services rely on a platform and OS independent
25801 layer known as GNARL.  This code is responsible for implementing the
25802 correct semantics of Ada’s task creation, rendezvous, protected
25803 operations etc.
25805 GNARL decomposes Ada’s tasking semantics into simpler lower level
25806 operations such as create a thread, set the priority of a thread,
25807 yield, create a lock, lock/unlock, etc.  The spec for these low-level
25808 operations constitutes GNULLI, the GNULL Interface.  This interface is
25809 directly inspired from the POSIX real-time API.
25811 If the underlying executive or OS implements the POSIX standard
25812 faithfully, the GNULL Interface maps as is to the services offered by
25813 the underlying kernel.  Otherwise, some target dependent glue code maps
25814 the services offered by the underlying kernel to the semantics expected
25815 by GNARL.
25817 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
25818 key point is that each Ada task is mapped on a thread in the underlying
25819 kernel.  For example, in the case of VxWorks, one Ada task = one VxWorks task.
25821 In addition Ada task priorities map onto the underlying thread priorities.
25822 Mapping Ada tasks onto the underlying kernel threads has several advantages:
25825 @itemize *
25827 @item 
25828 The underlying scheduler is used to schedule the Ada tasks.  This
25829 makes Ada tasks as efficient as kernel threads from a scheduling
25830 standpoint.
25832 @item 
25833 Interaction with code written in C containing threads is eased
25834 since at the lowest level Ada tasks and C threads map onto the same
25835 underlying kernel concept.
25837 @item 
25838 When an Ada task is blocked during I/O the remaining Ada tasks are
25839 able to proceed.
25841 @item 
25842 On multiprocessor systems Ada tasks can execute in parallel.
25843 @end itemize
25845 Some threads libraries offer a mechanism to fork a new process, with the
25846 child process duplicating the threads from the parent.
25847 GNAT does not
25848 support this functionality when the parent contains more than one task.
25850 @geindex Forking a new process
25852 @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
25853 @anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{418}@anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{419}
25854 @subsection Ensuring Compliance with the Real-Time Annex
25857 @geindex Real-Time Systems Annex compliance
25859 Although mapping Ada tasks onto
25860 the underlying threads has significant advantages, it does create some
25861 complications when it comes to respecting the scheduling semantics
25862 specified in the real-time annex (Annex D).
25864 For instance the Annex D requirement for the @code{FIFO_Within_Priorities}
25865 scheduling policy states:
25867 @quotation
25869 `When the active priority of a ready task that is not running
25870 changes, or the setting of its base priority takes effect, the
25871 task is removed from the ready queue for its old active priority
25872 and is added at the tail of the ready queue for its new active
25873 priority, except in the case where the active priority is lowered
25874 due to the loss of inherited priority, in which case the task is
25875 added at the head of the ready queue for its new active priority.'
25876 @end quotation
25878 While most kernels do put tasks at the end of the priority queue when
25879 a task changes its priority, (which respects the main
25880 FIFO_Within_Priorities requirement), almost none keep a thread at the
25881 beginning of its priority queue when its priority drops from the loss
25882 of inherited priority.
25884 As a result most vendors have provided incomplete Annex D implementations.
25886 The GNAT run-time, has a nice cooperative solution to this problem
25887 which ensures that accurate FIFO_Within_Priorities semantics are
25888 respected.
25890 The principle is as follows.  When an Ada task T is about to start
25891 running, it checks whether some other Ada task R with the same
25892 priority as T has been suspended due to the loss of priority
25893 inheritance.  If this is the case, T yields and is placed at the end of
25894 its priority queue.  When R arrives at the front of the queue it
25895 executes.
25897 Note that this simple scheme preserves the relative order of the tasks
25898 that were ready to execute in the priority queue where R has been
25899 placed at the end.
25901 @c Support_for_Locking_Policies
25903 @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
25904 @anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{41a}
25905 @subsection Support for Locking Policies
25908 This section specifies which policies specified by pragma Locking_Policy
25909 are supported on which platforms.
25911 GNAT supports the standard @code{Ceiling_Locking} policy, and the
25912 implementation defined @code{Inheritance_Locking} and
25913 @code{Concurrent_Readers_Locking} policies.
25915 @code{Ceiling_Locking} is supported on all platforms if the operating system
25916 supports it. In particular, @code{Ceiling_Locking} is not supported on
25917 VxWorks.
25918 @code{Inheritance_Locking} is supported on
25919 Linux,
25920 Darwin (Mac OS X),
25921 LynxOS 178,
25922 and VxWorks.
25923 @code{Concurrent_Readers_Locking} is supported on Linux.
25925 Notes about @code{Ceiling_Locking} on Linux:
25926 If the process is running as ‘root’, ceiling locking is used.
25927 If the capabilities facility is installed
25928 (“sudo apt-get –assume-yes install libcap-dev” on Ubuntu,
25929 for example),
25930 and the program is linked against that library
25931 (“-largs -lcap”),
25932 and the executable file has the cap_sys_nice capability
25933 (“sudo /sbin/setcap cap_sys_nice=ep executable_file_name”),
25934 then ceiling locking is used.
25935 Otherwise, the @code{Ceiling_Locking} policy is ignored.
25937 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
25938 @anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{41b}@anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{41c}
25939 @section GNAT Implementation of Shared Passive Packages
25942 @geindex Shared passive packages
25944 GNAT fully implements the 
25945 @geindex pragma Shared_Passive
25946 pragma
25947 @code{Shared_Passive} for
25948 the purpose of designating shared passive packages.
25949 This allows the use of passive partitions in the
25950 context described in the Ada Reference Manual; i.e., for communication
25951 between separate partitions of a distributed application using the
25952 features in Annex E.
25954 @geindex Annex E
25956 @geindex Distribution Systems Annex
25958 However, the implementation approach used by GNAT provides for more
25959 extensive usage as follows:
25962 @table @asis
25964 @item `Communication between separate programs'
25966 This allows separate programs to access the data in passive
25967 partitions, using protected objects for synchronization where
25968 needed. The only requirement is that the two programs have a
25969 common shared file system. It is even possible for programs
25970 running on different machines with different architectures
25971 (e.g., different endianness) to communicate via the data in
25972 a passive partition.
25974 @item `Persistence between program runs'
25976 The data in a passive package can persist from one run of a
25977 program to another, so that a later program sees the final
25978 values stored by a previous run of the same program.
25979 @end table
25981 The implementation approach used is to store the data in files. A
25982 separate stream file is created for each object in the package, and
25983 an access to an object causes the corresponding file to be read or
25984 written.
25986 @geindex SHARED_MEMORY_DIRECTORY environment variable
25988 The environment variable @code{SHARED_MEMORY_DIRECTORY} should be
25989 set to the directory to be used for these files.
25990 The files in this directory
25991 have names that correspond to their fully qualified names. For
25992 example, if we have the package
25994 @example
25995 package X is
25996   pragma Shared_Passive (X);
25997   Y : Integer;
25998   Z : Float;
25999 end X;
26000 @end example
26002 and the environment variable is set to @code{/stemp/}, then the files created
26003 will have the names:
26005 @example
26006 /stemp/x.y
26007 /stemp/x.z
26008 @end example
26010 These files are created when a value is initially written to the object, and
26011 the files are retained until manually deleted. This provides the persistence
26012 semantics. If no file exists, it means that no partition has assigned a value
26013 to the variable; in this case the initial value declared in the package
26014 will be used. This model ensures that there are no issues in synchronizing
26015 the elaboration process, since elaboration of passive packages elaborates the
26016 initial values, but does not create the files.
26018 The files are written using normal @code{Stream_IO} access.
26019 If you want to be able
26020 to communicate between programs or partitions running on different
26021 architectures, then you should use the XDR versions of the stream attribute
26022 routines, since these are architecture independent.
26024 If active synchronization is required for access to the variables in the
26025 shared passive package, then as described in the Ada Reference Manual, the
26026 package may contain protected objects used for this purpose. In this case
26027 a lock file (whose name is @code{___lock}, with three underscores)
26028 is created in the shared memory directory.
26030 @geindex ___lock file (for shared passive packages)
26032 This is used to provide the required locking
26033 semantics for proper protected object synchronization.
26035 @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
26036 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{41d}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{41e}
26037 @section Code Generation for Array Aggregates
26040 Aggregates have a rich syntax and allow the user to specify the values of
26041 complex data structures by means of a single construct.  As a result, the
26042 code generated for aggregates can be quite complex and involve loops, case
26043 statements and multiple assignments.  In the simplest cases, however, the
26044 compiler will recognize aggregates whose components and constraints are
26045 fully static, and in those cases the compiler will generate little or no
26046 executable code.  The following is an outline of the code that GNAT generates
26047 for various aggregate constructs.  For further details, you will find it
26048 useful to examine the output produced by the -gnatG flag to see the expanded
26049 source that is input to the code generator.  You may also want to examine
26050 the assembly code generated at various levels of optimization.
26052 The code generated for aggregates depends on the context, the component values,
26053 and the type.  In the context of an object declaration the code generated is
26054 generally simpler than in the case of an assignment.  As a general rule, static
26055 component values and static subtypes also lead to simpler code.
26057 @menu
26058 * Static constant aggregates with static bounds:: 
26059 * Constant aggregates with unconstrained nominal types:: 
26060 * Aggregates with static bounds:: 
26061 * Aggregates with nonstatic bounds:: 
26062 * Aggregates in assignment statements:: 
26064 @end menu
26066 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
26067 @anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{41f}@anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{420}
26068 @subsection Static constant aggregates with static bounds
26071 For the declarations:
26073 @example
26074 type One_Dim is array (1..10) of integer;
26075 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
26076 @end example
26078 GNAT generates no executable code: the constant ar0 is placed in static memory.
26079 The same is true for constant aggregates with named associations:
26081 @example
26082 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
26083 Cr3 : constant One_Dim := (others => 7777);
26084 @end example
26086 The same is true for multidimensional constant arrays such as:
26088 @example
26089 type two_dim is array (1..3, 1..3) of integer;
26090 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
26091 @end example
26093 The same is true for arrays of one-dimensional arrays: the following are
26094 static:
26096 @example
26097 type ar1b  is array (1..3) of boolean;
26098 type ar_ar is array (1..3) of ar1b;
26099 None  : constant ar1b := (others => false);     --  fully static
26100 None2 : constant ar_ar := (1..3 => None);       --  fully static
26101 @end example
26103 However, for multidimensional aggregates with named associations, GNAT will
26104 generate assignments and loops, even if all associations are static.  The
26105 following two declarations generate a loop for the first dimension, and
26106 individual component assignments for the second dimension:
26108 @example
26109 Zero1: constant two_dim := (1..3 => (1..3 => 0));
26110 Zero2: constant two_dim := (others => (others => 0));
26111 @end example
26113 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
26114 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{421}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{422}
26115 @subsection Constant aggregates with unconstrained nominal types
26118 In such cases the aggregate itself establishes the subtype, so that
26119 associations with @code{others} cannot be used.  GNAT determines the
26120 bounds for the actual subtype of the aggregate, and allocates the
26121 aggregate statically as well.  No code is generated for the following:
26123 @example
26124 type One_Unc is array (natural range <>) of integer;
26125 Cr_Unc : constant One_Unc := (12,24,36);
26126 @end example
26128 @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
26129 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{423}@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{424}
26130 @subsection Aggregates with static bounds
26133 In all previous examples the aggregate was the initial (and immutable) value
26134 of a constant.  If the aggregate initializes a variable, then code is generated
26135 for it as a combination of individual assignments and loops over the target
26136 object.  The declarations
26138 @example
26139 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
26140 Cr_Var2 : One_Dim := (others > -1);
26141 @end example
26143 generate the equivalent of
26145 @example
26146 Cr_Var1 (1) := 2;
26147 Cr_Var1 (2) := 3;
26148 Cr_Var1 (3) := 5;
26149 Cr_Var1 (4) := 11;
26151 for I in Cr_Var2'range loop
26152    Cr_Var2 (I) := -1;
26153 end loop;
26154 @end example
26156 @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
26157 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{425}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{426}
26158 @subsection Aggregates with nonstatic bounds
26161 If the bounds of the aggregate are not statically compatible with the bounds
26162 of the nominal subtype  of the target, then constraint checks have to be
26163 generated on the bounds.  For a multidimensional array, constraint checks may
26164 have to be applied to sub-arrays individually, if they do not have statically
26165 compatible subtypes.
26167 @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
26168 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{427}@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{428}
26169 @subsection Aggregates in assignment statements
26172 In general, aggregate assignment requires the construction of a temporary,
26173 and a copy from the temporary to the target of the assignment.  This is because
26174 it is not always possible to convert the assignment into a series of individual
26175 component assignments.  For example, consider the simple case:
26177 @example
26178 A := (A(2), A(1));
26179 @end example
26181 This cannot be converted into:
26183 @example
26184 A(1) := A(2);
26185 A(2) := A(1);
26186 @end example
26188 So the aggregate has to be built first in a separate location, and then
26189 copied into the target.  GNAT recognizes simple cases where this intermediate
26190 step is not required, and the assignments can be performed in place, directly
26191 into the target.  The following sufficient criteria are applied:
26194 @itemize *
26196 @item 
26197 The bounds of the aggregate are static, and the associations are static.
26199 @item 
26200 The components of the aggregate are static constants, names of
26201 simple variables that are not renamings, or expressions not involving
26202 indexed components whose operands obey these rules.
26203 @end itemize
26205 If any of these conditions are violated, the aggregate will be built in
26206 a temporary (created either by the front-end or the code generator) and then
26207 that temporary will be copied onto the target.
26209 @node The Size of Discriminated Records with Default Discriminants,Image Values For Nonscalar Types,Code Generation for Array Aggregates,Implementation of Specific Ada Features
26210 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{429}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{42a}
26211 @section The Size of Discriminated Records with Default Discriminants
26214 If a discriminated type @code{T} has discriminants with default values, it is
26215 possible to declare an object of this type without providing an explicit
26216 constraint:
26218 @example
26219 type Size is range 1..100;
26221 type Rec (D : Size := 15) is record
26222    Name : String (1..D);
26223 end T;
26225 Word : Rec;
26226 @end example
26228 Such an object is said to be `unconstrained'.
26229 The discriminant of the object
26230 can be modified by a full assignment to the object, as long as it preserves the
26231 relation between the value of the discriminant, and the value of the components
26232 that depend on it:
26234 @example
26235 Word := (3, "yes");
26237 Word := (5, "maybe");
26239 Word := (5, "no"); -- raises Constraint_Error
26240 @end example
26242 In order to support this behavior efficiently, an unconstrained object is
26243 given the maximum size that any value of the type requires. In the case
26244 above, @code{Word} has storage for the discriminant and for
26245 a @code{String} of length 100.
26246 It is important to note that unconstrained objects do not require dynamic
26247 allocation. It would be an improper implementation to place on the heap those
26248 components whose size depends on discriminants. (This improper implementation
26249 was used by some Ada83 compilers, where the @code{Name} component above
26250 would have
26251 been stored as a pointer to a dynamic string). Following the principle that
26252 dynamic storage management should never be introduced implicitly,
26253 an Ada compiler should reserve the full size for an unconstrained declared
26254 object, and place it on the stack.
26256 This maximum size approach
26257 has been a source of surprise to some users, who expect the default
26258 values of the discriminants to determine the size reserved for an
26259 unconstrained object: “If the default is 15, why should the object occupy
26260 a larger size?”
26261 The answer, of course, is that the discriminant may be later modified,
26262 and its full range of values must be taken into account. This is why the
26263 declaration:
26265 @example
26266 type Rec (D : Positive := 15) is record
26267    Name : String (1..D);
26268 end record;
26270 Too_Large : Rec;
26271 @end example
26273 is flagged by the compiler with a warning:
26274 an attempt to create @code{Too_Large} will raise @code{Storage_Error},
26275 because the required size includes @code{Positive'Last}
26276 bytes. As the first example indicates, the proper approach is to declare an
26277 index type of ‘reasonable’ range so that unconstrained objects are not too
26278 large.
26280 One final wrinkle: if the object is declared to be @code{aliased}, or if it is
26281 created in the heap by means of an allocator, then it is `not'
26282 unconstrained:
26283 it is constrained by the default values of the discriminants, and those values
26284 cannot be modified by full assignment. This is because in the presence of
26285 aliasing all views of the object (which may be manipulated by different tasks,
26286 say) must be consistent, so it is imperative that the object, once created,
26287 remain invariant.
26289 @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
26290 @anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{42b}@anchor{gnat_rm/implementation_of_specific_ada_features image-values-for-nonscalar-types}@anchor{42c}
26291 @section Image Values For Nonscalar Types
26294 Ada 2022 defines the Image, Wide_Image, and Wide_Wide image attributes
26295 for nonscalar types; earlier Ada versions defined these attributes only
26296 for scalar types. Ada RM 4.10 provides some general guidance regarding
26297 the default implementation of these attributes and the GNAT compiler
26298 follows that guidance. However, beyond that the precise details of the
26299 image text generated in these cases are deliberately not documented and are
26300 subject to change. In particular, users should not rely on formatting details
26301 (such as spaces or line breaking), record field order, image values for access
26302 types, image values for types that have ancestor or subcomponent types
26303 declared in non-Ada2022 code, image values for predefined types, or the
26304 compiler’s choices regarding the implementation permissions described in
26305 Ada RM 4.10. This list is not intended to be exhaustive. If more precise
26306 control of image text is required for some type T, then T’Put_Image should be
26307 explicitly specified.
26309 @node Strict Conformance to the Ada Reference Manual,,Image Values For Nonscalar Types,Implementation of Specific Ada Features
26310 @anchor{gnat_rm/implementation_of_specific_ada_features id15}@anchor{42d}@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{42e}
26311 @section Strict Conformance to the Ada Reference Manual
26314 The dynamic semantics defined by the Ada Reference Manual impose a set of
26315 run-time checks to be generated. By default, the GNAT compiler will insert many
26316 run-time checks into the compiled code, including most of those required by the
26317 Ada Reference Manual. However, there are two checks that are not enabled in
26318 the default mode for efficiency reasons: checks for access before elaboration
26319 on subprogram calls, and stack overflow checking (most operating systems do not
26320 perform this check by default).
26322 Strict conformance to the Ada Reference Manual can be achieved by adding two
26323 compiler options for dynamic checks for access-before-elaboration on subprogram
26324 calls and generic instantiations (`-gnatE'), and stack overflow checking
26325 (`-fstack-check').
26327 Note that the result of a floating point arithmetic operation in overflow and
26328 invalid situations, when the @code{Machine_Overflows} attribute of the result
26329 type is @code{False}, is to generate IEEE NaN and infinite values. This is the
26330 case for machines compliant with the IEEE floating-point standard, but on
26331 machines that are not fully compliant with this standard, such as Alpha, the
26332 `-mieee' compiler flag must be used for achieving IEEE confirming
26333 behavior (although at the cost of a significant performance penalty), so
26334 infinite and NaN values are properly generated.
26336 @node Implementation of Ada 2012 Features,GNAT language extensions,Implementation of Specific Ada Features,Top
26337 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{42f}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{430}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14}
26338 @chapter Implementation of Ada 2012 Features
26341 @geindex Ada 2012 implementation status
26343 @geindex -gnat12 option (gcc)
26345 @geindex pragma Ada_2012
26347 @geindex configuration pragma Ada_2012
26349 @geindex Ada_2012 configuration pragma
26351 This chapter contains a complete list of Ada 2012 features that have been
26352 implemented.
26353 Generally, these features are only
26354 available if the `-gnat12' (Ada 2012 features enabled) option is set,
26355 which is the default behavior,
26356 or if the configuration pragma @code{Ada_2012} is used.
26358 However, new pragmas, attributes, and restrictions are
26359 unconditionally available, since the Ada 95 standard allows the addition of
26360 new pragmas, attributes, and restrictions (there are exceptions, which are
26361 documented in the individual descriptions), and also certain packages
26362 were made available in earlier versions of Ada.
26364 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
26365 This date shows the implementation date of the feature. Any wavefront
26366 subsequent to this date will contain the indicated feature, as will any
26367 subsequent releases. A date of 0000-00-00 means that GNAT has always
26368 implemented the feature, or implemented it as soon as it appeared as a
26369 binding interpretation.
26371 Each feature corresponds to an Ada Issue (‘AI’) approved by the Ada
26372 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
26373 The features are ordered based on the relevant sections of the Ada
26374 Reference Manual (“RM”).  When a given AI relates to multiple points
26375 in the RM, the earliest is used.
26377 A complete description of the AIs may be found in
26378 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
26380 @geindex AI-0176 (Ada 2012 feature)
26383 @itemize *
26385 @item 
26386 `AI-0176 Quantified expressions (2010-09-29)'
26388 Both universally and existentially quantified expressions are implemented.
26389 They use the new syntax for iterators proposed in AI05-139-2, as well as
26390 the standard Ada loop syntax.
26392 RM References:  1.01.04 (12)   2.09 (2/2)   4.04 (7)   4.05.09 (0)
26393 @end itemize
26395 @geindex AI-0079 (Ada 2012 feature)
26398 @itemize *
26400 @item 
26401 `AI-0079 Allow other_format characters in source (2010-07-10)'
26403 Wide characters in the unicode category `other_format' are now allowed in
26404 source programs between tokens, but not within a token such as an identifier.
26406 RM References:  2.01 (4/2)   2.02 (7)
26407 @end itemize
26409 @geindex AI-0091 (Ada 2012 feature)
26412 @itemize *
26414 @item 
26415 `AI-0091 Do not allow other_format in identifiers (0000-00-00)'
26417 Wide characters in the unicode category `other_format' are not permitted
26418 within  an identifier, since this can be a security problem. The error
26419 message for this case has been improved to be more specific, but GNAT has
26420 never allowed such characters to appear in identifiers.
26422 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)
26423 @end itemize
26425 @geindex AI-0100 (Ada 2012 feature)
26428 @itemize *
26430 @item 
26431 `AI-0100 Placement of pragmas  (2010-07-01)'
26433 This AI is an earlier version of AI-163. It simplifies the rules
26434 for legal placement of pragmas. In the case of lists that allow pragmas, if
26435 the list may have no elements, then the list may consist solely of pragmas.
26437 RM References:  2.08 (7)
26438 @end itemize
26440 @geindex AI-0163 (Ada 2012 feature)
26443 @itemize *
26445 @item 
26446 `AI-0163 Pragmas in place of null (2010-07-01)'
26448 A statement sequence may be composed entirely of pragmas. It is no longer
26449 necessary to add a dummy @code{null} statement to make the sequence legal.
26451 RM References:  2.08 (7)   2.08 (16)
26452 @end itemize
26454 @geindex AI-0080 (Ada 2012 feature)
26457 @itemize *
26459 @item 
26460 `AI-0080 ‘View of’ not needed if clear from context (0000-00-00)'
26462 This is an editorial change only, described as non-testable in the AI.
26464 RM References:  3.01 (7)
26465 @end itemize
26467 @geindex AI-0183 (Ada 2012 feature)
26470 @itemize *
26472 @item 
26473 `AI-0183 Aspect specifications (2010-08-16)'
26475 Aspect specifications have been fully implemented except for pre and post-
26476 conditions, and type invariants, which have their own separate AI’s. All
26477 forms of declarations listed in the AI are supported. The following is a
26478 list of the aspects supported (with GNAT implementation aspects marked)
26479 @end itemize
26482 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} 
26483 @headitem
26485 Supported Aspect
26487 @tab
26489 Source
26491 @item
26493 @code{Ada_2005}
26495 @tab
26497 – GNAT
26499 @item
26501 @code{Ada_2012}
26503 @tab
26505 – GNAT
26507 @item
26509 @code{Address}
26511 @tab
26513 @item
26515 @code{Alignment}
26517 @tab
26519 @item
26521 @code{Atomic}
26523 @tab
26525 @item
26527 @code{Atomic_Components}
26529 @tab
26531 @item
26533 @code{Bit_Order}
26535 @tab
26537 @item
26539 @code{Component_Size}
26541 @tab
26543 @item
26545 @code{Contract_Cases}
26547 @tab
26549 – GNAT
26551 @item
26553 @code{Discard_Names}
26555 @tab
26557 @item
26559 @code{External_Tag}
26561 @tab
26563 @item
26565 @code{Favor_Top_Level}
26567 @tab
26569 – GNAT
26571 @item
26573 @code{Inline}
26575 @tab
26577 @item
26579 @code{Inline_Always}
26581 @tab
26583 – GNAT
26585 @item
26587 @code{Invariant}
26589 @tab
26591 – GNAT
26593 @item
26595 @code{Machine_Radix}
26597 @tab
26599 @item
26601 @code{No_Return}
26603 @tab
26605 @item
26607 @code{Object_Size}
26609 @tab
26611 – GNAT
26613 @item
26615 @code{Pack}
26617 @tab
26619 @item
26621 @code{Persistent_BSS}
26623 @tab
26625 – GNAT
26627 @item
26629 @code{Post}
26631 @tab
26633 @item
26635 @code{Pre}
26637 @tab
26639 @item
26641 @code{Predicate}
26643 @tab
26645 @item
26647 @code{Preelaborable_Initialization}
26649 @tab
26651 @item
26653 @code{Pure_Function}
26655 @tab
26657 – GNAT
26659 @item
26661 @code{Remote_Access_Type}
26663 @tab
26665 – GNAT
26667 @item
26669 @code{Shared}
26671 @tab
26673 – GNAT
26675 @item
26677 @code{Size}
26679 @tab
26681 @item
26683 @code{Storage_Pool}
26685 @tab
26687 @item
26689 @code{Storage_Size}
26691 @tab
26693 @item
26695 @code{Stream_Size}
26697 @tab
26699 @item
26701 @code{Suppress}
26703 @tab
26705 @item
26707 @code{Suppress_Debug_Info}
26709 @tab
26711 – GNAT
26713 @item
26715 @code{Test_Case}
26717 @tab
26719 – GNAT
26721 @item
26723 @code{Thread_Local_Storage}
26725 @tab
26727 – GNAT
26729 @item
26731 @code{Type_Invariant}
26733 @tab
26735 @item
26737 @code{Unchecked_Union}
26739 @tab
26741 @item
26743 @code{Universal_Aliasing}
26745 @tab
26747 – GNAT
26749 @item
26751 @code{Unmodified}
26753 @tab
26755 – GNAT
26757 @item
26759 @code{Unreferenced}
26761 @tab
26763 – GNAT
26765 @item
26767 @code{Unreferenced_Objects}
26769 @tab
26771 – GNAT
26773 @item
26775 @code{Unsuppress}
26777 @tab
26779 @item
26781 @code{Value_Size}
26783 @tab
26785 – GNAT
26787 @item
26789 @code{Volatile}
26791 @tab
26793 @item
26795 @code{Volatile_Components}
26797 @tab
26799 @item
26801 @code{Warnings}
26803 @tab
26805 – GNAT
26807 @end multitable
26810 @quotation
26812 Note that for aspects with an expression, e.g. @code{Size}, the expression is
26813 treated like a default expression (visibility is analyzed at the point of
26814 occurrence of the aspect, but evaluation of the expression occurs at the
26815 freeze point of the entity involved).
26817 RM References:  3.02.01 (3)   3.02.02 (2)   3.03.01 (2/2)   3.08 (6)
26818 3.09.03 (1.1/2)   6.01 (2/2)   6.07 (2/2)   9.05.02 (2/2)   7.01 (3)   7.03
26819 (2)   7.03 (3)   9.01 (2/2)   9.01 (3/2)   9.04 (2/2)   9.04 (3/2)
26820 9.05.02 (2/2)   11.01 (2)   12.01 (3)   12.03 (2/2)   12.04 (2/2)   12.05 (2)
26821 12.06 (2.1/2)   12.06 (2.2/2)   12.07 (2)   13.01 (0.1/2)   13.03 (5/1)
26822 13.03.01 (0)
26823 @end quotation
26825 @geindex AI-0128 (Ada 2012 feature)
26828 @itemize *
26830 @item 
26831 `AI-0128 Inequality is a primitive operation (0000-00-00)'
26833 If an equality operator (“=”) is declared for a type, then the implicitly
26834 declared inequality operator (“/=”) is a primitive operation of the type.
26835 This is the only reasonable interpretation, and is the one always implemented
26836 by GNAT, but the RM was not entirely clear in making this point.
26838 RM References:  3.02.03 (6)   6.06 (6)
26839 @end itemize
26841 @geindex AI-0003 (Ada 2012 feature)
26844 @itemize *
26846 @item 
26847 `AI-0003 Qualified expressions as names (2010-07-11)'
26849 In Ada 2012, a qualified expression is considered to be syntactically a name,
26850 meaning that constructs such as @code{A'(F(X)).B} are now legal. This is
26851 useful in disambiguating some cases of overloading.
26853 RM References:  3.03 (11)   3.03 (21)   4.01 (2)   4.04 (7)   4.07 (3)
26854 5.04 (7)
26855 @end itemize
26857 @geindex AI-0120 (Ada 2012 feature)
26860 @itemize *
26862 @item 
26863 `AI-0120 Constant instance of protected object (0000-00-00)'
26865 This is an RM editorial change only. The section that lists objects that are
26866 constant failed to include the current instance of a protected object
26867 within a protected function. This has always been treated as a constant
26868 in GNAT.
26870 RM References:  3.03 (21)
26871 @end itemize
26873 @geindex AI-0008 (Ada 2012 feature)
26876 @itemize *
26878 @item 
26879 `AI-0008 General access to constrained objects (0000-00-00)'
26881 The wording in the RM implied that if you have a general access to a
26882 constrained object, it could be used to modify the discriminants. This was
26883 obviously not intended. @code{Constraint_Error} should be raised, and GNAT
26884 has always done so in this situation.
26886 RM References:  3.03 (23)   3.10.02 (26/2)   4.01 (9)   6.04.01 (17)   8.05.01 (5/2)
26887 @end itemize
26889 @geindex AI-0093 (Ada 2012 feature)
26892 @itemize *
26894 @item 
26895 `AI-0093 Additional rules use immutably limited (0000-00-00)'
26897 This is an editorial change only, to make more widespread use of the Ada 2012
26898 ‘immutably limited’.
26900 RM References:  3.03 (23.4/3)
26901 @end itemize
26903 @geindex AI-0096 (Ada 2012 feature)
26906 @itemize *
26908 @item 
26909 `AI-0096 Deriving from formal private types (2010-07-20)'
26911 In general it is illegal for a type derived from a formal limited type to be
26912 nonlimited.  This AI makes an exception to this rule: derivation is legal
26913 if it appears in the private part of the generic, and the formal type is not
26914 tagged. If the type is tagged, the legality check must be applied to the
26915 private part of the package.
26917 RM References:  3.04 (5.1/2)   6.02 (7)
26918 @end itemize
26920 @geindex AI-0181 (Ada 2012 feature)
26923 @itemize *
26925 @item 
26926 `AI-0181 Soft hyphen is a non-graphic character (2010-07-23)'
26928 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
26929 means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the
26930 @code{Image} and @code{Value} attributes for the character types. Strictly
26931 speaking this is an inconsistency with Ada 95, but in practice the use of
26932 these attributes is so obscure that it will not cause problems.
26934 RM References:  3.05.02 (2/2)   A.01 (35/2)   A.03.03 (21)
26935 @end itemize
26937 @geindex AI-0182 (Ada 2012 feature)
26940 @itemize *
26942 @item 
26943 `AI-0182 Additional forms for' @code{Character'Value} `(0000-00-00)'
26945 This AI allows @code{Character'Value} to accept the string @code{'?'} where
26946 @code{?} is any character including non-graphic control characters. GNAT has
26947 always accepted such strings. It also allows strings such as
26948 @code{HEX_00000041} to be accepted, but GNAT does not take advantage of this
26949 permission and raises @code{Constraint_Error}, as is certainly still
26950 permitted.
26952 RM References:  3.05 (56/2)
26953 @end itemize
26955 @geindex AI-0214 (Ada 2012 feature)
26958 @itemize *
26960 @item 
26961 `AI-0214 Defaulted discriminants for limited tagged (2010-10-01)'
26963 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
26964 to have default expressions by allowing them when the type is limited. It
26965 is often useful to define a default value for a discriminant even though
26966 it can’t be changed by assignment.
26968 RM References:  3.07 (9.1/2)   3.07.02 (3)
26969 @end itemize
26971 @geindex AI-0102 (Ada 2012 feature)
26974 @itemize *
26976 @item 
26977 `AI-0102 Some implicit conversions are illegal (0000-00-00)'
26979 It is illegal to assign an anonymous access constant to an anonymous access
26980 variable. The RM did not have a clear rule to prevent this, but GNAT has
26981 always generated an error for this usage.
26983 RM References:  3.07 (16)   3.07.01 (9)   6.04.01 (6)   8.06 (27/2)
26984 @end itemize
26986 @geindex AI-0158 (Ada 2012 feature)
26989 @itemize *
26991 @item 
26992 `AI-0158 Generalizing membership tests (2010-09-16)'
26994 This AI extends the syntax of membership tests to simplify complex conditions
26995 that can be expressed as membership in a subset of values of any type. It
26996 introduces syntax for a list of expressions that may be used in loop contexts
26997 as well.
26999 RM References:  3.08.01 (5)   4.04 (3)   4.05.02 (3)   4.05.02 (5)   4.05.02 (27)
27000 @end itemize
27002 @geindex AI-0173 (Ada 2012 feature)
27005 @itemize *
27007 @item 
27008 `AI-0173 Testing if tags represent abstract types (2010-07-03)'
27010 The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked
27011 with the tag of an abstract type, and @code{False} otherwise.
27013 RM References:  3.09 (7.4/2)   3.09 (12.4/2)
27014 @end itemize
27016 @geindex AI-0076 (Ada 2012 feature)
27019 @itemize *
27021 @item 
27022 `AI-0076 function with controlling result (0000-00-00)'
27024 This is an editorial change only. The RM defines calls with controlling
27025 results, but uses the term ‘function with controlling result’ without an
27026 explicit definition.
27028 RM References:  3.09.02 (2/2)
27029 @end itemize
27031 @geindex AI-0126 (Ada 2012 feature)
27034 @itemize *
27036 @item 
27037 `AI-0126 Dispatching with no declared operation (0000-00-00)'
27039 This AI clarifies dispatching rules, and simply confirms that dispatching
27040 executes the operation of the parent type when there is no explicitly or
27041 implicitly declared operation for the descendant type. This has always been
27042 the case in all versions of GNAT.
27044 RM References:  3.09.02 (20/2)   3.09.02 (20.1/2)   3.09.02 (20.2/2)
27045 @end itemize
27047 @geindex AI-0097 (Ada 2012 feature)
27050 @itemize *
27052 @item 
27053 `AI-0097 Treatment of abstract null extension (2010-07-19)'
27055 The RM as written implied that in some cases it was possible to create an
27056 object of an abstract type, by having an abstract extension inherit a non-
27057 abstract constructor from its parent type. This mistake has been corrected
27058 in GNAT and in the RM, and this construct is now illegal.
27060 RM References:  3.09.03 (4/2)
27061 @end itemize
27063 @geindex AI-0203 (Ada 2012 feature)
27066 @itemize *
27068 @item 
27069 `AI-0203 Extended return cannot be abstract (0000-00-00)'
27071 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
27072 permitted such usage.
27074 RM References:  3.09.03 (8/3)
27075 @end itemize
27077 @geindex AI-0198 (Ada 2012 feature)
27080 @itemize *
27082 @item 
27083 `AI-0198 Inheriting abstract operators  (0000-00-00)'
27085 This AI resolves a conflict between two rules involving inherited abstract
27086 operations and predefined operators. If a derived numeric type inherits
27087 an abstract operator, it overrides the predefined one. This interpretation
27088 was always the one implemented in GNAT.
27090 RM References:  3.09.03 (4/3)
27091 @end itemize
27093 @geindex AI-0073 (Ada 2012 feature)
27096 @itemize *
27098 @item 
27099 `AI-0073 Functions returning abstract types (2010-07-10)'
27101 This AI covers a number of issues regarding returning abstract types. In
27102 particular generic functions cannot have abstract result types or access
27103 result types designated an abstract type. There are some other cases which
27104 are detailed in the AI. Note that this binding interpretation has not been
27105 retrofitted to operate before Ada 2012 mode, since it caused a significant
27106 number of regressions.
27108 RM References:  3.09.03 (8)   3.09.03 (10)   6.05 (8/2)
27109 @end itemize
27111 @geindex AI-0070 (Ada 2012 feature)
27114 @itemize *
27116 @item 
27117 `AI-0070 Elaboration of interface types (0000-00-00)'
27119 This is an editorial change only, there are no testable consequences short of
27120 checking for the absence of generated code for an interface declaration.
27122 RM References:  3.09.04 (18/2)
27123 @end itemize
27125 @geindex AI-0208 (Ada 2012 feature)
27128 @itemize *
27130 @item 
27131 `AI-0208 Characteristics of incomplete views (0000-00-00)'
27133 The wording in the Ada 2005 RM concerning characteristics of incomplete views
27134 was incorrect and implied that some programs intended to be legal were now
27135 illegal. GNAT had never considered such programs illegal, so it has always
27136 implemented the intent of this AI.
27138 RM References:  3.10.01 (2.4/2)   3.10.01 (2.6/2)
27139 @end itemize
27141 @geindex AI-0162 (Ada 2012 feature)
27144 @itemize *
27146 @item 
27147 `AI-0162 Incomplete type completed by partial view (2010-09-15)'
27149 Incomplete types are made more useful by allowing them to be completed by
27150 private types and private extensions.
27152 RM References:  3.10.01 (2.5/2)   3.10.01 (2.6/2)   3.10.01 (3)   3.10.01 (4/2)
27153 @end itemize
27155 @geindex AI-0098 (Ada 2012 feature)
27158 @itemize *
27160 @item 
27161 `AI-0098 Anonymous subprogram access restrictions (0000-00-00)'
27163 An unintentional omission in the RM implied some inconsistent restrictions on
27164 the use of anonymous access to subprogram values. These restrictions were not
27165 intentional, and have never been enforced by GNAT.
27167 RM References:  3.10.01 (6)   3.10.01 (9.2/2)
27168 @end itemize
27170 @geindex AI-0199 (Ada 2012 feature)
27173 @itemize *
27175 @item 
27176 `AI-0199 Aggregate with anonymous access components (2010-07-14)'
27178 A choice list in a record aggregate can include several components of
27179 (distinct) anonymous access types as long as they have matching designated
27180 subtypes.
27182 RM References:  4.03.01 (16)
27183 @end itemize
27185 @geindex AI-0220 (Ada 2012 feature)
27188 @itemize *
27190 @item 
27191 `AI-0220 Needed components for aggregates (0000-00-00)'
27193 This AI addresses a wording problem in the RM that appears to permit some
27194 complex cases of aggregates with nonstatic discriminants. GNAT has always
27195 implemented the intended semantics.
27197 RM References:  4.03.01 (17)
27198 @end itemize
27200 @geindex AI-0147 (Ada 2012 feature)
27203 @itemize *
27205 @item 
27206 `AI-0147 Conditional expressions (2009-03-29)'
27208 Conditional expressions are permitted. The form of such an expression is:
27210 @example
27211 (if expr then expr @{elsif expr then expr@} [else expr])
27212 @end example
27214 The parentheses can be omitted in contexts where parentheses are present
27215 anyway, such as subprogram arguments and pragma arguments. If the `else'
27216 clause is omitted, `else' `True' is assumed;
27217 thus @code{(if A then B)} is a way to conveniently represent
27218 `(A implies B)' in standard logic.
27220 RM References:  4.03.03 (15)   4.04 (1)   4.04 (7)   4.05.07 (0)   4.07 (2)
27221 4.07 (3)   4.09 (12)   4.09 (33)   5.03 (3)   5.03 (4)   7.05 (2.1/2)
27222 @end itemize
27224 @geindex AI-0037 (Ada 2012 feature)
27227 @itemize *
27229 @item 
27230 `AI-0037 Out-of-range box associations in aggregate (0000-00-00)'
27232 This AI confirms that an association of the form @code{Indx => <>} in an
27233 array aggregate must raise @code{Constraint_Error} if @code{Indx}
27234 is out of range. The RM specified a range check on other associations, but
27235 not when the value of the association was defaulted. GNAT has always inserted
27236 a constraint check on the index value.
27238 RM References:  4.03.03 (29)
27239 @end itemize
27241 @geindex AI-0123 (Ada 2012 feature)
27244 @itemize *
27246 @item 
27247 `AI-0123 Composability of equality (2010-04-13)'
27249 Equality of untagged record composes, so that the predefined equality for a
27250 composite type that includes a component of some untagged record type
27251 @code{R} uses the equality operation of @code{R} (which may be user-defined
27252 or predefined). This makes the behavior of untagged records identical to that
27253 of tagged types in this respect.
27255 This change is an incompatibility with previous versions of Ada, but it
27256 corrects a non-uniformity that was often a source of confusion. Analysis of
27257 a large number of industrial programs indicates that in those rare cases
27258 where a composite type had an untagged record component with a user-defined
27259 equality, either there was no use of the composite equality, or else the code
27260 expected the same composability as for tagged types, and thus had a bug that
27261 would be fixed by this change.
27263 RM References:  4.05.02 (9.7/2)   4.05.02 (14)   4.05.02 (15)   4.05.02 (24)
27264 8.05.04 (8)
27265 @end itemize
27267 @geindex AI-0088 (Ada 2012 feature)
27270 @itemize *
27272 @item 
27273 `AI-0088 The value of exponentiation (0000-00-00)'
27275 This AI clarifies the equivalence rule given for the dynamic semantics of
27276 exponentiation: the value of the operation can be obtained by repeated
27277 multiplication, but the operation can be implemented otherwise (for example
27278 using the familiar divide-by-two-and-square algorithm, even if this is less
27279 accurate), and does not imply repeated reads of a volatile base.
27281 RM References:  4.05.06 (11)
27282 @end itemize
27284 @geindex AI-0188 (Ada 2012 feature)
27287 @itemize *
27289 @item 
27290 `AI-0188 Case expressions (2010-01-09)'
27292 Case expressions are permitted. This allows use of constructs such as:
27294 @example
27295 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
27296 @end example
27298 RM References:  4.05.07 (0)   4.05.08 (0)   4.09 (12)   4.09 (33)
27299 @end itemize
27301 @geindex AI-0104 (Ada 2012 feature)
27304 @itemize *
27306 @item 
27307 `AI-0104 Null exclusion and uninitialized allocator (2010-07-15)'
27309 The assignment @code{Ptr := new not null Some_Ptr;} will raise
27310 @code{Constraint_Error} because the default value of the allocated object is
27311 `null'. This useless construct is illegal in Ada 2012.
27313 RM References:  4.08 (2)
27314 @end itemize
27316 @geindex AI-0157 (Ada 2012 feature)
27319 @itemize *
27321 @item 
27322 `AI-0157 Allocation/Deallocation from empty pool (2010-07-11)'
27324 Allocation and Deallocation from an empty storage pool (i.e. allocation or
27325 deallocation of a pointer for which a static storage size clause of zero
27326 has been given) is now illegal and is detected as such. GNAT
27327 previously gave a warning but not an error.
27329 RM References:  4.08 (5.3/2)   13.11.02 (4)   13.11.02 (17)
27330 @end itemize
27332 @geindex AI-0179 (Ada 2012 feature)
27335 @itemize *
27337 @item 
27338 `AI-0179 Statement not required after label (2010-04-10)'
27340 It is not necessary to have a statement following a label, so a label
27341 can appear at the end of a statement sequence without the need for putting a
27342 null statement afterwards, but it is not allowable to have only labels and
27343 no real statements in a statement sequence.
27345 RM References:  5.01 (2)
27346 @end itemize
27348 @geindex AI-0139-2 (Ada 2012 feature)
27351 @itemize *
27353 @item 
27354 `AI-0139-2 Syntactic sugar for iterators (2010-09-29)'
27356 The new syntax for iterating over arrays and containers is now implemented.
27357 Iteration over containers is for now limited to read-only iterators. Only
27358 default iterators are supported, with the syntax:  @code{for Elem of C}.
27360 RM References:  5.05
27361 @end itemize
27363 @geindex AI-0134 (Ada 2012 feature)
27366 @itemize *
27368 @item 
27369 `AI-0134 Profiles must match for full conformance (0000-00-00)'
27371 For full conformance, the profiles of anonymous-access-to-subprogram
27372 parameters must match. GNAT has always enforced this rule.
27374 RM References:  6.03.01 (18)
27375 @end itemize
27377 @geindex AI-0207 (Ada 2012 feature)
27380 @itemize *
27382 @item 
27383 `AI-0207 Mode conformance and access constant (0000-00-00)'
27385 This AI confirms that access_to_constant indication must match for mode
27386 conformance. This was implemented in GNAT when the qualifier was originally
27387 introduced in Ada 2005.
27389 RM References:  6.03.01 (16/2)
27390 @end itemize
27392 @geindex AI-0046 (Ada 2012 feature)
27395 @itemize *
27397 @item 
27398 `AI-0046 Null exclusion match for full conformance (2010-07-17)'
27400 For full conformance, in the case of access parameters, the null exclusion
27401 must match (either both or neither must have @code{not null}).
27403 RM References:  6.03.02 (18)
27404 @end itemize
27406 @geindex AI-0118 (Ada 2012 feature)
27409 @itemize *
27411 @item 
27412 `AI-0118 The association of parameter associations (0000-00-00)'
27414 This AI clarifies the rules for named associations in subprogram calls and
27415 generic instantiations. The rules have been in place since Ada 83.
27417 RM References:  6.04.01 (2)   12.03 (9)
27418 @end itemize
27420 @geindex AI-0196 (Ada 2012 feature)
27423 @itemize *
27425 @item 
27426 `AI-0196 Null exclusion tests for out parameters (0000-00-00)'
27428 Null exclusion checks are not made for @code{out} parameters when
27429 evaluating the actual parameters. GNAT has never generated these checks.
27431 RM References:  6.04.01 (13)
27432 @end itemize
27434 @geindex AI-0015 (Ada 2012 feature)
27437 @itemize *
27439 @item 
27440 `AI-0015 Constant return objects (0000-00-00)'
27442 The return object declared in an `extended_return_statement' may be
27443 declared constant. This was always intended, and GNAT has always allowed it.
27445 RM References:  6.05 (2.1/2)   3.03 (10/2)   3.03 (21)   6.05 (5/2)
27446 6.05 (5.7/2)
27447 @end itemize
27449 @geindex AI-0032 (Ada 2012 feature)
27452 @itemize *
27454 @item 
27455 `AI-0032 Extended return for class-wide functions (0000-00-00)'
27457 If a function returns a class-wide type, the object of an extended return
27458 statement can be declared with a specific type that is covered by the class-
27459 wide type. This has been implemented in GNAT since the introduction of
27460 extended returns. Note AI-0103 complements this AI by imposing matching
27461 rules for constrained return types.
27463 RM References:  6.05 (5.2/2)   6.05 (5.3/2)   6.05 (5.6/2)   6.05 (5.8/2)
27464 6.05 (8/2)
27465 @end itemize
27467 @geindex AI-0103 (Ada 2012 feature)
27470 @itemize *
27472 @item 
27473 `AI-0103 Static matching for extended return (2010-07-23)'
27475 If the return subtype of a function is an elementary type or a constrained
27476 type, the subtype indication in an extended return statement must match
27477 statically this return subtype.
27479 RM References:  6.05 (5.2/2)
27480 @end itemize
27482 @geindex AI-0058 (Ada 2012 feature)
27485 @itemize *
27487 @item 
27488 `AI-0058 Abnormal completion of an extended return (0000-00-00)'
27490 The RM had some incorrect wording implying wrong treatment of abnormal
27491 completion in an extended return. GNAT has always implemented the intended
27492 correct semantics as described by this AI.
27494 RM References:  6.05 (22/2)
27495 @end itemize
27497 @geindex AI-0050 (Ada 2012 feature)
27500 @itemize *
27502 @item 
27503 `AI-0050 Raising Constraint_Error early for function call (0000-00-00)'
27505 The implementation permissions for raising @code{Constraint_Error} early on a function call
27506 when it was clear an exception would be raised were over-permissive and allowed
27507 mishandling of discriminants in some cases. GNAT did
27508 not take advantage of these incorrect permissions in any case.
27510 RM References:  6.05 (24/2)
27511 @end itemize
27513 @geindex AI-0125 (Ada 2012 feature)
27516 @itemize *
27518 @item 
27519 `AI-0125 Nonoverridable operations of an ancestor (2010-09-28)'
27521 In Ada 2012, the declaration of a primitive operation of a type extension
27522 or private extension can also override an inherited primitive that is not
27523 visible at the point of this declaration.
27525 RM References:  7.03.01 (6)   8.03 (23)   8.03.01 (5/2)   8.03.01 (6/2)
27526 @end itemize
27528 @geindex AI-0062 (Ada 2012 feature)
27531 @itemize *
27533 @item 
27534 `AI-0062 Null exclusions and deferred constants (0000-00-00)'
27536 A full constant may have a null exclusion even if its associated deferred
27537 constant does not. GNAT has always allowed this.
27539 RM References:  7.04 (6/2)   7.04 (7.1/2)
27540 @end itemize
27542 @geindex AI-0178 (Ada 2012 feature)
27545 @itemize *
27547 @item 
27548 `AI-0178 Incomplete views are limited (0000-00-00)'
27550 This AI clarifies the role of incomplete views and plugs an omission in the
27551 RM. GNAT always correctly restricted the use of incomplete views and types.
27553 RM References:  7.05 (3/2)   7.05 (6/2)
27554 @end itemize
27556 @geindex AI-0087 (Ada 2012 feature)
27559 @itemize *
27561 @item 
27562 `AI-0087 Actual for formal nonlimited derived type (2010-07-15)'
27564 The actual for a formal nonlimited derived type cannot be limited. In
27565 particular, a formal derived type that extends a limited interface but which
27566 is not explicitly limited cannot be instantiated with a limited type.
27568 RM References:  7.05 (5/2)   12.05.01 (5.1/2)
27569 @end itemize
27571 @geindex AI-0099 (Ada 2012 feature)
27574 @itemize *
27576 @item 
27577 `AI-0099 Tag determines whether finalization needed (0000-00-00)'
27579 This AI clarifies that ‘needs finalization’ is part of dynamic semantics,
27580 and therefore depends on the run-time characteristics of an object (i.e. its
27581 tag) and not on its nominal type. As the AI indicates: “we do not expect
27582 this to affect any implementation’’.
27584 RM References:  7.06.01 (6)   7.06.01 (7)   7.06.01 (8)   7.06.01 (9/2)
27585 @end itemize
27587 @geindex AI-0064 (Ada 2012 feature)
27590 @itemize *
27592 @item 
27593 `AI-0064 Redundant finalization rule (0000-00-00)'
27595 This is an editorial change only. The intended behavior is already checked
27596 by an existing ACATS test, which GNAT has always executed correctly.
27598 RM References:  7.06.01 (17.1/1)
27599 @end itemize
27601 @geindex AI-0026 (Ada 2012 feature)
27604 @itemize *
27606 @item 
27607 `AI-0026 Missing rules for Unchecked_Union (2010-07-07)'
27609 Record representation clauses concerning Unchecked_Union types cannot mention
27610 the discriminant of the type. The type of a component declared in the variant
27611 part of an Unchecked_Union cannot be controlled, have controlled components,
27612 nor have protected or task parts. If an Unchecked_Union type is declared
27613 within the body of a generic unit or its descendants, then the type of a
27614 component declared in the variant part cannot be a formal private type or a
27615 formal private extension declared within the same generic unit.
27617 RM References:  7.06 (9.4/2)   B.03.03 (9/2)   B.03.03 (10/2)
27618 @end itemize
27620 @geindex AI-0205 (Ada 2012 feature)
27623 @itemize *
27625 @item 
27626 `AI-0205 Extended return declares visible name (0000-00-00)'
27628 This AI corrects a simple omission in the RM. Return objects have always
27629 been visible within an extended return statement.
27631 RM References:  8.03 (17)
27632 @end itemize
27634 @geindex AI-0042 (Ada 2012 feature)
27637 @itemize *
27639 @item 
27640 `AI-0042 Overriding versus implemented-by (0000-00-00)'
27642 This AI fixes a wording gap in the RM. An operation of a synchronized
27643 interface can be implemented by a protected or task entry, but the abstract
27644 operation is not being overridden in the usual sense, and it must be stated
27645 separately that this implementation is legal. This has always been the case
27646 in GNAT.
27648 RM References:  9.01 (9.2/2)   9.04 (11.1/2)
27649 @end itemize
27651 @geindex AI-0030 (Ada 2012 feature)
27654 @itemize *
27656 @item 
27657 `AI-0030 Requeue on synchronized interfaces (2010-07-19)'
27659 Requeue is permitted to a protected, synchronized or task interface primitive
27660 providing it is known that the overriding operation is an entry. Otherwise
27661 the requeue statement has the same effect as a procedure call. Use of pragma
27662 @code{Implemented} provides a way to impose a static requirement on the
27663 overriding operation by adhering to one of the implementation kinds: entry,
27664 protected procedure or any of the above.
27666 RM References:  9.05 (9)   9.05.04 (2)   9.05.04 (3)   9.05.04 (5)
27667 9.05.04 (6)   9.05.04 (7)   9.05.04 (12)
27668 @end itemize
27670 @geindex AI-0201 (Ada 2012 feature)
27673 @itemize *
27675 @item 
27676 `AI-0201 Independence of atomic object components (2010-07-22)'
27678 If an Atomic object has a pragma @code{Pack} or a @code{Component_Size}
27679 attribute, then individual components may not be addressable by independent
27680 tasks. However, if the representation clause has no effect (is confirming),
27681 then independence is not compromised. Furthermore, in GNAT, specification of
27682 other appropriately addressable component sizes (e.g. 16 for 8-bit
27683 characters) also preserves independence. GNAT now gives very clear warnings
27684 both for the declaration of such a type, and for any assignment to its components.
27686 RM References:  9.10 (1/3)   C.06 (22/2)   C.06 (23/2)
27687 @end itemize
27689 @geindex AI-0009 (Ada 2012 feature)
27692 @itemize *
27694 @item 
27695 `AI-0009 Pragma Independent[_Components] (2010-07-23)'
27697 This AI introduces the new pragmas @code{Independent} and
27698 @code{Independent_Components},
27699 which control guaranteeing independence of access to objects and components.
27700 The AI also requires independence not unaffected by confirming rep clauses.
27702 RM References:  9.10 (1)   13.01 (15/1)   13.02 (9)   13.03 (13)   C.06 (2)
27703 C.06 (4)   C.06 (6)   C.06 (9)   C.06 (13)   C.06 (14)
27704 @end itemize
27706 @geindex AI-0072 (Ada 2012 feature)
27709 @itemize *
27711 @item 
27712 `AI-0072 Task signalling using ‘Terminated (0000-00-00)'
27714 This AI clarifies that task signalling for reading @code{'Terminated} only
27715 occurs if the result is True. GNAT semantics has always been consistent with
27716 this notion of task signalling.
27718 RM References:  9.10 (6.1/1)
27719 @end itemize
27721 @geindex AI-0108 (Ada 2012 feature)
27724 @itemize *
27726 @item 
27727 `AI-0108 Limited incomplete view and discriminants (0000-00-00)'
27729 This AI confirms that an incomplete type from a limited view does not have
27730 discriminants. This has always been the case in GNAT.
27732 RM References:  10.01.01 (12.3/2)
27733 @end itemize
27735 @geindex AI-0129 (Ada 2012 feature)
27738 @itemize *
27740 @item 
27741 `AI-0129 Limited views and incomplete types (0000-00-00)'
27743 This AI clarifies the description of limited views: a limited view of a
27744 package includes only one view of a type that has an incomplete declaration
27745 and a full declaration (there is no possible ambiguity in a client package).
27746 This AI also fixes an omission: a nested package in the private part has no
27747 limited view. GNAT always implemented this correctly.
27749 RM References:  10.01.01 (12.2/2)   10.01.01 (12.3/2)
27750 @end itemize
27752 @geindex AI-0077 (Ada 2012 feature)
27755 @itemize *
27757 @item 
27758 `AI-0077 Limited withs and scope of declarations (0000-00-00)'
27760 This AI clarifies that a declaration does not include a context clause,
27761 and confirms that it is illegal to have a context in which both a limited
27762 and a nonlimited view of a package are accessible. Such double visibility
27763 was always rejected by GNAT.
27765 RM References:  10.01.02 (12/2)   10.01.02 (21/2)   10.01.02 (22/2)
27766 @end itemize
27768 @geindex AI-0122 (Ada 2012 feature)
27771 @itemize *
27773 @item 
27774 `AI-0122 Private with and children of generics (0000-00-00)'
27776 This AI clarifies the visibility of private children of generic units within
27777 instantiations of a parent. GNAT has always handled this correctly.
27779 RM References:  10.01.02 (12/2)
27780 @end itemize
27782 @geindex AI-0040 (Ada 2012 feature)
27785 @itemize *
27787 @item 
27788 `AI-0040 Limited with clauses on descendant (0000-00-00)'
27790 This AI confirms that a limited with clause in a child unit cannot name
27791 an ancestor of the unit. This has always been checked in GNAT.
27793 RM References:  10.01.02 (20/2)
27794 @end itemize
27796 @geindex AI-0132 (Ada 2012 feature)
27799 @itemize *
27801 @item 
27802 `AI-0132 Placement of library unit pragmas (0000-00-00)'
27804 This AI fills a gap in the description of library unit pragmas. The pragma
27805 clearly must apply to a library unit, even if it does not carry the name
27806 of the enclosing unit. GNAT has always enforced the required check.
27808 RM References:  10.01.05 (7)
27809 @end itemize
27811 @geindex AI-0034 (Ada 2012 feature)
27814 @itemize *
27816 @item 
27817 `AI-0034 Categorization of limited views (0000-00-00)'
27819 The RM makes certain limited with clauses illegal because of categorization
27820 considerations, when the corresponding normal with would be legal. This is
27821 not intended, and GNAT has always implemented the recommended behavior.
27823 RM References:  10.02.01 (11/1)   10.02.01 (17/2)
27824 @end itemize
27826 @geindex AI-0035 (Ada 2012 feature)
27829 @itemize *
27831 @item 
27832 `AI-0035 Inconsistencies with Pure units (0000-00-00)'
27834 This AI remedies some inconsistencies in the legality rules for Pure units.
27835 Derived access types are legal in a pure unit (on the assumption that the
27836 rule for a zero storage pool size has been enforced on the ancestor type).
27837 The rules are enforced in generic instances and in subunits. GNAT has always
27838 implemented the recommended behavior.
27840 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)
27841 @end itemize
27843 @geindex AI-0219 (Ada 2012 feature)
27846 @itemize *
27848 @item 
27849 `AI-0219 Pure permissions and limited parameters (2010-05-25)'
27851 This AI refines the rules for the cases with limited parameters which do not
27852 allow the implementations to omit ‘redundant’. GNAT now properly conforms
27853 to the requirements of this binding interpretation.
27855 RM References:  10.02.01 (18/2)
27856 @end itemize
27858 @geindex AI-0043 (Ada 2012 feature)
27861 @itemize *
27863 @item 
27864 `AI-0043 Rules about raising exceptions (0000-00-00)'
27866 This AI covers various omissions in the RM regarding the raising of
27867 exceptions. GNAT has always implemented the intended semantics.
27869 RM References:  11.04.01 (10.1/2)   11 (2)
27870 @end itemize
27872 @geindex AI-0200 (Ada 2012 feature)
27875 @itemize *
27877 @item 
27878 `AI-0200 Mismatches in formal package declarations (0000-00-00)'
27880 This AI plugs a gap in the RM which appeared to allow some obviously intended
27881 illegal instantiations. GNAT has never allowed these instantiations.
27883 RM References:  12.07 (16)
27884 @end itemize
27886 @geindex AI-0112 (Ada 2012 feature)
27889 @itemize *
27891 @item 
27892 `AI-0112 Detection of duplicate pragmas (2010-07-24)'
27894 This AI concerns giving names to various representation aspects, but the
27895 practical effect is simply to make the use of duplicate
27896 @code{Atomic[_Components]},
27897 @code{Volatile[_Components]}, and
27898 @code{Independent[_Components]} pragmas illegal, and GNAT
27899 now performs this required check.
27901 RM References:  13.01 (8)
27902 @end itemize
27904 @geindex AI-0106 (Ada 2012 feature)
27907 @itemize *
27909 @item 
27910 `AI-0106 No representation pragmas on generic formals (0000-00-00)'
27912 The RM appeared to allow representation pragmas on generic formal parameters,
27913 but this was not intended, and GNAT has never permitted this usage.
27915 RM References:  13.01 (9.1/1)
27916 @end itemize
27918 @geindex AI-0012 (Ada 2012 feature)
27921 @itemize *
27923 @item 
27924 `AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)'
27926 It is now illegal to give an inappropriate component size or a pragma
27927 @code{Pack} that attempts to change the component size in the case of atomic
27928 or aliased components. Previously GNAT ignored such an attempt with a
27929 warning.
27931 RM References:  13.02 (6.1/2)   13.02 (7)   C.06 (10)   C.06 (11)   C.06 (21)
27932 @end itemize
27934 @geindex AI-0039 (Ada 2012 feature)
27937 @itemize *
27939 @item 
27940 `AI-0039 Stream attributes cannot be dynamic (0000-00-00)'
27942 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
27943 for stream attributes, but these were never useful and are now illegal. GNAT
27944 has always regarded such expressions as illegal.
27946 RM References:  13.03 (4)   13.03 (6)   13.13.02 (38/2)
27947 @end itemize
27949 @geindex AI-0095 (Ada 2012 feature)
27952 @itemize *
27954 @item 
27955 `AI-0095 Address of intrinsic subprograms (0000-00-00)'
27957 The prefix of @code{'Address} cannot statically denote a subprogram with
27958 convention @code{Intrinsic}. The use of the @code{Address} attribute raises
27959 @code{Program_Error} if the prefix denotes a subprogram with convention
27960 @code{Intrinsic}.
27962 RM References:  13.03 (11/1)
27963 @end itemize
27965 @geindex AI-0116 (Ada 2012 feature)
27968 @itemize *
27970 @item 
27971 `AI-0116 Alignment of class-wide objects (0000-00-00)'
27973 This AI requires that the alignment of a class-wide object be no greater
27974 than the alignment of any type in the class. GNAT has always followed this
27975 recommendation.
27977 RM References:  13.03 (29)   13.11 (16)
27978 @end itemize
27980 @geindex AI-0146 (Ada 2012 feature)
27983 @itemize *
27985 @item 
27986 `AI-0146 Type invariants (2009-09-21)'
27988 Type invariants may be specified for private types using the aspect notation.
27989 Aspect @code{Type_Invariant} may be specified for any private type,
27990 @code{Type_Invariant'Class} can
27991 only be specified for tagged types, and is inherited by any descendent of the
27992 tagged types. The invariant is a boolean expression that is tested for being
27993 true in the following situations: conversions to the private type, object
27994 declarations for the private type that are default initialized, and
27995 [`in'] `out'
27996 parameters and returned result on return from any primitive operation for
27997 the type that is visible to a client.
27998 GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and
27999 @code{Invariant'Class} for @code{Type_Invariant'Class}.
28001 RM References:  13.03.03 (00)
28002 @end itemize
28004 @geindex AI-0078 (Ada 2012 feature)
28007 @itemize *
28009 @item 
28010 `AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)'
28012 In Ada 2012, compilers are required to support unchecked conversion where the
28013 target alignment is a multiple of the source alignment. GNAT always supported
28014 this case (and indeed all cases of differing alignments, doing copies where
28015 required if the alignment was reduced).
28017 RM References:  13.09 (7)
28018 @end itemize
28020 @geindex AI-0195 (Ada 2012 feature)
28023 @itemize *
28025 @item 
28026 `AI-0195 Invalid value handling is implementation defined (2010-07-03)'
28028 The handling of invalid values is now designated to be implementation
28029 defined. This is a documentation change only, requiring Annex M in the GNAT
28030 Reference Manual to document this handling.
28031 In GNAT, checks for invalid values are made
28032 only when necessary to avoid erroneous behavior. Operations like assignments
28033 which cannot cause erroneous behavior ignore the possibility of invalid
28034 values and do not do a check. The date given above applies only to the
28035 documentation change, this behavior has always been implemented by GNAT.
28037 RM References:  13.09.01 (10)
28038 @end itemize
28040 @geindex AI-0193 (Ada 2012 feature)
28043 @itemize *
28045 @item 
28046 `AI-0193 Alignment of allocators (2010-09-16)'
28048 This AI introduces a new attribute @code{Max_Alignment_For_Allocation},
28049 analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead
28050 of size.
28052 RM References:  13.11 (16)   13.11 (21)   13.11.01 (0)   13.11.01 (1)
28053 13.11.01 (2)   13.11.01 (3)
28054 @end itemize
28056 @geindex AI-0177 (Ada 2012 feature)
28059 @itemize *
28061 @item 
28062 `AI-0177 Parameterized expressions (2010-07-10)'
28064 The new Ada 2012 notion of parameterized expressions is implemented. The form
28067 @example
28068 function-specification is (expression)
28069 @end example
28071 This is exactly equivalent to the
28072 corresponding function body that returns the expression, but it can appear
28073 in a package spec. Note that the expression must be parenthesized.
28075 RM References:  13.11.01 (3/2)
28076 @end itemize
28078 @geindex AI-0033 (Ada 2012 feature)
28081 @itemize *
28083 @item 
28084 `AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)'
28086 Neither of these two pragmas may appear within a generic template, because
28087 the generic might be instantiated at other than the library level.
28089 RM References:  13.11.02 (16)   C.03.01 (7/2)   C.03.01 (8/2)
28090 @end itemize
28092 @geindex AI-0161 (Ada 2012 feature)
28095 @itemize *
28097 @item 
28098 `AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)'
28100 A new restriction @code{No_Default_Stream_Attributes} prevents the use of any
28101 of the default stream attributes for elementary types. If this restriction is
28102 in force, then it is necessary to provide explicit subprograms for any
28103 stream attributes used.
28105 RM References:  13.12.01 (4/2)   13.13.02 (40/2)   13.13.02 (52/2)
28106 @end itemize
28108 @geindex AI-0194 (Ada 2012 feature)
28111 @itemize *
28113 @item 
28114 `AI-0194 Value of Stream_Size attribute (0000-00-00)'
28116 The @code{Stream_Size} attribute returns the default number of bits in the
28117 stream representation of the given type.
28118 This value is not affected by the presence
28119 of stream subprogram attributes for the type. GNAT has always implemented
28120 this interpretation.
28122 RM References:  13.13.02 (1.2/2)
28123 @end itemize
28125 @geindex AI-0109 (Ada 2012 feature)
28128 @itemize *
28130 @item 
28131 `AI-0109 Redundant check in S’Class’Input (0000-00-00)'
28133 This AI is an editorial change only. It removes the need for a tag check
28134 that can never fail.
28136 RM References:  13.13.02 (34/2)
28137 @end itemize
28139 @geindex AI-0007 (Ada 2012 feature)
28142 @itemize *
28144 @item 
28145 `AI-0007 Stream read and private scalar types (0000-00-00)'
28147 The RM as written appeared to limit the possibilities of declaring read
28148 attribute procedures for private scalar types. This limitation was not
28149 intended, and has never been enforced by GNAT.
28151 RM References:  13.13.02 (50/2)   13.13.02 (51/2)
28152 @end itemize
28154 @geindex AI-0065 (Ada 2012 feature)
28157 @itemize *
28159 @item 
28160 `AI-0065 Remote access types and external streaming (0000-00-00)'
28162 This AI clarifies the fact that all remote access types support external
28163 streaming. This fixes an obvious oversight in the definition of the
28164 language, and GNAT always implemented the intended correct rules.
28166 RM References:  13.13.02 (52/2)
28167 @end itemize
28169 @geindex AI-0019 (Ada 2012 feature)
28172 @itemize *
28174 @item 
28175 `AI-0019 Freezing of primitives for tagged types (0000-00-00)'
28177 The RM suggests that primitive subprograms of a specific tagged type are
28178 frozen when the tagged type is frozen. This would be an incompatible change
28179 and is not intended. GNAT has never attempted this kind of freezing and its
28180 behavior is consistent with the recommendation of this AI.
28182 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)
28183 @end itemize
28185 @geindex AI-0017 (Ada 2012 feature)
28188 @itemize *
28190 @item 
28191 `AI-0017 Freezing and incomplete types (0000-00-00)'
28193 So-called ‘Taft-amendment types’ (i.e., types that are completed in package
28194 bodies) are not frozen by the occurrence of bodies in the
28195 enclosing declarative part. GNAT always implemented this properly.
28197 RM References:  13.14 (3/1)
28198 @end itemize
28200 @geindex AI-0060 (Ada 2012 feature)
28203 @itemize *
28205 @item 
28206 `AI-0060 Extended definition of remote access types (0000-00-00)'
28208 This AI extends the definition of remote access types to include access
28209 to limited, synchronized, protected or task class-wide interface types.
28210 GNAT already implemented this extension.
28212 RM References:  A (4)   E.02.02 (9/1)   E.02.02 (9.2/1)   E.02.02 (14/2)   E.02.02 (18)
28213 @end itemize
28215 @geindex AI-0114 (Ada 2012 feature)
28218 @itemize *
28220 @item 
28221 `AI-0114 Classification of letters (0000-00-00)'
28223 The code points 170 (@code{FEMININE ORDINAL INDICATOR}),
28224 181 (@code{MICRO SIGN}), and
28225 186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered
28226 lower case letters by Unicode.
28227 However, they are not allowed in identifiers, and they
28228 return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}.
28229 This behavior is consistent with that defined in Ada 95.
28231 RM References:  A.03.02 (59)   A.04.06 (7)
28232 @end itemize
28234 @geindex AI-0185 (Ada 2012 feature)
28237 @itemize *
28239 @item 
28240 `AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)'
28242 Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide
28243 classification functions for @code{Wide_Character} and
28244 @code{Wide_Wide_Character}, as well as providing
28245 case folding routines for @code{Wide_[Wide_]Character} and
28246 @code{Wide_[Wide_]String}.
28248 RM References:  A.03.05 (0)   A.03.06 (0)
28249 @end itemize
28251 @geindex AI-0031 (Ada 2012 feature)
28254 @itemize *
28256 @item 
28257 `AI-0031 Add From parameter to Find_Token (2010-07-25)'
28259 A new version of @code{Find_Token} is added to all relevant string packages,
28260 with an extra parameter @code{From}. Instead of starting at the first
28261 character of the string, the search for a matching Token starts at the
28262 character indexed by the value of @code{From}.
28263 These procedures are available in all versions of Ada
28264 but if used in versions earlier than Ada 2012 they will generate a warning
28265 that an Ada 2012 subprogram is being used.
28267 RM References:  A.04.03 (16)   A.04.03 (67)   A.04.03 (68/1)   A.04.04 (51)
28268 A.04.05 (46)
28269 @end itemize
28271 @geindex AI-0056 (Ada 2012 feature)
28274 @itemize *
28276 @item 
28277 `AI-0056 Index on null string returns zero (0000-00-00)'
28279 The wording in the Ada 2005 RM implied an incompatible handling of the
28280 @code{Index} functions, resulting in raising an exception instead of
28281 returning zero in some situations.
28282 This was not intended and has been corrected.
28283 GNAT always returned zero, and is thus consistent with this AI.
28285 RM References:  A.04.03 (56.2/2)   A.04.03 (58.5/2)
28286 @end itemize
28288 @geindex AI-0137 (Ada 2012 feature)
28291 @itemize *
28293 @item 
28294 `AI-0137 String encoding package (2010-03-25)'
28296 The packages @code{Ada.Strings.UTF_Encoding}, together with its child
28297 packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings},
28298 and @code{Wide_Wide_Strings} have been
28299 implemented. These packages (whose documentation can be found in the spec
28300 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
28301 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
28302 @code{String}, @code{Wide_String}, and @code{Wide_Wide_String}
28303 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
28304 UTF-16), as well as conversions between the different UTF encodings. With
28305 the exception of @code{Wide_Wide_Strings}, these packages are available in
28306 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
28307 The @code{Wide_Wide_Strings} package
28308 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
28309 mode since it uses @code{Wide_Wide_Character}).
28311 RM References:  A.04.11
28312 @end itemize
28314 @geindex AI-0038 (Ada 2012 feature)
28317 @itemize *
28319 @item 
28320 `AI-0038 Minor errors in Text_IO (0000-00-00)'
28322 These are minor errors in the description on three points. The intent on
28323 all these points has always been clear, and GNAT has always implemented the
28324 correct intended semantics.
28326 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)
28327 @end itemize
28329 @geindex AI-0044 (Ada 2012 feature)
28332 @itemize *
28334 @item 
28335 `AI-0044 Restrictions on container instantiations (0000-00-00)'
28337 This AI places restrictions on allowed instantiations of generic containers.
28338 These restrictions are not checked by the compiler, so there is nothing to
28339 change in the implementation. This affects only the RM documentation.
28341 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)
28342 @end itemize
28344 @geindex AI-0127 (Ada 2012 feature)
28347 @itemize *
28349 @item 
28350 `AI-0127 Adding Locale Capabilities (2010-09-29)'
28352 This package provides an interface for identifying the current locale.
28354 RM References:  A.19    A.19.01    A.19.02    A.19.03    A.19.05    A.19.06
28355 A.19.07    A.19.08    A.19.09    A.19.10    A.19.11    A.19.12    A.19.13
28356 @end itemize
28358 @geindex AI-0002 (Ada 2012 feature)
28361 @itemize *
28363 @item 
28364 `AI-0002 Export C with unconstrained arrays (0000-00-00)'
28366 The compiler is not required to support exporting an Ada subprogram with
28367 convention C if there are parameters or a return type of an unconstrained
28368 array type (such as @code{String}). GNAT allows such declarations but
28369 generates warnings. It is possible, but complicated, to write the
28370 corresponding C code and certainly such code would be specific to GNAT and
28371 non-portable.
28373 RM References:  B.01 (17)   B.03 (62)   B.03 (71.1/2)
28374 @end itemize
28376 @geindex AI05-0216 (Ada 2012 feature)
28379 @itemize *
28381 @item 
28382 `AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)'
28384 It is clearly the intention that @code{No_Task_Hierarchy} is intended to
28385 forbid tasks declared locally within subprograms, or functions returning task
28386 objects, and that is the implementation that GNAT has always provided.
28387 However the language in the RM was not sufficiently clear on this point.
28388 Thus this is a documentation change in the RM only.
28390 RM References:  D.07 (3/3)
28391 @end itemize
28393 @geindex AI-0211 (Ada 2012 feature)
28396 @itemize *
28398 @item 
28399 `AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)'
28401 The restriction @code{No_Relative_Delays} forbids any calls to the subprogram
28402 @code{Ada.Real_Time.Timing_Events.Set_Handler}.
28404 RM References:  D.07 (5)   D.07 (10/2)   D.07 (10.4/2)   D.07 (10.7/2)
28405 @end itemize
28407 @geindex AI-0190 (Ada 2012 feature)
28410 @itemize *
28412 @item 
28413 `AI-0190 pragma Default_Storage_Pool (2010-09-15)'
28415 This AI introduces a new pragma @code{Default_Storage_Pool}, which can be
28416 used to control storage pools globally.
28417 In particular, you can force every access
28418 type that is used for allocation (`new') to have an explicit storage pool,
28419 or you can declare a pool globally to be used for all access types that lack
28420 an explicit one.
28422 RM References:  D.07 (8)
28423 @end itemize
28425 @geindex AI-0189 (Ada 2012 feature)
28428 @itemize *
28430 @item 
28431 `AI-0189 No_Allocators_After_Elaboration (2010-01-23)'
28433 This AI introduces a new restriction @code{No_Allocators_After_Elaboration},
28434 which says that no dynamic allocation will occur once elaboration is
28435 completed.
28436 In general this requires a run-time check, which is not required, and which
28437 GNAT does not attempt. But the static cases of allocators in a task body or
28438 in the body of the main program are detected and flagged at compile or bind
28439 time.
28441 RM References:  D.07 (19.1/2)   H.04 (23.3/2)
28442 @end itemize
28444 @geindex AI-0171 (Ada 2012 feature)
28447 @itemize *
28449 @item 
28450 `AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)'
28452 A new package @code{System.Multiprocessors} is added, together with the
28453 definition of pragma @code{CPU} for controlling task affinity. A new no
28454 dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains},
28455 is added to the Ravenscar profile.
28457 RM References:  D.13.01 (4/2)   D.16
28458 @end itemize
28460 @geindex AI-0210 (Ada 2012 feature)
28463 @itemize *
28465 @item 
28466 `AI-0210 Correct Timing_Events metric (0000-00-00)'
28468 This is a documentation only issue regarding wording of metric requirements,
28469 that does not affect the implementation of the compiler.
28471 RM References:  D.15 (24/2)
28472 @end itemize
28474 @geindex AI-0206 (Ada 2012 feature)
28477 @itemize *
28479 @item 
28480 `AI-0206 Remote types packages and preelaborate (2010-07-24)'
28482 Remote types packages are now allowed to depend on preelaborated packages.
28483 This was formerly considered illegal.
28485 RM References:  E.02.02 (6)
28486 @end itemize
28488 @geindex AI-0152 (Ada 2012 feature)
28491 @itemize *
28493 @item 
28494 `AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)'
28496 Restriction @code{No_Anonymous_Allocators} prevents the use of allocators
28497 where the type of the returned value is an anonymous access type.
28499 RM References:  H.04 (8/1)
28500 @end itemize
28502 @node GNAT language extensions,Security Hardening Features,Implementation of Ada 2012 Features,Top
28503 @anchor{gnat_rm/gnat_language_extensions doc}@anchor{431}@anchor{gnat_rm/gnat_language_extensions gnat-language-extensions}@anchor{432}@anchor{gnat_rm/gnat_language_extensions id1}@anchor{433}
28504 @chapter GNAT language extensions
28507 The GNAT compiler implements a certain number of language extensions on top of
28508 the latest Ada standard, implementing its own extended superset of Ada.
28510 There are two sets of language extensions:
28513 @itemize *
28515 @item 
28516 The first is the curated set. The features in that set are features that we
28517 consider being worthy additions to the Ada language, and that we want to make
28518 available to users early on.
28520 @item 
28521 The second is the experimental set. It includes the first, but also
28522 experimental features, that are here because they’re still in an early
28523 prototyping phase.
28524 @end itemize
28526 @menu
28527 * How to activate the extended GNAT Ada superset:: 
28528 * Curated Extensions:: 
28529 * Experimental Language Extensions:: 
28531 @end menu
28533 @node How to activate the extended GNAT Ada superset,Curated Extensions,,GNAT language extensions
28534 @anchor{gnat_rm/gnat_language_extensions how-to-activate-the-extended-gnat-ada-superset}@anchor{434}
28535 @section How to activate the extended GNAT Ada superset
28538 There are two ways to activate the extended GNAT Ada superset:
28541 @itemize *
28543 @item 
28544 The @ref{65,,Pragma Extensions_Allowed}. To activate
28545 the curated set of extensions, you should use
28546 @end itemize
28548 @example
28549 pragma Extensions_Allowed (On)
28550 @end example
28552 As a configuration pragma, you can either put it at the beginning of a source
28553 file, or in a @code{.adc} file corresponding to your project.
28556 @itemize *
28558 @item 
28559 The @code{-gnatX} option, that you can pass to the compiler directly, will
28560 activate the curated subset of extensions.
28561 @end itemize
28563 @cartouche
28564 @quotation Attention 
28565 You can activate the extended set of extensions by using either
28566 the @code{-gnatX0} command line flag, or the pragma @code{Extensions_Allowed} with
28567 @code{All} as an argument. However, it is not recommended you use this subset
28568 for serious projects, and is only means as a playground/technology preview.
28569 @end quotation
28570 @end cartouche
28572 @node Curated Extensions,Experimental Language Extensions,How to activate the extended GNAT Ada superset,GNAT language extensions
28573 @anchor{gnat_rm/gnat_language_extensions curated-extensions}@anchor{435}@anchor{gnat_rm/gnat_language_extensions curated-language-extensions}@anchor{66}
28574 @section Curated Extensions
28577 @menu
28578 * Local Declarations Without Block:: 
28579 * Conditional when constructs:: 
28580 * Case pattern matching:: 
28581 * Fixed lower bounds for array types and subtypes:: 
28582 * Prefixed-view notation for calls to primitive subprograms of untagged types:: 
28583 * Expression defaults for generic formal functions:: 
28584 * String interpolation:: 
28585 * Constrained attribute for generic objects:: 
28586 * Static aspect on intrinsic functions:: 
28588 @end menu
28590 @node Local Declarations Without Block,Conditional when constructs,,Curated Extensions
28591 @anchor{gnat_rm/gnat_language_extensions local-declarations-without-block}@anchor{436}
28592 @subsection Local Declarations Without Block
28595 A basic_declarative_item may appear at the place of any statement.
28596 This avoids the heavy syntax of block_statements just to declare
28597 something locally.
28599 Link to the original RFC:
28600 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-local-vars-without-block.md}
28601 For example:
28603 @example
28604 if X > 5 then
28605    X := X + 1;
28607    Squared : constant Integer := X**2;
28609    X := X + Squared;
28610 end if;
28611 @end example
28613 @node Conditional when constructs,Case pattern matching,Local Declarations Without Block,Curated Extensions
28614 @anchor{gnat_rm/gnat_language_extensions conditional-when-constructs}@anchor{437}
28615 @subsection Conditional when constructs
28618 This feature extends the use of @code{when} as a way to condition a control-flow
28619 related statement, to all control-flow related statements.
28621 To do a conditional return in a procedure the following syntax should be used:
28623 @example
28624 procedure P (Condition : Boolean) is
28625 begin
28626    return when Condition;
28627 end;
28628 @end example
28630 This will return from the procedure if @code{Condition} is true.
28632 When being used in a function the conditional part comes after the return value:
28634 @example
28635 function Is_Null (I : Integer) return Boolean is
28636 begin
28637    return True when I = 0;
28638    return False;
28639 end;
28640 @end example
28642 In a similar way to the @code{exit when} a @code{goto ... when} can be employed:
28644 @example
28645 procedure Low_Level_Optimized is
28646    Flags : Bitmapping;
28647 begin
28648    Do_1 (Flags);
28649    goto Cleanup when Flags (1);
28651    Do_2 (Flags);
28652    goto Cleanup when Flags (32);
28654    --  ...
28656 <<Cleanup>>
28657    --  ...
28658 end;
28659 @end example
28661 @c code-block
28663 To use a conditional raise construct:
28665 @example
28666 procedure Foo is
28667 begin
28668    raise Error when Imported_C_Func /= 0;
28669 end;
28670 @end example
28672 An exception message can also be added:
28674 @example
28675 procedure Foo is
28676 begin
28677    raise Error with "Unix Error"
28678      when Imported_C_Func /= 0;
28679 end;
28680 @end example
28682 Link to the original RFC:
28683 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-conditional-when-constructs.rst}
28685 @node Case pattern matching,Fixed lower bounds for array types and subtypes,Conditional when constructs,Curated Extensions
28686 @anchor{gnat_rm/gnat_language_extensions case-pattern-matching}@anchor{438}
28687 @subsection Case pattern matching
28690 The selector for a case statement (but not yet for a case expression) may be of a composite type, subject to
28691 some restrictions (described below). Aggregate syntax is used for choices
28692 of such a case statement; however, in cases where a “normal” aggregate would
28693 require a discrete value, a discrete subtype may be used instead; box
28694 notation can also be used to match all values.
28696 Consider this example:
28698 @example
28699 type Rec is record
28700    F1, F2 : Integer;
28701 end record;
28703 procedure Caser_1 (X : Rec) is
28704 begin
28705    case X is
28706       when (F1 => Positive, F2 => Positive) =>
28707          Do_This;
28708       when (F1 => Natural, F2 => <>) | (F1 => <>, F2 => Natural) =>
28709          Do_That;
28710       when others =>
28711           Do_The_Other_Thing;
28712    end case;
28713 end Caser_1;
28714 @end example
28716 If @code{Caser_1} is called and both components of X are positive, then
28717 @code{Do_This} will be called; otherwise, if either component is nonnegative
28718 then @code{Do_That} will be called; otherwise, @code{Do_The_Other_Thing} will be
28719 called.
28721 In addition, pattern bindings are supported. This is a mechanism
28722 for binding a name to a component of a matching value for use within
28723 an alternative of a case statement. For a component association
28724 that occurs within a case choice, the expression may be followed by
28725 @code{is <identifier>}. In the special case of a “box” component association,
28726 the identifier may instead be provided within the box. Either of these
28727 indicates that the given identifier denotes (a constant view of) the matching
28728 subcomponent of the case selector.
28730 @cartouche
28731 @quotation Attention 
28732 Binding is not yet supported for arrays or subcomponents
28733 thereof.
28734 @end quotation
28735 @end cartouche
28737 Consider this example (which uses type @code{Rec} from the previous example):
28739 @example
28740 procedure Caser_2 (X : Rec) is
28741 begin
28742    case X is
28743       when (F1 => Positive is Abc, F2 => Positive) =>
28744          Do_This (Abc)
28745       when (F1 => Natural is N1, F2 => <N2>) |
28746            (F1 => <N2>, F2 => Natural is N1) =>
28747          Do_That (Param_1 => N1, Param_2 => N2);
28748       when others =>
28749          Do_The_Other_Thing;
28750    end case;
28751 end Caser_2;
28752 @end example
28754 This example is the same as the previous one with respect to determining
28755 whether @code{Do_This}, @code{Do_That}, or @code{Do_The_Other_Thing} will be called. But
28756 for this version, @code{Do_This} takes a parameter and @code{Do_That} takes two
28757 parameters. If @code{Do_This} is called, the actual parameter in the call will be
28758 @code{X.F1}.
28760 If @code{Do_That} is called, the situation is more complex because there are two
28761 choices for that alternative. If @code{Do_That} is called because the first choice
28762 matched (i.e., because @code{X.F1} is nonnegative and either @code{X.F1} or @code{X.F2}
28763 is zero or negative), then the actual parameters of the call will be (in order)
28764 @code{X.F1} and @code{X.F2}. If @code{Do_That} is called because the second choice
28765 matched (and the first one did not), then the actual parameters will be
28766 reversed.
28768 Within the choice list for single alternative, each choice must define the same
28769 set of bindings and the component subtypes for for a given identifer must all
28770 statically match. Currently, the case of a binding for a nondiscrete component
28771 is not implemented.
28773 If the set of values that match the choice(s) of an earlier alternative
28774 overlaps the corresponding set of a later alternative, then the first set shall
28775 be a proper subset of the second (and the later alternative will not be
28776 executed if the earlier alternative “matches”). All possible values of the
28777 composite type shall be covered. The composite type of the selector shall be an
28778 array or record type that is neither limited nor class-wide. Currently, a “when
28779 others =>” case choice is required; it is intended that this requirement will
28780 be relaxed at some point.
28782 If a subcomponent’s subtype does not meet certain restrictions, then the only
28783 value that can be specified for that subcomponent in a case choice expression
28784 is a “box” component association (which matches all possible values for the
28785 subcomponent). This restriction applies if:
28788 @itemize -
28790 @item 
28791 the component subtype is not a record, array, or discrete type; or
28793 @item 
28794 the component subtype is subject to a non-static constraint or has a
28795 predicate; or:
28797 @item 
28798 the component type is an enumeration type that is subject to an enumeration
28799 representation clause; or
28801 @item 
28802 the component type is a multidimensional array type or an array type with a
28803 nonstatic index subtype.
28804 @end itemize
28806 Support for casing on arrays (and on records that contain arrays) is
28807 currently subject to some restrictions. Non-positional
28808 array aggregates are not supported as (or within) case choices. Likewise
28809 for array type and subtype names. The current implementation exceeds
28810 compile-time capacity limits in some annoyingly common scenarios; the
28811 message generated in such cases is usually “Capacity exceeded in compiling
28812 case statement with composite selector type”.
28814 Link to the original RFC:
28815 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-pattern-matching.rst}
28817 @node Fixed lower bounds for array types and subtypes,Prefixed-view notation for calls to primitive subprograms of untagged types,Case pattern matching,Curated Extensions
28818 @anchor{gnat_rm/gnat_language_extensions fixed-lower-bounds-for-array-types-and-subtypes}@anchor{439}
28819 @subsection Fixed lower bounds for array types and subtypes
28822 Unconstrained array types and subtypes can be specified with a lower bound that
28823 is fixed to a certain value, by writing an index range that uses the syntax
28824 @code{<lower-bound-expression> .. <>}. This guarantees that all objects of the
28825 type or subtype will have the specified lower bound.
28827 For example, a matrix type with fixed lower bounds of zero for each dimension
28828 can be declared by the following:
28830 @example
28831 type Matrix is
28832   array (Natural range 0 .. <>, Natural range 0 .. <>) of Integer;
28833 @end example
28835 Objects of type @code{Matrix} declared with an index constraint must have index
28836 ranges starting at zero:
28838 @example
28839 M1 : Matrix (0 .. 9, 0 .. 19);
28840 M2 : Matrix (2 .. 11, 3 .. 22);  -- Warning about bounds; will raise CE
28841 @end example
28843 Similarly, a subtype of @code{String} can be declared that specifies the lower
28844 bound of objects of that subtype to be @code{1}:
28846 @quotation
28848 @example
28849 subtype String_1 is String (1 .. <>);
28850 @end example
28851 @end quotation
28853 If a string slice is passed to a formal of subtype @code{String_1} in a call to a
28854 subprogram @code{S}, the slice’s bounds will “slide” so that the lower bound is
28855 @code{1}.
28857 Within @code{S}, the lower bound of the formal is known to be @code{1}, so, unlike a
28858 normal unconstrained @code{String} formal, there is no need to worry about
28859 accounting for other possible lower-bound values. Sliding of bounds also occurs
28860 in other contexts, such as for object declarations with an unconstrained
28861 subtype with fixed lower bound, as well as in subtype conversions.
28863 Use of this feature increases safety by simplifying code, and can also improve
28864 the efficiency of indexing operations, since the compiler statically knows the
28865 lower bound of unconstrained array formals when the formal’s subtype has index
28866 ranges with static fixed lower bounds.
28868 Link to the original RFC:
28869 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-fixed-lower-bound.rst}
28871 @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
28872 @anchor{gnat_rm/gnat_language_extensions prefixed-view-notation-for-calls-to-primitive-subprograms-of-untagged-types}@anchor{43a}
28873 @subsection Prefixed-view notation for calls to primitive subprograms of untagged types
28876 When operating on an untagged type, if it has any primitive operations, and the
28877 first parameter of an operation is of the type (or is an access parameter with
28878 an anonymous type that designates the type), you may invoke these operations
28879 using an @code{object.op(...)} notation, where the parameter that would normally be
28880 the first parameter is brought out front, and the remaining parameters (if any)
28881 appear within parentheses after the name of the primitive operation.
28883 This same notation is already available for tagged types. This extension allows
28884 for untagged types. It is allowed for all primitive operations of the type
28885 independent of whether they were originally declared in a package spec or its
28886 private part, or were inherited and/or overridden as part of a derived type
28887 declaration occuring anywhere, so long as the first parameter is of the type,
28888 or an access parameter designating the type.
28890 For example:
28892 @example
28893 generic
28894    type Elem_Type is private;
28895 package Vectors is
28896     type Vector is private;
28897     procedure Add_Element (V : in out Vector; Elem : Elem_Type);
28898     function Nth_Element (V : Vector; N : Positive) return Elem_Type;
28899     function Length (V : Vector) return Natural;
28900 private
28901     function Capacity (V : Vector) return Natural;
28902        --  Return number of elements that may be added without causing
28903        --  any new allocation of space
28905     type Vector is ...
28906       with Type_Invariant => Vector.Length <= Vector.Capacity;
28907     ...
28908 end Vectors;
28910 package Int_Vecs is new Vectors(Integer);
28912 V : Int_Vecs.Vector;
28914 V.Add_Element(42);
28915 V.Add_Element(-33);
28917 pragma Assert (V.Length = 2);
28918 pragma Assert (V.Nth_Element(1) = 42);
28919 @end example
28921 Link to the original RFC:
28922 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-prefixed-untagged.rst}
28924 @node Expression defaults for generic formal functions,String interpolation,Prefixed-view notation for calls to primitive subprograms of untagged types,Curated Extensions
28925 @anchor{gnat_rm/gnat_language_extensions expression-defaults-for-generic-formal-functions}@anchor{43b}
28926 @subsection Expression defaults for generic formal functions
28929 The declaration of a generic formal function is allowed to specify
28930 an expression as a default, using the syntax of an expression function.
28932 Here is an example of this feature:
28934 @example
28935 generic
28936    type T is private;
28937    with function Copy (Item : T) return T is (Item); -- Defaults to Item
28938 package Stacks is
28940    type Stack is limited private;
28942    procedure Push (S : in out Stack; X : T); -- Calls Copy on X
28943    function Pop (S : in out Stack) return T; -- Calls Copy to return item
28945 private
28946    -- ...
28947 end Stacks;
28948 @end example
28950 Link to the original RFC:
28951 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-expression-functions-as-default-for-generic-formal-function-parameters.rst}
28953 @node String interpolation,Constrained attribute for generic objects,Expression defaults for generic formal functions,Curated Extensions
28954 @anchor{gnat_rm/gnat_language_extensions string-interpolation}@anchor{43c}
28955 @subsection String interpolation
28958 The syntax for string literals is extended to support string interpolation.
28960 Within an interpolated string literal, an arbitrary expression, when
28961 enclosed in @code{@{ ... @}}, is expanded at run time into the result of calling
28962 @code{'Image} on the result of evaluating the expression enclosed by the brace
28963 characters, unless it is already a string or a single character.
28965 Here is an example of this feature where the expressions @code{Name} and @code{X + Y}
28966 will be evaluated and included in the string.
28968 @example
28969 procedure Test_Interpolation is
28970    X    : Integer := 12;
28971    Y    : Integer := 15;
28972    Name : String := "Leo";
28973 begin
28974    Put_Line (f"The name is @{Name@} and the sum is @{X + Y@}.");
28975 end Test_Interpolation;
28976 @end example
28978 In addition, an escape character (@code{\}) is provided for inserting certain
28979 standard control characters (such as @code{\t} for tabulation or @code{\n} for
28980 newline) or to escape characters with special significance to the
28981 interpolated string syntax, namely @code{"}, @code{@{}, @code{@}},and @code{\} itself.
28984 @multitable {xxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
28985 @item
28987 escaped_character
28989 @tab
28991 meaning
28993 @item
28995 @code{\a}
28997 @tab
28999 ALERT
29001 @item
29003 @code{\b}
29005 @tab
29007 BACKSPACE
29009 @item
29011 @code{\f}
29013 @tab
29015 FORM FEED
29017 @item
29019 @code{\n}
29021 @tab
29023 LINE FEED
29025 @item
29027 @code{\r}
29029 @tab
29031 CARRIAGE RETURN
29033 @item
29035 @code{\t}
29037 @tab
29039 CHARACTER TABULATION
29041 @item
29043 @code{\v}
29045 @tab
29047 LINE TABULATION
29049 @item
29051 @code{\0}
29053 @tab
29057 @item
29059 @code{\\}
29061 @tab
29063 @code{\}
29065 @item
29067 @code{\"}
29069 @tab
29071 @code{"}
29073 @item
29075 @code{\@{}
29077 @tab
29079 @code{@{}
29081 @item
29083 @code{\@}}
29085 @tab
29087 @code{@}}
29089 @end multitable
29092 Note that, unlike normal string literals, doubled characters have no
29093 special significance. So to include a double-quote or a brace character
29094 in an interpolated string, they must be preceded by a @code{\}.
29095 For example:
29097 @example
29098 Put_Line
29099   (f"X = @{X@} and Y = @{Y@} and X+Y = @{X+Y@};\n" &
29100    f" a double quote is \" and" &
29101    f" an open brace is \@{");
29102 @end example
29104 Finally, a syntax is provided for creating multi-line string literals,
29105 without having to explicitly use an escape sequence such as @code{\n}. For
29106 example:
29108 @example
29109 Put_Line
29110   (f"This is a multi-line"
29111     "string literal"
29112     "There is no ambiguity about how many"
29113     "spaces are included in each line");
29114 @end example
29116 Here is a link to the original RFC   :
29117 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-string-interpolation.rst}
29119 @node Constrained attribute for generic objects,Static aspect on intrinsic functions,String interpolation,Curated Extensions
29120 @anchor{gnat_rm/gnat_language_extensions constrained-attribute-for-generic-objects}@anchor{43d}
29121 @subsection Constrained attribute for generic objects
29124 The @code{Constrained} attribute is permitted for objects of generic types. The
29125 result indicates whether the corresponding actual is constrained.
29127 @node Static aspect on intrinsic functions,,Constrained attribute for generic objects,Curated Extensions
29128 @anchor{gnat_rm/gnat_language_extensions static-aspect-on-intrinsic-functions}@anchor{43e}
29129 @subsection @code{Static} aspect on intrinsic functions
29132 The Ada 202x @code{Static} aspect can be specified on Intrinsic imported functions
29133 and the compiler will evaluate some of these intrinsics statically, in
29134 particular the @code{Shift_Left} and @code{Shift_Right} intrinsics.
29136 @node Experimental Language Extensions,,Curated Extensions,GNAT language extensions
29137 @anchor{gnat_rm/gnat_language_extensions experimental-language-extensions}@anchor{67}@anchor{gnat_rm/gnat_language_extensions id2}@anchor{43f}
29138 @section Experimental Language Extensions
29141 @menu
29142 * Pragma Storage_Model:: 
29143 * Simpler accessibility model:: 
29145 @end menu
29147 @node Pragma Storage_Model,Simpler accessibility model,,Experimental Language Extensions
29148 @anchor{gnat_rm/gnat_language_extensions pragma-storage-model}@anchor{440}
29149 @subsection Pragma Storage_Model
29152 This feature proposes to redesign the concepts of Storage Pools into a more
29153 efficient model allowing higher performances and easier integration with low
29154 footprint embedded run-times.
29156 It also extends it to support distributed memory models, in particular to
29157 support interactions with GPU.
29159 Here is a link to the full RFC:
29160 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-storage-model.rst}
29162 @node Simpler accessibility model,,Pragma Storage_Model,Experimental Language Extensions
29163 @anchor{gnat_rm/gnat_language_extensions simpler-accessibility-model}@anchor{441}
29164 @subsection Simpler accessibility model
29167 The goal of this feature is to restore a common understanding of accessibility
29168 rules for implementers and users alike. The new rules should both be effective
29169 at preventing errors and feel natural and compatible in an Ada environment
29170 while removing dynamic accessibility checking.
29172 Here is a link to the full RFC:
29173 @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-simpler-accessibility.md}
29175 @node Security Hardening Features,Obsolescent Features,GNAT language extensions,Top
29176 @anchor{gnat_rm/security_hardening_features doc}@anchor{442}@anchor{gnat_rm/security_hardening_features id1}@anchor{443}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15}
29177 @chapter Security Hardening Features
29180 This chapter describes Ada extensions aimed at security hardening that
29181 are provided by GNAT.
29183 The features in this chapter are currently experimental and subject to
29184 change.
29186 @c Register Scrubbing:
29188 @menu
29189 * Register Scrubbing:: 
29190 * Stack Scrubbing:: 
29191 * Hardened Conditionals:: 
29192 * Hardened Booleans:: 
29193 * Control Flow Redundancy:: 
29195 @end menu
29197 @node Register Scrubbing,Stack Scrubbing,,Security Hardening Features
29198 @anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{444}
29199 @section Register Scrubbing
29202 GNAT can generate code to zero-out hardware registers before returning
29203 from a subprogram.
29205 It can be enabled with the @code{-fzero-call-used-regs=`choice'}
29206 command-line option, to affect all subprograms in a compilation, and
29207 with a @code{Machine_Attribute} pragma, to affect only specific
29208 subprograms.
29210 @example
29211 procedure Foo;
29212 pragma Machine_Attribute (Foo, "zero_call_used_regs", "used");
29213 --  Before returning, Foo scrubs only call-clobbered registers
29214 --  that it uses itself.
29216 function Bar return Integer;
29217 pragma Machine_Attribute (Bar, "zero_call_used_regs", "all");
29218 --  Before returning, Bar scrubs all call-clobbered registers.
29220 function Baz return Integer;
29221 pragma Machine_Attribute (Bar, "zero_call_used_regs", "leafy");
29222 --  Before returning, Bar scrubs call-clobbered registers, either
29223 --  those it uses itself, if it can be identified as a leaf
29224 --  function, or all of them otherwise.
29225 @end example
29227 For usage and more details on the command-line option, on the
29228 @code{zero_call_used_regs} attribute, and on their use with other
29229 programming languages, see @cite{Using the GNU Compiler Collection (GCC)}.
29231 @c Stack Scrubbing:
29233 @node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features
29234 @anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{445}
29235 @section Stack Scrubbing
29238 GNAT can generate code to zero-out stack frames used by subprograms.
29240 It can be activated with the @code{Machine_Attribute} pragma, on
29241 specific subprograms and variables, or their types.  (This attribute
29242 always applies to a type, even when it is associated with a subprogram
29243 or a variable.)
29245 @example
29246 function Foo returns Integer;
29247 pragma Machine_Attribute (Foo, "strub");
29248 --  Foo and its callers are modified so as to scrub the stack
29249 --  space used by Foo after it returns.  Shorthand for:
29250 --  pragma Machine_Attribute (Foo, "strub", "at-calls");
29252 procedure Bar;
29253 pragma Machine_Attribute (Bar, "strub", "internal");
29254 --  Bar is turned into a wrapper for its original body,
29255 --  and they scrub the stack used by the original body.
29257 Var : Integer;
29258 pragma Machine_Attribute (Var, "strub");
29259 --  Reading from Var in a subprogram enables stack scrubbing
29260 --  of the stack space used by the subprogram.  Furthermore, if
29261 --  Var is declared within a subprogram, this also enables
29262 --  scrubbing of the stack space used by that subprogram.
29263 @end example
29265 Given these declarations, Foo has its type and body modified as
29266 follows:
29268 @example
29269 function Foo (<WaterMark> : in out System.Address) returns Integer
29271   --  ...
29272 begin
29273   <__strub_update> (<WaterMark>);  --  Updates the stack WaterMark.
29274   --  ...
29275 end;
29276 @end example
29278 whereas its callers are modified from:
29280 @example
29281 X := Foo;
29282 @end example
29286 @example
29287 declare
29288   <WaterMark> : System.Address;
29289 begin
29290   <__strub_enter> (<WaterMark>);  -- Initialize <WaterMark>.
29291   X := Foo (<WaterMark>);
29292   <__strub_leave> (<WaterMark>);  -- Scrubs stack up to <WaterMark>.
29293 end;
29294 @end example
29296 As for Bar, because it is strubbed in internal mode, its callers are
29297 not modified.  Its definition is modified roughly as follows:
29299 @example
29300 procedure Bar is
29301   <WaterMark> : System.Address;
29302   procedure Strubbed_Bar (<WaterMark> : in out System.Address) is
29303   begin
29304     <__strub_update> (<WaterMark>);  --  Updates the stack WaterMark.
29305     -- original Bar body.
29306   end Strubbed_Bar;
29307 begin
29308   <__strub_enter> (<WaterMark>);  -- Initialize <WaterMark>.
29309   Strubbed_Bar (<WaterMark>);
29310   <__strub_leave> (<WaterMark>);  -- Scrubs stack up to <WaterMark>.
29311 end Bar;
29312 @end example
29314 There are also @code{-fstrub=`choice'} command-line options to
29315 control default settings.  For usage and more details on the
29316 command-line options, on the @code{strub} attribute, and their use with
29317 other programming languages, see @cite{Using the GNU Compiler Collection (GCC)}.
29319 Note that Ada secondary stacks are not scrubbed.  The restriction
29320 @code{No_Secondary_Stack} avoids their use, and thus their accidental
29321 preservation of data that should be scrubbed.
29323 Attributes @code{Access} and @code{Unconstrained_Access} of variables and
29324 constants with @code{strub} enabled require types with @code{strub} enabled;
29325 there is no way to express an access-to-strub type otherwise.
29326 @code{Unchecked_Access} bypasses this constraint, but the resulting
29327 access type designates a non-strub type.
29329 @example
29330 VI : aliased Integer;
29331 pragma Machine_Attribute (VI, "strub");
29332 XsVI : access Integer := VI'Access; -- Error.
29333 UXsVI : access Integer := VI'Unchecked_Access; -- OK,
29334 --  UXsVI does *not* enable strub in subprograms that
29335 --  dereference it to obtain the UXsVI.all value.
29337 type Strub_Int is new Integer;
29338 pragma Machine_Attribute (Strub_Int, "strub");
29339 VSI : aliased Strub_Int;
29340 XsVSI : access Strub_Int := VSI'Access; -- OK,
29341 --  VSI and XsVSI.all both enable strub in subprograms that
29342 --  read their values.
29343 @end example
29345 Every access-to-subprogram type, renaming, and overriding and
29346 overridden dispatching operations that may refer to a subprogram with
29347 an attribute-modified interface must be annotated with the same
29348 interface-modifying attribute.  Access-to-subprogram types can be
29349 explicitly converted to different strub modes, as long as they are
29350 interface-compatible (i.e., adding or removing @code{at-calls} is not
29351 allowed).  For example, a @code{strub}-@code{disabled} subprogram can be
29352 turned @code{callable} through such an explicit conversion:
29354 @example
29355 type TBar is access procedure;
29357 type TBar_Callable is access procedure;
29358 pragma Machine_Attribute (TBar_Callable, "strub", "callable");
29359 --  The attribute modifies the procedure type, rather than the
29360 --  access type, because of the extra argument after "strub",
29361 --  only applicable to subprogram types.
29363 Bar_Callable_Ptr : constant TBar_Callable
29364            := TBar_Callable (TBar'(Bar'Access));
29366 procedure Bar_Callable renames Bar_Callable_Ptr.all;
29367 pragma Machine_Attribute (Bar_Callable, "strub", "callable");
29368 @end example
29370 Note that the renaming declaration is expanded to a full subprogram
29371 body, it won’t be just an alias.  Only if it is inlined will it be as
29372 efficient as a call by dereferencing the access-to-subprogram constant
29373 Bar_Callable_Ptr.
29375 @c Hardened Conditionals:
29377 @node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features
29378 @anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{446}
29379 @section Hardened Conditionals
29382 GNAT can harden conditionals to protect against control-flow attacks.
29384 This is accomplished by two complementary transformations, each
29385 activated by a separate command-line option.
29387 The option @code{-fharden-compares} enables hardening of compares
29388 that compute results stored in variables, adding verification that the
29389 reversed compare yields the opposite result, turning:
29391 @example
29392 B := X = Y;
29393 @end example
29395 into:
29397 @example
29398 B := X = Y;
29399 declare
29400   NotB : Boolean := X /= Y; -- Computed independently of B.
29401 begin
29402   if B = NotB then
29403     <__builtin_trap>;
29404   end if;
29405 end;
29406 @end example
29408 The option @code{-fharden-conditional-branches} enables hardening
29409 of compares that guard conditional branches, adding verification of
29410 the reversed compare to both execution paths, turning:
29412 @example
29413 if X = Y then
29414   X := Z + 1;
29415 else
29416   Y := Z - 1;
29417 end if;
29418 @end example
29420 into:
29422 @example
29423 if X = Y then
29424   if X /= Y then -- Computed independently of X = Y.
29425     <__builtin_trap>;
29426   end if;
29427   X := Z + 1;
29428 else
29429   if X /= Y then -- Computed independently of X = Y.
29430     null;
29431   else
29432     <__builtin_trap>;
29433   end if;
29434   Y := Z - 1;
29435 end if;
29436 @end example
29438 These transformations are introduced late in the compilation pipeline,
29439 long after boolean expressions are decomposed into separate compares,
29440 each one turned into either a conditional branch or a compare whose
29441 result is stored in a boolean variable or temporary.  Compiler
29442 optimizations, if enabled, may also turn conditional branches into
29443 stored compares, and vice-versa, or into operations with implied
29444 conditionals (e.g. MIN and MAX).  Conditionals may also be optimized
29445 out entirely, if their value can be determined at compile time, and
29446 occasionally multiple compares can be combined into one.
29448 It is thus difficult to predict which of these two options will affect
29449 a specific compare operation expressed in source code.  Using both
29450 options ensures that every compare that is neither optimized out nor
29451 optimized into implied conditionals will be hardened.
29453 The addition of reversed compares can be observed by enabling the dump
29454 files of the corresponding passes, through command-line options
29455 @code{-fdump-tree-hardcmp} and @code{-fdump-tree-hardcbr},
29456 respectively.
29458 They are separate options, however, because of the significantly
29459 different performance impact of the hardening transformations.
29461 For usage and more details on the command-line options, see
29462 @cite{Using the GNU Compiler Collection (GCC)}.  These options can
29463 be used with other programming languages supported by GCC.
29465 @c Hardened Booleans:
29467 @node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features
29468 @anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{447}
29469 @section Hardened Booleans
29472 Ada has built-in support for introducing boolean types with
29473 alternative representations, using representation clauses:
29475 @example
29476 type HBool is new Boolean;
29477 for HBool use (16#5a#, 16#a5#);
29478 for HBool'Size use 8;
29479 @end example
29481 When validity checking is enabled, the compiler will check that
29482 variables of such types hold values corresponding to the selected
29483 representations.
29485 There are multiple strategies for where to introduce validity checking
29486 (see @code{-gnatV} options).  Their goal is to guard against
29487 various kinds of programming errors, and GNAT strives to omit checks
29488 when program logic rules out an invalid value, and optimizers may
29489 further remove checks found to be redundant.
29491 For additional hardening, the @code{hardbool} @code{Machine_Attribute}
29492 pragma can be used to annotate boolean types with representation
29493 clauses, so that expressions of such types used as conditions are
29494 checked even when compiling with @code{-gnatVT}:
29496 @example
29497 pragma Machine_Attribute (HBool, "hardbool");
29499 function To_Boolean (X : HBool) returns Boolean is (Boolean (X));
29500 @end example
29502 is compiled roughly like:
29504 @example
29505 function To_Boolean (X : HBool) returns Boolean is
29506 begin
29507   if X not in True | False then
29508     raise Constraint_Error;
29509   elsif X in True then
29510     return True;
29511   else
29512     return False;
29513   end if;
29514 end To_Boolean;
29515 @end example
29517 Note that @code{-gnatVn} will disable even @code{hardbool} testing.
29519 Analogous behavior is available as a GCC extension to the C and
29520 Objective C programming languages, through the @code{hardbool} attribute,
29521 with the difference that, instead of raising a Constraint_Error
29522 exception, when a hardened boolean variable is found to hold a value
29523 that stands for neither True nor False, the program traps.  For usage
29524 and more details on that attribute, see @cite{Using the GNU Compiler Collection (GCC)}.
29526 @c Control Flow Redundancy:
29528 @node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features
29529 @anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{448}
29530 @section Control Flow Redundancy
29533 GNAT can guard against unexpected execution flows, such as branching
29534 into the middle of subprograms, as in Return Oriented Programming
29535 exploits.
29537 In units compiled with @code{-fharden-control-flow-redundancy},
29538 subprograms are instrumented so that, every time they are called,
29539 basic blocks take note as control flows through them, and, before
29540 returning, subprograms verify that the taken notes are consistent with
29541 the control-flow graph.
29543 The performance impact of verification on leaf subprograms can be much
29544 higher, while the averted risks are much lower on them.
29545 Instrumentation can be disabled for leaf subprograms with
29546 @code{-fhardcfr-skip-leaf}.
29548 Functions with too many basic blocks, or with multiple return points,
29549 call a run-time function to perform the verification.  Other functions
29550 perform the verification inline before returning.
29552 Optimizing the inlined verification can be quite time consuming, so
29553 the default upper limit for the inline mode is set at 16 blocks.
29554 Command-line option @code{--param hardcfr-max-inline-blocks=} can
29555 override it.
29557 Even though typically sparse control-flow graphs exhibit run-time
29558 verification time nearly proportional to the block count of a
29559 subprogram, it may become very significant for generated subprograms
29560 with thousands of blocks.  Command-line option
29561 @code{--param hardcfr-max-blocks=} can set an upper limit for
29562 instrumentation.
29564 For each block that is marked as visited, the mechanism checks that at
29565 least one of its predecessors, and at least one of its successors, are
29566 also marked as visited.
29568 Verification is performed just before a subprogram returns.  The
29569 following fragment:
29571 @example
29572 if X then
29573   Y := F (Z);
29574   return;
29575 end if;
29576 @end example
29578 gets turned into:
29580 @example
29581 type Visited_Bitmap is array (1..N) of Boolean with Pack;
29582 Visited : aliased Visited_Bitmap := (others => False);
29583 --  Bitmap of visited blocks.  N is the basic block count.
29584 [...]
29585 --  Basic block #I
29586 Visited(I) := True;
29587 if X then
29588   --  Basic block #J
29589   Visited(J) := True;
29590   Y := F (Z);
29591   CFR.Check (N, Visited'Access, CFG'Access);
29592   --  CFR is a hypothetical package whose Check procedure calls
29593   --  libgcc's __hardcfr_check, that traps if the Visited bitmap
29594   --  does not hold a valid path in CFG, the run-time
29595   --  representation of the control flow graph in the enclosing
29596   --  subprogram.
29597   return;
29598 end if;
29599 --  Basic block #K
29600 Visited(K) := True;
29601 @end example
29603 Verification would also be performed before tail calls, if any
29604 front-ends marked them as mandatory or desirable, but none do.
29605 Regular calls are optimized into tail calls too late for this
29606 transformation to act on it.
29608 In order to avoid adding verification after potential tail calls,
29609 which would prevent tail-call optimization, we recognize returning
29610 calls, i.e., calls whose result, if any, is returned by the calling
29611 subprogram to its caller immediately after the call returns.
29612 Verification is performed before such calls, whether or not they are
29613 ultimately optimized to tail calls.  This behavior is enabled by
29614 default whenever sibcall optimization is enabled (see
29615 @code{-foptimize-sibling-calls}); it may be disabled with
29616 @code{-fno-hardcfr-check-returning-calls}, or enabled with
29617 @code{-fhardcfr-check-returning-calls}, regardless of the
29618 optimization, but the lack of other optimizations may prevent calls
29619 from being recognized as returning calls:
29621 @example
29622 --  CFR.Check here, with -fhardcfr-check-returning-calls.
29623 P (X);
29624 --  CFR.Check here, with -fno-hardcfr-check-returning-calls.
29625 return;
29626 @end example
29630 @example
29631 --  CFR.Check here, with -fhardcfr-check-returning-calls.
29632 R := F (X);
29633 --  CFR.Check here, with -fno-hardcfr-check-returning-calls.
29634 return R;
29635 @end example
29637 Any subprogram from which an exception may escape, i.e., that may
29638 raise or propagate an exception that isn’t handled internally, is
29639 conceptually enclosed by a cleanup handler that performs verification,
29640 unless this is disabled with @code{-fno-hardcfr-check-exceptions}.
29641 With this feature enabled, a subprogram body containing:
29643 @example
29644 --  ...
29645   Y := F (X);  -- May raise exceptions.
29646 --  ...
29647   raise E;  -- Not handled internally.
29648 --  ...
29649 @end example
29651 gets modified as follows:
29653 @example
29654 begin
29655   --  ...
29656     Y := F (X);  -- May raise exceptions.
29657   --  ...
29658     raise E;  -- Not handled internally.
29659   --  ...
29660 exception
29661   when others =>
29662     CFR.Check (N, Visited'Access, CFG'Access);
29663     raise;
29664 end;
29665 @end example
29667 Verification may also be performed before No_Return calls, whether all
29668 of them, with @code{-fhardcfr-check-noreturn-calls=always}; all but
29669 internal subprograms involved in exception-raising or -reraising, with
29670 @code{-fhardcfr-check-noreturn-calls=no-xthrow} (default); only
29671 nothrow ones, with @code{-fhardcfr-check-noreturn-calls=nothrow};
29672 or none, with @code{-fhardcfr-check-noreturn-calls=never}.
29674 When a No_Return call returns control to its caller through an
29675 exception, verification may have already been performed before the
29676 call, if @code{-fhardcfr-check-noreturn-calls=always} or
29677 @code{-fhardcfr-check-noreturn-calls=no-xthrow} is in effect.  The
29678 compiler arranges for already-checked No_Return calls without a
29679 preexisting handler to bypass the implicitly-added cleanup handler and
29680 thus the redundant check, but a local exception or cleanup handler, if
29681 present, will modify the set of visited blocks, and checking will take
29682 place again when the caller reaches the next verification point,
29683 whether it is a return or reraise statement after the exception is
29684 otherwise handled, or even another No_Return call.
29686 The instrumentation for hardening with control flow redundancy can be
29687 observed in dump files generated by the command-line option
29688 @code{-fdump-tree-hardcfr}.
29690 For more details on the control flow redundancy command-line options,
29691 see @cite{Using the GNU Compiler Collection (GCC)}.  These options
29692 can be used with other programming languages supported by GCC.
29694 @node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top
29695 @anchor{gnat_rm/obsolescent_features doc}@anchor{449}@anchor{gnat_rm/obsolescent_features id1}@anchor{44a}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16}
29696 @chapter Obsolescent Features
29699 This chapter describes features that are provided by GNAT, but are
29700 considered obsolescent since there are preferred ways of achieving
29701 the same effect. These features are provided solely for historical
29702 compatibility purposes.
29704 @menu
29705 * pragma No_Run_Time:: 
29706 * pragma Ravenscar:: 
29707 * pragma Restricted_Run_Time:: 
29708 * pragma Task_Info:: 
29709 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
29711 @end menu
29713 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
29714 @anchor{gnat_rm/obsolescent_features id2}@anchor{44b}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{44c}
29715 @section pragma No_Run_Time
29718 The pragma @code{No_Run_Time} is used to achieve an affect similar
29719 to the use of the “Zero Foot Print” configurable run time, but without
29720 requiring a specially configured run time. The result of using this
29721 pragma, which must be used for all units in a partition, is to restrict
29722 the use of any language features requiring run-time support code. The
29723 preferred usage is to use an appropriately configured run-time that
29724 includes just those features that are to be made accessible.
29726 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
29727 @anchor{gnat_rm/obsolescent_features id3}@anchor{44d}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{44e}
29728 @section pragma Ravenscar
29731 The pragma @code{Ravenscar} has exactly the same effect as pragma
29732 @code{Profile (Ravenscar)}. The latter usage is preferred since it
29733 is part of the new Ada 2005 standard.
29735 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
29736 @anchor{gnat_rm/obsolescent_features id4}@anchor{44f}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{450}
29737 @section pragma Restricted_Run_Time
29740 The pragma @code{Restricted_Run_Time} has exactly the same effect as
29741 pragma @code{Profile (Restricted)}. The latter usage is
29742 preferred since the Ada 2005 pragma @code{Profile} is intended for
29743 this kind of implementation dependent addition.
29745 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
29746 @anchor{gnat_rm/obsolescent_features id5}@anchor{451}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{452}
29747 @section pragma Task_Info
29750 The functionality provided by pragma @code{Task_Info} is now part of the
29751 Ada language. The @code{CPU} aspect and the package
29752 @code{System.Multiprocessors} offer a less system-dependent way to specify
29753 task affinity or to query the number of processors.
29755 Syntax
29757 @example
29758 pragma Task_Info (EXPRESSION);
29759 @end example
29761 This pragma appears within a task definition (like pragma
29762 @code{Priority}) and applies to the task in which it appears.  The
29763 argument must be of type @code{System.Task_Info.Task_Info_Type}.
29764 The @code{Task_Info} pragma provides system dependent control over
29765 aspects of tasking implementation, for example, the ability to map
29766 tasks to specific processors.  For details on the facilities available
29767 for the version of GNAT that you are using, see the documentation
29768 in the spec of package System.Task_Info in the runtime
29769 library.
29771 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
29772 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{453}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{454}
29773 @section package System.Task_Info (@code{s-tasinf.ads})
29776 This package provides target dependent functionality that is used
29777 to support the @code{Task_Info} pragma. The predefined Ada package
29778 @code{System.Multiprocessors} and the @code{CPU} aspect now provide a
29779 standard replacement for GNAT’s @code{Task_Info} functionality.
29781 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
29782 @anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{455}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{456}
29783 @chapter Compatibility and Porting Guide
29786 This chapter presents some guidelines for developing portable Ada code,
29787 describes the compatibility issues that may arise between
29788 GNAT and other Ada compilation systems (including those for Ada 83),
29789 and shows how GNAT can expedite porting
29790 applications developed in other Ada environments.
29792 @menu
29793 * Writing Portable Fixed-Point Declarations:: 
29794 * Compatibility with Ada 83:: 
29795 * Compatibility between Ada 95 and Ada 2005:: 
29796 * Implementation-dependent characteristics:: 
29797 * Compatibility with Other Ada Systems:: 
29798 * Representation Clauses:: 
29799 * Compatibility with HP Ada 83:: 
29801 @end menu
29803 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
29804 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{457}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{458}
29805 @section Writing Portable Fixed-Point Declarations
29808 The Ada Reference Manual gives an implementation freedom to choose bounds
29809 that are narrower by @code{Small} from the given bounds.
29810 For example, if we write
29812 @example
29813 type F1 is delta 1.0 range -128.0 .. +128.0;
29814 @end example
29816 then the implementation is allowed to choose -128.0 .. +127.0 if it
29817 likes, but is not required to do so.
29819 This leads to possible portability problems, so let’s have a closer
29820 look at this, and figure out how to avoid these problems.
29822 First, why does this freedom exist, and why would an implementation
29823 take advantage of it? To answer this, take a closer look at the type
29824 declaration for @code{F1} above. If the compiler uses the given bounds,
29825 it would need 9 bits to hold the largest positive value (and typically
29826 that means 16 bits on all machines). But if the implementation chooses
29827 the +127.0 bound then it can fit values of the type in 8 bits.
29829 Why not make the user write +127.0 if that’s what is wanted?
29830 The rationale is that if you are thinking of fixed point
29831 as a kind of ‘poor man’s floating-point’, then you don’t want
29832 to be thinking about the scaled integers that are used in its
29833 representation. Let’s take another example:
29835 @example
29836 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
29837 @end example
29839 Looking at this declaration, it seems casually as though
29840 it should fit in 16 bits, but again that extra positive value
29841 +1.0 has the scaled integer equivalent of 2**15 which is one too
29842 big for signed 16 bits. The implementation can treat this as:
29844 @example
29845 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
29846 @end example
29848 and the Ada language design team felt that this was too annoying
29849 to require. We don’t need to debate this decision at this point,
29850 since it is well established (the rule about narrowing the ranges
29851 dates to Ada 83).
29853 But the important point is that an implementation is not required
29854 to do this narrowing, so we have a potential portability problem.
29855 We could imagine three types of implementation:
29858 @enumerate a
29860 @item 
29861 those that narrow the range automatically if they can figure
29862 out that the narrower range will allow storage in a smaller machine unit,
29864 @item 
29865 those that will narrow only if forced to by a @code{'Size} clause, and
29867 @item 
29868 those that will never narrow.
29869 @end enumerate
29871 Now if we are language theoreticians, we can imagine a fourth
29872 approach: to narrow all the time, e.g. to treat
29874 @example
29875 type F3 is delta 1.0 range -10.0 .. +23.0;
29876 @end example
29878 as though it had been written:
29880 @example
29881 type F3 is delta 1.0 range -9.0 .. +22.0;
29882 @end example
29884 But although technically allowed, such a behavior would be hostile and silly,
29885 and no real compiler would do this. All real compilers will fall into one of
29886 the categories (a), (b) or (c) above.
29888 So, how do you get the compiler to do what you want? The answer is give the
29889 actual bounds you want, and then use a @code{'Small} clause and a
29890 @code{'Size} clause to absolutely pin down what the compiler does.
29891 E.g., for @code{F2} above, we will write:
29893 @example
29894 My_Small : constant := 2.0**(-15);
29895 My_First : constant := -1.0;
29896 My_Last  : constant := +1.0 - My_Small;
29898 type F2 is delta My_Small range My_First .. My_Last;
29899 @end example
29901 and then add
29903 @example
29904 for F2'Small use my_Small;
29905 for F2'Size  use 16;
29906 @end example
29908 In practice all compilers will do the same thing here and will give you
29909 what you want, so the above declarations are fully portable. If you really
29910 want to play language lawyer and guard against ludicrous behavior by the
29911 compiler you could add
29913 @example
29914 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
29915 Test2 : constant := 1 / Boolean'Pos (F2'Last  = My_Last);
29916 @end example
29918 One or other or both are allowed to be illegal if the compiler is
29919 behaving in a silly manner, but at least the silly compiler will not
29920 get away with silently messing with your (very clear) intentions.
29922 If you follow this scheme you will be guaranteed that your fixed-point
29923 types will be portable.
29925 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
29926 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{459}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{45a}
29927 @section Compatibility with Ada 83
29930 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
29932 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
29933 are highly upwards compatible with Ada 83.  In
29934 particular, the design intention was that the difficulties associated
29935 with moving from Ada 83 to later versions of the standard should be no greater
29936 than those that occur when moving from one Ada 83 system to another.
29938 However, there are a number of points at which there are minor
29939 incompatibilities.  The @cite{Ada 95 Annotated Reference Manual} contains
29940 full details of these issues as they relate to Ada 95,
29941 and should be consulted for a complete treatment.
29942 In practice the
29943 following subsections treat the most likely issues to be encountered.
29945 @menu
29946 * Legal Ada 83 programs that are illegal in Ada 95:: 
29947 * More deterministic semantics:: 
29948 * Changed semantics:: 
29949 * Other language compatibility issues:: 
29951 @end menu
29953 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
29954 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{45b}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{45c}
29955 @subsection Legal Ada 83 programs that are illegal in Ada 95
29958 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
29959 Ada 95 and later versions of the standard:
29962 @itemize *
29964 @item 
29965 `Character literals'
29967 Some uses of character literals are ambiguous.  Since Ada 95 has introduced
29968 @code{Wide_Character} as a new predefined character type, some uses of
29969 character literals that were legal in Ada 83 are illegal in Ada 95.
29970 For example:
29972 @example
29973 for Char in 'A' .. 'Z' loop ... end loop;
29974 @end example
29976 The problem is that ‘A’ and ‘Z’ could be from either
29977 @code{Character} or @code{Wide_Character}.  The simplest correction
29978 is to make the type explicit; e.g.:
29980 @example
29981 for Char in Character range 'A' .. 'Z' loop ... end loop;
29982 @end example
29984 @item 
29985 `New reserved words'
29987 The identifiers @code{abstract}, @code{aliased}, @code{protected},
29988 @code{requeue}, @code{tagged}, and @code{until} are reserved in Ada 95.
29989 Existing Ada 83 code using any of these identifiers must be edited to
29990 use some alternative name.
29992 @item 
29993 `Freezing rules'
29995 The rules in Ada 95 are slightly different with regard to the point at
29996 which entities are frozen, and representation pragmas and clauses are
29997 not permitted past the freeze point.  This shows up most typically in
29998 the form of an error message complaining that a representation item
29999 appears too late, and the appropriate corrective action is to move
30000 the item nearer to the declaration of the entity to which it refers.
30002 A particular case is that representation pragmas
30003 cannot be applied to a subprogram body.  If necessary, a separate subprogram
30004 declaration must be introduced to which the pragma can be applied.
30006 @item 
30007 `Optional bodies for library packages'
30009 In Ada 83, a package that did not require a package body was nevertheless
30010 allowed to have one.  This lead to certain surprises in compiling large
30011 systems (situations in which the body could be unexpectedly ignored by the
30012 binder).  In Ada 95, if a package does not require a body then it is not
30013 permitted to have a body.  To fix this problem, simply remove a redundant
30014 body if it is empty, or, if it is non-empty, introduce a dummy declaration
30015 into the spec that makes the body required.  One approach is to add a private
30016 part to the package declaration (if necessary), and define a parameterless
30017 procedure called @code{Requires_Body}, which must then be given a dummy
30018 procedure body in the package body, which then becomes required.
30019 Another approach (assuming that this does not introduce elaboration
30020 circularities) is to add an @code{Elaborate_Body} pragma to the package spec,
30021 since one effect of this pragma is to require the presence of a package body.
30023 @item 
30024 `Numeric_Error is the same exception as Constraint_Error'
30026 In Ada 95, the exception @code{Numeric_Error} is a renaming of @code{Constraint_Error}.
30027 This means that it is illegal to have separate exception handlers for
30028 the two exceptions.  The fix is simply to remove the handler for the
30029 @code{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
30030 @code{Constraint_Error} in place of @code{Numeric_Error} in all cases).
30032 @item 
30033 `Indefinite subtypes in generics'
30035 In Ada 83, it was permissible to pass an indefinite type (e.g, @code{String})
30036 as the actual for a generic formal private type, but then the instantiation
30037 would be illegal if there were any instances of declarations of variables
30038 of this type in the generic body.  In Ada 95, to avoid this clear violation
30039 of the methodological principle known as the ‘contract model’,
30040 the generic declaration explicitly indicates whether
30041 or not such instantiations are permitted.  If a generic formal parameter
30042 has explicit unknown discriminants, indicated by using @code{(<>)} after the
30043 subtype name, then it can be instantiated with indefinite types, but no
30044 stand-alone variables can be declared of this type.  Any attempt to declare
30045 such a variable will result in an illegality at the time the generic is
30046 declared.  If the @code{(<>)} notation is not used, then it is illegal
30047 to instantiate the generic with an indefinite type.
30048 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
30049 It will show up as a compile time error, and
30050 the fix is usually simply to add the @code{(<>)} to the generic declaration.
30051 @end itemize
30053 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
30054 @anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{45d}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{45e}
30055 @subsection More deterministic semantics
30059 @itemize *
30061 @item 
30062 `Conversions'
30064 Conversions from real types to integer types round away from 0.  In Ada 83
30065 the conversion Integer(2.5) could deliver either 2 or 3 as its value.  This
30066 implementation freedom was intended to support unbiased rounding in
30067 statistical applications, but in practice it interfered with portability.
30068 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
30069 is required.  Numeric code may be affected by this change in semantics.
30070 Note, though, that this issue is no worse than already existed in Ada 83
30071 when porting code from one vendor to another.
30073 @item 
30074 `Tasking'
30076 The Real-Time Annex introduces a set of policies that define the behavior of
30077 features that were implementation dependent in Ada 83, such as the order in
30078 which open select branches are executed.
30079 @end itemize
30081 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
30082 @anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{45f}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{460}
30083 @subsection Changed semantics
30086 The worst kind of incompatibility is one where a program that is legal in
30087 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
30088 possible in Ada 83.  Fortunately this is extremely rare, but the one
30089 situation that you should be alert to is the change in the predefined type
30090 @code{Character} from 7-bit ASCII to 8-bit Latin-1.
30092 @quotation
30094 @geindex Latin-1
30095 @end quotation
30098 @itemize *
30100 @item 
30101 `Range of type `@w{`}Character`@w{`}'
30103 The range of @code{Standard.Character} is now the full 256 characters
30104 of Latin-1, whereas in most Ada 83 implementations it was restricted
30105 to 128 characters. Although some of the effects of
30106 this change will be manifest in compile-time rejection of legal
30107 Ada 83 programs it is possible for a working Ada 83 program to have
30108 a different effect in Ada 95, one that was not permitted in Ada 83.
30109 As an example, the expression
30110 @code{Character'Pos(Character'Last)} returned @code{127} in Ada 83 and now
30111 delivers @code{255} as its value.
30112 In general, you should look at the logic of any
30113 character-processing Ada 83 program and see whether it needs to be adapted
30114 to work correctly with Latin-1.  Note that the predefined Ada 95 API has a
30115 character handling package that may be relevant if code needs to be adapted
30116 to account for the additional Latin-1 elements.
30117 The desirable fix is to
30118 modify the program to accommodate the full character set, but in some cases
30119 it may be convenient to define a subtype or derived type of Character that
30120 covers only the restricted range.
30121 @end itemize
30123 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
30124 @anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{461}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{462}
30125 @subsection Other language compatibility issues
30129 @itemize *
30131 @item 
30132 `-gnat83' switch
30134 All implementations of GNAT provide a switch that causes GNAT to operate
30135 in Ada 83 mode.  In this mode, some but not all compatibility problems
30136 of the type described above are handled automatically.  For example, the
30137 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
30138 as identifiers as in Ada 83.  However,
30139 in practice, it is usually advisable to make the necessary modifications
30140 to the program to remove the need for using this switch.
30141 See the @code{Compiling Different Versions of Ada} section in
30142 the @cite{GNAT User’s Guide}.
30144 @item 
30145 Support for removed Ada 83 pragmas and attributes
30147 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
30148 generally because they were replaced by other mechanisms.  Ada 95 and Ada 2005
30149 compilers are allowed, but not required, to implement these missing
30150 elements.  In contrast with some other compilers, GNAT implements all
30151 such pragmas and attributes, eliminating this compatibility concern.  These
30152 include @code{pragma Interface} and the floating point type attributes
30153 (@code{Emax}, @code{Mantissa}, etc.), among other items.
30154 @end itemize
30156 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
30157 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{463}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{464}
30158 @section Compatibility between Ada 95 and Ada 2005
30161 @geindex Compatibility between Ada 95 and Ada 2005
30163 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
30164 a number of incompatibilities. Several are enumerated below;
30165 for a complete description please see the
30166 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
30167 @cite{Rationale for Ada 2005}.
30170 @itemize *
30172 @item 
30173 `New reserved words.'
30175 The words @code{interface}, @code{overriding} and @code{synchronized} are
30176 reserved in Ada 2005.
30177 A pre-Ada 2005 program that uses any of these as an identifier will be
30178 illegal.
30180 @item 
30181 `New declarations in predefined packages.'
30183 A number of packages in the predefined environment contain new declarations:
30184 @code{Ada.Exceptions}, @code{Ada.Real_Time}, @code{Ada.Strings},
30185 @code{Ada.Strings.Fixed}, @code{Ada.Strings.Bounded},
30186 @code{Ada.Strings.Unbounded}, @code{Ada.Strings.Wide_Fixed},
30187 @code{Ada.Strings.Wide_Bounded}, @code{Ada.Strings.Wide_Unbounded},
30188 @code{Ada.Tags}, @code{Ada.Text_IO}, and @code{Interfaces.C}.
30189 If an Ada 95 program does a @code{with} and @code{use} of any of these
30190 packages, the new declarations may cause name clashes.
30192 @item 
30193 `Access parameters.'
30195 A nondispatching subprogram with an access parameter cannot be renamed
30196 as a dispatching operation.  This was permitted in Ada 95.
30198 @item 
30199 `Access types, discriminants, and constraints.'
30201 Rule changes in this area have led to some incompatibilities; for example,
30202 constrained subtypes of some access types are not permitted in Ada 2005.
30204 @item 
30205 `Aggregates for limited types.'
30207 The allowance of aggregates for limited types in Ada 2005 raises the
30208 possibility of ambiguities in legal Ada 95 programs, since additional types
30209 now need to be considered in expression resolution.
30211 @item 
30212 `Fixed-point multiplication and division.'
30214 Certain expressions involving ‘*’ or ‘/’ for a fixed-point type, which
30215 were legal in Ada 95 and invoked the predefined versions of these operations,
30216 are now ambiguous.
30217 The ambiguity may be resolved either by applying a type conversion to the
30218 expression, or by explicitly invoking the operation from package
30219 @code{Standard}.
30221 @item 
30222 `Return-by-reference types.'
30224 The Ada 95 return-by-reference mechanism has been removed.  Instead, the user
30225 can declare a function returning a value from an anonymous access type.
30226 @end itemize
30228 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
30229 @anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{465}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{466}
30230 @section Implementation-dependent characteristics
30233 Although the Ada language defines the semantics of each construct as
30234 precisely as practical, in some situations (for example for reasons of
30235 efficiency, or where the effect is heavily dependent on the host or target
30236 platform) the implementation is allowed some freedom.  In porting Ada 83
30237 code to GNAT, you need to be aware of whether / how the existing code
30238 exercised such implementation dependencies.  Such characteristics fall into
30239 several categories, and GNAT offers specific support in assisting the
30240 transition from certain Ada 83 compilers.
30242 @menu
30243 * Implementation-defined pragmas:: 
30244 * Implementation-defined attributes:: 
30245 * Libraries:: 
30246 * Elaboration order:: 
30247 * Target-specific aspects:: 
30249 @end menu
30251 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
30252 @anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{467}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{468}
30253 @subsection Implementation-defined pragmas
30256 Ada compilers are allowed to supplement the language-defined pragmas, and
30257 these are a potential source of non-portability.  All GNAT-defined pragmas
30258 are described in @ref{7,,Implementation Defined Pragmas},
30259 and these include several that are specifically
30260 intended to correspond to other vendors’ Ada 83 pragmas.
30261 For migrating from VADS, the pragma @code{Use_VADS_Size} may be useful.
30262 For compatibility with HP Ada 83, GNAT supplies the pragmas
30263 @code{Extend_System}, @code{Ident}, @code{Inline_Generic},
30264 @code{Interface_Name}, @code{Passive}, @code{Suppress_All},
30265 and @code{Volatile}.
30266 Other relevant pragmas include @code{External} and @code{Link_With}.
30267 Some vendor-specific
30268 Ada 83 pragmas (@code{Share_Generic}, @code{Subtitle}, and @code{Title}) are
30269 recognized, thus
30270 avoiding compiler rejection of units that contain such pragmas; they are not
30271 relevant in a GNAT context and hence are not otherwise implemented.
30273 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
30274 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{469}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{46a}
30275 @subsection Implementation-defined attributes
30278 Analogous to pragmas, the set of attributes may be extended by an
30279 implementation.  All GNAT-defined attributes are described in
30280 @ref{8,,Implementation Defined Attributes},
30281 and these include several that are specifically intended
30282 to correspond to other vendors’ Ada 83 attributes.  For migrating from VADS,
30283 the attribute @code{VADS_Size} may be useful.  For compatibility with HP
30284 Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
30285 @code{Type_Class}.
30287 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
30288 @anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{46b}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{46c}
30289 @subsection Libraries
30292 Vendors may supply libraries to supplement the standard Ada API.  If Ada 83
30293 code uses vendor-specific libraries then there are several ways to manage
30294 this in Ada 95 and later versions of the standard:
30297 @itemize *
30299 @item 
30300 If the source code for the libraries (specs and bodies) are
30301 available, then the libraries can be migrated in the same way as the
30302 application.
30304 @item 
30305 If the source code for the specs but not the bodies are
30306 available, then you can reimplement the bodies.
30308 @item 
30309 Some features introduced by Ada 95 obviate the need for library support.  For
30310 example most Ada 83 vendors supplied a package for unsigned integers.  The
30311 Ada 95 modular type feature is the preferred way to handle this need, so
30312 instead of migrating or reimplementing the unsigned integer package it may
30313 be preferable to retrofit the application using modular types.
30314 @end itemize
30316 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
30317 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{46d}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{46e}
30318 @subsection Elaboration order
30321 The implementation can choose any elaboration order consistent with the unit
30322 dependency relationship.  This freedom means that some orders can result in
30323 Program_Error being raised due to an ‘Access Before Elaboration’: an attempt
30324 to invoke a subprogram before its body has been elaborated, or to instantiate
30325 a generic before the generic body has been elaborated.  By default GNAT
30326 attempts to choose a safe order (one that will not encounter access before
30327 elaboration problems) by implicitly inserting @code{Elaborate} or
30328 @code{Elaborate_All} pragmas where
30329 needed.  However, this can lead to the creation of elaboration circularities
30330 and a resulting rejection of the program by gnatbind.  This issue is
30331 thoroughly described in the `Elaboration Order Handling in GNAT' appendix
30332 in the @cite{GNAT User’s Guide}.
30333 In brief, there are several
30334 ways to deal with this situation:
30337 @itemize *
30339 @item 
30340 Modify the program to eliminate the circularities, e.g., by moving
30341 elaboration-time code into explicitly-invoked procedures
30343 @item 
30344 Constrain the elaboration order by including explicit @code{Elaborate_Body} or
30345 @code{Elaborate} pragmas, and then inhibit the generation of implicit
30346 @code{Elaborate_All}
30347 pragmas either globally (as an effect of the `-gnatE' switch) or locally
30348 (by selectively suppressing elaboration checks via pragma
30349 @code{Suppress(Elaboration_Check)} when it is safe to do so).
30350 @end itemize
30352 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
30353 @anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{46f}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{470}
30354 @subsection Target-specific aspects
30357 Low-level applications need to deal with machine addresses, data
30358 representations, interfacing with assembler code, and similar issues.  If
30359 such an Ada 83 application is being ported to different target hardware (for
30360 example where the byte endianness has changed) then you will need to
30361 carefully examine the program logic; the porting effort will heavily depend
30362 on the robustness of the original design.  Moreover, Ada 95 (and thus
30363 Ada 2005 and Ada 2012) are sometimes
30364 incompatible with typical Ada 83 compiler practices regarding implicit
30365 packing, the meaning of the Size attribute, and the size of access values.
30366 GNAT’s approach to these issues is described in @ref{471,,Representation Clauses}.
30368 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
30369 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{472}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{473}
30370 @section Compatibility with Other Ada Systems
30373 If programs avoid the use of implementation dependent and
30374 implementation defined features, as documented in the
30375 @cite{Ada Reference Manual}, there should be a high degree of portability between
30376 GNAT and other Ada systems.  The following are specific items which
30377 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
30378 compilers, but do not affect porting code to GNAT.
30379 (As of January 2007, GNAT is the only compiler available for Ada 2005;
30380 the following issues may or may not arise for Ada 2005 programs
30381 when other compilers appear.)
30384 @itemize *
30386 @item 
30387 `Ada 83 Pragmas and Attributes'
30389 Ada 95 compilers are allowed, but not required, to implement the missing
30390 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
30391 GNAT implements all such pragmas and attributes, eliminating this as
30392 a compatibility concern, but some other Ada 95 compilers reject these
30393 pragmas and attributes.
30395 @item 
30396 `Specialized Needs Annexes'
30398 GNAT implements the full set of special needs annexes.  At the
30399 current time, it is the only Ada 95 compiler to do so.  This means that
30400 programs making use of these features may not be portable to other Ada
30401 95 compilation systems.
30403 @item 
30404 `Representation Clauses'
30406 Some other Ada 95 compilers implement only the minimal set of
30407 representation clauses required by the Ada 95 reference manual.  GNAT goes
30408 far beyond this minimal set, as described in the next section.
30409 @end itemize
30411 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
30412 @anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{474}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{471}
30413 @section Representation Clauses
30416 The Ada 83 reference manual was quite vague in describing both the minimal
30417 required implementation of representation clauses, and also their precise
30418 effects.  Ada 95 (and thus also Ada 2005) are much more explicit, but the
30419 minimal set of capabilities required is still quite limited.
30421 GNAT implements the full required set of capabilities in
30422 Ada 95 and Ada 2005, but also goes much further, and in particular
30423 an effort has been made to be compatible with existing Ada 83 usage to the
30424 greatest extent possible.
30426 A few cases exist in which Ada 83 compiler behavior is incompatible with
30427 the requirements in Ada 95 (and thus also Ada 2005).  These are instances of
30428 intentional or accidental dependence on specific implementation dependent
30429 characteristics of these Ada 83 compilers.  The following is a list of
30430 the cases most likely to arise in existing Ada 83 code.
30433 @itemize *
30435 @item 
30436 `Implicit Packing'
30438 Some Ada 83 compilers allowed a Size specification to cause implicit
30439 packing of an array or record.  This could cause expensive implicit
30440 conversions for change of representation in the presence of derived
30441 types, and the Ada design intends to avoid this possibility.
30442 Subsequent AI’s were issued to make it clear that such implicit
30443 change of representation in response to a Size clause is inadvisable,
30444 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
30445 Reference Manuals as implementation advice that is followed by GNAT.
30446 The problem will show up as an error
30447 message rejecting the size clause.  The fix is simply to provide
30448 the explicit pragma @code{Pack}, or for more fine tuned control, provide
30449 a Component_Size clause.
30451 @item 
30452 `Meaning of Size Attribute'
30454 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
30455 the minimal number of bits required to hold values of the type.  For example,
30456 on a 32-bit machine, the size of @code{Natural} will typically be 31 and not
30457 32 (since no sign bit is required).  Some Ada 83 compilers gave 31, and
30458 some 32 in this situation.  This problem will usually show up as a compile
30459 time error, but not always.  It is a good idea to check all uses of the
30460 ‘Size attribute when porting Ada 83 code.  The GNAT specific attribute
30461 Object_Size can provide a useful way of duplicating the behavior of
30462 some Ada 83 compiler systems.
30464 @item 
30465 `Size of Access Types'
30467 A common assumption in Ada 83 code is that an access type is in fact a pointer,
30468 and that therefore it will be the same size as a System.Address value.  This
30469 assumption is true for GNAT in most cases with one exception.  For the case of
30470 a pointer to an unconstrained array type (where the bounds may vary from one
30471 value of the access type to another), the default is to use a ‘fat pointer’,
30472 which is represented as two separate pointers, one to the bounds, and one to
30473 the array.  This representation has a number of advantages, including improved
30474 efficiency.  However, it may cause some difficulties in porting existing Ada 83
30475 code which makes the assumption that, for example, pointers fit in 32 bits on
30476 a machine with 32-bit addressing.
30478 To get around this problem, GNAT also permits the use of ‘thin pointers’ for
30479 access types in this case (where the designated type is an unconstrained array
30480 type).  These thin pointers are indeed the same size as a System.Address value.
30481 To specify a thin pointer, use a size clause for the type, for example:
30483 @example
30484 type X is access all String;
30485 for X'Size use Standard'Address_Size;
30486 @end example
30488 which will cause the type X to be represented using a single pointer.
30489 When using this representation, the bounds are right behind the array.
30490 This representation is slightly less efficient, and does not allow quite
30491 such flexibility in the use of foreign pointers or in using the
30492 Unrestricted_Access attribute to create pointers to non-aliased objects.
30493 But for any standard portable use of the access type it will work in
30494 a functionally correct manner and allow porting of existing code.
30495 Note that another way of forcing a thin pointer representation
30496 is to use a component size clause for the element size in an array,
30497 or a record representation clause for an access field in a record.
30499 See the documentation of Unrestricted_Access in the GNAT RM for a
30500 full discussion of possible problems using this attribute in conjunction
30501 with thin pointers.
30502 @end itemize
30504 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
30505 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{475}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{476}
30506 @section Compatibility with HP Ada 83
30509 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
30510 of them can sensibly be implemented.  The description of pragmas in
30511 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
30512 applicable to GNAT.
30515 @itemize *
30517 @item 
30518 `Default floating-point representation'
30520 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
30521 it is VMS format.
30523 @item 
30524 `System'
30526 the package System in GNAT exactly corresponds to the definition in the
30527 Ada 95 reference manual, which means that it excludes many of the
30528 HP Ada 83 extensions.  However, a separate package Aux_DEC is provided
30529 that contains the additional definitions, and a special pragma,
30530 Extend_System allows this package to be treated transparently as an
30531 extension of package System.
30532 @end itemize
30534 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
30535 @anchor{share/gnu_free_documentation_license doc}@anchor{477}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{478}
30536 @chapter GNU Free Documentation License
30539 Version 1.3, 3 November 2008
30541 Copyright  2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc
30542 @indicateurl{https://fsf.org/}
30544 Everyone is permitted to copy and distribute verbatim copies of this
30545 license document, but changing it is not allowed.
30547 `Preamble'
30549 The purpose of this License is to make a manual, textbook, or other
30550 functional and useful document “free” in the sense of freedom: to
30551 assure everyone the effective freedom to copy and redistribute it,
30552 with or without modifying it, either commercially or noncommercially.
30553 Secondarily, this License preserves for the author and publisher a way
30554 to get credit for their work, while not being considered responsible
30555 for modifications made by others.
30557 This License is a kind of “copyleft”, which means that derivative
30558 works of the document must themselves be free in the same sense.  It
30559 complements the GNU General Public License, which is a copyleft
30560 license designed for free software.
30562 We have designed this License in order to use it for manuals for free
30563 software, because free software needs free documentation: a free
30564 program should come with manuals providing the same freedoms that the
30565 software does.  But this License is not limited to software manuals;
30566 it can be used for any textual work, regardless of subject matter or
30567 whether it is published as a printed book.  We recommend this License
30568 principally for works whose purpose is instruction or reference.
30570 `1. APPLICABILITY AND DEFINITIONS'
30572 This License applies to any manual or other work, in any medium, that
30573 contains a notice placed by the copyright holder saying it can be
30574 distributed under the terms of this License.  Such a notice grants a
30575 world-wide, royalty-free license, unlimited in duration, to use that
30576 work under the conditions stated herein.  The `Document', below,
30577 refers to any such manual or work.  Any member of the public is a
30578 licensee, and is addressed as “`you'”.  You accept the license if you
30579 copy, modify or distribute the work in a way requiring permission
30580 under copyright law.
30582 A “`Modified Version'” of the Document means any work containing the
30583 Document or a portion of it, either copied verbatim, or with
30584 modifications and/or translated into another language.
30586 A “`Secondary Section'” is a named appendix or a front-matter section of
30587 the Document that deals exclusively with the relationship of the
30588 publishers or authors of the Document to the Document’s overall subject
30589 (or to related matters) and contains nothing that could fall directly
30590 within that overall subject.  (Thus, if the Document is in part a
30591 textbook of mathematics, a Secondary Section may not explain any
30592 mathematics.)  The relationship could be a matter of historical
30593 connection with the subject or with related matters, or of legal,
30594 commercial, philosophical, ethical or political position regarding
30595 them.
30597 The “`Invariant Sections'” are certain Secondary Sections whose titles
30598 are designated, as being those of Invariant Sections, in the notice
30599 that says that the Document is released under this License.  If a
30600 section does not fit the above definition of Secondary then it is not
30601 allowed to be designated as Invariant.  The Document may contain zero
30602 Invariant Sections.  If the Document does not identify any Invariant
30603 Sections then there are none.
30605 The “`Cover Texts'” are certain short passages of text that are listed,
30606 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
30607 the Document is released under this License.  A Front-Cover Text may
30608 be at most 5 words, and a Back-Cover Text may be at most 25 words.
30610 A “`Transparent'” copy of the Document means a machine-readable copy,
30611 represented in a format whose specification is available to the
30612 general public, that is suitable for revising the document
30613 straightforwardly with generic text editors or (for images composed of
30614 pixels) generic paint programs or (for drawings) some widely available
30615 drawing editor, and that is suitable for input to text formatters or
30616 for automatic translation to a variety of formats suitable for input
30617 to text formatters.  A copy made in an otherwise Transparent file
30618 format whose markup, or absence of markup, has been arranged to thwart
30619 or discourage subsequent modification by readers is not Transparent.
30620 An image format is not Transparent if used for any substantial amount
30621 of text.  A copy that is not “Transparent” is called `Opaque'.
30623 Examples of suitable formats for Transparent copies include plain
30624 ASCII without markup, Texinfo input format, LaTeX input format, SGML
30625 or XML using a publicly available DTD, and standard-conforming simple
30626 HTML, PostScript or PDF designed for human modification.  Examples of
30627 transparent image formats include PNG, XCF and JPG.  Opaque formats
30628 include proprietary formats that can be read and edited only by
30629 proprietary word processors, SGML or XML for which the DTD and/or
30630 processing tools are not generally available, and the
30631 machine-generated HTML, PostScript or PDF produced by some word
30632 processors for output purposes only.
30634 The “`Title Page'” means, for a printed book, the title page itself,
30635 plus such following pages as are needed to hold, legibly, the material
30636 this License requires to appear in the title page.  For works in
30637 formats which do not have any title page as such, “Title Page” means
30638 the text near the most prominent appearance of the work’s title,
30639 preceding the beginning of the body of the text.
30641 The “`publisher'” means any person or entity that distributes
30642 copies of the Document to the public.
30644 A section “`Entitled XYZ'” means a named subunit of the Document whose
30645 title either is precisely XYZ or contains XYZ in parentheses following
30646 text that translates XYZ in another language.  (Here XYZ stands for a
30647 specific section name mentioned below, such as “`Acknowledgements'”,
30648 “`Dedications'”, “`Endorsements'”, or “`History'”.)
30649 To “`Preserve the Title'”
30650 of such a section when you modify the Document means that it remains a
30651 section “Entitled XYZ” according to this definition.
30653 The Document may include Warranty Disclaimers next to the notice which
30654 states that this License applies to the Document.  These Warranty
30655 Disclaimers are considered to be included by reference in this
30656 License, but only as regards disclaiming warranties: any other
30657 implication that these Warranty Disclaimers may have is void and has
30658 no effect on the meaning of this License.
30660 `2. VERBATIM COPYING'
30662 You may copy and distribute the Document in any medium, either
30663 commercially or noncommercially, provided that this License, the
30664 copyright notices, and the license notice saying this License applies
30665 to the Document are reproduced in all copies, and that you add no other
30666 conditions whatsoever to those of this License.  You may not use
30667 technical measures to obstruct or control the reading or further
30668 copying of the copies you make or distribute.  However, you may accept
30669 compensation in exchange for copies.  If you distribute a large enough
30670 number of copies you must also follow the conditions in section 3.
30672 You may also lend copies, under the same conditions stated above, and
30673 you may publicly display copies.
30675 `3. COPYING IN QUANTITY'
30677 If you publish printed copies (or copies in media that commonly have
30678 printed covers) of the Document, numbering more than 100, and the
30679 Document’s license notice requires Cover Texts, you must enclose the
30680 copies in covers that carry, clearly and legibly, all these Cover
30681 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
30682 the back cover.  Both covers must also clearly and legibly identify
30683 you as the publisher of these copies.  The front cover must present
30684 the full title with all words of the title equally prominent and
30685 visible.  You may add other material on the covers in addition.
30686 Copying with changes limited to the covers, as long as they preserve
30687 the title of the Document and satisfy these conditions, can be treated
30688 as verbatim copying in other respects.
30690 If the required texts for either cover are too voluminous to fit
30691 legibly, you should put the first ones listed (as many as fit
30692 reasonably) on the actual cover, and continue the rest onto adjacent
30693 pages.
30695 If you publish or distribute Opaque copies of the Document numbering
30696 more than 100, you must either include a machine-readable Transparent
30697 copy along with each Opaque copy, or state in or with each Opaque copy
30698 a computer-network location from which the general network-using
30699 public has access to download using public-standard network protocols
30700 a complete Transparent copy of the Document, free of added material.
30701 If you use the latter option, you must take reasonably prudent steps,
30702 when you begin distribution of Opaque copies in quantity, to ensure
30703 that this Transparent copy will remain thus accessible at the stated
30704 location until at least one year after the last time you distribute an
30705 Opaque copy (directly or through your agents or retailers) of that
30706 edition to the public.
30708 It is requested, but not required, that you contact the authors of the
30709 Document well before redistributing any large number of copies, to give
30710 them a chance to provide you with an updated version of the Document.
30712 `4. MODIFICATIONS'
30714 You may copy and distribute a Modified Version of the Document under
30715 the conditions of sections 2 and 3 above, provided that you release
30716 the Modified Version under precisely this License, with the Modified
30717 Version filling the role of the Document, thus licensing distribution
30718 and modification of the Modified Version to whoever possesses a copy
30719 of it.  In addition, you must do these things in the Modified Version:
30722 @enumerate A
30724 @item 
30725 Use in the Title Page (and on the covers, if any) a title distinct
30726 from that of the Document, and from those of previous versions
30727 (which should, if there were any, be listed in the History section
30728 of the Document).  You may use the same title as a previous version
30729 if the original publisher of that version gives permission.
30731 @item 
30732 List on the Title Page, as authors, one or more persons or entities
30733 responsible for authorship of the modifications in the Modified
30734 Version, together with at least five of the principal authors of the
30735 Document (all of its principal authors, if it has fewer than five),
30736 unless they release you from this requirement.
30738 @item 
30739 State on the Title page the name of the publisher of the
30740 Modified Version, as the publisher.
30742 @item 
30743 Preserve all the copyright notices of the Document.
30745 @item 
30746 Add an appropriate copyright notice for your modifications
30747 adjacent to the other copyright notices.
30749 @item 
30750 Include, immediately after the copyright notices, a license notice
30751 giving the public permission to use the Modified Version under the
30752 terms of this License, in the form shown in the Addendum below.
30754 @item 
30755 Preserve in that license notice the full lists of Invariant Sections
30756 and required Cover Texts given in the Document’s license notice.
30758 @item 
30759 Include an unaltered copy of this License.
30761 @item 
30762 Preserve the section Entitled “History”, Preserve its Title, and add
30763 to it an item stating at least the title, year, new authors, and
30764 publisher of the Modified Version as given on the Title Page.  If
30765 there is no section Entitled “History” in the Document, create one
30766 stating the title, year, authors, and publisher of the Document as
30767 given on its Title Page, then add an item describing the Modified
30768 Version as stated in the previous sentence.
30770 @item 
30771 Preserve the network location, if any, given in the Document for
30772 public access to a Transparent copy of the Document, and likewise
30773 the network locations given in the Document for previous versions
30774 it was based on.  These may be placed in the “History” section.
30775 You may omit a network location for a work that was published at
30776 least four years before the Document itself, or if the original
30777 publisher of the version it refers to gives permission.
30779 @item 
30780 For any section Entitled “Acknowledgements” or “Dedications”,
30781 Preserve the Title of the section, and preserve in the section all
30782 the substance and tone of each of the contributor acknowledgements
30783 and/or dedications given therein.
30785 @item 
30786 Preserve all the Invariant Sections of the Document,
30787 unaltered in their text and in their titles.  Section numbers
30788 or the equivalent are not considered part of the section titles.
30790 @item 
30791 Delete any section Entitled “Endorsements”.  Such a section
30792 may not be included in the Modified Version.
30794 @item 
30795 Do not retitle any existing section to be Entitled “Endorsements”
30796 or to conflict in title with any Invariant Section.
30798 @item 
30799 Preserve any Warranty Disclaimers.
30800 @end enumerate
30802 If the Modified Version includes new front-matter sections or
30803 appendices that qualify as Secondary Sections and contain no material
30804 copied from the Document, you may at your option designate some or all
30805 of these sections as invariant.  To do this, add their titles to the
30806 list of Invariant Sections in the Modified Version’s license notice.
30807 These titles must be distinct from any other section titles.
30809 You may add a section Entitled “Endorsements”, provided it contains
30810 nothing but endorsements of your Modified Version by various
30811 parties—for example, statements of peer review or that the text has
30812 been approved by an organization as the authoritative definition of a
30813 standard.
30815 You may add a passage of up to five words as a Front-Cover Text, and a
30816 passage of up to 25 words as a Back-Cover Text, to the end of the list
30817 of Cover Texts in the Modified Version.  Only one passage of
30818 Front-Cover Text and one of Back-Cover Text may be added by (or
30819 through arrangements made by) any one entity.  If the Document already
30820 includes a cover text for the same cover, previously added by you or
30821 by arrangement made by the same entity you are acting on behalf of,
30822 you may not add another; but you may replace the old one, on explicit
30823 permission from the previous publisher that added the old one.
30825 The author(s) and publisher(s) of the Document do not by this License
30826 give permission to use their names for publicity for or to assert or
30827 imply endorsement of any Modified Version.
30829 `5. COMBINING DOCUMENTS'
30831 You may combine the Document with other documents released under this
30832 License, under the terms defined in section 4 above for modified
30833 versions, provided that you include in the combination all of the
30834 Invariant Sections of all of the original documents, unmodified, and
30835 list them all as Invariant Sections of your combined work in its
30836 license notice, and that you preserve all their Warranty Disclaimers.
30838 The combined work need only contain one copy of this License, and
30839 multiple identical Invariant Sections may be replaced with a single
30840 copy.  If there are multiple Invariant Sections with the same name but
30841 different contents, make the title of each such section unique by
30842 adding at the end of it, in parentheses, the name of the original
30843 author or publisher of that section if known, or else a unique number.
30844 Make the same adjustment to the section titles in the list of
30845 Invariant Sections in the license notice of the combined work.
30847 In the combination, you must combine any sections Entitled “History”
30848 in the various original documents, forming one section Entitled
30849 “History”; likewise combine any sections Entitled “Acknowledgements”,
30850 and any sections Entitled “Dedications”.  You must delete all sections
30851 Entitled “Endorsements”.
30853 `6. COLLECTIONS OF DOCUMENTS'
30855 You may make a collection consisting of the Document and other documents
30856 released under this License, and replace the individual copies of this
30857 License in the various documents with a single copy that is included in
30858 the collection, provided that you follow the rules of this License for
30859 verbatim copying of each of the documents in all other respects.
30861 You may extract a single document from such a collection, and distribute
30862 it individually under this License, provided you insert a copy of this
30863 License into the extracted document, and follow this License in all
30864 other respects regarding verbatim copying of that document.
30866 `7. AGGREGATION WITH INDEPENDENT WORKS'
30868 A compilation of the Document or its derivatives with other separate
30869 and independent documents or works, in or on a volume of a storage or
30870 distribution medium, is called an “aggregate” if the copyright
30871 resulting from the compilation is not used to limit the legal rights
30872 of the compilation’s users beyond what the individual works permit.
30873 When the Document is included in an aggregate, this License does not
30874 apply to the other works in the aggregate which are not themselves
30875 derivative works of the Document.
30877 If the Cover Text requirement of section 3 is applicable to these
30878 copies of the Document, then if the Document is less than one half of
30879 the entire aggregate, the Document’s Cover Texts may be placed on
30880 covers that bracket the Document within the aggregate, or the
30881 electronic equivalent of covers if the Document is in electronic form.
30882 Otherwise they must appear on printed covers that bracket the whole
30883 aggregate.
30885 `8. TRANSLATION'
30887 Translation is considered a kind of modification, so you may
30888 distribute translations of the Document under the terms of section 4.
30889 Replacing Invariant Sections with translations requires special
30890 permission from their copyright holders, but you may include
30891 translations of some or all Invariant Sections in addition to the
30892 original versions of these Invariant Sections.  You may include a
30893 translation of this License, and all the license notices in the
30894 Document, and any Warranty Disclaimers, provided that you also include
30895 the original English version of this License and the original versions
30896 of those notices and disclaimers.  In case of a disagreement between
30897 the translation and the original version of this License or a notice
30898 or disclaimer, the original version will prevail.
30900 If a section in the Document is Entitled “Acknowledgements”,
30901 “Dedications”, or “History”, the requirement (section 4) to Preserve
30902 its Title (section 1) will typically require changing the actual
30903 title.
30905 `9. TERMINATION'
30907 You may not copy, modify, sublicense, or distribute the Document
30908 except as expressly provided under this License.  Any attempt
30909 otherwise to copy, modify, sublicense, or distribute it is void, and
30910 will automatically terminate your rights under this License.
30912 However, if you cease all violation of this License, then your license
30913 from a particular copyright holder is reinstated (a) provisionally,
30914 unless and until the copyright holder explicitly and finally
30915 terminates your license, and (b) permanently, if the copyright holder
30916 fails to notify you of the violation by some reasonable means prior to
30917 60 days after the cessation.
30919 Moreover, your license from a particular copyright holder is
30920 reinstated permanently if the copyright holder notifies you of the
30921 violation by some reasonable means, this is the first time you have
30922 received notice of violation of this License (for any work) from that
30923 copyright holder, and you cure the violation prior to 30 days after
30924 your receipt of the notice.
30926 Termination of your rights under this section does not terminate the
30927 licenses of parties who have received copies or rights from you under
30928 this License.  If your rights have been terminated and not permanently
30929 reinstated, receipt of a copy of some or all of the same material does
30930 not give you any rights to use it.
30932 `10. FUTURE REVISIONS OF THIS LICENSE'
30934 The Free Software Foundation may publish new, revised versions
30935 of the GNU Free Documentation License from time to time.  Such new
30936 versions will be similar in spirit to the present version, but may
30937 differ in detail to address new problems or concerns.  See
30938 @indicateurl{https://www.gnu.org/copyleft/}.
30940 Each version of the License is given a distinguishing version number.
30941 If the Document specifies that a particular numbered version of this
30942 License “or any later version” applies to it, you have the option of
30943 following the terms and conditions either of that specified version or
30944 of any later version that has been published (not as a draft) by the
30945 Free Software Foundation.  If the Document does not specify a version
30946 number of this License, you may choose any version ever published (not
30947 as a draft) by the Free Software Foundation.  If the Document
30948 specifies that a proxy can decide which future versions of this
30949 License can be used, that proxy’s public statement of acceptance of a
30950 version permanently authorizes you to choose that version for the
30951 Document.
30953 `11. RELICENSING'
30955 “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
30956 World Wide Web server that publishes copyrightable works and also
30957 provides prominent facilities for anybody to edit those works.  A
30958 public wiki that anybody can edit is an example of such a server.  A
30959 “Massive Multiauthor Collaboration” (or “MMC”) contained in the
30960 site means any set of copyrightable works thus published on the MMC
30961 site.
30963 “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
30964 license published by Creative Commons Corporation, a not-for-profit
30965 corporation with a principal place of business in San Francisco,
30966 California, as well as future copyleft versions of that license
30967 published by that same organization.
30969 “Incorporate” means to publish or republish a Document, in whole or
30970 in part, as part of another Document.
30972 An MMC is “eligible for relicensing” if it is licensed under this
30973 License, and if all works that were first published under this License
30974 somewhere other than this MMC, and subsequently incorporated in whole
30975 or in part into the MMC, (1) had no cover texts or invariant sections,
30976 and (2) were thus incorporated prior to November 1, 2008.
30978 The operator of an MMC Site may republish an MMC contained in the site
30979 under CC-BY-SA on the same site at any time before August 1, 2009,
30980 provided the MMC is eligible for relicensing.
30982 `ADDENDUM: How to use this License for your documents'
30984 To use this License in a document you have written, include a copy of
30985 the License in the document and put the following copyright and
30986 license notices just after the title page:
30988 @quotation
30990 Copyright © YEAR  YOUR NAME.
30991 Permission is granted to copy, distribute and/or modify this document
30992 under the terms of the GNU Free Documentation License, Version 1.3
30993 or any later version published by the Free Software Foundation;
30994 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
30995 A copy of the license is included in the section entitled “GNU
30996 Free Documentation License”.
30997 @end quotation
30999 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
31000 replace the “with … Texts.” line with this:
31002 @quotation
31004 with the Invariant Sections being LIST THEIR TITLES, with the
31005 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
31006 @end quotation
31008 If you have Invariant Sections without Cover Texts, or some other
31009 combination of the three, merge those two alternatives to suit the
31010 situation.
31012 If your document contains nontrivial examples of program code, we
31013 recommend releasing these examples in parallel under your choice of
31014 free software license, such as the GNU General Public License,
31015 to permit their use in free software.
31017 @node Index,,GNU Free Documentation License,Top
31018 @unnumbered Index
31021 @printindex ge
31024 @c %**end of body
31025 @bye